Closed weihongwei-zg closed 1 year ago
It seems you did not directly use the official mmdet3d repo. Could you please provide a link to your original used repo (maybe it required the old version of mmdet3d)?
The error code is in the reasoning part, when the model configuration is initialized. The new version is on line 66. https://github.com/open-mmlab/mmdetection3d/blob/v1.1.0rc2/mmdet3d/apis/inference.py
The part of the code call I run is in this link. https://github.com/AIR-THU/DAIR-V2X/blob/main/v2x/models/detection_models/mmdet3d_anymodel_lidar_early.py
I found that the 1.1.0rc2 code built in this way can be tested successfully, but the model.test encapsulates a lot of things, and I can't get the return value I want.How can I be compatible with older versions of inference code inference?
register_all_modules(init_default_scope=False)
config.load_from = checkpoint
model = RUNNERS.build(config)
model.test()
#model.to(device)
#model.eval()
return model
I need the model to give me this value.
result, _ = inference_detector(model, tmp)
I added the registration code and changed some code in mmdet3d. Now it can be executed normally.
Prerequisite
Task
I'm using the official example scripts/configs for the officially supported tasks/models/datasets.
Branch
1.1x branch https://github.com/open-mmlab/mmdetection3d/tree/1.1
Environment
System environment: sys.platform: linux Python: 3.7.13 (default, Mar 29 2022, 02:18:16) [GCC 7.5.0] CUDA available: True numpy_random_seed: 510644439 GPU 0: Quadro P5000 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 10.2, V10.2.8 GCC: gcc (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010 PyTorch: 1.8.0 PyTorch compiling details: PyTorch built with:
Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.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 -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.8.0, 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.9.0 OpenCV: 4.6.0 MMEngine: 0.1.0
Runtime environment: cudnn_benchmark: False mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0} dist_cfg: {'backend': 'nccl'} seed: None Distributed launcher: none Distributed training: False GPU number: 1
Reproduces the problem - code sample
Reproduces the problem - command or script
Reproduces the problem - error message
12/29/2022 17:51:58 - INFO - dair_v2x_for_detection - VIC-Sync test_A dataset, overall 851 frames 12/29/2022 17:51:58 - INFO - main - loading evaluator 12/29/2022 17:51:58 - INFO - main - loading model 0%| | 0/851 [00:00<?, ?it/s]12/29/2022 17:52:17 - INFO - mmdet3d_anymodel_lidar_early - building model 12/29/2022 17:52:17 - WARNING - trimesh - No FCL -- collision checking will not work /media/wangshuang/sdb/3d_new/mmdetection3d/mmdet3d/models/dense_heads/anchor3d_head.py:93: UserWarning: dir_offset and dir_limit_offset will be depressed and be incorporated into box coder in the future 'dir_offset and dir_limit_offset will be depressed and be ' local loads checkpoint from path: ../configs/vic3d/early-fusion-pointcloud/pointpillars/earlyfusion_veh_pointpillars.pth 0%| | 0/851 [00:22<?, ?it/s] Traceback (most recent call last): File "../v2x/models/detection_models/mmdet3d_anymodel_lidar_early.py", line 197, in forward pred_dict, id = self.pred(data, trans, pred_filter) File "../v2x/models/detection_models/mmdet3d_anymodel_lidar_early.py", line 144, in pred raise Exception Exception
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "eval.py", line 120, in
eval_vic(args, dataset, model, evaluator)
File "eval.py", line 40, in eval_vic
None if not hasattr(dataset, "prev_inf_frame") else dataset.prev_inf_frame,
File "/home/wangshuang/anaconda3/envs/mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, kwargs)
File "../v2x/models/detection_models/mmdet3d_anymodel_lidar_early.py", line 107, in forward
pred, id_veh = self.model(vic_frame.vehicle_frame(), None, filt)
File "/home/wangshuang/anaconda3/envs/mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, *kwargs)
File "../v2x/models/detection_models/mmdet3d_anymodel_lidar_early.py", line 208, in forward
pred_dict, id = self.pred(data, trans, pred_filter)
File "../v2x/models/detection_models/mmdet3d_anymodel_lidarearly.py", line 147, in pred
result, = inference_detector(self.model, tmp)
File "../v2x/models/model_utils/mmdet3d_utils.py", line 139, in inference_detector
test_pipeline = Compose(test_pipeline)
File "/home/wangshuang/anaconda3/envs/mmlab/lib/python3.7/site-packages/mmengine/dataset/base_dataset.py", line 36, in init
transform = TRANSFORMS.build(transform)
File "/home/wangshuang/anaconda3/envs/mmlab/lib/python3.7/site-packages/mmengine/registry/registry.py", line 421, in build
return self.build_func(cfg, args, kwargs, registry=self)
File "/home/wangshuang/anaconda3/envs/mmlab/lib/python3.7/site-packages/mmengine/registry/build_functions.py", line 101, in build_from_cfg
f'{obj_type} is not in the {registry.name} registry. '
KeyError: 'LoadPointsFromFile is not in the transform registry. Please check whether the value of
LoadPointsFromFile
is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/tutorials/config.html#import-custom-python-modules'Additional information
The registration model code has been added, but you still need to change the registry one by one.