Skip to content

Unintuitive output of predict_jsons() #29

@woctezuma

Description

@woctezuma

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(),
}
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions