open-mmlab / mmdetection3d

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

TypeError: init() missing 1 required positional argument: 'coord_type' in FCOS3D Model #3040

Open Hafizirshaid opened 1 month ago

Hafizirshaid commented 1 month 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

/home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/optim/optimizer/zero_optimizer.py:11: DeprecationWarning: TorchScript support for functional optimizers is deprecated and will be removed in a future PyTorch release. Consider using the torch.compile optimizer instead. from torch.distributed.optim import \ /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:47: FutureWarning: torch.cuda.amp.custom_fwd(args...) is deprecated. Please use torch.amp.custom_fwd(args..., device_type='cuda') instead. _TORCH_CUSTOM_FWD = amp.custom_fwd(cast_inputs=torch.float16) /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:97: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:163: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:243: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:332: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:369: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:389: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): /home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/spconv/pytorch/functional.py:412: FutureWarning: torch.cuda.amp.custom_bwd(args...) is deprecated. Please use torch.amp.custom_bwd(args..., device_type='cuda') instead. def backward(ctx, grad_output): sys.platform: linux Python: 3.8.19 (default, Mar 20 2024, 19:58:24) [GCC 11.2.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: NVIDIA GeForce RTX 4090 CUDA_HOME: /usr NVCC: Cuda compilation tools, release 12.4, V12.4.131 GCC: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 PyTorch: 2.4.1 PyTorch compiling details: PyTorch built with:

TorchVision: 0.19.1 OpenCV: 4.10.0 MMEngine: 0.10.3 MMDetection: 3.3.0 MMDetection3D: 1.4.0+962f093 spconv2.0: True

Reproduces the problem - code sample

from mmdet3d.apis import init_model, inference_detector
import mmcv

def main():
    config_file = 'configs/fcos3d/fcos3d_r101-caffe-dcn_fpn_head-gn_8xb2-1x_nus-mono3d_finetune.py'
    checkpoint_file = 'checkpoints/fcos3d_r101_caffe_fpn_gn-head_dcn_2x8_1x_nus-mono3d_finetune_20210717_095645-8d806dc2.pth'

    # Init Model using Config and Checkpoint files
    model = init_model(config_file, checkpoint_file, device='cpu')

    # Local Image Oatg
    img = 'demo/data/nuscenes/n015-2018-07-24-11-22-45+0800__CAM_FRONT__1532402927612460.jpg'
    image = mmcv.imread(img)

    # Run inference
    result, data = inference_detector(model, image)

if __name__ == '__main__':
    main()

Reproduces the problem - command or script

the prevuois code is stored in a new file called inference.py and triggered using the command line. python inference.py

Reproduces the problem - error message

Traceback (most recent call last): File "inference.py", line 22, in main() File "inference.py", line 17, in main result, data = inference_detector(model, image) File "/home/irshaidh/mmdetection3d/mmdet3d/apis/inference.py", line 150, in inference_detector test_pipeline = Compose(test_pipeline) File "/home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/dataset/base_dataset.py", line 38, in init transform = TRANSFORMS.build(transform) File "/home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/registry.py", line 570, in build return self.build_func(cfg, *args, kwargs, registry=self) File "/home/irshaidh/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg obj = obj_cls(args) # type: ignore TypeError: init() missing 1 required positional argument: 'coord_type'

Additional information

I am using inference_detector and passing FCOS3D model with its config. What I'm trying to do here is to run this model and feed an image to it so I can do 3D object detection on new images. Right now, I keep getting this error TypeError: __init__() missing 1 required positional argument: 'coord_type' Is there any solution for this issue?

Thanks,

justicme commented 1 week ago

hello , I encountered this issue while deploying FCOS3D as well. Do you have any good solutions?