oarriaga / paz

Hierarchical perception library in Python for pose estimation, object detection, instance segmentation, keypoint estimation, face recognition, etc.
https://oarriaga.github.io/paz/
MIT License
617 stars 102 forks source link

Error in emotion detection example in Readme #222

Open vpodpecan opened 2 years ago

vpodpecan commented 2 years ago

The mid-level example in Readme.md contains an error. The reported scores are both 1.0 which is wrong. Those 1.0 scores are set by the HaarCascadeFrontalFace pipeline and should be set to the real MiniXceptionFER scores just like the class_name is set.

The relevant lines in the example which are now like this:

for cropped_image, box2D in zip(cropped_images, boxes2D):
    box2D.class_name = self.classify(cropped_image)['class_name']

should be updated to something like this:

for cropped_image, box2D in zip(cropped_images, boxes2D):
    prediction = self.classify(cropped_image)
    box2D.class_name = prediction['class_name']
    box2D.score = prediction['scores'].ravel()[self.classify.class_names.index(prediction['class_name'])]

Then, the scores are reported as 0.80, happy and 0.38, fear.