yifanlu0227 / ChatSim

[CVPR2024 Highlight] Editable Scene Simulation for Autonomous Driving via LLM-Agent Collaboration
https://yifanlu0227.github.io/ChatSim
308 stars 20 forks source link

UnboundLocalError: local variable 'sorted_destination' referenced before assignment #8

Closed LiuXuan66 closed 6 months ago

LiuXuan66 commented 6 months ago

python3 main.py -y config/waymo-3425.yaml -p 'add serval different colors traffic_cones such as yellow red black in the scene' -s demo

Traceback (most recent call last): File "/home/ChatSim/main.py", line 135, in chatsim.execute_llms(args.prompt) File "/home/ChatSim/main.py", line 99, in execute_llms self.project_manager.dispatch_task(self.scene, task, self.tech_agents) File "/home/ChatSim/chatsim/agents/project_manager.py", line 167, in dispatch_task self.addition_operation(scene, task, tech_agents) File "/home/ChatSim/chatsim/agents/project_manager.py", line 230, in addition_operation motion_agent.func_placement_and_motion_single_vehicle(scene, added_car_name) File "/home/ChatSim/chatsim/agents/motion_agent.py", line 314, in func_placement_and_motion_single_vehicle motion_result = vehicle_motion( File "/home/ChatSim/chatsim/foreground/motion_tools/placement_and_motion.py", line 87, in vehicle_motion end = np.array([sorted_destination[0], sorted_destination[1]]) UnboundLocalError: local variable 'sorted_destination' referenced before assignment

yifanlu0227 commented 6 months ago

@vfishc could you check it?

vfishc commented 6 months ago

Thanks for your issue! Sorry for the bug of static objects. We have fixed it in the latest version, the static objects will be assume a static motion directly.

LiuXuan66 commented 6 months ago

Thanks for your issue! Sorry for the bug of static objects. We have fixed it in the latest version, the static objects will be assume a static motion directly.

Thanks for your reply and work! I have test it again. For motion part, it works well. But it seems there is another question in Blender as below. Blender 3.5.1 (hash e1ccd9d4a1d3 built 2023-04-24 23:31:15) Read prefs: /home/.config/blender/3.5/config/userpref.blend 错误: Python: Traceback (most recent call last): File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/main_multicar.py", line 78, in main() File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/main_multicar.py", line 75, in main render(render_opt) File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/main_multicar.py", line 31, in render add_model_params(car_obj) File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/model/set_model.py", line 100, in add_model_params set_model_params(model_setting['insert_pos'], File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/model/set_model.py", line 43, in set_model_params modify_car_color(model, File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/model/set_model.py", line 17, in modify_car_color material = model.material_slots[material_key].material KeyError: 'bpy_prop_collection[key]: key "added_car_0_car_paint" not found' rename Car to added_car_0

Blender quit

This is some log in console. use shutter [Inpaint] No inpainting. [Blender] Start rendering 50 images. see the log in results/cache/3425_demo_2024_03_29_11_42_00/blender.log if save_cache is enabled 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:33<00:00, 1.49it/s] [Blender] Finish rendering 50 images. [Blender] Copying Remaining 0 images. Traceback (most recent call last): File "/home/rChatSim/main.py", line 136, in chatsim.execute_funcs() File "/home/ChatSim/main.py", line 121, in execute_funcs self.foreground_rendering_agent.func_blender_add_cars(self.scene) File "/home/ChatSim/chatsim/agents/foreground_rendering_agent.py", line 138, in func_blender_add_cars img = imageio.imread(video_frame_file) File "/home/.local/lib/python3.10/site-packages/imageio/v2.py", line 359, in imread with imopen(uri, "ri", **imopen_args) as file: File "/home/.local/lib/python3.10/site-packages/imageio/core/imopen.py", line 113, in imopen request = Request(uri, io_mode, format_hint=format_hint, extension=extension) File "/home/.local/lib/python3.10/site-packages/imageio/core/request.py", line 247, in init self._parse_uri(uri) File "/home/.local/lib/python3.10/site-packages/imageio/core/request.py", line 407, in _parse_uri raise FileNotFoundError("No such file: '%s'" % fn) FileNotFoundError: No such file: '/home/ChatSim/results/cache/3425_demo_2024_03_29_11_42_00/blender_output/0/RGB_composite.png'

vfishc commented 6 months ago

This is because for the other objects(cone, loader_truck, bulldozer, cement, excavator, sign_fence), as they appear in almost the same specific color, we do not set the related color adjustment parameters for the .blend files. If you want to change their color, you can find the material key in their .blend files which indicates the main color, and change the material key to 'car_paint'(because we hardcode the key name in /ChatSim-release/chatsim/agents/foreground_rendering_agent.py line 178). But as this is not a frequently-used situation, we do not adjust the .blend files for the other objects. For all of the cars' .blend files, we have adjusted the mentioned material name.

LiuXuan66 commented 6 months ago

This is because for the other objects(cone, loader_truck, bulldozer, cement, excavator, sign_fence), as they appear in almost the same specific color, we do not set the related color adjustment parameters for the .blend files. If you want to change their color, you can find the material key in their .blend files which indicates the main color, and change the material key to 'car_paint'(because we hardcode the key name in /ChatSim-release/chatsim/agents/foreground_rendering_agent.py line 178). But as this is not a frequently-used situation, we do not adjust the .blend files for the other objects. For all of the cars' .blend files, we have adjusted the mentioned material name.

Got it! Thanks for your reply!

wmkai commented 3 weeks ago

Thanks for your issue! Sorry for the bug of static objects. We have fixed it in the latest version, the static objects will be assume a static motion directly.

Thanks for your reply and work! I have test it again. For motion part, it works well. But it seems there is another question in Blender as below. Blender 3.5.1 (hash e1ccd9d4a1d3 built 2023-04-24 23:31:15) Read prefs: /home/.config/blender/3.5/config/userpref.blend 错误: Python: Traceback (most recent call last): File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/main_multicar.py", line 78, in main() File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/main_multicar.py", line 75, in main render(render_opt) File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/main_multicar.py", line 31, in render add_model_params(car_obj) File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/model/set_model.py", line 100, in add_model_params set_model_params(model_setting['insert_pos'], File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/model/set_model.py", line 43, in set_model_params modify_car_color(model, File "/home/ChatSim/chatsim/foreground/Blender/utils/blender_utils/model/set_model.py", line 17, in modify_car_color material = model.material_slots[material_key].material KeyError: 'bpy_prop_collection[key]: key "added_car_0_car_paint" not found' rename Car to added_car_0

Blender quit

This is some log in console. use shutter [Inpaint] No inpainting. [Blender] Start rendering 50 images. see the log in results/cache/3425_demo_2024_03_29_11_42_00/blender.log if save_cache is enabled 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50/50 [00:33<00:00, 1.49it/s] [Blender] Finish rendering 50 images. [Blender] Copying Remaining 0 images. Traceback (most recent call last): File "/home/rChatSim/main.py", line 136, in chatsim.execute_funcs() File "/home/ChatSim/main.py", line 121, in execute_funcs self.foreground_rendering_agent.func_blender_add_cars(self.scene) File "/home/ChatSim/chatsim/agents/foreground_rendering_agent.py", line 138, in func_blender_add_cars img = imageio.imread(video_frame_file) File "/home/.local/lib/python3.10/site-packages/imageio/v2.py", line 359, in imread with imopen(uri, "ri", imopen_args) as file: File "/home/.local/lib/python3.10/site-packages/imageio/core/imopen.py", line 113, in imopen request = Request(uri, io_mode, format_hint=format_hint, extension=extension) File "/home/.local/lib/python3.10/site-packages/imageio/core/request.py", line 247, in init** self._parse_uri(uri) File "/home/.local/lib/python3.10/site-packages/imageio/core/request.py", line 407, in _parse_uri raise FileNotFoundError("No such file: '%s'" % fn) FileNotFoundError: No such file: '/home/ChatSim/results/cache/3425_demo_2024_03_29_11_42_00/blender_output/0/RGB_composite.png'

Hi, I still encounter this error. Do you fix it?