Closed leeyunhome closed 3 years ago
@leeyunhome I can't comment on your custom dataset, but in general for best results with small objects you'll want to run inference at large image sizes. A full guide on improving training results is below, including commentary on image sizes.
π 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 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
--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/
Hello,
Images per class. β₯1.5k images per class Instances per class. β₯10k instances (labeled objects) per class total
Thank you.
@leeyunhome 1.5k indicates 1500 using the metric prefix k for kilo: https://en.wikipedia.org/wiki/Metric_prefix
Hello,
Images per class. β₯1.5k images per class Instances per class. β₯10k instances (labeled objects) per class total
1. What is the unit of 1.5k? Are you talking about 1500 images? 2. I don't know what the instance refers to exactly. Can you explain with an example that there is one image? 3. I have 42000 car license plates and number images that are labeled. Could this be enough?
Thank you.
When you have 1000 images with 2 license plates labeled "license plate" per image you have 2k instances on 1k images
If you have 42000 license plates labeled, if we are talking just the numbers 0 to 9 you have ~ on average ~ 4200 instances per class if a license plate would just contain one number.
Here in Germany we have numbers and letters, so 10+26 classes =36 classes for the signs. If one license plate had just one sign you'd have on average 1.166 instances per class.
Best case: your 42000 is not license plates but license plates with labeled signs, so lets say a license plate has 6 signs a-b, 0-9 that would make 420006 labels or 420006/36 7000 instances per class
If however your 42000 labeled images are "just" labeled letters/numbers you'd have 42000/36 = 1166 instances per class
π 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 β!
βQuestion
Hello,
Thank you for your always good help. We are using yolov5s to recognize car numbers called lpr and anpr. I am deducing from the jetson nano by labeling the number inside the license plate rather than recognizing only the license plate.
The accuracy is very poor. We know that car license plate and number recognition is usually done by object detection up to license plate and numbering using ocr (optical character recognition), but we do not use ocr based on the excellent performance of yolov5s and all objects (license plate, license plate) genus number) by labeling and learning and inferring.
Is this a limitation of the jetson nano? Models over yolov5s are not usable in jetson nano because they are slow. Is it possible to recognize a car number with more than 95% accuracy using yolov5s?
If you know of a project that uses yolov5s to perform license plate recognition and number recognition, can you please let me know?
Thank you.
Additional context