~ Face Mask Detection with Edge TPU ~
Face mask detection on Edge TPU at more than 50 fps. The code is very straightforward: there's a network trained to recognize faces in an image and another one that detects the presence of the mask. The first network can be found here, and the second one has been trained with this little dataset (A Colab notebook is provided to train a new classifier on top of a different backbone). Everything is optimized for Edge TPU inference, but it's possible to run all the code on a CPU changing configurations. Only opencv-python and the TensorFlow-Lite interpreter are needed. As it's possible to see in the example below, it runs around 50 fps with a couple of faces with less than 3W! Enjoy 👨💻
1.0 Getting Started
Clone this repository
git clone https://github.com/EscVM/Edge_TPU_Face_Mask_Detection
1.1 Installations for the hosting device
Install on the hosting device the following libraries:
- opencv-python
- numpy
- Flask (Optional)
- TensorFlow Lite Interpreter If you're using the Coral USB Accelerator with the Raspberry download ARM32.
2.0 Run Face Mask Detector
python3 main.py
Instead, if you want a mini server version, run the following command:
python3 main_server.py
Once started, search on your browser localhost:8080. Login with the username and password 'admin'/'admin' (what👀?).
3.0 Train and Optimize a New Mask Detector
With the following notebook you can easily train a new classifier on top of whitchever backbone found here(almost).
Once trained and converted you can place it in the models folder. Rember to change paths in the detector module.