ultralytics / yolov5

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

Why my Yolov5 model have a confusion matrix only on background FN, and 0 for all precision, recall, mAP_0.5, mAP_0.5:0.95? #12620

Closed xcjames closed 9 months ago

xcjames commented 9 months ago

Search before asking

Question

I am doing a object detection for 6 classes, and the confusion matrix is like this: image Throughout the training process, the precision, recall, mAP_0.5, mAP_0.5:0.95 remains 0: image I also trained coco128 dataset , but the results were similar as above, only have the last row in confusion matrix all equal to 1, and precision, recall, mAP_0.5, mAP_0.5:0.95 remains 0: image

Methods I have tried to solve the problem but didn't work:

  1. increase epoch number to 1000
  2. run detect.py with very low confidence threshold and iou threshold (always show no predictions)

May I ask what could the possible reason be for my mistake? Thank you!

Additional

No response

github-actions[bot] commented 9 months ago

👋 Hello @xcjames, 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
xcjames commented 9 months ago

I train my own dataset using the following command: python train.py --img 640 --batch 16 --epochs 100 --data data/CCTV.yaml --cfg models/yolov5s.yaml --weight yolov5s.pt and I train the coco128 dataset using: python train.py --img 640 --data coco128.yaml --epochs 1000 --cfg models/yolov5s.yaml --weight yolov5s.pt

xcjames commented 9 months ago

image Solved. The lesson I learned is that do not rely too much on the GPU renting online platform to help you build the environment, because they may still use the out-of-date realease of Yolov5 instead of the updated one to build the environment...

glenn-jocher commented 9 months ago

@xcjames hello! I'm glad to hear you've resolved the issue. It's indeed important to ensure that you're using the latest version of YOLOv5 for optimal performance and to benefit from the latest features and bug fixes. Always double-check the environment and dependencies when using third-party platforms. If you encounter any further issues or have questions, feel free to reach out. Happy detecting! 😊🚀