ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.78k stars 16.36k forks source link

Corrupted images error #3095

Closed Happinesseuh closed 3 years ago

Happinesseuh commented 3 years ago

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 ?

github-actions[bot] commented 3 years ago

πŸ‘‹ 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 commented 3 years ago

@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. https://github.com/ultralytics/yolov5/blob/25f8ab835ef82a5664f6434934c7f40088117f65/utils/datasets.py#L491-L493

To receive this update you can:

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 πŸš€!

vrtompki commented 3 years ago

@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.

github-actions[bot] commented 3 years ago

πŸ‘‹ 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 ⭐!

kstisser commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

gmt710 commented 2 years ago

maybe your images and labelsβ€˜ folder do not exist.

sebasmos commented 2 years ago

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 commented 2 years ago

@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.

nihanaltaytas commented 1 year ago

eror train I have this similar problem.

glenn-jocher commented 1 year ago

@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:

For Ultralytics to provide assistance your code should also be:

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 commented 1 year ago

Screenshot (132) i have this problem

glenn-jocher commented 1 year ago

@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.