ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.22k stars 16.21k forks source link

Ways to reduce overfitting? #7059

Closed Sauravpandey98 closed 2 years ago

Sauravpandey98 commented 2 years ago

Search before asking

Question

Hello to all.I am working on project to detect warehouse boxes.So I trained a model with around 2000 images and tuned the parameters manually to get best model.After this I fine tuned my best model on a new dataset that consists of 1800 train images and around 484 validation images.Here here the stats of my dataset and training parameters:

Dataset properties:

media_images_Mosaics_0_1 media_images_Labels_0_0

Results: Screenshot from 2022-03-20 20-31-07 Screenshot from 2022-03-20 20-30-49

So as you can see I have done most of the things as suggested by experts to reduce overfitting but still my model is overfitting very early.So I have a few questions:

  1. As you can see the mAP values and precision and recall are good but still the obj loss seemed to be high even after reducing the hyp['obj].Why this is happening?
  2. What can I do further to reduce overfitting?
  3. Lastly if there is any problem with my fine tuning strategy then please tell me?

Additional

And yes please ignore the other box labels that have no objects.It is just an error from my side(that has a long story :) ).It has no effect on training because all I want is to detect the first box label i.e 0th class.

glenn-jocher commented 2 years ago

@Sauravpandey98 see Tips for Best Training Results and Hyperparameter Evolution tutorials:

YOLOv5 Tutorials

Good luck πŸ€ and let us know if you have any other questions!

Sauravpandey98 commented 2 years ago

yes I have seen this and according to that I tried to apply augmentations and reduced hyp['object'] value to achieve desired result.But still it is overfitting . I cannot do hyper parameter evolution because of computation resources constrain.

glenn-jocher commented 2 years ago

@Sauravpandey98 wel, looking at your plots your mAP@0.5 is about 99%. Not sure what type of improvement you are trying to get but I'd say focus on increasing your dataset if you don't have resources for evolution.

Sauravpandey98 commented 2 years ago

yes @glenn-jocher, sir yeah my mAP value is good.As you have said before that mAP value is affected by both regression loss and classification loss.So this mAP value may be because of very low regression loss and a mediocre classification loss. I'm saying this because as you can see from the training graphs that even after reducing the hyp['obj'], the object loss is still not so low.Basically I want to reduce this loss further to make classification good.

So,my question is how can I reduce this loss. Also I may be wrong regarding this.So,correct me if I'm wrong.

github-actions[bot] commented 2 years ago

πŸ‘‹ 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 ⭐!