ultralytics / yolov5

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

How to increase mAP@0.5 and recall value #11120

Open muttahirul opened 1 year ago

muttahirul commented 1 year ago

Search before asking

Question

Hi @glenn-jocher , I trained a custom data using yolov5m pre-trained weight to detect weather a person is pedestrian or not. My data has two classes. I use minibatch size = 16 and epochs=100. These are the hyperparameter I used: lr0: 0.01 lrf: 0.01 momentum: 0.937 weight_decay: 0.0005 warmup_epochs: 3.0 warmup_momentum: 0.8 warmup_bias_lr: 0.1 box: 0.05 cls: 0.5 cls_pw: 1.0 obj: 1.0 obj_pw: 1.0 iou_t: 0.2 anchor_t: 4.0 fl_gamma: 0.0 hsv_h: 0.015 hsv_s: 0.7 hsv_v: 0.4 degrees: 0.0 translate: 0.1 scale: 0.5 shear: 0.0 perspective: 0.0 flipud: 0.0 fliplr: 0.5 mosaic: 1.0 mixup: 0.0 copy_paste: 0.0 I have 2550 train image and 451 validation image. I also added 2% background image with no labels as per previous issues suggestions. I got only 0.508 mAP @0.5 and very low recall value. From result, I can also see the val/obj loss and val/class loss is increasing. Also from confusion matrix, I got 0% correctly predicted background which is very confusing me. Could you give any suggestion or direction to increase mAP value,please?

results train_batch1 confusion_matrix F1_curve labels P_curve PR_curve R_curve

Additional

No response

github-actions[bot] commented 1 year ago

👋 Hello @muttahirul, 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.7.0 with all requirements.txt installed including PyTorch>=1.7. 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
HGCSDN commented 1 year ago

There are some advices I think might be helpful:1. Balance the amount of Pedestrain and No Pedestrain. 2. Delete labels which are too small to see the person 3. Notice whether the label is correct after data augment.

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

HGCSDN commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 1 year ago

@HGCSDN 抱歉,我不明白你的问题是什么。请问有什么我可以帮助你的吗?

github-actions[bot] commented 1 year 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 ⭐

HGCSDN commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 1 year ago

@HGCSDN hello,

Thank you for reaching out. However, I'm afraid this looks like an automated out-of-office message. If you have any questions or issues related to YOLOv5, please feel free to let us know. We'll do our best to assist you.

Best regards, The YOLOv5 team

github-actions[bot] commented 1 year 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 ⭐

HGCSDN commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 1 year ago

@HGCSDN hi there,

Thank you for reaching out. However, it seems like the content of your message is an automated out-of-office reply. If you have any questions or need assistance regarding YOLOv5, please let us know. We're here to help.

Thank you, YOLOv5 Team

github-actions[bot] commented 1 year 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 ⭐

HGCSDN commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 1 year ago

@HGCSDN 你好,

非常感谢你的回复。不过,这似乎是一个自动回复的邮件。如果你有关于 YOLOv5 的任何问题或困惑,请随时告诉我们。我们将竭诚为你提供帮助。

YOLOv5 团队

github-actions[bot] commented 1 year 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 ⭐

HGCSDN commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 1 year ago

@HGCSDN hi there,

Thank you for reaching out to us. However, it appears that the content of your message is an automated out-of-office reply. If you have any questions or need assistance regarding YOLOv5, please let us know. We are here to help.

Thank you, YOLOv5 Team

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

HGCSDN commented 11 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 11 months ago

@HGCSDN hi there,

Thank you for your response. However, it seems like the content of your message is an automated out-of-office reply. If you have any questions or need assistance regarding YOLOv5, please let us know. We are here to help.

Thank you, YOLOv5 Team

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

HGCSDN commented 10 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 10 months ago

@HGCSDN hi there,

Thank you for your response. However, it appears that the content of your message is an automated out-of-office reply. If you have any questions or need assistance regarding YOLOv5, please feel free to reach out to us. We are here to help.

Thank you, YOLOv5 Team

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 ⭐

HGCSDN commented 9 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 9 months ago

@HGCSDN hi there,

Thank you for letting us know. Feel free to reach out if you have any questions about YOLOv5 once you're back. We're here to help!

Thank you, YOLOv5 Team

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

HGCSDN commented 8 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 7 months ago

@HGCSDN hi there! No worries. Whenever you're ready to discuss YOLOv5 or have any questions, feel free to reach out. We're here to help. Thank you!

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

HGCSDN commented 6 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 6 months ago

@HGCSDN it seems there's a misunderstanding. If you have any questions or need assistance with YOLOv5 when you return, please don't hesitate to reach out. Have a great holiday! 😊

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

HGCSDN commented 5 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 5 months ago

@HGCSDN i'm sorry, but I can't proceed with this conversation. If you have any inquiries or need support regarding YOLOv5, please feel free to reach out when you're available. Enjoy your time off! 😊

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

HGCSDN commented 4 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 4 months ago

@HGCSDN i'm sorry, but it seems like there's been a bit of a mix-up with the message content. It appears to be an auto-response rather than a question or comment about Ultralytics YOLOv5. If you have any specific questions or need assistance, please feel free to reach out with more details. We're here to help! 😊

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

HGCSDN commented 3 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 3 months ago

@HGCSDN hello! It looks like your message is an auto-reply. If you have any specific questions or issues related to YOLOv5 when you return, please feel free to reach out. Enjoy your holiday! 😊

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

HGCSDN commented 2 months ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 2 months ago

Hello! It seems like your message is an auto-reply. If you have any questions or need assistance with YOLOv5 when you're available, please don't hesitate to reach out. Enjoy your holiday! 😊

github-actions[bot] commented 1 month 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 ⭐

HGCSDN commented 1 month ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 1 month ago

@HGCSDN hello! It seems like your message is an auto-reply. When you have a moment, please provide more details about the issue you're experiencing with YOLOv5.

If you're encountering a bug, please ensure you've included a minimum reproducible code example. This helps us understand and replicate the issue on our end. You can find more information on creating a minimum reproducible example here: Minimum Reproducible Example.

Additionally, please verify that the issue persists with the latest versions of torch and the YOLOv5 repository from GitHub.

Looking forward to your response so we can assist you further! 😊

github-actions[bot] commented 2 weeks 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 ⭐

HGCSDN commented 2 weeks ago

这是来自QQ邮箱的假期自动回复邮件。   你好,邮件已收到。

glenn-jocher commented 2 weeks ago

Hello! It appears that your message is an auto-reply. When you have the opportunity, please provide more details about the issue or question you have regarding YOLOv5.

To address your initial query about increasing mAP @HGCSDN.5 and recall values, here are some suggestions:

  1. Dataset Quality and Quantity:

    • Ensure your dataset is sufficiently large and well-labeled. For optimal results, aim for at least 1500 images per class and 10,000 instances per class.
    • Verify label accuracy and consistency. All instances of all classes in all images must be labeled correctly.
  2. Training Settings:

    • Epochs: Consider increasing the number of epochs if your model is not overfitting. Start with 300 epochs and adjust based on performance.
    • Batch Size: Use the largest batch size that your hardware can handle to improve batch normalization statistics.
    • Image Size: Train at a higher resolution if your dataset contains many small objects. For example, try --img 1280.
  3. Hyperparameters:

    • Start with default hyperparameters and then fine-tune them. You can use hyperparameter evolution to find the optimal settings automatically. For more details, refer to the Hyperparameter Evolution Tutorial.
  4. Model Selection:

    • Larger models like YOLOv5x generally produce better results but require more computational resources. If feasible, try using a larger model.
  5. Background Images:

    • Adding background images (images with no objects) can help reduce false positives. Ensure you have about 0-10% background images in your dataset.

Here is an example command to start training with default settings:

python train.py --data custom.yaml --weights yolov5m.pt --epochs 300 --batch-size 16 --img 1280

For more detailed guidance, please refer to the Tips for Best Training Results.

If this is a bug report, please ensure that the issue is reproducible with the latest versions of YOLOv5 and PyTorch. You can update your YOLOv5 repository with:

git pull

Feel free to share any additional information or results plots (train losses, val losses, P, R, mAP, PR curve, confusion matrix, etc.) to help us better understand and address your issue.

Looking forward to your response! 😊