ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.56k stars 16.31k forks source link

Yolov5 Overfitting Problem #3857

Closed yasarniyazoglu closed 3 years ago

yasarniyazoglu commented 3 years ago

❔Question

Hello there. I trained in yolov5 with my own data set and my map values ​​are like this. As a result of the model I made with 30 epochs, it did a normal quality job when testing with video, but when I tested the same video with the model formed as a result of 300 epochs, it did a worse job than 30 epochs. how can i solve this.

Additional context

Ekran Alıntısı2 Ekran Alıntısı Ekran Alıntısı1

github-actions[bot] commented 3 years ago

👋 Hello @yasarniyazoglu, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

ou525 commented 3 years ago

hi, I am very interested in your problem and want to know how big your dataset is, how many classifications, and whether it is complicated

tetelevm commented 3 years ago

For statistics - I have 5 classes, a dataset of 7500 images and about 1500 images of background/unnecessary objects, and I have enough 20 epochs for a pre-trained m-version to an accuracy of 0.97. This figure is not quite right, since I use the same images for training and validation, but on real data the performance is still quite satisfactory. That is, I mean that 30 epochs for the pre-trained model may be quite sufficient. (Also, don't completely trust any tutorial. If they give you code that doesn't work and you have a working code, wouldn't it be better to use your working code?)

glenn-jocher commented 3 years ago

@yasarniyazoglu 👋 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.

Dataset

COCO Analysis

Model Selection

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.

YOLOv5 Models

Training Settings

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.

Further Reading

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/

yasarniyazoglu commented 3 years ago

merhaba, probleminizle çok ilgileniyorum ve veri kümenizin ne kadar büyük olduğunu, kaç sınıflandırma olduğunu ve karmaşık olup olmadığını bilmek istiyorum.

Thank you for your attention. There are 863 photos and nearly 900 tags. There are approximately 200 photos and tags for each class.

github-actions[bot] commented 3 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 ⭐!