open-mmlab / mmdetection3d

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

[Bug] TypeError: paint_uniform_color(): incompatible function arguments. #2942

Open hitbuyi opened 2 months ago

hitbuyi commented 2 months ago

Prerequisite

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

TorchVision: 0.12.0+cu113
OpenCV: 4.6.0
MMEngine: 0.10.3
MMDetection: 3.2.0
MMDetection3D: 1.4.0+fe25f7a
spconv2.0: False

Reproduces the problem - code sample

import torch
import numpy as np

from mmdet3d.visualization import Det3DLocalVisualizer
from mmdet3d.structures import LiDARInstance3DBoxes

points = np.fromfile('demo/data/kitti/000008.bin', dtype=np.float32)
points = points.reshape(-1, 4)
visualizer = Det3DLocalVisualizer()
# set point cloud in visualizer
visualizer.set_points(points)
bboxes_3d = LiDARInstance3DBoxes(
    torch.tensor([[8.7314, -1.8559, -1.5997, 4.2000, 3.4800, 1.8900,
                   -1.5808]],dtype =torch.float64))
# Draw 3D bboxes
visualizer.draw_bboxes_3d(bboxes_3d)
visualizer.show()

Reproduces the problem - command or script

example from official document

import torch
import numpy as np

from mmdet3d.visualization import Det3DLocalVisualizer
from mmdet3d.structures import LiDARInstance3DBoxes

points = np.fromfile('demo/data/kitti/000008.bin', dtype=np.float32)
points = points.reshape(-1, 4)
visualizer = Det3DLocalVisualizer()
# set point cloud in visualizer
visualizer.set_points(points)
bboxes_3d = LiDARInstance3DBoxes(
    torch.tensor([[8.7314, -1.8559, -1.5997, 4.2000, 3.4800, 1.8900,
                   -1.5808]],dtype =torch.float64))
# Draw 3D bboxes
visualizer.draw_bboxes_3d(bboxes_3d)
visualizer.show()

Reproduces the problem - error message

C:\Users\YTX\Anaconda3\envs\py1110\python.exe "C:\Program Files\JetBrains\PyCharm 2020.1.2\plugins\python\helpers\pydev\pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 12182 --file D:/MachineLearning/Projects/MMLab/MMDetection3D/tVisual_mono3D.py
pydev debugger: process 250528 is connecting

Connected to pydev debugger (build 201.7846.77)
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2020.1.2\plugins\python\helpers\pydev\pydevd.py", line 1438, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2020.1.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/MachineLearning/Projects/MMLab/MMDetection3D/tVisual_mono3D.py", line 29, in <module>
    visualizer.draw_bboxes_3d(bboxes_3d)
  File "C:\Users\YTX\Anaconda3\envs\py1110\lib\site-packages\mmdet3d\visualization\local_visualizer.py", line 317, in draw_bboxes_3d
    line_set.paint_uniform_color(np.array(bbox_color[i]) / 255.)
TypeError: paint_uniform_color(): incompatible function arguments. The following argument types are supported:
    1. (self: open3d.cpu.pybind.geometry.LineSet, color: numpy.ndarray[numpy.float64[3, 1]]) -> open3d.cpu.pybind.geometry.LineSet

Invoked with: LineSet with 12 lines., 0.0

Additional information

fix this bug

YJJ1125 commented 1 month ago

same problem, have u resolved?

haduoken commented 1 month ago

一样的问题,仓库没人维护了么? image

haduoken commented 1 month ago

@YJJ1125 @hitbuyi 解决啦,这个颜色需要[3,1]shape的tensor,把bbox_color[i]改成bbox_color即可。

image

image

haduoken commented 1 month ago

@YJJ1125 另外建议把/255也去掉,估计作者本意是画个绿色框 image

image