Closed wll0307 closed 1 month ago
我不想用手动选择一个面然后在进行识别需要调什么或者是自动选择面然后在识别特征有啥好的方法
print(viewer.selection_list)
assert len(viewer.selection_list) > 0, "Please select some faces on the solid" 这一块
npz_folder = step_folder / "/tmp/brepnet_test_working_dir" npz_pathname = npz_folder / (file_stem + ".npz")
data = data_utils.load_npz_data(npz_pathname)
data = standarize_data(data, feature_standardization)
face_features = data["face_features"] edge_features = data["edge_features"]
pooled_face_edge_features = pool_edge_data_onto_faces(data)
assert pooled_face_edge_features.shape[0] == len(viewer.entity_mapper.face_map), "Embedding size doesn't match solid"
selected_faces_features = pooled_face_edge_features[viewer.selection_list] 我最终想要自动的选择该零件要加工的面
我不想用手动选择一个面然后在进行识别需要调什么或者是自动选择面然后在识别特征有啥好的方法
打印查看器中的选择列表
print(viewer.selection_list)
断言查看器的选择列表长度大于0,否则抛出异常提示用户需要在模型上选择一些面
assert len(viewer.selection_list) > 0, "Please select some faces on the solid" 这一块
加载原始特征数据
npz_folder = step_folder / "/tmp/brepnet_test_working_dir" npz_pathname = npz_folder / (file_stem + ".npz")
使用 data_utils 加载 NPZ 文件中的数据
data = data_utils.load_npz_data(npz_pathname)
对数据进行标准化处理
data = standarize_data(data, feature_standardization)
获取面和边的特征
face_features = data["face_features"] edge_features = data["edge_features"]
将边的特征池化到相邻的面上
pooled_face_edge_features = pool_edge_data_onto_faces(data)
断言池化后的面特征的数量与选择器中面的数量相匹配,否则抛出异常
assert pooled_face_edge_features.shape[0] == len(viewer.entity_mapper.face_map), "Embedding size doesn't match solid"
根据用户选择的面,从池化后的特征中提取对应面的特征
selected_faces_features = pooled_face_edge_features[viewer.selection_list] 我最终想要自动的选择该零件要加工的面