open-mmlab / mmyolo

OpenMMLab YOLO series toolbox and benchmark. Implemented RTMDet, RTMDet-Rotated,YOLOv5, YOLOv6, YOLOv7, YOLOv8,YOLOX, PPYOLOE, etc.

Home Page:https://mmyolo.readthedocs.io/zh_CN/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: only integer scalar arrays can be converted to a scalar index

HGD-ai opened this issue · comments

Prerequisite

💬 Describe the reimplementation questions

When I want to replicate the performance of yolov5 and coco datasets on the window platform, the following error occurs:
TypeError: only integer scalar arrays can be converted to a scalar index

The detailed error information is as follows:
Traceback (most recent call last):
File "D:/pycharm_project/open-mmlab/mmyolo/tools/train.py", line 106, in
main()
File "D:/pycharm_project/open-mmlab/mmyolo/tools/train.py", line 102, in main
runner.train()
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmengine\runner\runner.py", line 1633, in train
model = self.train_loop.run() # type: ignore
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmengine\runner\loops.py", line 88, in run
self.run_epoch()
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmengine\runner\loops.py", line 103, in run_epoch
for idx, data_batch in enumerate(self.dataloader):
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmengine\dataset\base_dataset.py", line 408, in getitem
data = self.prepare_data(idx)
File "D:\pycharm_project\open-mmlab\mmyolo\mmyolo\datasets\yolov5_coco.py", line 57, in prepare_data
return self.pipeline(data_info)
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmengine\dataset\base_dataset.py", line 58, in call
data = t(data)
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmcv\transforms\base.py", line 11, in call
return self.transform(results)
File "D:\software\anaconda\envs\mmdetection\lib\site-packages\mmdet\datasets\transforms\formatting.py", line 96, in transform
results[key][valid_idx])
TypeError: only integer scalar arrays can be converted to a scalar index

Process finished with exit code 1

I would be grateful if you could answer this question.

Environment

sys.platform: win32
Python: 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0: NVIDIA GeForce RTX 3050 Ti Laptop GPU
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5
NVCC: Cuda compilation tools, release 11.5, V11.5.50
MSVC: 用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.29.30146 版
GCC: n/a
PyTorch: 1.10.0+cu113
PyTorch compiling details: PyTorch built with:

  • C++ Version: 199711
  • MSVC 192829337
  • Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v2.2.3 (Git Hash 7336ca9f055cf1bfa13efb658fe15dc9b41f0740)
  • OpenMP 2019
  • LAPACK is enabled (usually provided by MKL)
  • CPU capability usage: AVX2
  • CUDA Runtime 11.3
  • 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_61,code=sm_61;-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;-gencode;arch=compute_37,code=compute_37
  • CuDNN 8.2
  • Magma 2.5.4
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.2.0, CXX_COMPILER=C:/w/b/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/w/b/windows/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.10.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=OFF, USE_NNPACK=OFF, USE_OPENMP=ON,

TorchVision: 0.11.1+cu113
OpenCV: 4.6.0
MMEngine: 0.1.0
MMCV: 2.0.0rc1
MMDetection: 3.0.0rc1
MMYOLO: 0.1.1+unknown

Process finished with exit code 0

Expected results

No response

Additional information

No response

When I use the train_pipeline type='mmdet. Albu ', this error occurs, and will not occur if I turn it off

When I use the train_pipeline type='mmdet. Albu ', this error occurs, and will not occur if I turn it off

Hi @HGD-ai , thank you for your attention to MMYOLO.
If you want to use Albu, please install albumentations==1.0.1. We are trying to fix the problem about the latest Albu.

Thank you very much for your reply. The problem has been solved