Face recognition for edge applications

Build a face recognition app with AI edge computing

Lightweight face recognition

Detect and identify multiple faces directly from your browser or use the Abraia Vision SDK to develop your custom application. Simply take a picture and label the people you want to recognize and test the face recognition solution. Ready to deploy on your edge hardware using the onnxruntime.

Recognize faces directly on your hardware avoiding privacy concerns.

deeplab face recognition

How to build a face recognition application

In this tutorial, we'll show you how easy is identifying people on image or video with the Abraia Vision SDK. Just follow these simple steps:

1. Install the Abraia Python SDK

You can install the package on Windows, Mac, and Linux:

python -m pip install -U abraia

2. Load and run the face recognition model

Import the FaceRecognizer class from abraia inference. Then use "load_image" and run the model to detect every face in the image. Build the index with a portrait image of every person you want to identify in the image. Finally, identify people on the image using the previously generated search index, and use "render_results" to show the results on the image.

import os

from abraia.inference import FaceRecognizer
from abraia.utils import load_image, save_image, render_results

img = load_image('images/rolling-stones.jpg')
out = img.copy()

recognition = FaceRecognizer()
results = recognition.represent_faces(img)

index = []
for src in ['mick-jagger.jpg', 'keith-richards.jpg', 'ronnie-wood.jpg', 'charlie-watts.jpg']:
    img = load_image(f"images/{src}")
    rslt = recognition.represent_faces(img)[0]
    index.append({'name': os.path.splitext(src)[0], 'embeddings': rslt['embeddings']})

results = recognition.identify_faces(results, index)
render_results(out, results)
save_image(out, 'images/rolling-stones-identified.jpg')
rolling stones members identified

3. Run the face recognition model on video

Import the class "Video" to create a video object to iterate on the frames. Input the path for a video file or "Video(0)" to use your webcam. So, you can directly run the model directly on your camera stream, and show the results using the "show" method from video.

from abraia.utils import Video

video = Video(0)
for frame in video:
    results = recognition.represent_faces(frame)
    results = recognition.identify_faces(results, index)
    frame = render_results(frame, results)
    video.show(frame)

Congratulations! You have successfully run the face recognition model on a video. This tutorial provides a basic overview, and you can further explore advanced features, optimize your model, and fine-tune parameters based on your specific use case.


Contact Us