This blog post will detail how Boundary Devices created its Facemask Detection app for the i.MX 8M Plus-based Nitrogen8MP and its NPU! It was done as part of our i.MX 8M Plus Machine Learning webinar which you can see here:
Facemask Detection app details
History
We decided to create a demo leveraging the i.MX 8M Plus NPU when COVID was spreading worldwide. So it became obvious that an application detecting whether or not a person is wearing a mask was a great example. Not only does it show how machine learning can be used to track and recognize a face, a model can be created to learn if the detected face has a specific attribute, like a mask.
Hardware setup
For this demo, we used our Nitrogen8M Plus Evaluation Kit Bundle which includes:
Software details
Overall architecture
After some investigation, we decided to use the following:
- OS: Android 10 (BSP 2.5.0)
- Inference Engine: TensorFlow Lite
- Using existing example to build demo
- Customized model for face mask detection
Leveraging existing projects
This application was possible thanks to several other projects: Credit: Esteban Uri (Medium article)
- Dataset from Prajna Bhandary
- Cleverly generated “with mask” images
- github.com/prajnasb/observations
- 1st model generation from Adrian Rosebrock
- Android app created by Esteban Uri
- Real time face mask detection in Android
- Adaptation to TensorFlow Lite (float32)
- Boundary Devices additions!
- Quantized model (int8) to run on NPU
- Allow landscape mode
Demo
Here is a snippet of our webinar showing the Facemask Detection app which can be downloaded here.