YOLO backend Max number of detection 300. Can we config via docker arg?
I wanted to use my own YOLO models for auto-labelling my images, but they only label up to 300 instances.
After some digging, I found this is due to a limit in Ultralytic's .predict() function.
I solved my case by just changing results = self.model.predict(path) to results = self.model.predict(path, max_det=3000) in control_models/rectangle_labels.py under the predict_regions function.
Can it be configured in the Docker Compose file to make it easier to change? I might end up doing it at some point myself, but it may be a while before I get around to these changes, so I thought someone else might be able to get to them before me.
What does the max_det param do?
It limits how many detected objects are returned from the predict method.
300 is the default, hence why you would get no more than 300 annotations return from the auto annotations feature.
Increase it means that the labelling model can return more annotations for you when using the auto annotations feature.
I should also state that I've only tried with bounding box labelling and models, as that was my use case when trying to label images with many more than 300 instances of objects
I think it makes more sense if we add a new model parameter like model_score_threshold:
<RectangleLabels name="label" toName="image" model_score_threshold="0.25" model_max_det="500" opacity="0.1">
It would be great if you could contribute it. The fix can look like this: https://github.com/HumanSignal/label-studio-ml-backend/pull/838/files
I would agree. That does seem to make more sense.
I'll look into implementing it once I get a little bit of time to go through it