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 👨💻
Clone this repository
git clone https://github.com/EscVM/Edge_TPU_Face_Mask_DetectionInstall 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.
python3 main.pyInstead, if you want a mini server version, run the following command:
python3 main_server.pyOnce started, search on your browser localhost:8080. Login with the username and password 'admin'/'admin' (what👀?).
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.
