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

Images sizes do not match. This will causes images to be display incorrectly in the UI. #1676

Closed
HerrLieber opened this issue Dec 12, 2020 · 13 comments
Labels
question Further information is requested Stale

Comments

@HerrLieber
Copy link

❔Question

When I follow the tutorial "Train custom data", I run the following command:

python train.py --img 640 --batch 64 --epochs 5 --data coco128.yaml --weights yolov5s.pt

Two errors then occur:

1:

Analyzing anchors... anchors/target = 4.26, Best Possible Recall (BPR) = 0.9946
Image sizes 640 train, 640 test
Using 0 dataloader workers
Logging results to runs\train\exp14
Starting training for 5 epochs...

 Epoch   gpu_mem       box       obj       cls     total   targets  img_size

0%| | 0/2 [00:00<?, ?it/s]Images sizes do not match. This will causes images to be display incorrectly in the UI.

2:
Traceback (most recent call last):
File "traingai.py", line 503, in
train(hyp, opt, device, tb_writer, wandb)
File "traingai.py", line 288, in train
pred = model(imgs) # forward
File "F:\Anaconda\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "F:\github\yolov5\models\yolo.py", line 122, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "F:\github\yolov5\models\yolo.py", line 138, in forward_once
x = m(x) # run
File "F:\Anaconda\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "F:\github\yolov5\models\common.py", line 94, in forward
return self.conv(torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1))
File "F:\Anaconda\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "F:\github\yolov5\models\common.py", line 35, in forward
return self.act(self.bn(self.conv(x)))
File "F:\Anaconda\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "F:\Anaconda\lib\site-packages\torch\nn\modules\conv.py", line 419, in forward
return self._conv_forward(input, self.weight)
File "F:\Anaconda\lib\site-packages\torch\nn\modules\conv.py", line 416, in _conv_forward
self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_ALLOC_FAILED

For the second error, I saw that someone said it was solved by installing torch.version.cuda==10.1, but I still get the second error after installing torch.version.cuda==10.1. At the same time I uninstalled the corresponding cuda software as well as cudnn (i.e. 10.2 as shown by nvcc -V) and installed cuda 10.1 as well as the corresponding cudnn version.

The rest of the environment I have configured to run the command:

python detect.py --source 0 # webcam
file.jpg # image
file.mp4 # video

Thanks for your help!

Additional context

@HerrLieber HerrLieber added the question Further information is requested label Dec 12, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2020

Hello @HerrLieber, 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
Copy link
Member

glenn-jocher commented Dec 12, 2020

@HerrLieber it appears you may have environment problems. Please ensure you meet all dependency requirements if you are attempting to run YOLOv5 locally. If in doubt, create a new virtual Python 3.8 environment, clone the latest repo (code changes daily), and pip install -r requirements.txt again. We also highly recommend using one of our verified environments below.

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 passing. These tests evaluate proper operation of basic YOLOv5 functionality, including training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@isildur7
Copy link

I have the same issue. After the first epoch, I see the message - "Images sizes do not match. This will causes images to be display incorrectly in the UI." The mosaics are totally wrong. My image size is 512x512.
Here is the image I see:
image

@glenn-jocher
Copy link
Member

glenn-jocher commented Feb 15, 2021

@isildur7 the 'Images sizes do not match. This will causes images to be display incorrectly in the UI.' warning is from matplotlib I believe, and has always been present, with no apparent ill effects that I know of (COCO128 mosaics are correct despite message).

@isildur7 I don't know how you expect your images to appear. I would start by running the Train Custom Data tutorial to validate your training pipeline, and then substituting your own data. You can get started here:

Tutorials

@isildur7
Copy link

sorry here is more info. I did look at your tutorial and it was most helpful. I ran the following command:
train.py --img 512 --batch 8 --epochs 10 --data datacfg.yaml --cfg ./models/yolov5m-custom.yaml --weights yolov5m.pt --name wbcv0.1 --cache
The model trains but it's only the UI that appears to be wonky. I am not sure if the training data being fed is actually what the UI shows and that is my concern. Here are a few examples of actual training data:
000001
000134

@glenn-jocher
Copy link
Member

@isildur7 yes the jpgs generated display the training mosaics and labels. If these labels do not appear correct then there is an error in your dataset labels. There are no known issues in the jpgs. You can see examples of them in the tutorial.

If you'd like to modify augmentation hyps you can do this in the default hyperparameter file here:
https://github.com/ultralytics/yolov5/blob/master/data/hyp.scratch.yaml

@akshat-suwalka
Copy link

@glenn-jocher I am training the model with a dataset which have some image 1920x1200 and some image as 2048x1536 and when I write code for training it will be :-

!python train.py --img 1200 --batch 16 --epochs 3 --data my_custom.yaml --weights yolov5s.pt --nosave --cache

My question is that since i will definitely get the warning or error as " 'Images sizes do not match. This will causes images to be display incorrectly in the UI." Does it will impact my model performance?

Same error we are getting when we are using simply (without changing any piece of code) of your Colab code. There also we are getting same error.

In earlier comment you mention that it is matplotlib error.
Just want to clarify that Is it going to affect my model performace on custom dataset like consider an example where I have all images of same dimension as 1920x1200 then Which model will give better results the one with 1920x1200 OR the one which have some images as 1920x1200 and some images as 2048x1536.

Do I really have to make all images size to be equal so that YOLO V5 will work properly OR Should I ignore the image size error?

@glenn-jocher
Copy link
Member

glenn-jocher commented Mar 3, 2021

@akshat-suwalka Images sizes do not match message is generated by the plotting routines before or after training.

Training is not affected.

@akshat-suwalka
Copy link

@glenn-jocher Thank you for your response!

@ys31jp
Copy link
Contributor

ys31jp commented May 31, 2021

Hi, is this mean that the Images sizes do not match message will not be an issues?

@glenn-jocher
Copy link
Member

@ys31jp this is just a matplotlib message that sometimes appears when labels.jpg is created, it has no effect on training.

@glenn-jocher
Copy link
Member

UPDATE: issue re-raised in #3575, seems to original in W&B, not in matplotlib.

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

No branches or pull requests

5 participants