ultralytics / ultralytics

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

SEG model outputs max 15 instances with 4 classes (out of 30) after training, while it finds all with 1 class #19060

Closed dk-teknologisk-mlnn closed 6 days ago

dk-teknologisk-mlnn commented 6 days ago

Search before asking

Question

I trained a seg model to find cakes. and it works great. It finds all cakes, also in the final prediction output. then I added classifications to teh cake. Have 4 classes. Training metrics are great. but after training it outputs the "_label -> _pred " mosaics, and there it finds max 15 cakes in all images. ( there's ~30)

I tried to increase "max detections" from 300 to 3000. but its the same.

Where does this max 15 come from ?

Image Image Image

Additional

No response

UltralyticsAssistant commented 6 days ago

👋 Hello @dk-teknologisk-mlnn, thank you for your interest in Ultralytics 🚀! We recommend checking out our comprehensive Docs for insights into using our tools effectively. You’ll find many resources such as Python and CLI guides, which may already have answers to your questions.

If this is a 🐛 Bug Report, please provide a minimum reproducible example (MRE) to help us debug the issue effectively. This would involve sharing code snippets and any relevant configurations that consistently reproduce the behavior you're observing.

If this is a custom training ❓ Question, please provide as much detail as possible, including:

It appears that your segmentation model faces an issue where it doesn't detect more than 15 instances in your multi-class setup. Please double-check your settings, including the model configuration and post-processing parameters like the confidence threshold or Non-Maximum Suppression (NMS) behavior. If possible, share additional details or code snippets regarding the adjusted "max detections" setting for further clarity.

In the meantime, ensure you've upgraded to the latest release, as newer versions often contain fixes and improvements. Update using the following command:

pip install -U ultralytics

Verified Environments

For smooth operation, you can run YOLO in various environments fully configured with all dependencies (like CUDA, PyTorch, etc.):

Community Support

For real-time interactions, join our Discord 🎧. Participate in discussions on Discourse or dive into conversations in our Subreddit to share and gain insights from the broader Ultralytics community.

Ultralytics CI

An Ultralytics team member will review your issue shortly. Thank you for your patience! 😊

Y-T-G commented 6 days ago

It keeps 15 to save memory.

https://github.com/ultralytics/ultralytics/blob/5db36db822550dd008dbc10c9af31876ce441a70/ultralytics/models/yolo/segment/val.py#L137

dk-teknologisk-mlnn commented 6 days ago

wow, that is a very good explanation haha, thanks.

glenn-jocher commented 4 days ago

@dk-teknologisk-mlnn You're welcome.