Replies: 1 comment 1 reply
-
@haimat 👋 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 We've put together a full guide for users looking to get the best results on their YOLOv5 trainings below. Dataset
Model SelectionLarger 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.
python train.py --data custom.yaml --weights yolov5s.pt
yolov5m.pt
yolov5l.pt
yolov5x.pt
custom_pretrained.pt
python train.py --data custom.yaml --weights '' --cfg yolov5s.yaml
yolov5m.yaml
yolov5l.yaml
yolov5x.yaml Training SettingsBefore 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.
Further ReadingIf 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! |
Beta Was this translation helpful? Give feedback.
-
I trained a YOLOv5 with default hyperparams on my own dataset - 30.000 images, only 2 classes to detect, training img. size 1280, X-large p6 model. First I trained for 50 epochs, which led to an overall model fitness of 0.81 (with default YOLOv5 fitness function). Then I took that trained model and used it as
weights
parameter for another training - same dataset, same default hyperparams, same image size etc., now for 100 epochs.In the first 1-2 epochs the model fitness jumps up to ~0.88, i.e. quite a bit above the result from the first training. Then after these 1-2 epochs the model fitness drops back to to ~0.60, only to result in about 0.81-0.82 after the 100 epochs of this 2nd training, i.e. the same result as the first trainining.
However, I can reproduce the same behaviour - start training again with 100 epochs using the best model from the first training, which had a model fitness of 0.81 - in that new training the model fitness first jumps up to ~0.88, i.e. increases for 1-2 epochs, only to fall back below the original model fitness, to finally end up with roughly the same model fitness as in the first training.
So my question is: How can help YOLOv5 to keep up the good results of the first 1-2 epochs in the 2nd training?
Any ideas what hyperparams I might/should consider chaning in this case?
Beta Was this translation helpful? Give feedback.
All reactions