yangfei4/BlenderProc2_Cobot

RuntimeError: The object "female_usb_1" does not have the attribute: "category_id". Either set the attribute for every object or pass a default value to bproc.renderer.enable_segmentation_output(default_values={'category_id': None}).

monajalal opened this issue · 0 comments

I get this error:


(blenderproc) mona@ada:~/BlenderProc2_Cobot/BlenderProc$ bash ./scripts/generate_dataset


(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0025 sec |   0.0025 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0058 sec |   0.0057 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0328 sec |   0.0327 sec) Done.
  (  0.0328 sec |   0.0328 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0415 sec |   0.0414 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0449 sec |   0.0448 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0787 sec |   0.0786 sec) Done.
  (  0.0788 sec |   0.0787 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0025 sec |   0.0024 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0059 sec |   0.0058 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0433 sec |   0.0432 sec) Done.
  (  0.0433 sec |   0.0433 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0026 sec |   0.0025 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0061 sec |   0.0060 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0488 sec |   0.0487 sec) Done.
  (  0.0489 sec |   0.0488 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0025 sec |   0.0024 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0060 sec |   0.0059 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0522 sec |   0.0521 sec) Done.
  (  0.0522 sec |   0.0522 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0026 sec |   0.0025 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0064 sec |   0.0063 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0582 sec |   0.0581 sec) Done.
  (  0.0583 sec |   0.0582 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

Running simulation up to 1 seconds (24 frames)
Running simulation up to 2 seconds (48 frames)
Running simulation up to 3 seconds (72 frames)
Running simulation up to 4 seconds (96 frames)
Running simulation up to 5 seconds (120 frames)
Running simulation up to 6 seconds (144 frames)
Running simulation up to 7 seconds (168 frames)
Running simulation up to 8 seconds (192 frames)
Running simulation up to 9 seconds (216 frames)
Running simulation up to 10 seconds (240 frames)
Running simulation up to 11 seconds (264 frames)
Running simulation up to 12 seconds (288 frames)
Running simulation up to 13 seconds (312 frames)
Running simulation up to 14 seconds (336 frames)
Running simulation up to 15 seconds (360 frames)
Running simulation up to 16 seconds (384 frames)
Running simulation up to 17 seconds (408 frames)
Running simulation up to 18 seconds (432 frames)
Running simulation up to 19 seconds (456 frames)
Stopping simulation as configured max_simulation_time has been reached
Rendering 1 frames of colors, normals, segmap...
Finished rendering after 4.365 seconds
Error: Python: Traceback (most recent call last):
  File "/home/mona/BlenderProc2_Cobot/BlenderProc/./main_rand.py", line 190, in <module>
    data = bproc.renderer.render()
  File "/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc/python/renderer/RendererUtility.py", line 707, in render
    return _WriterUtility.load_registered_outputs(load_keys, keys_with_alpha_channel) if return_data else {}
  File "/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc/python/writer/WriterUtility.py", line 138, in load_registered_outputs
    output_file = segmentation_mapping(output_file,
  File "/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc/python/postprocessing/PostProcessingUtility.py", line 391, in segmentation_mapping
    raise RuntimeError(f"The object \"{current_obj.name}\" does not have the "
RuntimeError: The object "female_usb_1" does not have the attribute: "category_id". Either set the attribute for every object or pass a default value to bproc.renderer.enable_segmentation_output(default_values={'category_id': None}).

Error: script failed, file: './main_rand.py', exiting.
Cleaning temporary directory
  0%|▍                                                                                                                                                                                                                                                                                                                                                  | 5/3750 [03:25<42:40:07, 41.02s/it]python /home/mona/BlenderProc2_Cobot/BlenderProc/cli.py run ./main_rand.py ../synthetic_dataset/random3 --custom-blender-path /home/mona/Downloads/blender-3.5.1-linux-x64
Using blender in /home/mona/Downloads/blender-3.5.1-linux-x64
Using temporary directory: /dev/shm/blender_proc_9a81201da3d147c7a1f3c09a47282038
Blender 3.5.1 (hash e1ccd9d4a1d3 built 2023-04-24 23:31:15)
/home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/numpy/core/getlimits.py:500: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float64'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
/home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/numpy/core/getlimits.py:500: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  setattr(self, word, getattr(machar, word).flat[0])
/home/mona/Downloads/blender-3.5.1-linux-x64/3.5/python/lib/python3.10/site-packages/numpy/core/getlimits.py:89: UserWarning: The value of the smallest subnormal for <class 'numpy.float32'> type is zero.
  return self._float_to_str(self.smallest_subnormal)
Selecting render devices...
Device NVIDIA RTX 6000 Ada Generation of type OPTIX found and used.
Device Intel Xeon w5-3435X of type CPU found and used.
Failed to open dir (No such file or directory): ./CAD_model/home/mona/BlenderProc2_Cobot/BlenderProc/CAD_model/
Cannot load image file: './CAD_model//home/mona/BlenderProc2_Cobot/BlenderProc/CAD_model/apriltag_board.png'
Loaded image from: '/home/mona/BlenderProc2_Cobot/BlenderProc/CAD_model/apriltag_board.png'
OBJ import of 'tagboard_21x21x1cm.obj' took 0.5 ms
OBJ import of 'female_usb.obj' took 7.2 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.5 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.4 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.5 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.2 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.1 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 7.2 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.0 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 7.7 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
OBJ import of 'female_usb.obj' took 5.2 ms
female_usb.obj
parts:  ['mainshell', 'topshell', 'insert_mold', 'usb_c', 'female_usb']
category_id = 5
Part Name = female_usb
It took 3 tries to place female_usb.001
It took 1 tries to place female_usb.002
It took 1 tries to place female_usb.003
It took 1 tries to place female_usb.004
It took 1 tries to place female_usb.005
It took 3 tries to place female_usb.006
It took 1 tries to place female_usb.007
It took 1 tries to place female_usb.008
It took 2 tries to place female_usb.009
It took 1 tries to place female_usb
(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0026 sec |   0.0025 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0052 sec |   0.0052 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0142 sec |   0.0142 sec) Done.
  (  0.0142 sec |   0.0142 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0025 sec |   0.0025 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0053 sec |   0.0053 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
    (  0.0187 sec |   0.0187 sec) Done.
  (  0.0188 sec |   0.0188 sec) Finished importing: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'
Progress: 100.00%

^C
Sent an internal break event. Press ^C again to kill Blender
(  0.0000 sec |   0.0000 sec) Importing OBJ '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/3534173949356700691.obj'...
  (  0.0001 sec |   0.0000 sec) Parsing OBJ file...
    (  0.0024 sec |   0.0024 sec) Done, loading materials and images...
ProgressMaterial not found MTL: '/home/mona/BlenderProc2_Cobot/BlenderProc/blenderproc_resources/decomposition_cache/decomp.mtl'
    (  0.0053 sec |   0.0052 sec) Done, building geometries (verts:559 faces:860 materials: 64 smoothgroups:0) ...
  0%|▍                                                                                                                                                                                                                                                                                                                                                  | 5/3750 [03:28<43:20:25, 41.66s/it]
Traceback (most recent call last):
  File "/home/mona/BlenderProc2_Cobot/BlenderProc/rerun.py", line 30, in <module>
    subprocess.call(" ".join(cmd), shell=True)
  File "/home/mona/anaconda3/envs/blenderproc/lib/python3.10/subprocess.py", line 347, in call
    return p.wait(timeout=timeout)
  File "/home/mona/anaconda3/envs/blenderproc/lib/python3.10/subprocess.py", line 1209, in wait
    return self._wait(timeout=timeout)
  File "/home/mona/anaconda3/envs/blenderproc/lib/python3.10/subprocess.py", line 1959, in _wait
    (pid, sts) = self._try_wait(0)
  File "/home/mona/anaconda3/envs/blenderproc/lib/python3.10/subprocess.py", line 1917, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

I have these:

(blenderproc) mona@ada:~/BlenderProc2_Cobot/BlenderProc$ ls CAD_model/models/
total 252K
-rw-rw-r-- 1 mona mona   71 Dec  5 13:00 female_usb.mtl
-rw-rw-r-- 1 mona mona 239K Dec  5 13:27 female_usb.obj
drwxrwxr-x 2 mona mona 4.0K Dec  5 13:27 .
drwxrwxr-x 4 mona mona 4.0K Dec  5 13:32 ..

my obj file has sections like these:

(blenderproc) mona@ada:~/BlenderProc2_Cobot/BlenderProc$ cat  CAD_model/models/female_usb.obj | head -n 500
mtllib female_usb.mtl
o female_usb_1
v 1.818 -5.765 12.84
v 3.182 -5.765 12.84
v 1.805 -5.778 12.717
v 3.195 -5.778 12.717
v 3.182 -6.065 12.84
v 1.818 -6.065 12.84
v 3.189 -6.071 12.778
v 1.811 -6.071 12.778
v -3.182 -5.765 12.84
v -1.818 -5.765 12.84
v -3.195 -5.778 12.717
v -1.805 -5.778 12.717
v -1.818 -6.065 12.84
v -3.182 -6.065 12.84
v -1.811 -6.071 12.778
v -3.189 -6.071 12.778
v 3.925 3.577 10.523
v 4.5 3.577 10.523
v 3.925 3.562 10.374
v 4.5 3.562 10.374
v 4.5 3.518 10.231
v 3.925 3.518 10.231
v 4.5 3.446 10.1
v 3.925 3.446 10.1
v 3.925 3.35 9.985
v 4.5 3.35 9.985
v 3.925 3.525 13.93
v 4.5 3.525 13.93
v 3.925 3.518 13.852
v 4.5 3.518 13.852
v 4.5 3.498 13.776
v 4.5 3.465 13.705
v 3.925 3.465 13.705
v 3.925 3.498 13.776
v 3 2.173 10.523
v 3.575 2.173 10.523
v 3 2.173 10.545
v 3.575 2.173 10.545
v 3 2.174 10.567
v 3.575 2.174 10.567
v 3 2.176 10.589
v 3.575 2.176 10.589
v 3 2.225 13.93
v 3.575 2.225 13.93
v 3 2.225 13.943
v 3.575 2.225 13.943
v 3 2.226 13.956
v 3.575 2.226 13.956
v 3 2.227 13.97
v 3.575 2.227 13.97
v 0.5 2.173 10.523
v 1.075 2.173 10.523
v 0.5 2.173 10.545
v 1.075 2.173 10.545
v 0.5 2.174 10.567
v 1.075 2.174 10.567
v 0.5 2.176 10.589
v 1.075 2.176 10.589
v 0.5 2.225 13.93
v 1.075 2.225 13.93
v 0.5 2.225 13.943
v 1.075 2.225 13.943
v 0.5 2.226 13.956
v 1.075 2.226 13.956
v 0.5 2.227 13.97
v 1.075 2.227 13.97
v 1.425 3.577 10.523
v 2 3.577 10.523
v 1.425 3.562 10.374
v 2 3.562 10.374
v 2 3.518 10.231
v 1.425 3.518 10.231
v 2 3.446 10.1
v 1.425 3.446 10.1
v 1.425 3.35 9.985
v 2 3.35 9.985
v 1.425 3.525 13.93
v 2 3.525 13.93
v 1.425 3.518 13.852
v 2 3.518 13.852
v 2 3.498 13.776
v 2 3.465 13.705
v 1.425 3.465 13.705
v 1.425 3.498 13.776
v -1.075 3.577 10.523
v -0.5 3.577 10.523
v -1.075 3.562 10.374
v -0.5 3.562 10.374
v -0.5 3.518 10.231
v -1.075 3.518 10.231
v -0.5 3.446 10.1
v -1.075 3.446 10.1
v -1.075 3.35 9.985
v -0.5 3.35 9.985
v -1.075 3.525 13.93

(blenderproc) mona@ada:~/BlenderProc2_Cobot/BlenderProc$ cat  CAD_model/models/female_usb.obj | grep female_usb
mtllib female_usb.mtl
o female_usb_1
g female_usb_1
usemtl female_usb_color_1
o female_usb_2
g female_usb_2
usemtl female_usb_color_1
o female_usb_3
g female_usb_3
usemtl female_usb_color_1

Can you please suggest how I could fix this error?