huggingface / huggingface.js

Utilities to use the Hugging Face Hub API
https://hf.co/docs/huggingface.js
MIT License
1.41k stars 228 forks source link

Add threshold parameter for object detection widget #322

Open NielsRogge opened 2 years ago

NielsRogge commented 2 years ago

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.

osanseviero commented 2 years ago

Is this supported in the pipeline class already @NielsRogge ?

alaradirik commented 2 years ago

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.

osanseviero commented 2 years ago

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

plannaAlain commented 10 months ago

I think this is a critical feature.

NielsRogge commented 10 months ago

cc @mishig25 would you be up for implementing this?