retinaface icon indicating copy to clipboard operation
retinaface copied to clipboard

Unintuitive output of predict_jsons()

Open woctezuma opened this issue 3 years ago • 0 comments

I was surprised by the output of predict_jsons() when the input image did not contain any face.

The expected behaviour would have been an empty list, so that I could find the number of detected faces as len(annotations).

Instead, there is a list with 1 element, with empty bounding-boxes and a score of -1, due to the following line:

https://github.com/ternaus/retinaface/blob/29611c722ad400eed977b2df1816ddf914dbb2bf/retinaface/predict_single.py#L92-L93

I think it is unintuitive and can lead to some confusion for the user. A more consistent and intuitive behaviour would return annotations as initialized here:

https://github.com/ternaus/retinaface/blob/29611c722ad400eed977b2df1816ddf914dbb2bf/retinaface/predict_single.py#L66

Indeed:

  • if new faces are detected, they are appended to annotations,
  • otherwise, annotations would be returned exactly as it was initialized.

https://github.com/ternaus/retinaface/blob/29611c722ad400eed977b2df1816ddf914dbb2bf/retinaface/predict_single.py#L124-L130

woctezuma avatar Dec 10 '20 18:12 woctezuma