mmdetection3d icon indicating copy to clipboard operation
mmdetection3d copied to clipboard

[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'

Open RhythmOfTheRain-Byte opened this issue 1 year ago • 7 comments

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:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.1.2 (Git Hash 98be7e8afa711dc9b66c8ff3504129cb82013cdb)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 11.1
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86
  • CuDNN 8.0.5
  • Magma 2.5.2
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

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!

RhythmOfTheRain-Byte avatar Jun 07 '23 15:06 RhythmOfTheRain-Byte

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

JingweiZhang12 avatar Jun 08 '23 02:06 JingweiZhang12

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!

RhythmOfTheRain-Byte avatar Jun 08 '23 07:06 RhythmOfTheRain-Byte

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

JingweiZhang12 avatar Jun 08 '23 07:06 JingweiZhang12

It works ! Thank you very much!

RhythmOfTheRain-Byte avatar Jun 08 '23 07:06 RhythmOfTheRain-Byte

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

RhythmOfTheRain-Byte avatar Jul 05 '23 11:07 RhythmOfTheRain-Byte

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

Alicture avatar Dec 02 '23 05:12 Alicture