Giter Club home page Giter Club logo

qengineering / tensorflow_lite_face_mask_rpi_64-bits Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 2.0 23.7 MB

Face mask detection on a bare Raspberry Pi 4 wit 32 or 64-bit OS

Home Page: https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-64-os.html

License: BSD 3-Clause "New" or "Revised" License

C++ 100.00%
face-mask face-mask-detection aarch64 tensorflow-lite raspberry-pi-4 tensorflow-examples high-fps armv8 ubuntu1804 ubuntu2004

tensorflow_lite_face_mask_rpi_64-bits's Introduction

output image Find this example on our SD-image

TensorFlow_Lite_Face_Mask_RPi_64-bits

output image

TensorFlow Lite Face Mask detection running on a bare Raspberry Pi 4.

License

A fast C++ implementation of TensorFlow Lite Face Mask detector on a bare Raspberry Pi 4 with a 32 or 64-bit operating system. Ubuntu 18.04, or Ubuntu20.04 are also possible.
Once overclocked to 1900 MHz, your app runs at 8.3 FPS without any hardware accelerator.

You could call this Face Mask detection 2.0.
The network used is a re-trained MobileNet V2 SSD. It has three classes: no maks, a mask, and wearing a mask incorrectly. Although the latter category is not very convincing, given the small size of training samples.
It's not the usual cascade of the two deep learning models, one face recognition and a second one that detects the masks.
This one model now recognizes not only the white masks, but also the black, colored and fancy masks.
Although it can detect more faces/masks in the same scene, the best result is still one face in front of the camera.

Update 8-29-2022.

  • Added GPIO outputs.

Benchmark.

Model RPi 4 64os 1900 MHz RPi 4 64os 1500 MHz
ssd_mobilenet_v2.tflite 8.1 FPS 7.5 FPS
ssd_mobilenet_v2_fpnlite.tflite 6.3 FPS 5.8 FPS

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


Dependencies.

To run the application, you have to:


Running the app.

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

Your MyDir folder must now look like this:
Face_Mask_Video.mp4
ssd_mobilenet_v2_fpnlite.tflite - more accurate
ssd_mobilenet_v2.tflite - somewhat faster
TestTensorFlow_Lite_Mask.cpb
FaceMask.cpp
Kapje_x.jpg - examples

Run TestTensorFlow_Lite.cpb with Code::Blocks.


WebCam.

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


Thanks.

https://www.kaggle.com/andrewmvd/face-mask-detection
https://github.com/tanhouren/Face_mask_detector


paypal

output image
output image
output image

tensorflow_lite_face_mask_rpi_64-bits's People

Contributors

qengineering avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tspannhw exadmax

tensorflow_lite_face_mask_rpi_64-bits's Issues

Not working with out monitor/display

I have deployed this program as startup on raspberry PI 4 and is working fine with display connected - Monitor., But doesn't work with out display. Need help how to make it work. The face mask detection is indicated using a LED.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.