open-mmlab / mmdetection3d

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

[Bug] TypeError: class `DETR3D` in projects/DETR3D/detr3d/detr3d.py: class `DETR3DHead` in projects/DETR3D/detr3d/detr3d_head.py: __init__() got an unexpected keyword argument 'transformer' #2594

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

sys.platform: linux Python: 3.8.16 (default, Mar 2 2023, 03:21:46) [GCC 11.2.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0,1: NVIDIA RTX A6000 CUDA_HOME: /usr/local/cuda-11.7 NVCC: Cuda compilation tools, release 11.7, V11.7.99 GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 PyTorch: 1.9.1+cu111 PyTorch compiling details: PyTorch built with:

TorchVision: 0.10.1+cu111 OpenCV: 4.7.0 MMEngine: 0.7.3 MMDetection: 3.0.0 MMDetection3D: 1.1.1+e753ecb spconv2.0: False

Reproduces the problem - code sample

Traceback (most recent call last): File "tools/train.py", line 135, in main() File "tools/train.py", line 124, in main runner = Runner.from_cfg(cfg) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 439, in from_cfg runner = cls( File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 406, in init self.model = self.build_model(model) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 813, in build_model model = MODELS.build(model) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 250, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 144, in build_from_cfg raise type(e)( TypeError: class DETR3D in projects/DETR3D/detr3d/detr3d.py: class DETR3DHead in projects/DETR3D/detr3d/detr3d_head.py: init() got an unexpected keyword argument 'transformer'

Reproduces the problem - command or script

python tools/train.py /home/estar/Projects/mmdetection3d/projects/DETR3D/configs/detr3d_r101_gridmask_cbgs.py

Reproduces the problem - error message

Traceback (most recent call last): File "tools/train.py", line 135, in main() File "tools/train.py", line 124, in main runner = Runner.from_cfg(cfg) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 439, in from_cfg runner = cls( File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 406, in init self.model = self.build_model(model) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/runner/runner.py", line 813, in build_model model = MODELS.build(model) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 250, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/estar/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 144, in build_from_cfg raise type(e)( TypeError: class DETR3D in projects/DETR3D/detr3d/detr3d.py: class DETR3DHead in projects/DETR3D/detr3d/detr3d_head.py: init() got an unexpected keyword argument 'transformer'

Additional information

I have tried different versions of mmdetection3d. This problem always arises. Would please help me , thaks very much!

JingweiZhang12 commented 1 year ago

image @RhythmOfTheRain-Byte The transformer head in DETR3D uses the old TransFormer structure in mmdet. Please mind your version of mmdet.

RhythmOfTheRain-Byte commented 1 year ago

Thank you very much! I install the MMEngine/MMCV/MMDetection as the Best Practices in the Get Starte.md. Then i try to execute mim install mmdet<=V3.0.0rc5, it shows "mmdet3d 1.1.0 requires mmdet<3.1.0,>=3.0.0, but you have mmdet 2.24.0 which is incompatible." What should i do? Thanks!

JingweiZhang12 commented 1 year ago

modify this line: https://github.com/open-mmlab/mmdetection3d/blob/main/mmdet3d/__init__.py#L17

RhythmOfTheRain-Byte commented 1 year ago

It works ! Thank you very much!

RhythmOfTheRain-Byte commented 1 year ago

Hello, how can I deploy the trained model such as pointpillar on the car for real-time 3D target detection?

Alicture commented 1 year ago

@RhythmOfTheRain-Byte hi,what's version of mmdet mmcv and mmdet3d you using,i can't found a match version.

ywfwyht commented 2 months ago

@Alicture @JingweiZhang12 @RhythmOfTheRain-Byte hi, bro. I have the same error, How to solve this error? (mmcv 2.1.0, mmdet 3.2.0, mmengine 0.10.3, mmdet3d 1.3.0)