open-mmlab / mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
https://mmdetection3d.readthedocs.io/en/latest/
Apache License 2.0
5.3k stars 1.54k forks source link

how to visualize the the predict results in eval process? #2573

Open markwave opened 1 year ago

markwave commented 1 year ago

I can find the command "python tools/test.py ${CONFIG_FILE} ${CKPT_PATH} --eval 'mAP' --eval-options 'show=True' 'out_dir=${SHOW_DIR}'" that used to visualize the results in the eval process in the old version of chineses guide document ,but the new version guide document in English ,there is no command to show it ,so what's the command in the new version mmdetection3d v1.1.0?

JingweiZhang12 commented 1 year ago

https://mmdetection3d.readthedocs.io/zh_CN/latest/user_guides/visualization.html. Please use the latest 1.1.1 branch which supports visualization better.

ZitengXue commented 1 year ago

https://mmdetection3d.readthedocs.io/zh_CN/latest/user_guides/visualization.html. Please use the latest 1.1.1 branch which supports visualization better.

Hi! I follow the link you provided to visualize the ground-truth box in nuScenes dataset And I got this error: python tools/misc/browse_dataset.py configs/base/datasets/nus-mono3d.py --task mono_det --output-dir ./output 09/25 13:17:10 - mmengine - INFO - ------------------------------ 09/25 13:17:10 - mmengine - INFO - The length of the dataset: 168780 09/25 13:17:10 - mmengine - INFO - The number of instances per category in the dataset: +----------------------+--------+ | category | number | +----------------------+--------+ | car | 517166 | | truck | 93259 | | trailer | 28466 | | bus | 16671 | | construction_vehicle | 15882 | | bicycle | 11154 | | motorcycle | 11777 | | pedestrian | 213239 | | traffic_cone | 91774 | | barrier | 150210 | +----------------------+--------+ /home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/visualization/visualizer.py:196: UserWarning: Failed to add <class 'mmengine.visualization.vis_backend.LocalVisBackend'>, please provide the save_dir argument. warnings.warn(f'Failed to add {vis_backend.class}, ' [ ] 1/168780, 0.2 task/s, elapsed: 4s, ETA: 719244sTraceback (most recent call last): File "tools/misc/browse_dataset.py", line 152, in main() File "tools/misc/browse_dataset.py", line 123, in main for i, item in enumerate(dataset): File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 409, in getitem data = self.prepare_data(idx) File "/home/xzt/Downloads/mmdetection3d-1.1.0/mmdet3d/datasets/det3d_dataset.py", line 387, in prepare_data example = self.pipeline(input_dict) File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 58, in call data = t(data) File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmcv/transforms/base.py", line 12, in call return self.transform(results) File "/home/xzt/Downloads/mmdetection3d-1.1.0/mmdet3d/datasets/transforms/formating.py", line 119, in transform return self.pack_single_results(results) File "/home/xzt/Downloads/mmdetection3d-1.1.0/mmdet3d/datasets/transforms/formating.py", line 210, in pack_single_results gt_instances_3d[self._remove_prefix(key)] = results[key] File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/structures/instance_data.py", line 151, in setattr if len(self) > 0: File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/structures/instance_data.py", line 306, in len return len(self.values()[0]) File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/torch/_tensor.py", line 589, in len raise TypeError("len() of a 0-d tensor") TypeError: len() of a 0-d tensor

I thougt it was the 'save_dir' is different from the args 'output_dir' at first, so I add the save_dir in /miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/visualization/visualizer.py but I still got error, which looks like : File "tools/misc/browse_dataset.py", line 152, in main() File "tools/misc/browse_dataset.py", line 123, in main for i, item in enumerate(dataset): File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 409, in getitem data = self.prepare_data(idx) File "/home/xzt/Downloads/mmdetection3d-1.1.0/mmdet3d/datasets/det3d_dataset.py", line 387, in prepare_data example = self.pipeline(input_dict) File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 58, in call data = t(data) File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmcv/transforms/base.py", line 12, in call return self.transform(results) File "/home/xzt/Downloads/mmdetection3d-1.1.0/mmdet3d/datasets/transforms/formating.py", line 119, in transform return self.pack_single_results(results) File "/home/xzt/Downloads/mmdetection3d-1.1.0/mmdet3d/datasets/transforms/formating.py", line 210, in pack_single_results gt_instances_3d[self._remove_prefix(key)] = results[key] File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/structures/instance_data.py", line 151, in setattr if len(self) > 0: File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/mmengine/structures/instance_data.py", line 306, in len return len(self.values()[0]) File "/home/xzt/miniconda3/envs/detr/lib/python3.8/site-packages/torch/_tensor.py", line 589, in len raise TypeError("len() of a 0-d tensor") TypeError: len() of a 0-d tensor

It looks like the second image didn't load successfully, only one image was generated. The training process can runs successfully and my environment is mmcv==2.0.0rc4 mmdet==3.0.0rc5 mmdet3d==1.1.0 (I also tried 1.1.1 still this error) mmengine==0.8.4 torch==1.9.0+cu111 torchvision==0.10.0+cu111