An open API service indexing awesome lists of open source software.

https://github.com/qengineering/face-mask-detection-jetson-nano

Face mask detection on a Jetson Nano
https://github.com/qengineering/face-mask-detection-jetson-nano

aarch64 cpp deep-learning face-detection face-mask face-mask-detection face-recognition high-fps jetson-nano ncnn ncnn-framework paddle paddle-lite ssd-model

Last synced: 6 months ago
JSON representation

Face mask detection on a Jetson Nano

Awesome Lists containing this project

README

          

# Face-Mask-Detection-Jetson-Nano
![output image]( https://qengineering.eu/images/FamilyOut.jpg )

## A fast face mask recognition running at 44-5 FPS on a Jetson Nano.
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)


This is a fast C++ implementation of two deep learning models found in the public domain.


The first is face detector of Linzaer running on a ncnn framework.

https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB.


The second is the Paddle Lite mask detection which classifies the found faces.

https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/demo/cxx/mask_detection.


The frame rate depends on the number of detected faces and can be calculated as follows:

FPS = 1.0/(0.022 + 0.008 x #Faces) when overclocked to 2014 MHz.


Paper: https://arxiv.org/abs/1905.00641.pdf

Size: 320x320


Special made for a Jetson Nano see [Q-engineering deep learning examples](https://qengineering.eu/deep-learning-examples-on-raspberry-32-64-os.html)

### New version 2.0.
A new and superior version with only __TensorFlow Lite__ for a Jetson Nano see [GitHub](https://github.com/Qengineering/TensorFlow_Lite_Face_Mask_Jetson-Nano)

## Dependencies.
### April 4 2021: Adapted for ncnn version 20210322 or later
To run the application, you have to:
- The Paddle Lite framework installed. [Install Paddle](https://qengineering.eu/install-paddle-on-jetson-nano.html)

- The Tencent ncnn framework installed. [Install ncnn](https://qengineering.eu/install-ncnn-on-jetson-nano.html)

- Code::Blocks installed. (```$ sudo apt-get install codeblocks```)
## Running the app.
To extract and run the network in Code::Blocks

$ mkdir *MyDir*

$ cd *MyDir*

$ wget https://github.com/Qengineering/Face-Mask-Detection-Jetson-Nano/archive/refs/heads/main.zip

$ unzip -j master.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:

Face_1.jpg

Face_2.jpg

Face_3.jpg

Face_Mask_Video.mp4

mask_detector_opt2.nb

MaskUltra.cpb

mask_ultra.cpp

UltraFace.cpp

UltraFace.hpp

RFB-320.bin

RFB-320.param

slim_320.bin

slim_320.param

### Notes.
The directories in the Code::Blocks project file will probably need to be adapted to the naming convention you are using.

The camera input used is a simple OpenCV webcam. The GStreamer is not used in this example for symplicity reasons.


The RFB-320 model recognizes slightly more faces than slim_320 at the expense of a little bit of speed. It is up to you.

Note that the compilation of the Paddle Lite framework in your application may take a while.


See the Raspberry Pi video at https://youtu.be/LDPXgJv3wAk