Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unintuitive output of predict_jsons() #29

Open
woctezuma opened this issue Dec 10, 2020 · 0 comments
Open

Unintuitive output of predict_jsons() #29

woctezuma opened this issue Dec 10, 2020 · 0 comments

Comments

@woctezuma
Copy link

woctezuma commented Dec 10, 2020

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:

if boxes.shape[0] == 0:
return [{"bbox": [], "score": -1, "landmarks": []}]

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:

annotations: List[Dict[str, Union[List, float]]] = []

Indeed:

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

annotations += [
{
"bbox": bbox.tolist(),
"score": scores[box_id],
"landmarks": landmarks[box_id].reshape(-1, 2).tolist(),
}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant