How kishan-shr/computer-vision-based-facemask-detection-with-alert-system works
Project Type and Purpose
• This is a standalone, real-time computer vision application (an open-source tool) whose purpose is to detect whether people are wearing face masks in live video or static images and to trigger an audio alert if a violation is detected.
High-Level Component Identification
a. Video/Image Input
• Webcam (live capture) or static images/videos from disk
b. Face Detection Module
• OpenCV DNN using Caffe model (deploy.prototxt + res10_300x300_ssd_iter_140000.caffemodel)
c. Mask Classification Module
• TensorFlow/Keras model (fmd_model.h5)
d. Alert System
• Audio files in Alarm/ or root directory (WAV/MP3) played via Pygame or simple audio playback library
e. User Interface / Control Scripts
• detect_mask_live.ipynb or detect_mask.py / detect_mask_video.py
• login.py (optional UI/log-in workflow)
f. Supporting Assets
• Test frames in Test/, example images in Images/
• requirements.txt for environment setup
Component Interactions & Data Flow
1. The system initializes by loading the face detector model and the mask classifier model.
2. Video Capture continuously grabs frames.
4. For each detected face, crop & preprocess → Mask Classification Module → outputs “Mask” or “No Mask” probability.
5. Decision logic:
– If “No Mask” exceeds threshold → invoke Alert System (play sound).
6. Annotated frame in UI window.
7. Optionally, log events or save snapshots in Test/.
Architectural Patterns & Design Principles
• Pipeline pattern: clear stages (Capture → Detect → Classify → Alert → Display)
• Modular separation: each stage is its own Python module/script
• Single-process, event-driven loop for real-time performance
• Extensibility: swap face detector models or mask classifier models without touching alert code
Technologies & Frameworks
• Python 3.8+
• OpenCV for video I/O and DNN face detection
• TensorFlow/Keras for mask classification
• Pygame or native audio library for alert playback
• NumPy, imutils, customtkinter or tkinter for UI controls
• Caffe model files for face detection