open-mmlab / mmdetection3d

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

[Bug] BBOX Visualization Detection results deviate from actual targets in rviz2 #2648

Open RhythmOfTheRain-Byte opened 1 year ago

RhythmOfTheRain-Byte commented 1 year ago

Prerequisite

Task

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

Branch

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

Environment

comm 0.1.3 pypi_0 pypi mmcv 2.0.0rc4 pypi_0 pypi mmdet 3.0.0 pypi_0 pypi mmdet3d 1.1.1 dev_0 mmengine 0.7.4 pypi_0 pypi

Reproduces the problem - code sample

    initial_points = []
    # for data in read_points(msg,field_names=('x', 'y', 'z','intensity'),skip_nans=True):
    for data in read_points(msg,field_names=('x', 'y', 'z','i'),skip_nans=True):
        initial_points.append([data[0], data[1], data[2], data[3]])
    points = np.array(initial_points)
    points_class = get_points_type('LIDAR') 
    # points_class = get_points_type('DEPTH') 
    # points_class = get_points_type('CAMERA') 
    points_mmdet3d = points_class(points, points_dim=points.shape[-1], attribute_dims=None)
    # print (points_mmdet3d.tensor)
    torch.cuda.synchronize()
    start_time = time.perf_counter()
    result, data = inference_detector(model, points_mmdet3d)
    torch.cuda.synchronize()
    elapsed = time.perf_counter() - start_time
    print(f'single frame: {elapsed*1000:.1f} ms')
    scores = result.pred_instances_3d.scores_3d
    mask = scores > 0.5
    scores = scores[mask]
    print(scores)       
    boxes_lidar = result.pred_instances_3d.bboxes_3d[mask].tensor.cpu().numpy()     
    print(boxes_lidar)       
    label = result.pred_instances_3d.labels_3d[mask]

Reproduces the problem - command or script

ros2 run ****

Reproduces the problem - error message

no error message just the boundbox is deviatres from its position

Additional information

Excuse me, I am using mmdetection3D 1.1.1 when processing a ros2 node. I Converted part of the KITTI dataset to ROS2BAG and subscribed to the Pointclopud2 topic in the ros2 node. The code can output the message of the detected box normally, but when visualizing the 3DBOUNDINGBOX in RVIZ2, I found that the position of the detected bounding box does not match the position of the actual target point cloud. I would like to know why. When testing a single pcd file by the demo node the results are all ok with the same config file and pth file. Some part of my code is as fellows: initial_points = []

for data in read_points(msg,field_names=('x', 'y', 'z','intensity'),skip_nans=True):

    for data in read_points(msg,field_names=('x', 'y', 'z','i'),skip_nans=True):
        initial_points.append([data[0], data[1], data[2], data[3]])
    points = np.array(initial_points)
    points_class = get_points_type('LIDAR') 
    # points_class = get_points_type('DEPTH') 
    # points_class = get_points_type('CAMERA') 
    points_mmdet3d = points_class(points, points_dim=points.shape[-1], attribute_dims=None)
    # print (points_mmdet3d.tensor)
    torch.cuda.synchronize()
    start_time = time.perf_counter()
    result, data = inference_detector(model, points_mmdet3d)
    torch.cuda.synchronize()
    scores = result.pred_instances_3d.scores_3d
    mask = scores > 0.5
    scores = scores[mask]     
    boxes_lidar = result.pred_instances_3d.bboxes_3d[mask].tensor.cpu().numpy()           
    label = result.pred_instances_3d.labels_3d[mask]
mm-assistant[bot] commented 1 year ago

We recommend using English or English & Chinese for issues so that we could have broader discussion.

jaan1729 commented 1 year ago

Hello @RhythmOfTheRain-Byte , the script that you have provided is not enough to reproduce the issue. Kindly provide the ros node script to understand predictions to ROS detected objects messages and test it. Thanks