open-mmlab / mmdetection3d

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

[Bug] FCOS3D validation with input shape [512, 768], mAP=0 #2204

Open Hukongtao opened 1 year ago

Hukongtao commented 1 year ago

Prerequisite

Task

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

Branch

master branch https://github.com/open-mmlab/mmdetection3d

Environment

sys.platform: linux Python: 3.8.12 (default, Aug 9 2022, 19:33:50) [GCC 5.4.0] CUDA available: True GPU 0,1,2,3: NVIDIA TITAN V CUDA_HOME: /usr/local/cuda-11.1 NVCC: Cuda compilation tools, release 11.1, V11.1.74 GCC: gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) PyTorch: 1.10.2+cu111 PyTorch compiling details: PyTorch built with:

TorchVision: 0.11.3+cu111 OpenCV: 4.6.0 MMCV: 1.7.0 MMCV Compiler: GCC 5.4 MMCV CUDA Compiler: 11.1 MMDetection: 2.25.3 MMSegmentation: 0.29.1 MMDetection3D: 1.0.0rc5+962fc83 spconv2.0: True

Reproduces the problem - code sample

First, you should change the test_pipeline in the config to,

test_pipeline = [
    dict(type='LoadImageFromFileMono3D'),
    dict(type='Resize', img_scale=(768, 512), keep_ratio=True),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='Pad', size_divisor=32),
    dict(type='DefaultFormatBundle3D', class_names=class_names, with_label=False),
    dict(type='Collect3D', keys=['img']),
]

then, you should change the code https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/models/dense_heads/fcos_mono3d_head.py#L641 to:

if rescale:
    bbox_pred[:, :2] /= bbox_pred[:, :2].new_tensor(scale_factor[0])
    bbox_pred[:, 3:6] /= bbox_pred[:, 3:6].new_tensor(scale_factor[0])

Then you can run the validation:

python tools/test.py config configs/fcos3d/fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d.py checkpoint checkpoints/fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d_finetune_20210717_095645-8d806dc2.pth --out outputs/resize_result.pickle --gpu-id 0 --eval mAP 

Finally, you get:

mAP: 0.0026
mATE: 1.0238
mASE: 0.9864
mAOE: 0.9358
mAVE: 1.0000
mAAE: 1.0000
NDS: 0.0091
Eval time: 72.5s

Reproduces the problem - command or script

With less resolution, the mAP should be lower. but should not be 0.

Reproduces the problem - error message

No error, Just the mAP is low,and I don't know why.

Additional information

No response

Hukongtao commented 1 year ago

@Tai-Wang Can you help me with this question?

Tai-Wang commented 1 year ago

It's because monocular 3D detectors are sensitive to the change of input images. When the input resolution is changed, at least we need to allow the network to see them during the training phase. Actually, our pre-release version can support this augmentation and we will release this feature together with some others new in about 1-2 months.

Hukongtao commented 1 year ago

It's because monocular 3D detectors are sensitive to the change of input images. When the input resolution is changed, at least we need to allow the network to see them during the training phase. Actually, our pre-release version can support this augmentation and we will release this feature together with some others new in about 1-2 months.

Thank you very much I will try this resize3D right away.

Hukongtao commented 1 year ago

@Tai-Wang https://github.com/open-mmlab/mmdetection3d/blob/master/configs/fcos3d/fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d.py#L27 In fact, I think the resize here will cause some misunderstandings for users, making users think that this resize can be used for training

Tai-Wang commented 1 year ago

@Tai-Wang https://github.com/open-mmlab/mmdetection3d/blob/master/configs/fcos3d/fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d.py#L27 In fact, I think the resize here will cause some misunderstandings for users, making users think that this resize can be used for training

Yes, thanks for your suggestions. We may consider adding some comments to avoid such confusion.