Open AbhishekPSI7042 opened 3 weeks ago
@AbhishekPSI7042 hi there,
Thank you for reaching out and providing detailed information about your training setup and results. It looks like you're achieving good performance on most classes, but the NumberPlate
class has a lower mAP50-95 score. Here are a few suggestions to help improve the accuracy for number plate detection:
Dataset Quality and Quantity:
Training Settings:
--img 640
or higher.Model Selection:
Hyperparameter Tuning:
Here is an example command to train with some of these suggestions:
python train.py --epochs 300 --img 640 --batch 32 --data dev_data.yaml --weights yolov5m.pt --cache --patience 10
For more detailed tips and best practices, please refer to our Tips for Best Training Results guide.
I hope these suggestions help improve your number plate detection accuracy. If you have any further questions or need additional assistance, feel free to ask!
Hii @glenn-jocher, In my case, I need a small model because I have to run it with DeepStream on Jetson, where I can't compromise on FPS. That's why I'm using the YOLOv5n model with an image size of 360. Do I need to have more images for validation? In the training dataset, we have around 7,100 images, but in the validation dataset, I have approximately 2,100 images.
Hi @AbhishekPSI7042,
Thank you for your question and for providing details about your use case. Running YOLOv5n on Jetson with DeepStream is a great choice for maintaining high FPS. Here are some suggestions to help you optimize your model performance:
Validation Dataset Size:
Dataset Quality:
Training Settings:
Model Optimization:
Hyperparameter Tuning:
Here is an example command to train with some of these suggestions:
python train.py --epochs 300 --img 480 --batch 32 --data dev_data.yaml --weights yolov5n.pt --cache --patience 10
For more detailed tips and best practices, please refer to our Tips for Best Training Results guide.
If you encounter any issues or have further questions, feel free to ask. The YOLO community and the Ultralytics team are here to help! 😊
Hii @glenn-jocher, I have trained model with image size 480 and epochs 300 but model accuracy didn't increased. Now what things do I need to do to increase the accuracy of numberplate. I training model on google colab pro.
Will this hyperparameter tuning work?
lr0: 0.001 # initial learning rate (SGD=1E-2, Adam=1E-3) lrf: 0.01 # final OneCycleLR learning rate (lr0 * lrf) momentum: 0.937 # SGD momentum/Adam beta1 weight_decay: 0.0005 # optimizer weight decay 5e-4 warmup_epochs: 5.0 # warmup epochs (fractions ok) warmup_momentum: 0.9 # warmup initial momentum warmup_bias_lr: 0.2 # warmup initial bias lr box: 0.05 # box loss gain cls: 0.5 # cls loss gain cls_pw: 1.0 # cls BCELoss positive_weight obj: 1.5 # obj loss gain (scale with pixels) obj_pw: 1.0 # obj BCELoss positive_weight iou_t: 0.15 # IoU training threshold anchor_t: 3.0 # anchor-multiple threshold
fl_gamma: 0.5 # focal loss gamma (efficientDet default gamma=1.5) hsv_h: 0.015 # image HSV-Hue augmentation (fraction) hsv_s: 0.7 # image HSV-Saturation augmentation (fraction) hsv_v: 0.4 # image HSV-Value augmentation (fraction) degrees: 0.0 # image rotation (+/- deg) translate: 0.2 # image translation (+/- fraction) scale: 0.5 # image scale (+/- gain) shear: 0.0 # image shear (+/- deg) perspective: 0.0 # image perspective (+/- fraction), range 0-0.001 flipud: 0.0 # image flip up-down (probability) fliplr: 0.5 # image flip left-right (probability) mosaic: 1.0 # image mosaic (probability) mixup: 0.0 # image mixup (probability) copy_paste: 0.0 # segment copy-paste (probability)
Hi @AbhishekPSI7042,
Thank you for your detailed follow-up. It's great to see you're experimenting with different settings to improve your model's performance. Let's address your concerns and explore further steps to enhance the accuracy of your number plate detection.
Hyperparameter tuning can indeed have a significant impact on model performance. The hyperparameters you've listed are a good starting point. Here are a few suggestions to fine-tune them:
Learning Rate (lr0
and lrf
):
lr0
) and the final learning rate (lrf
) are crucial. You might want to experiment with slightly lower or higher values. For example, try lr0: 0.0005
and lrf: 0.01
to see if it stabilizes the training.Loss Gains (box
, cls
, obj
):
box
loss gain slightly, e.g., box: 0.1
.Augmentation Parameters:
hsv_h
, hsv_s
, hsv_v
, translate
, scale
, and shear
. For instance, increasing translate
to 0.3
or scale
to 0.6
might help.Here's an example command incorporating some of these suggestions:
python train.py --epochs 300 --img 480 --batch 32 --data dev_data.yaml --weights yolov5n.pt --cache --patience 10 --hyp hyp.yaml
And your hyp.yaml
might look like this:
lr0: 0.0005
lrf: 0.01
momentum: 0.937
weight_decay: 0.0005
warmup_epochs: 5.0
warmup_momentum: 0.9
warmup_bias_lr: 0.2
box: 0.1
cls: 0.5
cls_pw: 1.0
obj: 1.5
obj_pw: 1.0
iou_t: 0.15
anchor_t: 3.0
fl_gamma: 0.5
hsv_h: 0.015
hsv_s: 0.7
hsv_v: 0.4
degrees: 0.0
translate: 0.3
scale: 0.6
shear: 0.0
perspective: 0.0
flipud: 0.0
fliplr: 0.5
mosaic: 1.0
mixup: 0.0
copy_paste: 0.0
Model Architecture:
Data Quality:
Training Duration:
Validation Strategy:
For more detailed tips and best practices, please refer to our Tips for Best Training Results guide.
If you encounter any issues or have further questions, feel free to ask. The YOLO community and the Ultralytics team are here to help! 😊
Best of luck with your training!
Search before asking
Question
Hi,
I'm training a YOLOv5n model for vehicle detection, and we have five classes. In training, I have 7519 images, including background images, and in validation, 2130 images. However, I'm unable to achieve accuracy in number plate detection. How can I improve the accuracy of number plate detection? Please help me to improve the accuracy of numberplate
!python train.py --epochs 150 --img 360 --batch 32 --data dev_data.yaml --weights yolov5n.pt --cache --patience 10
Accuracy achieved:-
Class Images Instances P R mAP50 mAP50-95: 100%|██████████| 34/34 [00:23<00:00, 1.44it/s] all 2130 3710 0.99 0.984 0.995 0.859 Vehicle 2130 1158 0.985 0.985 0.995 0.922 NumberPlate 2130 1594 0.985 0.981 0.994 0.655 Heavy Vehicle 2130 650 1 0.984 0.995 0.921 TwoWheeler 2130 295 0.993 0.969 0.995 0.871 ThreeWheeler 2130 13 0.985 1 0.995 0.927
Additional
No response