Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupted images error #3095

Closed
Happinesseuh opened this issue May 10, 2021 · 15 comments · Fixed by #3103
Closed

Corrupted images error #3095

Happinesseuh opened this issue May 10, 2021 · 15 comments · Fixed by #3103
Labels
question Further information is requested Stale

Comments

@Happinesseuh
Copy link

I tried to train custom data, but when i launch the train i have this issue :

Screenshot_20210510_130402

We can see that the images are corrupted, but is the good format (jpg) and the good path to the folder.

How can I solve it ?

@Happinesseuh Happinesseuh added the question Further information is requested label May 10, 2021
@github-actions
Copy link
Contributor

github-actions bot commented May 10, 2021

👋 Hello @Happinesseuh, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher added a commit that referenced this issue May 10, 2021
Might indirectly help #3095 by providing better visibility on source of corruption.
@glenn-jocher glenn-jocher linked a pull request May 10, 2021 that will close this issue
glenn-jocher added a commit that referenced this issue May 10, 2021
Might indirectly help #3095 by providing better visibility on source of corruption.
@glenn-jocher
Copy link
Member

glenn-jocher commented May 10, 2021

@Happinesseuh good news 😃! This issue may be improved ✅ in PR #3103. This won't solve your corrupted image problem but it should allow you to better understand the cause of the problem by logging to screen the cause, which seems not to be logging to screen with the default older print() statement in your case.

yolov5/utils/datasets.py

Lines 491 to 493 in 25f8ab8

except Exception as e:
nc += 1
print(f'{prefix}WARNING: Ignoring corrupted image and/or label {im_file}: {e}')

To receive this update you can:

  • git pull from within your yolov5/ directory
  • git clone https://github.com/ultralytics/yolov5 again
  • Force-reload PyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • View our updated notebooks: Open In Colab Open In Kaggle

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

@glenn-jocher glenn-jocher reopened this May 10, 2021
@vrtompki
Copy link

@Happinesseuh I ran into this issue today, and it turned out to be a round off error after the labels were read and converted into Numpy arrays. Since I am working with "dense" small objects, the coordinates matched for the first 11 out of 17 digits so once converted to float32, the numbers were rounded to be the same 5 digit coords hence the corrupted/duplicate images error for me. So you could also look at your labels to see if that's potentially what happened in your case.

KMint1819 pushed a commit to KMint1819/yolov5 that referenced this issue May 12, 2021
Might indirectly help ultralytics#3095 by providing better visibility on source of corruption.
@github-actions
Copy link
Contributor

github-actions bot commented Jun 12, 2021

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

@github-actions github-actions bot added the Stale label Jun 12, 2021
Lechtr pushed a commit to Lechtr/yolov5 that referenced this issue Jul 20, 2021
Might indirectly help ultralytics#3095 by providing better visibility on source of corruption.

(cherry picked from commit abfcf9e)
@kstisser
Copy link

kstisser commented Dec 4, 2021

Good afternoon, I am attempting to train using the bird dataset , where I hand labeled the first 34 species using the labelImg tool. I am also getting the 'ignoring corrupt image/label', though the files exist. I am running this yaml, you can see in my fork with data/labels included. I am running the latest branch today with the following command:
python train.py --img 416 --batch 12 --epochs 50 --data ./myData/birds.yaml --weights ./myData/weights/yolov5x.pt
Here is a screenshot. I'd appreciate any feedback. Thanks!
yolov5_corrupt_image
!

@kstisser
Copy link

kstisser commented Dec 5, 2021

In doing some debugging it looks like it was having a hard time finding the files within the train.txt and test.txt, as I had just stated the file names. However it needed reference to the local directory added in front './' to make it './filename.jpg' in case this helps anyone else. This issue is resolved. Cheers!

@yejinaCodes
Copy link

error

this is my error when I try to train Yolov5s using my custom dataset and the yaml I created.
the warning signs that were printed before the error said "ignoring corrupt image/label: could not convert string to float:'0.7736...'". Then I get the above ValueError message. Could I know what my problem is?

@glenn-jocher
Copy link
Member

@YejinKimHanyang your images have problems. Please review your dataset for corrupted images prior to training.

@gmt710
Copy link
Contributor

gmt710 commented Mar 17, 2022

maybe your images and labels‘ folder do not exist.

@sebasmos
Copy link

sebasmos commented Mar 23, 2022

It is a formatting issue by the data side. #3103 just prints the error. Debugging like this can help you find the error:
[~/dataset.py]

  1. Check that the label contents on cache_path match the real files content.
  2. See if np.load(cache_path, allow_pickle=True).item() actually works, if not then change the way data is being stored: wrong format etc.

@yejinaCodes
Copy link

@YejinKimHanyang your images have problems. Please review your dataset for corrupted images prior to training.

Thank you! I solved it! My dataset was the problem. It got corrupted while I was changing it to COCO data format.

BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this issue Aug 26, 2022
Might indirectly help ultralytics#3095 by providing better visibility on source of corruption.
@nihanaltaytas
Copy link

eror train
I have this similar problem.

@glenn-jocher
Copy link
Member

glenn-jocher commented Dec 17, 2022

@nihanaltaytas 👋 hi, thanks for letting us know about this possible problem with YOLOv5 🚀. VisDrone automatically downloads and starts training without any issues for me in my test just now, I am not able to reproduce any problems with it.

Screenshot 2022-12-17 at 12 13 31

We've created a few short guidelines below to help users provide what we need in order to start investigating a possible problem.

How to create a Minimal, Reproducible Example

When asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:

  • Minimal – Use as little code as possible to produce the problem
  • Complete – Provide all parts someone else needs to reproduce the problem
  • Reproducible – Test the code you're about to provide to make sure it reproduces the problem

For Ultralytics to provide assistance your code should also be:

  • Current – Verify that your code is up-to-date with GitHub master, and if necessary git pull or git clone a new copy to ensure your problem has not already been solved in master.
  • Unmodified – Your problem must be reproducible using official YOLOv5 code without changes. Ultralytics does not provide support for custom code ⚠️.

If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem.

Thank you! 😃

@anushkjd
Copy link

Screenshot (132)
i have this problem

@glenn-jocher
Copy link
Member

@anushkjd this issue can occur when there is a mismatch between the number of classes specified in the YAML file and the actual number of classes in your dataset. Make sure that you have correctly defined the number of classes in the "nc" field of the YAML file.

If the number of classes is correct, please ensure that your dataset annotations and images are properly formatted and aligned. Double-check that the file paths in the annotations match the actual image locations. Additionally, verify that all images and annotations are valid and can be opened and parsed correctly.

If the problem persists, please consider providing a minimal, reproducible example along with your code and dataset to help us further investigate the issue.

Thank you for your understanding, and we will do our best to assist you with this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants