exadel-inc / CompreFace

Leading free and open-source face recognition system
https://exadel.com/accelerator-showcase/compreface/
Apache License 2.0
5.69k stars 775 forks source link

det_prob_threshold is validating the wrong field on method recognize. #1194

Open decioschmitt opened 1 year ago

decioschmitt commented 1 year ago

Describe the bug det_prod threshold is comparing the probability field instead of the similarity field.

A clear and concise description of what the bug is.

To Reproduce add two subjects, and try recognition with a completely different user with filter det_prob_threshold activated.

Steps to reproduce the behavior: Log application when i try request.

----------------------------REQUEST-------------------------------------------
ENDPOINT: http://192.168.3.84:8000/api/v1/recognition/recognize?limit=10&det_prob_threshold=0.7
----------------------------REQUEST-------------------------------------------
----------------------------RESPONSE-------------------------------------------
STATUS CODE:200
{
  "result" : [ {
    "box" : {
      "probability" : 0.96841,
      "x_max" : 704,
      "y_max" : 575,
      "x_min" : 211,
      "y_min" : 30
    },
    "subjects" : [ {
      "subject" : "31a41cb2-d640-4833-ae9e-1baca1c2e2bd",
      "similarity" : 0.09532
    } ]
  } ]
}
----------------------------RESPONSE-------------------------------------------

Notice in the log above that the filter was applied to 0.7 and the API returns a user with "similarity": 0.09532, carrying out some tests I confirmed that the filter is comparing the probability field instead of the similarity field.

ndxw commented 12 months ago

This is intended behaviour. From the docs:

Element Notes
det_prob_threshold minimum required confidence that a recognized face is actually a face. Value is between 0.0 and 1.0.

If you need faces above a certain similarity, that can be handled in your own code.