'Count Unique Faces from Image dataset

I'm using OpenCV's haar cascade(haar-classifier) to detect faces in the image and storing those faces(cropped from the image) in one folder. I've around 10000+ images of faces detected using haar cascade.

Now I want to find the Number of Unique faces in these 10000 images. (One person should have only one image)

I tried DeepFace and face_recognition library but, these libraries are not that efficient as they need to have eyes and nose position aligned which is not the case in my dataset.

is there any library or method which I can use?



Solution 1:[1]

retinaface is the strongest face detector. here, you can find its repo.

#!pip install retina-face
from retinaface import RetinaFace
resp = RetinaFace.detect_faces("img1.jpg")

Here, response object stores each face as dictionary. Then, you can find out the number of faces in an image as:

num_of_faces = len(list(resp.keys()))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 johncasey