About error samples in dataset preparation
Mingyu-Zheng opened this issue · 2 comments
Hi and thank you for the great work! When I prepare the dataset from .step and .obj files in ABC for getting wire_json, I follow your file list, choose the same object id and process them according your method. But there are some errors that I can't find the reason. It seems that there are some dirty .obj files. Do you know why it happens?
If I set focus=0, there are two kinds of errors:
- in shape_to_svg raise Exception("faces unenclosed")
3%|▎ | 301/10107 [00:28<16:42, 9.78it/s]00003847 received unknown error faces unenclosed
Traceback (most recent call last):
File "dataset/gt_data_gen.py", line 353, in extract_shapeinfo_and_wireframe
shape_to_svg(shape, name, args)
File "dataset/gt_data_gen.py", line 155, in shape_to_svg
raise Exception("faces unenclosed")
Exception: faces unenclosed
- File "/data/work/wire2brep/dataset/utils/TopoMapper.py", line 35, in init self._remove_sewn_edges(sewn_edge_keys)
4%|▍ | 411/10107 [00:41<23:09, 6.98it/s]00005323 received unknown error 652977386
Traceback (most recent call last):
File "dataset/gt_data_gen.py", line 353, in extract_shapeinfo_and_wireframe
shape_to_svg(shape, name, args)
File "dataset/gt_data_gen.py", line 53, in shape_to_svg
topo = TopoMapper(shape, args)
File "/data/work/wire2brep/dataset/utils/TopoMapper.py", line 35, in init
self._remove_sewn_edges(sewn_edge_keys)
File "/data/work/wire2brep/dataset/utils/TopoMapper.py", line 169, in _remove_sewn_edges
d1, d2 = np.array(self.all_edges[key1].dedge), np.array(self.all_edges[key2].dedge)
KeyError: 652977386
and if I set focus=3, there is one more error:
- RuntimeError: Standard_ConstructionError raised from method Add of class BRepFeat_SplitShape
10%|▉ | 991/10107 [01:18<17:14, 8.81it/s]00012572 received unknown error Standard_ConstructionError raised from method Add of class BRepFeat_SplitShape
Traceback (most recent call last):
File "dataset/gt_data_gen.py", line 353, in extract_shapeinfo_and_wireframe
shape_to_svg(shape, name, args)
File "dataset/gt_data_gen.py", line 53, in shape_to_svg
topo = TopoMapper(shape, args)
File "/data/work/wire2brep/dataset/utils/TopoMapper.py", line 25, in init
self.full_topo = self._add_outline_edges(outline_edges)
File "/data/work/wire2brep/dataset/utils/TopoMapper.py", line 75, in _add_outline_edges
split, curr_num_edge, add_success = self._add_edge(backup_split, edge, num_edge)
File "/data/work/wire2brep/dataset/utils/TopoMapper.py", line 53, in _add_edge
add_success = split.Add(toptool_seq_shape)
File "/data/.conda/envs/wire2brep/lib/python3.7/site-packages/OCC/Core/BRepFeat.py", line 1305, in Add
return _BRepFeat.BRepFeat_SplitShape_Add(self, *args)
RuntimeError: Standard_ConstructionError raised from method Add of class BRepFeat_SplitShape
It seems that these kinds of errors only occur on a small number of samples(40 of 10k), but I set my samples of ABC as your dataset lists. I don't know why it happens. Could you give me some help? Thanks!
Hi Mingyu, sorry for such a late reply. I haven't worked on this project for a long time now and just saw this issue.
I would say 40 out of 10k is pretty good actually - cheers to that 99.6% pass rate :). At different focuses, some of these complex shapes are not great after projection and they just cannot be parsed. I wish my if/else could cover all the edge cases, but when the shapes can be as complex as a car engine, there are too many edge cases to cover. If you check the projected 2D images, I think you will find something uninterpretable.
I'll close this issue for now. Feel free to reopen if you have more questions!
Oh yeah, thanks for using my code by the way! If it helped you, a star on the repo would be much appreciated :)