ultralytics / yolov5

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

Background Images Ruining Accuracy of the Model Yolov5s #12536

Closed bariskedira closed 8 months ago

bariskedira commented 10 months ago

Search before asking

Question

Hi!

I am an CE student at the University of Warwick, doing research in Effects of AI on competitive games for my Yearly Project.

As Proof of Concept, I made an basic "Aim-Bot" using Yolov5s; that only works on "Dummies" in the Training-Mode of the game called Apex Legends.

I have created a Pretty broad and comprehensive Model with 25665 Labelled Images. The Dataset is very diverse and comprehensive.

The Model performs exceptionally well, detecting the dummies %98 of the time, All Angles / All Distances / Crouching / Standing / Walking; works with every scenario.

Here is a small Sample of the Positive Detections ↓↓↓ㅤ (Yolov5s)

POSITIVES1 POSITIVES2 POSITIVES3 POSITIVES4 POSITIVES5

Problem is; Even though model is great, it has many False-Positives. And most of these False-Positives are very high percentaged %

In Total it took 533 Background images + 25665 Labelled Images.

But The Results Were Horrible:

There were no more False Positives at all, But Accuracy of the Model went from detecting %98 of the dummies to %3 - %4. Even the simplest & easiest Images weren't being detected.

My Question Is; How can I get rid of False-Positives with minimal damage to model's accuracy.

Here is a Sample of the False-Positives ↓↓↓ (before adding Backgrounds) (Yolov5s)

NEGATIVES1 NEGATIVES2 NEGATIVES3 NEGATIVES4 NEGATIVES6 NEGATIVES7 NEGATIVES8 NEGATIVES9 NEGATIVES 10! ㅤ ㅤ

DATA OF THE LATEST TRAINING ↓↓↓

(^one that has %3 accuracy) _(^This Model Had mAP05:95 = 0.924 at last epoch--> pretty high)

results confusion_matrix F1_curve PR_curve P_curve R_curve labels labels_correlogram

All The Epochs (299/299) --> results.csv

Additional

No response

github-actions[bot] commented 10 months ago

👋 Hello @bariskedira, 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 a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.8.0 with all requirements.txt installed including PyTorch>=1.8. To get started:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

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

YOLOv5 CI

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics
glenn-jocher commented 10 months ago

@bariskedira hi there,

It sounds like you've put a lot of effort into your project, and it's great to hear that your YOLOv5 model is performing exceptionally well with the dummies. As you mentioned, using background images to reduce false positives is a common technique, but it seems to have significantly impacted your model's accuracy.

One approach you could try is to use hard-negative mining, where you retrain the model on a large set of false positive images, and possibly true negative images as well, to emphasize learning from those challenging cases. Re-evaluating the distribution of your false positives may also help identify specific patterns causing the accuracy drop.

Keep in mind that there are many potential factors at play, and it might require some experimentation to find the best approach for your specific use case.

Best of luck with your project, and feel free to consult the Ultralytics YOLOv5 documentation for additional guidance. Keep up the good work!

Shanky71 commented 10 months ago

@bariskedira I am new to this field. Can you please explain me more about False positive, True positive , False negative and True negative with some example?. Different books are giving me different opinions.

github-actions[bot] commented 9 months ago

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

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 YOLO 🚀 and Vision AI ⭐