Deep Learning · 2026
Face Mask Detection
Real-time mask detection with PyTorch, MobileNetV2 transfer learning and OpenCV, webcam inference and a modular pipeline.
Model
- MobileNetV2 backbone (ImageNet weights) with a new classification head
- Two classes: mask / no-mask
- OpenCV face crop → resize → normalize → classify
Dataset
Face mask dataset (with/without mask images) plus live webcam frames at inference.
Results & metrics
- Accuracy
- ~0.98
- Inference
- real-time webcam
- Backbone
- MobileNetV2
Deployment steps
- 1Fine-tune MobileNetV2 on the mask dataset
- 2Serialize the best checkpoint
- 3Run the OpenCV webcam loop: detect faces, crop, classify per frame
- 4Modular pipeline lets the classifier swap into other video sources
Tech stack
- PyTorch
- MobileNetV2
- OpenCV