esimov / pigo

Fast face detection, pupil/eyes localization and facial landmark points detection library in pure Go.
MIT License
4.37k stars 309 forks source link

What are the bounds of the score? #50

Closed alexislefebvre closed 2 years ago

alexislefebvre commented 2 years ago

Is your feature request related to a problem? Please describe.

This library is used in PhotoPrism: https://github.com/photoprism/photoprism/issues/22#issuecomment-936412220

PhotoPrism allows to define a threshold for the score.

While trying to document the value of that threshold, I wonder what are the possible values.

Describe the solution you'd like

Define the minimal and maximal values for the score.

Describe alternatives you've considered

According to this article:

An image region is considered being face if the detection score average is above a certain threshold (in general around 0.995).

The score goes from 0 to 1?

Additional context

.

esimov commented 2 years ago

This detection score is encoded into the binary tree structure, so it's not really possible to play with this value. Instead you can modify the IoU (Intersection over Union) threshold value to filter out multiple detection results related to the same detected face or you can play with the shiftFactor or scaleFactor values. These values are related to the face detector sensibility. Also in case you know in advance the image size you can adjust the min and max values, which defines the minimum and maximum face detection window. For example if you know that image you are running over the face detection method is small you can decrease the max value. This will also increase the computation speed, since the dimension of the 2d pixel array over the detection method is running will became much smaller.

All in one there isn't a magical good for all value which plays out nicely for all of the use cases, but you can adapt these values dynamically based on the information provided by analyzing in advance the image the Pigo face detector you are running over.

If there is anything else where I could help just ask.

You can also check these slides for a presentation I've given last year @golab conference: https://talks.godoc.org/github.com/esimov/talks/2020/golab.io/golab-2020.slide#1

alexislefebvre commented 2 years ago

Thanks for your detailed answer.