huggingface.js icon indicating copy to clipboard operation
huggingface.js copied to clipboard

Add threshold parameter for object detection widget

Open NielsRogge opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. Currently, the object detection widgets don't have a threshold parameter, so they just use the hardcoded one from the object detection pipeline, which is 0.9 as seen here.

However, with more and more object detection models coming, we definitely need an adjustable threshold button for the widget, as for instance now Deformable DETR checkpoints, which need a lower threshold to detect objects in a scene, simply say "no objects detected":

Screenshot 2022-10-17 at 08 40 55

Describe the solution you'd like Adding a "threshold button" to the inference widgets. Perhaps make it possible to set a default threshold in the model card.

NielsRogge avatar Oct 17 '22 06:10 NielsRogge

Is this supported in the pipeline class already @NielsRogge ?

osanseviero avatar Oct 17 '22 15:10 osanseviero

Hey @osanseviero, threshold is already supported in the pipeline class, I'm updating the pipeline to use the post_process_object_detection methods instead of post_process with this PR. We still need to add a threshold slider to the inference widgets though.

alaradirik avatar Nov 01 '22 16:11 alaradirik

Cc @mishig25 and @OlivierDehaene maybe can help here (adding the slider in the widget and adding support in the inference API for this)

osanseviero avatar Nov 01 '22 16:11 osanseviero

I think this is a critical feature.

plannaAlain avatar Jan 19 '24 09:01 plannaAlain

cc @mishig25 would you be up for implementing this?

NielsRogge avatar Jan 19 '24 10:01 NielsRogge