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

Add script to evaluate face recognition by LFW #72

Merged
merged 7 commits into from
Jul 29, 2022
Merged

Add script to evaluate face recognition by LFW #72

merged 7 commits into from
Jul 29, 2022

Conversation

WanliZhong
Copy link
Member

The script is modified based on evaluation of InsightFace.

  • Add dataset for evaluation: LFW
  • Report sface accuracy

@fengyuentau fengyuentau self-assigned this Jul 14, 2022
@fengyuentau fengyuentau requested review from fengyuentau, zihaomu and kaingwade and removed request for fengyuentau July 14, 2022 02:46
@fengyuentau fengyuentau added evaluation adding tools for evaluation or bugs of eval scripts labels Jul 14, 2022
@kaingwade
Copy link
Collaborator

LGTM.

ids = self.ids
embeddings = np.zeros(shape=(len(self), 128))
for idx, img in tqdm(enumerate(self), desc="Evaluating {} with {} val set".format(model.name, self.name)):
embedding = model.infer(img)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image should be aligned before being fed into the model. This can be the problem of low accuracy.

To get aligned image, you need to get the bounding box of the face using YuNet. For simplicity, you can start with treating the bounding box of highest score as the only face in the image. So I suggest you:

  1. Validate whether alignment using YuNet improves the accuracy.
  2. If it does, store those boxes in a constant in this file (or a separate .npy file) and load it when requires to save time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! After using YuNet to get bbox, the accuracy is 97.92%. this is still not 99.6% as described in the documentation. I will try to solve this problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference can be YuNet failing to detect a face in some images. You can have a check on the images with low score faces or no face.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may not be the problem. Each image is detected with a face and the selected bbox scores are all above 0.8.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it may fail even with score 0.8. Please, take a look at those faces with score lower than 0.9.

Copy link
Member

@fengyuentau fengyuentau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lfw_face_features.npy should be renamed to lfw_face_bboxes.npy to address confusions. Should also explain what this file is for and the data structure (e.g. [[x1, y1, x2, y2, lm1_x, lm1_y, ... ]]) in the section of LFW in readme.

Others look good to me 👍 Thank you so much!

Copy link
Member

@zihaomu zihaomu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@fengyuentau fengyuentau merged commit 3c4d87d into opencv:master Jul 29, 2022
Charles-258 pushed a commit to Charles-258/opencv_zoo that referenced this pull request Jul 29, 2022
@fengyuentau fengyuentau added this to the 4.9.0 (first release) milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluation adding tools for evaluation or bugs of eval scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants