Mask detection and alert system
This was a fun and timely project born during the pandemic. One day I saw a sign in my apartment building that read: βMandatory use of masks in all areasβ, and I found myself wondering: βBut how would anyone actually check?β
With a Raspberry Pi equipped with a camera sitting idle, I built an end-to-end system to monitor mask usage in real time. If someone was detected without a mask, the system would automatically send a WhatsApp alert.
The pipeline included:
- πΌοΈ Building a small custom dataset of masked and unmasked faces
- π₯ Using a Raspberry Pi camera as a real-time video stream source
- π§βπ¬ Running face detection to crop and extract face regions from each frame
- π§ Training a CNN to classify mask usage
- βοΈ Deploying the model to a cloud server with FastAPI for inference
- π² Integrating WhatsApp notifications via Twilio
It was a lighthearted side project during uncertain times, and a great opportunity to work with hardware, computer vision, and real-time systems.
π§© Features
- π§ Real-time face detection and mask classification
- π· Raspberry Pi as a low-cost edge device
- βοΈ Cloud-hosted inference API for efficient processing
- π WhatsApp notifications for non-compliance alerts
- π§ͺ Custom training pipeline with CNN model
π‘ Technologies used
- OpenCV β Face detection and image processing
- TensorFlow / Keras β CNN training for mask detection
- FastAPI β Lightweight inference API
- Raspberry Pi β Real-time video streaming hardware
- Twilio API β WhatsApp messaging integration
- Docker β Reproducible environment for running the server
- Python β Core backend and data flow orchestration
π Resources
π Github repo