April 03, 2023

According to Test Blog #1, I found it is not enough for me to continue building the system not only because of the simple data set but also the data I want to collect.

So I keep researching and finally found this library called deepface which is a lightweight face recognition and facial attribute analysis (agegenderemotion and race) framework for python. It is a hybrid face recognition framework wrapping state-of-the-art models: VGG-FaceGoogle FaceNetOpenFaceFacebook DeepFaceDeepIDArcFaceDlib and SFace.

It is also easy to get access to a set of features:

  1. Face Verification: The task of face verification refers to comparing a face with another to verify if it is a match or not. Hence, face verification is commonly used to compare a candidate’s face to another. This can be used to confirm that a physical face matches the one in an ID document.
  2. Face Recognition: The task refers to finding a face in an image database. Performing face recognition requires running face verification many times.
  3. Facial Attribute Analysis: The task of facial attribute analysis refers to describing the visual properties of face images. Accordingly, facial attributes analysis is used to extract attributes such as age, gender classification, emotion analysis, or race/ethnicity prediction.
  4. Real-Time Face Analysis: This feature includes testing face recognition and facial attribute analysis with the real-time video feed of your webcam.

I used Colaboratory - Google to test around this library(also my first time using colab) and followed the tutorial: DeepFace: State-of-the-Art Face Attribute Analysis in Python, here is my work flow:

  1. Install deepface
!pip install deepface
  1. Import deepface, matplotlib, cv2, pandas
from deepface import DeepFace
import matplotlib.pyplot as plt
import cv2
import pandas as pd
  1. Import drive to upload the images I saved
from google.colab import drive
drive.mount('/content/drive')
  1. Test the detectFace function
backends = [  'opencv', 'ssd', 'dlib', 'mtcnn', 'retinaface', 'mediapipe']

face = DeepFace.detectFace('/content/drive/MyDrive/Siri_Images/IMG_0171.jpg', target_size = (224, 224), detector_backend='opencv')
plt.imshow(face)

Screenshot 2023-04-03 at 4.45.27 PM.png

  1. Analyze face, and easily get the data such as emotion, age, gender, race.