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 JPEG,I can't solved. #3731

Closed
992060356 opened this issue Jun 22, 2021 · 15 comments · Fixed by #4548
Closed

Corrupted JPEG,I can't solved. #3731

992060356 opened this issue Jun 22, 2021 · 15 comments · Fixed by #4548
Labels
question Further information is requested

Comments

@992060356
Copy link

❔Question

Why is my image or label corrupted? A lot of pictures are corrupted, so I checked some of them and opened the pictures and the corresponding label. There is no problem.
Can you give me some help?
I tried to delete cacha and retrain
I looked at utiles / datasets.py, but I didn't know how to debug it.

Additional context

`train: WARNING: Ignoring corrupted image and/or label voc/images/9556041603720_camera3-8.jpg: corrupted JPEG
train: WARNING: Ignoring corrupted image and/or label voc/images/9556041603720_camera3-9.jpg: corrupted JPEG
train: Scanning 'voc/train' images and labels...29281 found, 0 missing, 0 empty, 46085 corrupted: 100%|█| 75366/75366 [00:08<00
train: New cache created: voc/train.cache

val: WARNING: Ignoring corrupted image and/or label voc/images/9556041603720_camera2-25.jpg: corrupted JPEG
val: WARNING: Ignoring corrupted image and/or label voc/images/6907777808584-back_camera2-20.jpg: corrupted JPEG
val: Scanning 'voc/val' images and labels...333 found, 0 missing, 0 empty, 505 corrupted: 100%|███████| 838/838 [00:00<00:00, 1
val: New cache created: voc/val.cache
Plotting labels...

autoanchor: Analyzing anchors... anchors/target = 3.51, Best Possible Recall (BPR) = 1.0000
Image sizes 1280 train, 1280 test
Using 4 dataloader workers
Logging results to runs/train/RPC
Starting training for 600 epochs...

 Epoch   gpu_mem       box       obj       cls     total    labels  img_size
 0/599     20.3G   0.06935    0.1463    0.1145    0.3301        72      1280:  37%|█████         | 2673/7321 [37:15<1:03:24     0/599     20.3G   0.06935    0.1463    0.1145    0.3301        72      1280:  37%|█████         | 2673/7321 [37:15<1:04:47

`

@992060356 992060356 added the question Further information is requested label Jun 22, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jun 22, 2021

👋 Hello @992060356, 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.

@tetelevm
Copy link

What are your image and label paths? Also, what does a typical labels file look like?

@glenn-jocher
Copy link
Member

@992060356 if you believe your JPEGs are ok then you may want to load and save them with cv2 so that they are properly saved, avoiding the corrupt JPEG message.

@SpongeBab
Copy link
Contributor

SpongeBab commented Jun 23, 2021

Are you sure?Please check them carefully again.May be this will help you.#3656

@992060356
Copy link
Author

992060356 commented Jun 23, 2021

What are your image and label paths? Also, what does a typical labels file look like?
this is my yaml config file.
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/] train: voc/train.txt # 75366 images val: voc/val.txt # 838 images test: voc/test.txt # 7535 images
The image path is in the txt file.
I found a corrupted image's label, which looks like this.
111 0.5335648148148148 0.6144547325102881 0.15046296296296297 0.14660493827160495
this is image
038900004095_camera0-13

@992060356
Copy link
Author

@992060356如果您认为 JPEG 没问题,那么您可能希望使用 cv2 加载和保存它们,以便正确保存它们,避免损坏的 JPEG 消息。

@992060356如果您认为 JPEG 没问题,那么您可能希望使用 cv2 加载和保存它们,以便正确保存它们,避免损坏的 JPEG 消息。

thanks for your reply,I will try this way.

@992060356
Copy link
Author

你确定吗?请再仔细检查一下。也许这对你有帮助。#3656

看了你的#3656问题,我跟你的问题不太一样,标签中的坐标也没有越界。

@992060356 992060356 reopened this Jun 23, 2021
@992060356
Copy link
Author

@992060356如果您认为 JPEG 没问题,那么您可能希望使用 cv2 加载和保存它们,以便正确保存它们,避免损坏的 JPEG 消息。

I'm realy happy,I take cv2 load and save them ,then try again ,it's successfull, why? I looked at their properties,It is found that the image file is more than 50 K larger than the original image file, and has more horizontal and vertical resolution attributes

@glenn-jocher
Copy link
Member

@992060356 @SpongeBab one option here might be to simply re-save the corrupted jpegs with cv2 automatically, or provide an option to do this.

But in the case of seriously problematic JPEGs this would allow them to be included in training.

@992060356
Copy link
Author

@992060356 @SpongeBab one option here might be to simply re-save the corrupted jpegs with cv2 automatically, or provide an option to do this.

But in the case of seriously problematic JPEGs this would allow them to be included in training.

Thank you very much for your suggestions, have not found the specific reasons, I do not know if there is a relationship with the cv2 version

@ccl-private
Copy link

I met this problem too. why this is closed?
I write images using cv2, and my cv2 version is 4.5.2.54.

@ccl-private
Copy link

OH! duplicate labels.
my fault.

@glenn-jocher glenn-jocher linked a pull request Aug 26, 2021 that will close this issue
@glenn-jocher
Copy link
Member

@992060356 @ccl-private good news 😃! Your original issue may now be fixed ✅ in PR #4548. This PR automatically restores and saves corrupted JPEGs, and all images are now used for training, including the restored JPEGs.

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload with model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

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 🚀!

@apoorv4wadhwani
Copy link

apoorv4wadhwani commented Dec 21, 2021

@992060356 @ccl-private good news 😃! Your original issue may now be fixed ✅ in PR #4548. This PR automatically restores and saves corrupted JPEGs, and all images are now used for training, including the restored JPEGs.

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload with model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

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 🚀!

I think this should not have happened, I had no idea that running the training routine will change the files that are stored on the computer. I think this is a weird side effect that should be optional and by default not allowed.

@992060356
Copy link
Author

992060356 commented Dec 21, 2021 via email

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

Successfully merging a pull request may close this issue.

6 participants