mmrotate icon indicating copy to clipboard operation
mmrotate copied to clipboard

[Bug] ValueError: need at least one array to concatenate

Open zhu011 opened this issue 2 years ago • 0 comments

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/mmrotate/tree/1.x

Environment

ys.platform: linux Python: 3.7.13 (default, Oct 18 2022, 18:57:03) [GCC 11.2.0] CUDA available: True GPU 0: NVIDIA GeForce RTX 2080 Ti CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.1, V11.1.105 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.7.0 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v1.6.0 (Git Hash 5ef631a030a6f73131c77892041042805a06064f)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 10.1
  • 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_37,code=compute_37
  • CuDNN 7.6.3
  • Magma 2.5.2
  • Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -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, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=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.8.1 OpenCV: 4.6.0 MMCV: 1.7.0 MMCV Compiler: GCC 7.3 MMCV CUDA Compiler: 10.1 MMRotate: 0.3.3+4bbef14

Reproduces the problem - code sample

python tools/train.py configs/rotated_faster_rcnn/rotated_faster_rcnn_r50_fpn_1x_dota_le135.py 本次使用的数据集使ssdd数据集标注格式如下 SSDD+ 000003.jpg C:\Users\Administrator\Desktop\SSDD+\000003.jpg

SSDD+ 500 403 3 ship Unspecified 0 0 1.2835148733977624 92.78496325469862 38.88380889038815 104.5 219.00000000000003 因为是voc格式所以我在mmrotate/mmrotate/datasets/sar.py中将代码变为 from .builder import ROTATED_DATASETS from .hrsc import HRSCDataset#原来是DOTADataset

@ROTATED_DATASETS.register_module() class SARDataset(HRSCDataset): """SAR ship dataset for detection (Support RSSDD and HRSID).""" CLASSES = ('ship', ) PALETTE = [ (0, 255, 0), ]

Reproduces the problem - command or script

ValueError: need at least one array to concatenate

Reproduces the problem - error message

File "tools/train.py", line 192, in main() File "tools/train.py", line 188, in main meta=meta) File "/root/autodl-tmp/mmrotate/mmrotate/apis/train.py", line 141, in train_detector runner.run(data_loaders, cfg.workflow) File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 137, in run epoch_runner(data_loaders[i], **kwargs) File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train for i, data_batch in enumerate(self.data_loader): File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 352, in iter return self._get_iterator() File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 294, in _get_iterator return _MultiProcessingDataLoaderIter(self) File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 827, in init self._reset(loader, first_iter=True) File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 857, in _reset self._try_put_index() File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1091, in _try_put_index index = self._next_index() File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 427, in _next_index return next(self._sampler_iter) # may raise StopIteration File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 227, in iter for idx in self.sampler: File "/root/miniconda3/envs/zyf/lib/python3.7/site-packages/mmdet/datasets/samplers/group_sampler.py", line 41, in iter indices = np.concatenate(indices) File "<array_function internals>", line 6, in concatenate ValueError: need at least one array to concatenate 然后报错,我在mmdet/datasets/samplers/group_sampler.py中第十行 class GroupSampler(Sampler):

def __init__(self, dataset, samples_per_gpu=1):
    assert hasattr(dataset, 'flag')
    self.dataset = dataset
    self.samples_per_gpu = samples_per_gpu
    print('@@@@@@@@@@@@@@@@@@@@@@@@@@@',dataset)

print了dataset发现 @@@@@@@@@@@@@@@@@@@@@@@@@@@ SARDataset Train dataset with number of images 0, and instance counts: +----------+-------+----------+-------+----------+-------+----------+-------+----------+-------+ | category | count | category | count | category | count | category | count | category | count | +----------+-------+----------+-------+----------+-------+----------+-------+----------+-------+ | | | | | | | | | | | | 0 [ship] | 0 | | | | | | | | | +----------+-------+----------+-------+----------+-------+----------+-------+----------+-------+ 可能是因为与HRSC的数据集标注方式不完全相同导致的,但我个人能力无法从代码中找出解决方法,希望能得到您们的帮助,期待您们的宝贵建议!

Additional information

使用SSDD+数据集

zhu011 avatar Nov 16 '22 06:11 zhu011