All Projects → Qengineering → Face-Recognition-Raspberry-Pi-64-bits

Qengineering / Face-Recognition-Raspberry-Pi-64-bits

Licence: BSD-3-Clause license
Recognize 2000+ faces on your Raspberry Pi 4 with database auto-fill and anti-spoofing

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to Face-Recognition-Raspberry-Pi-64-bits

Face-Recognition-Jetson-Nano
Recognize 2000+ faces on your Jetson Nano with database auto-fill and anti-spoofing
Stars: ✭ 63 (+31.25%)
Mutual labels:  face-recognition, face-detection, ncnn, mtcnn-face-detection, arcface, blur-filter, anti-spoofing, retinaface
Insightface
State-of-the-art 2D and 3D Face Analysis Project
Stars: ✭ 10,886 (+22579.17%)
Mutual labels:  face-recognition, face-detection, arcface, retinaface
TensorFlow Lite SSD RPi 64-bits
TensorFlow Lite SSD on bare Raspberry Pi 4 with 64-bit OS at 24 FPS
Stars: ✭ 25 (-47.92%)
Mutual labels:  aarch64, armv8, raspberry-pi-4, high-fps
lite.ai.toolkit
🛠 A lite C++ toolkit of awesome AI models with ONNXRuntime, NCNN, MNN and TNN. YOLOX, YOLOP, MODNet, YOLOR, NanoDet, YOLOX, SCRFD, YOLOX . MNN, NCNN, TNN, ONNXRuntime, CPU/GPU.
Stars: ✭ 1,354 (+2720.83%)
Mutual labels:  face-recognition, face-detection, ncnn, retinaface
FaceRecognitionCpp
Large input size REAL-TIME Face Detector on Cpp. It can also support face verification using MobileFaceNet+Arcface with real-time inference. 480P Over 30FPS on CPU
Stars: ✭ 40 (-16.67%)
Mutual labels:  face-recognition, face-detection, arcface, retinaface
InsightFace-REST
InsightFace REST API for easy deployment of face recognition services with TensorRT in Docker.
Stars: ✭ 308 (+541.67%)
Mutual labels:  face-recognition, face-detection, arcface, retinaface
TensorFlow-Raspberry-Pi 64-bit
TensorFlow installation wheels for Raspberry Pi 64 OS
Stars: ✭ 27 (-43.75%)
Mutual labels:  aarch64, armv8, raspberry-pi-4
YoloV3-ncnn-Raspberry-Pi-4
MobileNetV2_YOLOV3 for ncnn framework
Stars: ✭ 20 (-58.33%)
Mutual labels:  ncnn, raspberry-pi-4, ncnn-framework
Rust Raspberrypi Os Tutorials
📚 Learn to write an embedded OS in Rust 🦀
Stars: ✭ 7,275 (+15056.25%)
Mutual labels:  aarch64, armv8, raspberry-pi-4
Debian Pi Aarch64
This is the first 64-bit system in the world to support all Raspberry Pi 64-bit hardware!!! (Include: PI400,4B,3B+,3B,3A+,Zero2W)
Stars: ✭ 2,505 (+5118.75%)
Mutual labels:  aarch64, armv8, raspberry-pi-4
retinaface
RetinaFace: Deep Face Detection Library for Python
Stars: ✭ 242 (+404.17%)
Mutual labels:  face-recognition, face-detection, retinaface
Human
Human: 3D Face Detection, Body Pose, Hand & Finger Tracking, Iris Tracking and Age & Gender Prediction
Stars: ✭ 172 (+258.33%)
Mutual labels:  face-recognition, face-detection
Dockerface
Face detection using deep learning.
Stars: ✭ 173 (+260.42%)
Mutual labels:  face-recognition, face-detection
Attendance Using Face
Face-recognition using Siamese network
Stars: ✭ 174 (+262.5%)
Mutual labels:  face-recognition, face-detection
Facepapercollection
A collection of face related papers
Stars: ✭ 241 (+402.08%)
Mutual labels:  face-recognition, face-detection
Ownphotos Frontend
Stars: ✭ 171 (+256.25%)
Mutual labels:  face-recognition, face-detection
Instabotai
Instagram AI bot with face detection. It works without instagram api, need only login and password.
Stars: ✭ 181 (+277.08%)
Mutual labels:  face-recognition, face-detection
Face-Recognition
A Java application for Face Recognition under expressions, occlusions and pose variations.
Stars: ✭ 55 (+14.58%)
Mutual labels:  face-recognition, face-detection
Hms Ml Demo
HMS ML Demo provides an example of integrating Huawei ML Kit service into applications. This example demonstrates how to integrate services provided by ML Kit, such as face detection, text recognition, image segmentation, asr, and tts.
Stars: ✭ 187 (+289.58%)
Mutual labels:  face-recognition, face-detection
Deepstream Project
This is a highly separated deployment project based on Deepstream , including the full range of Yolo and continuously expanding deployment projects such as Ocr.
Stars: ✭ 120 (+150%)
Mutual labels:  face-recognition, arcface

output image Find this example on our SD-image

Recognize 2000+ faces with your Raspberry Pi 4.

output image

A fast face recognition and face recording running on bare a Raspberry Pi 4.

License

This C++ application recognizes a person from a database of more than 2000 faces. It is built for a Raspberry PI 4, but can easily be ported to other platforms.

First, the faces and their landmarks are detected by RetinaFace or MTCNN. Next, the database is scanned with Arcface for the matching face. In the end, Face Anti Spoofing tests whether the person in front of the camera is real and not a mask or a cardboard photo.

If the face is not found in the database, it will be added automatically. A blur filter ensures only sharp faces in the database. One photo per person is sufficient, although more does not hurt.

Special made for a bare Raspberry Pi see Q-engineering deep learning examples


Benchmark.

Model RPi 4 64-OS 1950 MHz RPi 4 64-OS 1500 MHz Jetson Nano 2015 MHz Jetson Nano 1479 MHz
MTCNN 22 mS 25 mS 11 mS 14 mS
RetinaFace 35 mS 37 mS 15 mS 19 mS
ArcFace +36 mS +40 mS +17 mS +21 mS
Spoofing +37 mS +45 mS +25 mS +37 mS

Dependencies.

To run the application, you have to:

  • A raspberry Pi 4 with a 64-bit operating system. It can be the Raspberry 64-bit OS, or Ubuntu 18.04 / 20.04. Install 64-bit OS
  • The Tencent ncnn framework installed. Install ncnn
  • OpenCV 64 bit installed. Install OpenCV 4.5
  • Code::Blocks installed. ($ sudo apt-get install codeblocks)

Installing the app.

To extract and run the application in Code::Blocks
$ mkdir MyDir
$ cd MyDir
$ wget https://github.com/Qengineering/Face-Recognition-Raspberry-Pi-64-bits/archive/refs/heads/main.zip
$ unzip -j main.zip
Remove master.zip and README.md as they are no longer needed.
$ rm master.zip
$ rm README.md

Your MyDir folder must now look like this:
Graham Norton.jpg (example image)
FaceRecognition.cbp (code::blocks project file)
Norton_A.mp4 (movie with faces to load)
Norton_2.mp4 (movie to check)
img (database folder)
models (folder with used ncnn deep learning models)
src (C++ source files)
include (the C++ headers)


Running the app.

To run the application load the project file FaceRecognition.cbp in Code::Blocks.
First, we are going to fill the database with new faces. The database img initial holds one face, Graham.jpg.

output image

Check in main.cpp line 253. It must be cv::VideoCapture cap("Norton_A.mp4");

Compile and run the app. Movie Norton_A.mp4 will be played and new faces are stored in the database. In the end, you have the database filled as below.

output image

Next, alter the name of the movie in line 253 of main.cpp to Norton_2.mpg. Compile and run the application again. You will see that all the faces are correctly recognized. It can still happen that faces are added to the database due to strange angles or grimaces.


CMake.

Instead of Code::Blocks, you can now use CMake to build the application.
Please follow the instructions at #12


Database.

The application can easily contain more than 2000 faces. There are reports that ArcFace works flawlessly with over 5000 faces. With large databases, it is important to keep your face "natural". It means a front view photo with eyes open and mouth closed without a smile or other funny faces.
The database is filled "on the fly", as you have seen above. It is also possible to manually add a face to the databases. To do this, run the application from the command-line and enter the name of the image as an argument. For example ./FaceRecognition "Graham Norton.jpg" Note the quotation marks around the name if it has a space.

You can give the faces a corresponding name. By using a hash, you can associate multiple pictures with the same name.

output image

By the way, note the warp perspective of Graham Norton's face that we added via a command-line argument and the crop of the same photo already saved in the database. This is done by the ArcFace algorithms.

The blur filter prevents vague or imprecise faces from being added to the database. Below you see a few examples of faces we encounter in the database when de blur filter was switched off.

output image

Another safety measure is the orientation of the face. Only faces in front of the camera are added to the database. Faces "in profile" are often inaccurate in large databases.


Code.

The application is written in C ++. The setup is flexible and easy to adapt to your own needs. See it as a skeleton which you can expand yourself. Some hints. In main .cpp at line 21 you see a few defines.

#define RETINA                  //comment if you want to use MtCNN landmark detection instead
#define RECOGNIZE_FACE
#define TEST_LIVING
#define AUTO_FILL_DATABASE
#define BLUR_FILTER_STRANGER
// some diagnostics
#define SHOW_LEGEND
#define SHOW_LANDMARKS

By commenting the line the define is switched off. For instance, if you do not want to incorporate the anti-spoofing test (saves you 37 mS), comment this line. The MtCNN face detection is switched on by turning RETINA off.
Another important point is that only one face is labelled. It is no problem to loop through all faces. However, they are usually too small to be recognized with great accuracy. Besides, your FPS will drop also. Note, the input image for the RetinaFace is 324 x 240 pixels. Larger pictures are resized to that format. ArcFace works with an input of 112 x 112 pixels. If you have a large input format, you could extract the faces at a larger scale from this image, once you have the coordinates from the RetinaFace network. Now, faces are to be recognized with much greater accuracy. Of course, there will be not much of an FPS left.


RaspiCam.

If you want to use a camera please alter line 253 in main.cpp to
cv::VideoCapture cap(0); //RaspiCam
If you want to run a movie please alter line 253 in main.cpp to
cv::VideoCapture cap("Norton_2.mp4"); //Movie


Papers.

MTCNN
RetinaFace
ArcFace
Anti spoofing


Thanks.

https://github.com/Tencent/ncnn
https://github.com/nihui
https://github.com/LicheeX/MTCNN-NCNN
https://github.com/XinghaoChen9/LiveFaceReco_RaspberryPi
https://github.com/deepinsight/insightface
https://github.com/minivision-ai/Silent-Face-Anti-Spoofing
https://github.com/Qengineering/Blur-detection-with-FFT-in-C

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].