mmdetection3d
mmdetection3d copied to clipboard
[Bug] Det3DLocalVisualizer 对象的 show 方法中,该对象缺少一个名为 view_control 的属性
Prerequisite
- [X] I have searched Issues and Discussions but cannot get the expected help.
- [X] I have read the FAQ documentation but cannot get the expected help.
- [X] The bug has not been fixed in the latest version (dev-1.x) or latest version (dev-1.0).
Task
I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
Branch
main branch https://github.com/open-mmlab/mmdetection3d
Environment
File "demo/pcd_demo.py", line 90, in
Reproduces the problem - code sample
python demo/pcd_demo.py demo/data/kitti/000008.bin pointpillars_hv_secfpn_8xb6-160e_kitti-3d-car.py hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth --show
Reproduces the problem - command or script
python demo/pcd_demo.py demo/data/kitti/000008.bin pointpillars_hv_secfpn_8xb6-160e_kitti-3d-car.py hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth --show
Reproduces the problem - error message
python demo/pcd_demo.py demo/data/kitti/000008.bin pointpillars_hv_secfpn_8xb6-160e_kitti-3d-car.py hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth --show
Additional information
python demo/pcd_demo.py demo/data/kitti/000008.bin pointpillars_hv_secfpn_8xb6-160e_kitti-3d-car.py hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth --show
What version of system are you using, Windows/Linux ? And check the version of open3d in your environment.
I encountered the same problem in the officially provided docker environment.
mmdet3d.__version__
1.4.0
open3d.__version__
0.17.0
run script mmdetection3d/demo/inference_demo.ipynb as:
# inference and visualize
# NOTE: use the `Esc` key to exit Open3D window in Jupyter Notebook Environment
inferencer(inputs, show=True)
then raise error as:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[/tmp/ipykernel_17325/1388200773.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/tmp/ipykernel_17325/1388200773.py) in <module>
1 # inference and visualize
2 # NOTE: use the `Esc` key to exit Open3D window in Jupyter Notebook Environment
----> 3 inferencer(inputs, show=True)
[/mmdetection3d/mmdet3d/apis/inferencers/base_3d_inferencer.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/mmdetection3d/mmdet3d/apis/inferencers/base_3d_inferencer.py) in __call__(self, inputs, batch_size, return_datasamples, **kwargs)
212 preds.extend(self.forward(data, **forward_kwargs))
213 visualization = self.visualize(ori_inputs, preds,
--> 214 **visualize_kwargs)
215 results = self.postprocess(preds, visualization,
216 return_datasamples,
[/mmdetection3d/mmdet3d/apis/inferencers/lidar_det3d_inferencer.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/mmdetection3d/mmdet3d/apis/inferencers/lidar_det3d_inferencer.py) in visualize(self, inputs, preds, return_vis, show, wait_time, draw_pred, pred_score_thr, no_save_vis, img_out_dir)
198 pred_score_thr=pred_score_thr,
199 o3d_save_path=o3d_save_path,
--> 200 vis_task='lidar_det',
201 )
202 results.append(points)
[/opt/conda/lib/python3.7/site-packages/mmengine/dist/utils.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/opt/conda/lib/python3.7/site-packages/mmengine/dist/utils.py) in wrapper(*args, **kwargs)
416 def wrapper(*args, **kwargs):
417 if is_main_process():
--> 418 return func(*args, **kwargs)
...
--> 868 self.view_control.convert_to_pinhole_camera_parameters() # noqa: E501
869 if wait_time != -1:
870 self.last_time = time.time()
AttributeError: 'Det3DLocalVisualizer' object has no attribute 'view_control'
Can't seem to visualize?
I encountered the same problem in the officially provided docker environment.
mmdet3d.__version__ 1.4.0 open3d.__version__ 0.17.0
run script mmdetection3d/demo/inference_demo.ipynb as:
# inference and visualize # NOTE: use the `Esc` key to exit Open3D window in Jupyter Notebook Environment inferencer(inputs, show=True)
then raise error as:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) [/tmp/ipykernel_17325/1388200773.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/tmp/ipykernel_17325/1388200773.py) in <module> 1 # inference and visualize 2 # NOTE: use the `Esc` key to exit Open3D window in Jupyter Notebook Environment ----> 3 inferencer(inputs, show=True) [/mmdetection3d/mmdet3d/apis/inferencers/base_3d_inferencer.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/mmdetection3d/mmdet3d/apis/inferencers/base_3d_inferencer.py) in __call__(self, inputs, batch_size, return_datasamples, **kwargs) 212 preds.extend(self.forward(data, **forward_kwargs)) 213 visualization = self.visualize(ori_inputs, preds, --> 214 **visualize_kwargs) 215 results = self.postprocess(preds, visualization, 216 return_datasamples, [/mmdetection3d/mmdet3d/apis/inferencers/lidar_det3d_inferencer.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/mmdetection3d/mmdet3d/apis/inferencers/lidar_det3d_inferencer.py) in visualize(self, inputs, preds, return_vis, show, wait_time, draw_pred, pred_score_thr, no_save_vis, img_out_dir) 198 pred_score_thr=pred_score_thr, 199 o3d_save_path=o3d_save_path, --> 200 vis_task='lidar_det', 201 ) 202 results.append(points) [/opt/conda/lib/python3.7/site-packages/mmengine/dist/utils.py](https://vscode-remote+ssh-002dremote-002b7b22686f73744e616d65223a22544c4b4a332e33362e39303135227d.vscode-resource.vscode-cdn.net/opt/conda/lib/python3.7/site-packages/mmengine/dist/utils.py) in wrapper(*args, **kwargs) 416 def wrapper(*args, **kwargs): 417 if is_main_process(): --> 418 return func(*args, **kwargs) ... --> 868 self.view_control.convert_to_pinhole_camera_parameters() # noqa: E501 869 if wait_time != -1: 870 self.last_time = time.time() AttributeError: 'Det3DLocalVisualizer' object has no attribute 'view_control'
Can't seem to visualize?
If you are executing the project in a python environment on a remote server, then the problem is caused by the lack of a monitor on your server.
I have the same problem in Windows 11, add
import os
os.environ['DISPLAY'] = '1'
to solve it
loc :\mmdet3d\visualization\local_visualizer.py
if os.environ.get('DISPLAY', None) is not None and show:
o3d_vis.create_window()
self.view_control = o3d_vis.get_view_control()
return o3d_vis
我也遇到了这个问题,是因为这段代码,会判断你的环境变量中有没有'DISPLAY',添加环境变量就行了 import os os.environ['DISPLAY'] = '1',或者任何其他的字符串都行 就能解决