How b23mt1033/real-time-facemask-detection works
This repository implements real-time face-mask detection for webcam frames and still images. The interactive workflow selects an input and model mode, detects faces (or uses YOLO directly), classifies mask status, and displays annotated results. ResNet and YOLO inference can also contribute to an ensemble. The available excerpts establish several dispatch and inference relationships; some frame-processing details are omitted, so those links are not inferred.
Main entry points: realtime.py Interactive Menu · deploy.prototxt Caffe Detector Config · res10_300x300_ssd_iter_140000.caffemodel Caffe Detector Weights · yolo_v8.pt YOLO Model
Components 17
Input and Runtime
- Interactive Menu
realtime.py - Image Input
realtime.py - Webcam Loop
realtime.py - Frame Mode Router
realtime.py - Result Display
realtime.py
Face Detection
- Caffe Frame Processing
realtime.py - Face Detector
realtime.py - YOLO Frame Processing
realtime.py
Mask Classification
- ResNet Prediction
realtime.py - Ensemble Voting
realtime.py
Model Assets
- Caffe Detector Config
deploy.prototxt - Caffe Detector Weights
res10_300x300_ssd_iter_140000.caffemodel - YOLO Model
yolo_v8.pt - ResNet-18 Weights
saved_models/model_resnet18_state_dict.pth - ResNet-50 Weights
saved_models/model_resnet50_state_dict.pth
Other components
- User
- Webcam
Connections 18
- User → Interactive Menu: selects mode
realtime.py - Interactive Menu → Webcam Loop: starts webcam
realtime.py - Webcam → Webcam Loop: supplies frames
realtime.py - Interactive Menu → Image Input: selects image
realtime.py - Image Input → Frame Mode Router: dispatches image
realtime.py - Webcam Loop → Frame Mode Router: dispatches frames
realtime.py - Frame Mode Router → YOLO Frame Processing: selects YOLO mode
realtime.py - Frame Mode Router → Caffe Frame Processing: selects other modes
realtime.py - Caffe Frame Processing → Face Detector: runs detection
realtime.py - Face Detector → Caffe Detector Config: loads config
realtime.py - Face Detector → Caffe Detector Weights: loads weights
realtime.py - YOLO Frame Processing → YOLO Model: runs inference
realtime.py - ResNet Prediction → ResNet-18 Weights: loads when selected
realtime.py - ResNet Prediction → ResNet-50 Weights: loads when selected
realtime.py - Ensemble Voting → ResNet Prediction: collects predictions
realtime.py - Ensemble Voting → YOLO Frame Processing: uses YOLO prediction
realtime.py - Interactive Menu → Result Display: shows image result
realtime.py - Webcam Loop → Result Display: displays frames
realtime.py