Closed zcswdt closed 3 years ago
@zcswdt well you may want to gather more data for your underrepresented categories, but class imbalance in itself is the norm in ML. I'll post our default training guidelines below that show imbalances across the various common datasets.
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/
Larger models like
thank you reply,In the process of evolving hyperparameters, --envole is set to 300 by default, and I train for 10 epochs. Does it mean that it is equivalent to 300 times, each time you have to complete 10 epochs of training?
@zcswdt yes
reply,In the process of evolving hyperparameters, --envole is set to 300 by default, and I train for 10 epochs. Does it mean that it is equivalent to 300 times, each time you have to complete 10 epochs of training?
Isnβt that equivalent to training 3000 epochs, which is a bit time-consuming?
The following are the 12 categories of detection models I trained, but there are very few samples in some categories. How to solve the imbalance problem of categories?
@zcswdt can you share your script for visualization of dataset ,width & height?
ou share your script for visualization of dataset ,wid Did you find anything? Or is a good idea to solve this problem
Normally in scaled yolov4 we are using Focal_loss & counter_per_class to solve data imbalance problem. I'm not sure about this in yolov5
On Mon, 26 Jul, 2021, 7:53 am zcswdt, @.***> wrote:
ou share your script for visualization of dataset ,wid Did you find anything? Or is a good idea to solve this problem [image: labels_correlogram] https://user-images.githubusercontent.com/43515926/126924541-605423ca-be4a-476b-9003-cb8ed415da3b.jpg
β You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ultralytics/yolov5/issues/4105#issuecomment-886323632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO5PB2XVX7AF7LD5LMHU7FLTZTBJLANCNFSM5AZKNZNA .
Normally in scaled yolov4 we are using Foca_loss & counter_per_class to solve data imbalance problem. I'm not sure about this in yolov5
Then if you are sure whether yolov5 can do this, please let me know, thank you
π 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 β!
The following are the 12 categories of detection models I trained, but there are very few samples in some categories. How to solve the imbalance problem of categories?