Closed DrewdropLife closed 2 years ago
Have you checked that your annotations are correct?
Have you checked that your annotations are correct?
yes, all annotations are correct, I have visualized them.
Have you checked that your annotations are correct?
yes, all annotations are correct, I have visualized them.
Using the format class x_center y_center width height? If you keep seeing an increase in the MaP after 200 epochs, then you can keep training for better precision.
Could you try running inference where the confidence is printed on the bbox?
Another note: If you are detecting logos, I assume that there will almost never be overlaps? If that is the case you can reduce the IOU to filter the inner boxes away.
👋 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!
@MartinPedersenpp @glenn-jocher Thank you for your reply! I've found the problem, because the code I use belongs to tag v6.1, and the Detect structure have some error! When I update the Detect structure with the latest version, the problem is solved! Now the map has risen to 0.94x~!
Awesome!
Because the problem has been solved, I closed it.
@DrewdropLife great! If you ever have more questions or run into any issues in the future, feel free to open a new one. Happy coding!
Search before asking
Question
The task is "Icons Detection" in the image, I think it is too easy, but, I use the yolov5s pretrained weight and train about 200 epochs, while mp & mr is too high, map also too small, and the visualized result always have many small boxes.
Train dataset: about 30000+ image Val dataset: about 300+ image
(I try to use the images which are come from training dataset to val, but the result is also bad.)
mp mr map@50 map 0.9801 0.8799 0.9542 0.3903
what may the reason be? Thanks.
Additional
No response