ultralytics / yolov5

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

Can let Yolo focus learning in a custom area? #3739

Closed 0220220313 closed 3 years ago

0220220313 commented 3 years ago

❔Question

I have a datasets ,and most of the labels are locate in specific area. Thus I want let Yolo learning stronger in this area. Current I create a label 'Area' to box these area ,but it seems not very helpful for the datasets. Does any one have suggestion?

Additional context

Another question is this datasets have lots of no label image ( 25% ). If train model with them will get low confidence in all predict box ( < 0.3 ) Have any method to solve it?

github-actions[bot] commented 3 years ago

👋 Hello @0220220313, 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.

glenn-jocher commented 3 years ago

@0220220313 👋 Hello! Thanks for asking about improving 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/

0220220313 commented 3 years ago

@glenn-jocher Thank for your reply. But in this case , I'm hard to get another data. Total Image number is about 8.1 k , but images which have labels only 5.5 k. So I want to let model focus learning on specific area to improve the score. This datasets have a characteristic , most of label locate in specific area. Although these area have different size and address in each image ,they are easy to get .

These are informations of training model. image image image

glenn-jocher commented 3 years ago

@0220220313 you might try retraining with --epochs 50, or retraining with --epochs 300 --weights '' --cfg yolov5m6.yaml --img 1280

0220220313 commented 3 years ago

@0220220313 you might try retraining with --epochs 50, or retraining with --epochs 300 --weights '' --cfg yolov5m6.yaml --img 1280

Thanks ,I will try it recently.

0220220313 commented 3 years ago

@glenn-jocher Thanks for your recommend. After retraining with --epochs 300 --weights '' --cfg yolov5m6.yaml --img 1280 , my map@.5 is up to 0.531 . But it seems odd in precision-confidence curve , why high confidence result have lower precision. Is the model over fitting or have another issue? image

glenn-jocher commented 3 years ago

@0220220313 results will vary by multiple factors including your dataset.

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 ⭐!