ultralytics / ultralytics

NEW - YOLOv8 🚀 in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
28.76k stars 5.71k forks source link

Detection of a fluid object, bbox not perfectly defined #9364

Closed MateoLostanlen closed 4 months ago

MateoLostanlen commented 6 months ago

Search before asking

Question

Hello,

Thank you very much for this repo!

I have a question about loss. I'm using ultralytics to train a yolov8 to do wildfire detection. The problem is that a smoke plume is not a perfectly defined object, two annotators will probably never make the same bbox. But two bboxes with a small iou can be perfectly acceptable.

Do you have any recommendations for training? I'm thinking of modifying the losses to take this rather special case into account.

Screenshot from 2024-03-27 17-27-21

github-actions[bot] commented 6 months ago

👋 Hello @MateoLostanlen, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

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.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

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

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

glenn-jocher commented 6 months ago

@MateoLostanlen hello! 👋

Thank you for reaching out and for the kind words about the repo.

Detecting fluid or amorphous objects like smoke plumes can indeed be challenging due to the varying interpretations of bounding boxes among different annotators. For your wildfire detection project using YOLOv8, one possible approach is to focus on customizing the loss function to better handle the ambiguity in object boundaries.

One straightforward strategy could be to adjust the IoU threshold used during training. Lowering the IoU threshold could make the model less stringent about the exact match of the predicted bounding box to the ground truth, which might be beneficial for your use case.

Additionally, focusing on enhancing the dataset by including a diverse set of annotations (varying in size and shape for the same type of object) might help the model learn the variability inherent to smoke plumes.

While directly modifying the loss function to account for amorphous objects could be complex, these adjustments might provide a good start towards handling the inherent ambiguity of your target objects.

Hope this helps, and feel free to share your progress or any further questions you might have!

MateoLostanlen commented 6 months ago

Hi @glenn-jocher , thank you very much for your quick reply. I thought that the iou parameter during training was only used to lower the threshold for the NMS but not to accept a bbox with a lower iou, am I wrong?

glenn-jocher commented 6 months ago

Hello @MateoLostanlen! You're partially correct 😊. The IoU parameter during training does influence NMS to a great extent but also plays a role in determining how closely a model's predicted bounding box needs to match the ground truth to be considered a positive detection during the training process. It's a subtle balance that affects both detection performance and how the model perceives what constitutes a correct detection. Diversifying your dataset annotations, as mentioned, remains a crucial strategy for improving detection robustness for scenarios like yours. Happy training!

MateoLostanlen commented 6 months ago

Thank you very much for your reply, @glenn-jocher !

I'm going to try this, I'm one of the founders of Pyronear an association that proposes a solution for early wildfire detection to firefighters, we hope to improve the model significantly to be as effective as possible this summer.

glenn-jocher commented 6 months ago

Hello @MateoLostanlen! That's excellent to hear – diving into adjustments and exploring what works best for your specific application is a promising path. 🚀 The work being done by Pyronear is truly commendable, and we're thrilled that Ultralytics YOLOv8 can contribute to such an impactful project. Should you need any further assistance or have more questions as you refine your model, please don't hesitate to reach out. Wishing you and the Pyronear team great success in making wildfire detection more effective! 🔥👩‍🚒

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 ⭐