Exception: Cannot find valid image after 1000! Please check your image path and pipeline
VincentCoulombe opened this issue · 3 comments
Prerequisite
- I have searched the existing and past issues but cannot get the expected help.
- I have read the FAQ documentation but cannot get the expected help.
- The bug has not been fixed in the latest version.
🐞 Describe the bug
Hello,
I hope this message finds you well. I've encountered an issue while using the library to train on my custom dataset. Regardless of the image I pass to the pipeline, it consistently outputs None. Additionally, I've observed that certain images in the cat dataset provided for the tutorial also result in None as output. This leads me to assume that these images are being disregarded in the training process, which appears counter-productive as it restricts the utilization of our complete dataset.
Hence, I would like to bring this to your attention as a potential issue that might need addressing
I have attached one of my images below. theyre of shape (640, 640, 3), my val annotations are also available below.
I am using the following pipelines:
train_pipeline = [
dict(type='LoadImageFromFile', backend_args=_base_.backend_args),
dict(type='LoadAnnotations', with_bbox=True),
dict(
type='Mosaic',
img_scale=img_scale,
use_cached=True,
max_cached_images=mosaic_max_cached_images, # note
random_pop=False, # note
pad_val=114.0),
dict(
type='mmdet.RandomResize',
# img_scale is (width, height)
scale=(img_scale[0] * 2, img_scale[1] * 2),
ratio_range=random_resize_ratio_range,
resize_type='mmdet.Resize',
keep_ratio=True),
dict(type='mmdet.RandomCrop', crop_size=img_scale),
dict(type='mmdet.YOLOXHSVRandomAug'),
dict(type='mmdet.RandomFlip', prob=0.5),
dict(type='mmdet.Pad', size=img_scale, pad_val=dict(img=(114, 114, 114))),
dict(
type='YOLOv5MixUp',
use_cached=True,
random_pop=False,
max_cached_images=mixup_max_cached_images,
prob=0.5),
dict(type='mmdet.PackDetInputs')
]
train_pipeline_stage2 = [
dict(type="LoadImageFromFile", backend_args=_base_.backend_args),
dict(type="LoadAnnotations", with_bbox=True),
dict(
type="mmdet.RandomResize",
scale=img_scale,
ratio_range=random_resize_ratio_range,
resize_type="mmdet.Resize",
keep_ratio=True,
),
dict(type="mmdet.RandomCrop", crop_size=img_scale),
dict(type="mmdet.YOLOXHSVRandomAug"),
dict(type="mmdet.RandomFlip", prob=0.5),
dict(type="mmdet.Pad", size=img_scale, pad_val=dict(img=(114, 114, 114))),
dict(type="mmdet.PackDetInputs"),
]
test_pipeline = [
dict(type="LoadImageFromFile", backend_args=_base_.backend_args),
dict(type="YOLOv5KeepRatioResize", scale=img_scale),
dict(
type="LetterResize",
scale=img_scale,
allow_scale_up=False,
pad_val=dict(img=114),
),
dict(type="LoadAnnotations", with_bbox=True, _scope_="mmdet"),
dict(
type="mmdet.PackDetInputs",
meta_keys=(
"img_id",
"img_path",
"ori_shape",
"img_shape",
"scale_factor",
"pad_param",
),
),
]
Your help in addressing this matter would be highly appreciated as I am eager to work with your framework.
Environment
sys.platform: win32
Python: 3.8.18 (default, Sep 07 2023, 13:39:12) [MSC v.1916 64 bit (AMD64)]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0: NVIDIA GeForce RTX 3090
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6
NVCC: Cuda compilation tools, release 11.6, V11.6.55
MSVC: Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32824 for x64
GCC: n/a
PyTorch: 1.10.1
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:/cb/pytorch_1000000000000/work/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/cb/pytorch_1000000000000/work/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.1, 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.2
OpenCV: 4.8.1
MMEngine: 0.10.1
MMCV: 2.0.1
MMDetection: 3.2.0
MMYOLO: 0.6.0+8c4d9dc
Additional information
I am closing my issue. I didnt fully understood the data transformation pipeline.
hi,i meet the same question.how do you fix it
The issue I encountered was with my annotations. I didn't calculate an 'area' for my bounding boxes because I wasn't using that specific label, so I labeled all of them as 0. It turns out there's a particular condition in the data processing pipeline that deems annotations invalid if their 'area' equals 0, rendering all of mine invalid. After fixing this, I managed to load some images for a given iteration, but not all of them. Upon closer inspection, I realized that eventually, all the images were loading correctly. It seems that specific seeds in the randomized transformations might corrupt images in a given iteration, but that same image might be okay in a subsequent iterations. I've come to accept this behavior as, empirically, all images end up being utilized anyway . As a result, I've closed the issue. I hope this explanation helps clarify the situation :).