UniAD icon indicating copy to clipboard operation
UniAD copied to clipboard

TypeError: 'DataContainer' object is not subscriptable(The error occurs in the evaluation stage)

Open yudefu opened this issue 1 year ago • 3 comments

Hello: When I loaded the pre-trained first-stage model for evaluation, the following error occurred; I searched on Google, it is probably caused by the mmcv version, but I see that the mmcv version mentioned in our installation documentation does not have my version High; Please help me to see!

my locale mmcv-full 1.5.3+corex.3.1.0 mmdet 2.24.0 mmdet3d 1.0.0rc3 /home/work/yudefu/mmdetection3d mmengine 0.8.0 mmsegmentation 0.20.0 py3.9.7 torch 1.13.1+corex.3.1.0

error message Traceback (most recent call last): File "/home/work/yudefu/UniAD/./tools/test.py", line 262, in main() File "/home/work/yudefu/UniAD/./tools/test.py", line 231, in main outputs = custom_multi_gpu_test(model, data_loader, args.tmpdir, File "/home/work/yudefu/UniAD/projects/mmdet3d_plugin/uniad/apis/test.py", line 90, in custom_multi_gpu_test result = model(return_loss=False, rescale=True, **data) File "/usr/local/corex/lib64/python3/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/corex/lib64/python3/dist-packages/torch/nn/parallel/distributed.py", line 1040, in forward output = self._run_ddp_forward(*inputs, **kwargs) File "/usr/local/corex/lib64/python3/dist-packages/torch/nn/parallel/distributed.py", line 1000, in _run_ddp_forward return module_to_run(*inputs[0], **kwargs[0]) File "/usr/local/corex/lib64/python3/dist-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/home/work/yudefu/UniAD/projects/mmdet3d_plugin/uniad/detectors/uniad_e2e.py", line 83, in forward return self.forward_test(**kwargs) File "/home/work/yudefu/UniAD/projects/mmdet3d_plugin/uniad/detectors/uniad_e2e.py", line 263, in forward_test if img_metas[0][0]['scene_token'] != self.prev_frame_info['scene_token']: TypeError: 'DataContainer' object is not subscriptable

yudefu avatar Jul 26 '23 03:07 yudefu

@yudefu Hi, both of your installed mmcv and mmdet3d have higher version than what's required in this project. You may need to create a new environment and install the requisite version of packages.

YTEP-ZHI avatar Jul 26 '23 03:07 YTEP-ZHI

@yudefu Hi, both of your installed mmcv and mmdet3d have higher version than what's required in this project. You may need to create a new environment and install the requisite version of packages. Okay, thank you very much; we don’t seem to have a low version of mmcv and mmdet3d adapted here, if you can’t solve it by installing a low version, do you have any good way to solve that error?

yudefu avatar Jul 26 '23 03:07 yudefu

Add

img_metas = img_metas[0].data
img = [img[0].data[0].cuda()]

before this line

Jian-danai avatar Nov 20 '23 19:11 Jian-danai