Closed zorro2017zdc closed 3 years ago
Hello @zorro2017zdc, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
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 model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
@zorro2017zdc I just tested your changes and started training and everything works correctly. I'm just going to link our default reply here:
Hello, thank you for your interest in our work! This issue seems to lack the minimum requirements for a proper response, or is insufficiently detailed for us to help you. Please note that most technical problems are due to:
Your changes to the default repository. If your issue is not reproducible in a new git clone
version of this repository we can not debug it. Before going further run this code and ensure your issue persists:
sudo rm -rf yolov5 # remove existing
git clone https://github.com/ultralytics/yolov5 && cd yolov5 # clone latest
python detect.py # verify detection
# CODE TO REPRODUCE YOUR ISSUE HERE
Your custom data. If your issue is not reproducible with COCO or COCO128 data we can not debug it. Visit our Custom Training Tutorial for guidelines on training your custom data. Examine train_batch0.jpg
and test_batch0.jpg
for a sanity check of training and testing data.
Your environment. If your issue is not reproducible in one of the verified environments below we can not debug it. If you are running YOLOv5 locally, ensure your environment meets all of the requirements.txt dependencies specified below.
If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.6
. To install run:
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
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.
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.
I meet the same problem when I using yolov5's detect.py to detect Scaled YOLOv4. When I resize the img_shape to hava same width and height, it runs. However, train.py without any problem. It seems some of models can only run with images having equal w and h.
I met same problem, who solve it
@xiaowo1996 π Hello, thank you for your interest in our work! This issue seems to lack the minimum requirements for a proper response, or is insufficiently detailed for us to help you. Please note that most technical problems are due to:
git clone
version of this repo we can not debug it. Before going further run this code and verify your issue persists:
$ git clone https://github.com/ultralytics/yolov5 yolov5_new # clone latest
$ cd yolov5_new
$ python detect.py # verify detection
- **Your custom data.** If your issue is not reproducible in one of our 3 common datasets ([COCO](https://github.com/ultralytics/yolov5/blob/master/data/coco.yaml), [COCO128](https://github.com/ultralytics/yolov5/blob/master/data/coco128.yaml), or [VOC](https://github.com/ultralytics/yolov5/blob/master/data/voc.yaml)) we can not debug it. Visit our [Custom Training Tutorial](https://docs.ultralytics.com/yolov5/tutorials/train_custom_data) for guidelines on training your custom data. Examine `train_batch0.jpg` and `test_batch0.jpg` for a sanity check of your labels and images.
- **Your environment.** If your issue is not reproducible in one of the verified environments below we can not debug it. If you are running YOLOv5 locally, verify your environment meets all of the [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) dependencies specified below. If in doubt, download Python 3.8.0 from https://www.python.org/, create a new [venv](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/), and install requirements.
If none of these apply to you, we suggest you close this issue and raise a new one using the π **Bug Report template**, providing screenshots and a [minimum reproducible example](https://docs.ultralytics.com/help/minimum_reproducible_example/) of your issue. Thank you!
## Requirements
Python 3.8 or later with all [requirements.txt](https://github.com/ultralytics/yolov5/blob/master/requirements.txt) dependencies installed, including `torch>=1.7`. To install run:
```bash
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
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.
I have the same problem, please help! The model works fine only if I use 640x640 images (I trained the model with 300x300 size)!
@HoseinHasani π hi, thanks for letting us know about this problem with YOLOv5 π. We've created a few short guidelines below to help users provide what we need in order to get started investigating a possible problem.
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:
In addition to the above requirements, for Ultralytics to provide assistance your code should be:
git pull
or git clone
a new copy to ensure your problem has not already been resolved by previous commits.If you believe your problem meets all of the above criteria, please close this issue and raise a new one using the π Bug Report template and providing a minimum reproducible example to help us better understand and diagnose your problem.
Thank you! π
@glenn-jocher. No more useless comments. plz
i have the same problem when i use yolov5 l6γI just can set the image size 640 to val or detect my imageγother size are the problem that ------ return torch.cat(x, self.d) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 14 but got size 13 for tensor number 1 in the list.
@suzijun @HoseinHasani π hi, thanks for letting us know about this possible problem with YOLOv5 π.
YOLOv5l6 inference runs correctly at any image size. Your issue in not reproducible.
We've created a few short guidelines below to help users provide what we need in order to start investigating a possible problem.
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:
git pull
or git clone
a new copy to ensure your problem has not already been solved in master.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! π
Thank your replyοΌThe image size I input can only be a multiple of 64. I don't know whether it is related to the step size of the model. I have visualized that the step size of Yolol6 is 64 while that of L is 32 So when I use yoloV5 L model input 416 image size detection is no problem.
@suzijun yes all models have stride constraints, P5 = 2 5 = 32, P6 = 2 6 = 64 etc.
This is a fundamental property of all object detection models in AI. In any case YOLOv5 automatically handles incorrect sizes, so I have no idea how you are producing errors. As I said please supply a minimum reproducible example.
I met same problem, who solve it
+1
Faced the same issue. The fix is to resize the image such that the image that is fed into the forward pass of the model should be suitable for the YOLOv5 architecture that you're using. E.g. For YOLOv5s, v5n, v5m, v5l, v5x, you should be using 640x640 images. Hope this helps!
@gerrylwk thanks for lending a hand and providing a workaround for the issue! It's important to ensure that the input image size aligns with the specific YOLOv5 architecture being used. If anyone else is encountering this, resizing the image to adhere to the requirements of the YOLOv5 architecture being utilized should resolve the problem. Great insight!
βQuestion
I set image_size (320,320), origin image_size 600x450. I used yolov5s.yaml , no problem. but when I changed yolov5s.yaml. During training work , test work get following error. RuntimeError: Sizes of tensors must match except in dimension 2.Got15 and 16(The offending index is 0)
Additional context
I changed yolov5s.yaml like this.