tasnif
tasnif copied to clipboard
[Feature Request] Getting Embeddings For Facial Images with Facial Recognition Models
Thank you for the project!
As I see, you are using pytorch's img2vec to generate embeddings. As an alternative, we may consider checking a face is available in the image, and if yes find its embeddings with a facial recognition model such as FaceNet.
# !pip instal deepface
from deepface import DeepFace
# check face is available in the given image. img can be a file on the filesystem, or numpy array as well.
face_objs = DeepFace.extract_faces(img_path = img, detector_backend="mtcnn")
if faces:
for face_obj in face_objs
detected_face = face_obj["face"]
embedding = DeepFace.represent(img_path = detected_face, model_name="Facenet", detector_backend="skip")
else:
# continue to do with pytorch's img2vec
I will be happy to contribute if this attracts your attention. Feel free to close this ticket if you think this will cause losing its way.