Closed callmesora closed 2 years ago
š Hello @callmesora, 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://ultralytics.com or email support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
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), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit.
@callmesora š Hello! Thanks for asking about improving YOLOv5 š 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.
train_batch*.jpg
on train start to verify your labels appear correct, i.e. see example mosaic.Larger models like YOLOv5x and YOLOv5x6 will produce better results in nearly all cases, but have more parameters, require more CUDA memory to train, and are slower to run. For mobile deployments we recommend YOLOv5s/m, for cloud deployments we recommend YOLOv5l/x. See our README table for a full comparison of all models.
--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
custom_pretrained.pt
--weights ''
argument:
python train.py --data custom.yaml --weights '' --cfg yolov5s.yaml
yolov5m.yaml
yolov5l.yaml
yolov5x.yaml
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/
Good luck š and let us know if you have any other questions!
@callmesora š Hello! Thanks for asking about training speed issues. YOLOv5 š can be trained on CPU (slowest), single-GPU, or multi-GPU (fastest). If you would like to increase your training speed some options are:
--batch-size
--img-size
--batch-size
python train.py --cache
(RAM caching) or --cache disk
(disk caching)Good luck š and let us know if you have any other questions!
Hello, I've tried and ajusted all of those previously. I'm traning on multiple GPU as well. (I'm unsure if this is an automated message , I assume so), regardless. Thanks for the valuable inputs but I've tried changing those values but my questions still remain, if any of you could help me It would be lovely!
Hi, did you solve this problem, i also got this problem, I use YOLOV5S to detect pedestrains in BDD100K dataset, but the output map, p, r, all are very low. If you can give some advice? thank you!!!
What is the format of the BDD100K Data set annotations and how are they converted? If you want to detect pedestrians, the pretrained Yolov5 models are trained on the coco dataset, which includes plenty of pictures of persons, which might as well be pedestrians. I hope this helps
@callmesora please submit a PR with a BDD100K.yaml to help other users get started training on this dataset. If we have this yaml and can train on the dataset we can help determine what mAP to expect on the dataset.
Please see our ā Contributing Guide to get started.
Hey, I will send you all the scripts and techniques I used to convert and prepare the Dataset. In the meantime I
All this trippled my mAP (from step 2-5). I will provide as soon as possible a git repo and a PR with the yaml I used and a guide to pre process the Data and the scripts I used.
If someone doesn't want to wait here's how I did it: Tried to use BDD100K official bdd-to-coco conversion and from coco to YOLOV5 with scripts I found online but No luck, I kept getting some labels messed up or some errors I couldn't solve.
Then I found another aproach I used fifty one library to pre process the BDD100K into the YOLOV5 PyTorch format and used the Validation set since it had 10k Images.
These 10K images luckly fit the Roboflow Maximum free images per dataset so I used it to merge and drop some of the labels (yes you can drop all but pedestrians if you wish!). You can merge and find these when you generate a new "version" of the Dataset in Roboflow, as so:
I also have a script for dividing the Dataset into train / val folders already in the PyTorch format in case you don't want to be limited by Roboflow 10K images. This pops a new problem I haven't been able to solve. How to merge and drop classes "manually" I have no script for it and haven't found any library that does it for me.
If anyone knows how to drop / merge classes in a YOLOV5 dataset please let me know!
But I still don't know why it perfomed worse with 100K images :/
Here is the convertion ! @glenn-jocher how should I structure this notebook in a PR? Should I add te notebook to a specific folder then sumbit the PR ? https://github.com/callmesora/BDD100K-to-YOLOV5
@callmesora thanks for the info! We want to generalize as much as possible, so perhaps your work is not suitable here, as you've customized the dataset?
No @glenn-jocher , I provide the original one , just in the YOLOv5 format :) (This script also converts it to COCO and YOLOv4 etc) formats so regardless I think it will be helpfull for people specially to compare different YOLOs to v5 and get better benchmarks
Those later changes are not in the Repo, they are made latter in roboflow if the user wants it. I just left more guidelines to help people manipulate the dataset to their will afterwords.
š 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 ā!
@callmesora thanks for sharing the notebook! To submit a PR, you could create a new folder such as datasets/conversion_scripts
within the YOLOv5 repo, and submit your notebook there. Feel free to mention this in the PR description. This would be very helpful for others to compare different YOLOs and to facilitate better benchmarks. Thank you for your valuable contribution!
Search before asking
Question
Can a I have too much Data?
I was training yolov5m with pre-trained weights on the BDD100K Data set. This Dataset has 100k Images.
They Seem to be a bit unbalanced in terms of number of instances.
I've ran the multi-GPU training program and obtained very poor results. Due to the huge ammount of images I could't use the --cache flag. So each epoc took a huge amout of time.
And besides the huge amount of time I also got terrible results I'm not sure why the mAP didn't even reach 1%. And kept getting worse . It took 50 Hours to run around 20 Epochs
I later tried to use only a sub section of the Dataset with 10K images and I got much better results and managed to cache the images, so training went a lot faster. And I also had better results. I have no Idea why
So In Recap my question(s) are:
Additional
No response