open-mmlab / mmrotate

OpenMMLab Rotated Object Detection Toolbox and Benchmark
https://mmrotate.readthedocs.io/en/latest/
Apache License 2.0
1.84k stars 541 forks source link

TypeError: list indices must be integers or slices, not tuple #1020

Open tianbo321 opened 5 months ago

tianbo321 commented 5 months ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmrotate

Environment

addict 2.4.0 aliyun-python-sdk-core 2.15.1 aliyun-python-sdk-kms 2.16.2 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 contourpy 1.1.1 crcmod 1.7 cryptography 42.0.5 cycler 0.12.1 e2cnn 0.2.3 fonttools 4.51.0 idna 3.7 importlib_metadata 7.1.0 importlib_resources 6.4.0 jmespath 0.10.0 kiwisolver 1.4.5 Markdown 3.6 markdown-it-py 3.0.0 matplotlib 3.7.5 mdurl 0.1.2 mmcv-full 1.7.2 mmdet 2.28.2 mmrotate 0.3.4 /home/mmrotate-0.3.4_v2 model-index 0.1.11 mpmath 1.3.0 numpy 1.24.4 opencv-python 4.9.0.80 opencv-python-headless 4.9.0.80 opendatalab 0.0.10 openmim 0.3.9 openxlab 0.0.38 ordered-set 4.1.0 oss2 2.17.0 packaging 24.0 pandas 2.0.3 pillow 10.3.0 pip 23.3.1 platformdirs 4.2.0 pycocotools 2.0.7 pycparser 2.22 pycryptodome 3.20.0 Pygments 2.17.2 pyparsing 3.1.2 python-dateutil 2.9.0.post0 pytz 2023.4 PyYAML 6.0.1 requests 2.28.2 rich 13.4.2 scipy 1.10.1 setuptools 60.2.0 six 1.16.0 sympy 1.12 tabulate 0.9.0 terminaltables 3.1.10 tomli 2.0.1 torch 1.8.0+cu111 torchaudio 0.8.0 torchvision 0.9.0+cu111 tqdm 4.65.2 typing_extensions 4.11.0 tzdata 2024.1 urllib3 1.26.18 wheel 0.41.2 yapf 0.40.2 zipp 3.18.1

Reproduces the problem - code sample

(mmrotate2) (base) root@localhost:/home/mmrotate-0.3.4_v2/tbrecode# python tools/test.py configs/r3det/r3det_r50_fpn_1x_dota_oc.py run/train/ssdd512gpu4/latest.pth --work-dir run/test/ssdd512gpu1 --eval mAP /home/miniconda3/envs/mmrotate2/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:38: UserWarning: Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:48: UserWarning: Setting MKL_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( load checkpoint from local path: run/train/ssdd512gpu4/latest.pth [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 240/240, 15.1 task/s, elapsed: 16s, ETA: 0sTraceback (most recent call last): File "tools/test.py", line 263, in main() File "tools/test.py", line 255, in main metric = dataset.evaluate(outputs, **eval_kwargs) File "/home/mmrotate-0.3.4_v2/mmrotate/datasets/dota.py", line 203, in evaluate meanap, = eval_rbbox_map( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 177, in eval_rbbox_map cls_dets, cls_gts, cls_gts_ignore = get_cls_results( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 114, in get_cls_results cls_gts.append(ann['bboxes'][gt_inds, :]) TypeError: list indices must be integers or slices, not tuple

Reproduces the problem - command or script

python tools/test.py configs/r3det/r3det_r50_fpn_1x_dota_oc.py run/train/ssdd512gpu4/latest.pth --work-dir run/test/ssdd512gpu1 --eval mAP

Reproduces the problem - error message

(mmrotate2) (base) root@localhost:/home/mmrotate-0.3.4_v2/tbrecode# python tools/test.py configs/r3det/r3det_r50_fpn_1x_dota_oc.py run/train/ssdd512gpu4/latest.pth --work-dir run/test/ssdd512gpu1 --eval mAP /home/miniconda3/envs/mmrotate2/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:38: UserWarning: Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:48: UserWarning: Setting MKL_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( load checkpoint from local path: run/train/ssdd512gpu4/latest.pth [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 240/240, 15.1 task/s, elapsed: 16s, ETA: 0sTraceback (most recent call last): File "tools/test.py", line 263, in main() File "tools/test.py", line 255, in main metric = dataset.evaluate(outputs, **eval_kwargs) File "/home/mmrotate-0.3.4_v2/mmrotate/datasets/dota.py", line 203, in evaluate meanap, = eval_rbbox_map( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 177, in eval_rbbox_map cls_dets, cls_gts, cls_gts_ignore = get_cls_results( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 114, in get_cls_results cls_gts.append(ann['bboxes'][gt_inds, :]) TypeError: list indices must be integers or slices, not tuple

Additional information

感觉计算mAP值时出现问题

770880hgj commented 5 months ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmrotate

Environment

addict 2.4.0 aliyun-python-sdk-core 2.15.1 aliyun-python-sdk-kms 2.16.2 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 contourpy 1.1.1 crcmod 1.7 cryptography 42.0.5 cycler 0.12.1 e2cnn 0.2.3 fonttools 4.51.0 idna 3.7 importlib_metadata 7.1.0 importlib_resources 6.4.0 jmespath 0.10.0 kiwisolver 1.4.5 Markdown 3.6 markdown-it-py 3.0.0 matplotlib 3.7.5 mdurl 0.1.2 mmcv-full 1.7.2 mmdet 2.28.2 mmrotate 0.3.4 /home/mmrotate-0.3.4_v2 model-index 0.1.11 mpmath 1.3.0 numpy 1.24.4 opencv-python 4.9.0.80 opencv-python-headless 4.9.0.80 opendatalab 0.0.10 openmim 0.3.9 openxlab 0.0.38 ordered-set 4.1.0 oss2 2.17.0 packaging 24.0 pandas 2.0.3 pillow 10.3.0 pip 23.3.1 platformdirs 4.2.0 pycocotools 2.0.7 pycparser 2.22 pycryptodome 3.20.0 Pygments 2.17.2 pyparsing 3.1.2 python-dateutil 2.9.0.post0 pytz 2023.4 PyYAML 6.0.1 requests 2.28.2 rich 13.4.2 scipy 1.10.1 setuptools 60.2.0 six 1.16.0 sympy 1.12 tabulate 0.9.0 terminaltables 3.1.10 tomli 2.0.1 torch 1.8.0+cu111 torchaudio 0.8.0 torchvision 0.9.0+cu111 tqdm 4.65.2 typing_extensions 4.11.0 tzdata 2024.1 urllib3 1.26.18 wheel 0.41.2 yapf 0.40.2 zipp 3.18.1

Reproduces the problem - code sample

(mmrotate2) (base) root@localhost:/home/mmrotate-0.3.4_v2/tbrecode# python tools/test.py configs/r3det/r3det_r50_fpn_1x_dota_oc.py run/train/ssdd512gpu4/latest.pth --work-dir run/test/ssdd512gpu1 --eval mAP /home/miniconda3/envs/mmrotate2/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:38: UserWarning: Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:48: UserWarning: Setting MKL_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( load checkpoint from local path: run/train/ssdd512gpu4/latest.pth [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 240/240, 15.1 task/s, elapsed: 16s, ETA: 0sTraceback (most recent call last): File "tools/test.py", line 263, in main() File "tools/test.py", line 255, in main metric = dataset.evaluate(outputs, **eval_kwargs) File "/home/mmrotate-0.3.4_v2/mmrotate/datasets/dota.py", line 203, in evaluate meanap, = eval_rbbox_map( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 177, in eval_rbbox_map cls_dets, cls_gts, cls_gts_ignore = get_cls_results( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 114, in get_cls_results cls_gts.append(ann['bboxes'][gt_inds, :]) TypeError: list indices must be integers or slices, not tuple

Reproduces the problem - command or script

python tools/test.py configs/r3det/r3det_r50_fpn_1x_dota_oc.py run/train/ssdd512gpu4/latest.pth --work-dir run/test/ssdd512gpu1 --eval mAP

Reproduces the problem - error message

(mmrotate2) (base) root@localhost:/home/mmrotate-0.3.4_v2/tbrecode# python tools/test.py configs/r3det/r3det_r50_fpn_1x_dota_oc.py run/train/ssdd512gpu4/latest.pth --work-dir run/test/ssdd512gpu1 --eval mAP /home/miniconda3/envs/mmrotate2/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:38: UserWarning: Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( /home/mmrotate-0.3.4_v2/mmrotate/utils/setup_env.py:48: UserWarning: Setting MKL_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( load checkpoint from local path: run/train/ssdd512gpu4/latest.pth [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 240/240, 15.1 task/s, elapsed: 16s, ETA: 0sTraceback (most recent call last): File "tools/test.py", line 263, in main() File "tools/test.py", line 255, in main metric = dataset.evaluate(outputs, **eval_kwargs) File "/home/mmrotate-0.3.4_v2/mmrotate/datasets/dota.py", line 203, in evaluate meanap, = eval_rbbox_map( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 177, in eval_rbbox_map cls_dets, cls_gts, cls_gts_ignore = get_cls_results( File "/home/mmrotate-0.3.4_v2/mmrotate/core/evaluation/eval_map.py", line 114, in get_cls_results cls_gts.append(ann['bboxes'][gt_inds, :]) TypeError: list indices must be integers or slices, not tuple

Additional information

感觉计算mAP值时出现问题

你好,我也遇到了一模一样的问题,请教一下,你是怎么解决的。

tianbo321 commented 3 months ago

数据集路径设置有问题

LTyanghuang commented 1 week ago

我也遇到了一模一样的问题,请教一下,你是怎么解决的。

tianbo321 commented 1 week ago

我也遇到了一模一样的问题,请教一下,你是怎么解决的。

检查一下数据集路径相关代码