mmdetection3d icon indicating copy to clipboard operation
mmdetection3d copied to clipboard

[Bug] NuScenesDataset class name conflict with CenterHead

Open qq1361096516 opened this issue 2 years ago • 1 comments

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

Name: mmdet3d Version: 1.3.0

Reproduces the problem - code sample

config use CenterHead: mmdetection3d-v1.3.0\configs_base_\models\centerpoint_pillar02_second_secfpn_nus.py

NuScenesDataset类中以及create data.py中使用的类别顺序是 ('car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle','motorcycle', 'pedestrian', 'traffic_cone', 'barrier'), 但是在mmdetection3d-v1.3.0\mmdet3d\models\dense_heads\centerpoint_head.py 中 482行 如果使用多tasks的CenterHead,将会出现问题,因为在482行中是根据给定task中的class_names 索引加上flag来计算对应的class index。这个顺序和NuScenesDataset的顺序是不一致的,这个将会有问题。

之前0.18的版本中设置的 NuScenesDataset 类别顺序是('car', 'truck', 'construction_vehicle', 'bus', 'trailer', 'barrier', 'motorcycle', 'bicycle', 'pedestrian', 'traffic_cone')则没问题

解决办法:可以在CenterHead中添加字段,用来输入数据集的顺序,计算索引的时候根据这个索引来获取对应的索引

type='CenterHead', in_channels=sum([128, 128, 128]), tasks=[ dict(num_class=1, class_names=['car']), dict(num_class=2, class_names=['truck', 'construction_vehicle']), dict(num_class=2, class_names=['bus', 'trailer']), dict(num_class=1, class_names=['barrier']), dict(num_class=2, class_names=['motorcycle', 'bicycle']), dict(num_class=2, class_names=['pedestrian', 'traffic_cone']), ],

Reproduces the problem - command or script

None

Reproduces the problem - error message

None

Additional information

No response

qq1361096516 avatar Dec 14 '23 09:12 qq1361096516

Note that we have reordered the class_names in the final config file, take this as an example.

Xiangxu-0103 avatar Dec 29 '23 09:12 Xiangxu-0103