open-mmlab / mmdetection3d

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

[Bug] _draw_instances_3d crashes when no detection #2119

Open shanmo opened 1 year ago

shanmo commented 1 year ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

1.1x branch https://github.com/open-mmlab/mmdetection3d/tree/1.1

Environment

sys.platform: linux Python: 3.8.15 | packaged by conda-forge | (default, Nov 22 2022, 08:49:35) [GCC 10.4.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0: NVIDIA T1200 Laptop GPU CUDA_HOME: /home/mambaforge/envs/openmmlab NVCC: Cuda compilation tools, release 11.7, V11.7.99 GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 PyTorch: 1.13.0 PyTorch compiling details: PyTorch built with:

TorchVision: 0.14.0 OpenCV: 4.6.0 MMEngine: 0.3.2 MMDetection: 3.0.0rc4 MMDetection3D: 1.1.0rc2+7fd57b1 spconv2.0: False

Reproduces the problem - code sample

NA

Reproduces the problem - command or script

python ./tools/test.py ./configs/pointpillars/debug_train_config.py ./work_dirs/debug_train_config/epoch_80.pth --show

Reproduces the problem - error message

  File "/home/workspace/mmdetection3d-1.1/mmdet3d/visualization/local_visualizer.py", line 731, in add_datasample
    gt_data_3d = self._draw_instances_3d(
  File "/home/workspace/mmdetection3d-1.1/mmdet3d/visualization/local_visualizer.py", line 564, in _draw_instances_3d
    bboxes_3d = instances.bboxes_3d  # BaseInstance3DBoxes
AttributeError: 'InstanceData' object has no attribute 'bboxes_3d'

Additional information

Code below fails when there is no detection

https://github.com/open-mmlab/mmdetection3d/blob/d7067e4430f4e99697b382b0e3ea5597af737a2c/mmdet3d/visualization/local_visualizer.py#L543-L560

ZCMax commented 1 year ago

Thanks for reminder, I'll fix it ASAP.

m-shahbaz-kharal commented 1 year ago

Hi, I also found the same problem, is it fixed yet or any quick workaround.

shanmo commented 1 year ago

Hi, I also found the same problem, is it fixed yet or any quick workaround.

A quick workaround is to use try except for this line bboxes_3d = instances.bboxes_3d