Face recognition

Hi there,

are you aware of some face recognition algorithm, apart from the quite “old” DeepFace?

I need an algo to recognize that a face in a picture belongs to someone.

Thank you!

Hi Vincenzo

In a previous fastai one of the students created a cousin recognizer. So create n folders (one for each person). Place 100 photographs of the unique person in each folder. Now use the vision categorical cnn.

Regards Conwyn

1 Like

Hi VLavorini here is a link to the cousin classifer mentioned by @Conwyn Share your work here ✅ - #387 by whatrocks

Cheers mrfabulous1 :smiley: :smiley:

Hi Guys,
Thank you for your replies, but I was thinking about something more generic: that model can discern only between the limited number of people you choose at the start.

I believe I have to go the unsupervised way, i.e. clustering together similar faces, and then assign names to those clusters.

I keep search.

Thank you so much!

If you’re on the lookout for up-to-date face recognition algorithms beyond the earlier DeepFace, there’s been quite an evolution in this tech landscape. Consider exploring recent advancements like FaceCheck ID, which offers enhanced capabilities in accurately identifying faces within images and associating them with specific individuals.

1 Like

THX, for reviving this thread. Are there a specific tools to recognize emotions of a person in the picture? I must check myself if am I a proper type of tourists before make a plan to visit some regions :wink: Do you know something about azure’s face id? What it can? I know that, the OpenCV has some pretrained functions in the field of the face recognition, code:

import cv2
import numpy as np

# Load a pre-trained face and eye classifier
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_eye.xml')

# Load an img
img = cv2.imread('path_to_file.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# Define the expected eye colour of the example person 'XYZ'
expected_eye_color = [b_value, g_value, r_value]  # Replace with BGR values of the person 'XYZ'

# Detect faces in the image
faces = face_cascade.detectMultiScale(gray, 1.3, 5)

person_recognized = False

for (x, y, w, h) in faces:
    roi_gray = gray[y:y+h, x:x+w]
    roi_color = img[y:y+h, x:x+w]

    # Detect eyes within the face area
    eyes = eye_cascade.detectMultiScale(roi_gray)
    for (ex, ey, ew, eh) in eyes:
        eye_roi = roi_color[ey: ey + eh, ex: ex + ew]

        # Calculate the average color of the eye
        average_color = np.average(np.average(eye_roi, axis=0), axis=0)

        # Check if the color matces the expected colour
        if np.allclose(average_color, expected_eye_color, atol=30):  # Adjust tolerance as needed
            person_recognized = True
            cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 2)
            cv2.putText(img, "Person XYZ recognized", (x, y-10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0,255,0), 2)
            break

    if person_recognized:
        break

if not person_recognized:
    cv2.putText(img, "Person not recognized", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 2)

# Shw the result
cv2.imshow('Person Identification', img)
cv2.waitKey(0)
cv2.destroyAllWindows()#free a momery from grids make with 'for' loops :)

Regards :slight_smile:

Your discussion on face recognition is intriguing! It’s amazing how technology is evolving to recognize faces accurately. I believe it can be a game-changer in various fields like security and personalization. Regarding the question about implementing it in a web app, it sounds like an exciting challenge! Integrating face recognition into online platforms could enhance user experience and security measures. However, it’s essential to consider privacy concerns and ensure ethical use. What do you all think? Let’s brainstorm ideas! By the way, if you’re interested, check out www.idanalyzer.com for some cool insights on identity verification.

Face recognition technology indeed offers a wide range of benefits, but it’s essential to be aware of the associated risks as well. If you’re interested in learning more about the key risks and benefits of face recognition technology, I recommend checking out this informative article: Key Risks and Benefits of Face Recognition Technology. It provides valuable insights that can help you make informed decisions about implementing such technology.