Closed Dukhovnost closed 3 years ago
👋 Hello @Dukhovnost, 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.
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7
. 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 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.
@Dukhovnost all image resizing is handled automatically, with user-settable training and inference image sizes using the --img-size parameter (example below). It's likely your poor training results are due to other factors, so I've included a training guide below.
python train.py --img 320
python detect.py --img 320
👋 Hello! Thanks for asking about improving training results. Most of the time good results can be obtained with no changes to the models or training settings, provided your dataset is sufficiently large and well labelled. If at first you don't get good results, there are steps you might be able to take to improve, but we always recommend users first train with all default settings before considering any changes. This helps establish a performance baseline and spot areas for improvement.
If you have questions about your training results we recommend you provide the maximum amount of information possible if you expect a helpful response, including results plots (train losses, val losses, P, R, mAP), PR curve, confusion matrix, training mosaics, test results and dataset statistics images such as labels.png. All of these are located in your project/name
directory, typically yolov5/runs/train/exp
.
We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below.
Larger models like YOLOv5x will produce better results in nearly all cases, but have more parameters and are slower to run. For mobile applications we recommend YOLOv5s/m, for cloud or desktop applications we recommend YOLOv5l/x. See our README table for a full comparison of all models.
To start training from pretrained weights simply pass the name of the model to the --weights
argument. Models download automatically from the latest YOLOv5 release.
python train.py --data custom.yaml --weights yolov5s.pt
yolov5m.pt
yolov5l.pt
yolov5x.pt
Before modifying anything, first train with default settings to establish a performance baseline. A full list of train.py settings can be found in the train.py argparser.
--img 640
, though due to the high amount of small objects in the dataset it can benefit from training at higher resolutions such as --img 1280
. If there are many small objects then custom datasets will benefit from training at native or higher resolution. Best inference results are obtained at the same --img
as the training was run at, i.e. if you train at --img 1280
you should also test and detect at --img 1280
.--batch-size
that your hardware allows for. Small batch sizes produce poor batchnorm statistics and should be avoided.hyp['obj']
will help reduce overfitting in those specific loss components. For an automated method of optimizing these hyperparameters, see our Hyperparameter Evolution Tutorial.If you'd like to know more a good place to start is Karpathy's 'Recipe for Training Neural Networks', which has great ideas for training that apply broadly across all ML domains: http://karpathy.github.io/2019/04/25/recipe/
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.
Inference on a custom dataset is producing accurate x-coordinates but incorrect y-coordinates. An example output is given below (final number is confidence):
'6 0.480469 1 0.0234375 0 0.211182', '12 0.984375 1 0.0234375 0 0.214478', '6 0.117188 1 0.0234375 0 0.216309', '1 0.0722656 1 0.0429688 0 0.221191', '3 0.0273438 1 0.046875 0 0.222168', '11 0.166016 1 0.0273438 0 0.22522',
The class distribution and x-coordinates indicate that the model is making correct predictions. However, the output y-coord is always a multiple of 1/8 (usually 0 or 1). The bbox height is always either 0 or 1.
Training was performed on images standardized to 256x256. Inference was performed on images both larger and smaller than this, but with the parameter: --img-size=256 used in detect.py. The behaviour manifests both in images that are larger and smaller than these dimensions, and also in instances where the image height is larger than the image width. I could not find mention of this issue elsewhere, has this been encountered before? My understanding was that Yolov5 resizes images according to the input parameters, and the varying image size should not be a problem. Any advice greatly appreciated.
Python 3.8 Ubuntu 18.04 RTX 2080Ti