ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
32.31k stars 6.21k forks source link

Add all class softmax probability scores to results object #16396

Open nick-lavigne-ursaspace opened 1 month ago

nick-lavigne-ursaspace commented 1 month ago

Search before asking

Description

In the results object for object detection models (including the obb version) I would love to have access to all the different class softmax scoeres/probabilities for each detection, instead of just the maximum. I'm surprised these values are not easily accessible. I believe they are accessible for ultralytics classification models.

Use case

The classes we use are hierarchical in nature and we are not only interested in the class with max probability. The next level up from class is subtype and we would like to know for low max confidence scores of the model is confused amongst all classes in a particular subtype or if it's softmax scores are confused across subtypes.

Another use case is in providing top-n class predictions. Instead of predicting just one class, predict the n classes with the highest probability. This can be useful in doing conformal prediction on top of base detections as well.

Additional

No response

Are you willing to submit a PR?

UltralyticsAssistant commented 1 month ago

👋 Hello @nick-lavigne-ursaspace, thank you for your suggestion and engagement with Ultralytics 🚀! We appreciate your detailed feature request regarding access to all class softmax probability scores for detections.

For further exploration, check our Docs for more on YOLOv8 features and customization possibilities. It sounds like this feature could add significant value, especially with use cases involving hierarchical classes and top-n predictions.

If you've encountered this while working with YOLOv8, ensure you're on the latest version by upgrading the ultralytics package with:

pip install -U ultralytics

This is an automated response 📢, and an Ultralytics engineer will review this request soon. Meanwhile, feel free to join our community discussions on Discord 🎧 or engage with others on Discourse and Subreddit.

Stay tuned for updates, and thank you for helping us improve! 🌟

Y-T-G commented 1 month ago

There's a draft PR for this.

https://github.com/ultralytics/ultralytics/pull/15966