← Home← Back to Projects

Face Mask Detection System

Face Mask Detection System

Project Description: This project is a real-time computer vision application that detects whether a person is wearing a face mask using a Convolutional Neural Network (CNN) and live webcam input. The system performs face detection, mask classification, and displays real-time analytics through an interactive Streamlit dashboard. The project is configured with two remotes: GitHub (origin) and Hugging Face (hf). Code pushed to the Hugging Face remote is automatically deployed on Hugging Face Spaces. The GitHub repository contains two branches: main and raghav. The main branch includes the full project with the trained 121 MB model, which is packaged inside a Docker container and deployed on Railway. The raghav branch is configured for deployment on Streamlit Cloud. The trained model (face_mask_detector.h5) is not stored in the repository due to GitHub file size limits and is downloaded during runtime from g-drive. Due to browser WebRTC restrictions in some cloud environments, the webcam stream closes automatically when webcam is turned on. However, the application runs completely as intended when executed locally. We can observe that detection counts are in hundreds whereas there are only two people in frame, this is actually expected behavior not a bug. Te analytics logic is counting frames, not the people. So this number depends on FPS and duration of video. We can solve this implementing tracking logic like DeepSort/ByteTrack. These trackers assign IDs to people, so each person is counted once.

PythonCNNOpenCVTensorFlowHaar Cascade Face DetectionStreamlitstreamlit-webrtcNumPyPandasDockerRailwayHugging Face Spaces
Live DemoLive DemoLive DemoGitHub Repo