Skip to main content
Face Mask Detection System
Computer Vision

Face Mask Detection System — Case Study

Accuracy: 95%+
PythonTensorFlowMobileNetV2OpenCVStreamlit

The Challenge

Manufacturing facilities needed automated mask compliance monitoring on standard CPU hardware. 3-class detection — correctly worn, incorrectly worn, not worn — with high accuracy for each.

💡 The Approach

MobileNetV2 transfer learning for fast CPU inference. 2-phase fine-tuning. Aggressive data augmentation to handle different lighting conditions, angles, and face sizes in real environments.

🔄 Step-by-Step Process

01

Collected dataset with 3 classes: with_mask, without_mask, mask_weared_incorrect

02

Applied data augmentation: horizontal flip, rotation ±15°, zoom 0.1, brightness shifts

03

Phase 1: Trained MobileNetV2 classification head with base frozen — accuracy ~92%

04

Phase 2: Fine-tuned last 20 MobileNetV2 layers — accuracy improved to 95%+

05

Built real-time webcam detection with color-coded bounding boxes per class

06

Added compliance rate tracker showing percentage of correctly masked people in frame

Final Result

95%+ accuracy across all 3 classes. Real-time detection at 15+ FPS on CPU. Color-coded alerts make violations immediately visible. Compliance percentage gives management actionable metrics.

📚 Key Lesson

3-class mask detection is significantly harder than binary. The incorrectly-worn class is visually similar to both other classes, requiring careful augmentation to differentiate reliably.