mmdetection3d icon indicating copy to clipboard operation
mmdetection3d copied to clipboard

[Bug] CenterHead with multi task.

Open DezeZhao opened this issue 2 years ago • 6 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

python3.7

Reproduces the problem - code sample

xxx

Reproduces the problem - command or script

xxx

Reproduces the problem - error message

https://github.com/open-mmlab/mmdetection3d/blob/0f9dfa97a35ef87e16b700742d3c358d0ad15452/mmdet3d/models/dense_heads/centerpoint_head.py#L484

Here, I found in CenterHead.py. in centerpoint models on nuscenes dataset, common_heads are multi-task specific. But I found the above code, while selecting gt boxes according to gt label for one specific task, directly use class name order in current task to index the original class name order in nus-3d.py, I think it should be under the premise of the class name order in common_heads the same as class name order in nus-3d.py. But I found they are not the same. I am confused about it, could you please show me the reason?

Additional information

class names in nus-3d.py

class_names = [
    'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle',
    'motorcycle', 'pedestrian', 'traffic_cone', 'barrier'
]

class names in common_head in file https://github.com/open-mmlab/mmdetection3d/blob/0f9dfa97a35ef87e16b700742d3c358d0ad15452/configs/base/models/centerpoint_voxel01_second_secfpn_nus.py#L42C3-L42C3

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']),
      ]

What I mean is that the class_names order of tasks while flattening in one list should be the same as class_names in nus-3d.py. Or we will get a wrong class label using class_name.index(i) + flag which is not aligned with the original class_names index order in gt_instances_3d.labels_3d.

DezeZhao avatar Aug 01 '23 07:08 DezeZhao

In the final config, we refactor the class_names to adjust the tasks. Please see here (https://github.com/open-mmlab/mmdetection3d/blob/main/configs/centerpoint/centerpoint_pillar02_second_secfpn_8xb4-cyclic-20e_nus-3d.py) for reference.

Xiangxu-0103 avatar Aug 01 '23 11:08 Xiangxu-0103

@Xiangxu-0103 thanks for your quick reply.

DezeZhao avatar Aug 09 '23 02:08 DezeZhao

Another question: I met a problem when using analysis_tools/get_flops.py

/opt/conda/lib/python3.7/site-packages/traits/etsconfig/etsconfig.py:428: UserWarning: Environment variable "HOME" not set, setting home directory to /tmp
  % (environment_variable, parent_directory)
Traceback (most recent call last):
  File "tools/analysis_tools/get_flops.py", line 83, in <module>
    main()
  File "tools/analysis_tools/get_flops.py", line 73, in main
    flops, params = get_model_complexity_info(model, input_shape)
  File "/opt/conda/lib/python3.7/site-packages/mmcv/cnn/utils/flops_counter.py", line 107, in get_model_complexity_info
    _ = flops_model(batch)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1120, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/root/code/mmdetection3d/mmdet3d/models/detectors/base.py", line 88, in forward
    return self._forward(inputs, data_samples, **kwargs)
TypeError: _forward() takes 1 positional argument but 3 were given

how to solve it?

DezeZhao avatar Aug 09 '23 02:08 DezeZhao

python tools/analysis_tools/get_flops.py \
    /root/code/mmdetection3d/configs/centerpoint/centerpoint_voxel0075_second_secfpn_8xb4-cyclic-20e_nus-3d.py \

Run this command

DezeZhao avatar Aug 09 '23 02:08 DezeZhao

It seems that model input is not only the arg shape, how can I compute the 3D detector flops using the script? Looking forward to your reply and solution.

DezeZhao avatar Aug 09 '23 03:08 DezeZhao

I get a similar error for Pointpillars #3028. Did you find a solution to fix this problem? @Xiangxu-0103 @DezeZhao

cadip92 avatar Aug 27 '24 13:08 cadip92