Face Recognition
The demo can be used to register and recognize a face of a person on edge device with ShunyaFace APIs.

Source
What will you need?
- Raspberry Pi 3/4 (or any variant of these)
- micro-SD card and micro-SD card Reader/Adapter.
- USB Camera
- Laptop
Steps
Make your own Face-Recognition Application following these steps.
- Install Shunya OS
- Write Code
- Connect Camera to Hardware
- Compile and Run
Step 1: Install Shunya OS
Shunya Face is built on top of Shunya OS and comes pre-installed with Shunya Face package. Shunya OS is an linux-based OS that runs on your hardware, it light-weight and configurable.
Install Etcher
Etcher allows you to Flash Shunya OS on the micro-SD card.
- Windows
- Ubuntu
For Ubuntu 16.04
Installing Etcher is Simple, just run few commands in the terminal
- Download balenaEtcher for Linux 64bit (depends on your system).
- Extract the zip file
- Open terminal in the same location where the file is extracted and run this command
It will open Etcher window in front of you
Flash Shunya OS
- Download Shunya OS
- Right click on the downloaded zip file.
- Click Extract here.
- Open Etcher (with the comment give above)
- Click Select Image.
- You will find the Shunya OS
.img
file in the folder that we had extracted earlier. - Select
shunya-aaaa-image-xxxx.img
file. - Insert SD card.
- Click on Flash.

This will load the micro-SD card with Shunya OS.
Booting Up with Shunya OS
- Insert the micro-SD card into the board.
- Connect peripherals like Keyboard, Mouse and HDMI monitor.
- Connect Power Supply.
The board should boot up with Shunya OS.
Login to Shunya
Login with these credentials:
- Username : shunya
- Password : shunya
Step 2: Lets code!
Open up your editor on Shunya OS and lets start coding.
Our application must be able to
- Capture a face from camera feed
- Detect Face from the frame
- Get Embeddings of a detected Face
- Store Embeddings in the database
- Take different frame of same person and recognize the face
- Display Recognized Person name in the terminal
Basic structure of Shunya Face
Use the basic structure as a reference and Paste code into the structure as per your app logic.
- CPP
Lets read frame with opencv
- CPP
API to detect faces from the given frame
- CPP
API to align the detected face
- CPP
API to get embeddings for aligned face
- CPP
API to store the face embeddings with the person name in database
- CPP
API to find the person name from his face embeddings
- CPP
Summary
Your Code should look something like this.
- CPP
Step 3: Connect USB camera to RPI

Step 4: Compile and Run
Compile and Run
- Clone code from the repository
Compile the program. Run following commands.
This will build the program and make it into a binary executable.
Now Lets run it.
You will see "Face Recognized: YourName" if your face embeddings are in database, else it will say "No face recognized".
Want to Build your own Application?
Click on the Next button, below.