Skip to content

A robust, real-time Face Mask Detection system built with Python, OpenCV, and TensorFlow. Features automated environment setup, FPS monitoring, and fail-safe execution.

License

Notifications You must be signed in to change notification settings

rebeeh/Face-Mask-Detection-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face Mask Detection System

A high-performance real-time Face Mask Detection system. Built with OpenCV YuNet, MobileNetV2 and a Threaded Architecture.

License Python Architecture

🚀 Key Features

1. High Performance Architecture

  • Threaded Video Capture: Decouples camera I/O from AI processing.
  • Batch Inference: Processes all faces in a frame simultaneously.
  • Dual-Stream: 1280x720 (Display) + 640x360 (Inference).

2. Detection Accuracy

  • RGB Color Space: Correctly handles input channels.
  • Smart Padding: Preserves face aspect ratio.
  • YuNet Detector: Fast and accurate face detection.

3. Clean Glass UI (Spatial Design)

  • Resolution Independent: Elements scale dynamically to 720p, 1080p, or 4K.
  • Modern Aesthetics: Rounded corners, floating floating pills, and semi-transparent dashboards.

📂 Project Structure

├── models/                  # AI Models (Auto-downloaded)
├── src/
│   ├── camera.py            # Threaded Camera Engine
│   ├── config.py            # Central Configuration & Environment
│   ├── detector.py          # YuNet + MobileNetV2 Batch Logic
│   ├── ui.py                # Clean Glass Rendering Engine
│   └── utils.py             # Robust Model Loading
├── setup_env.py             # One-click Setup Script
├── main.py                  # Application Entry Point
└── requirements.txt         # Dependencies

🛠️ Installation

  1. Clone & Install:

    pip install -r requirements.txt
  2. Setup Environment: Automatically downloads SOTA models and sets up directories.

    python setup_env.py

▶️ Usage

Run the main application:

python main.py
  • Q / ESC: Quit the application.

🔧 Troubleshooting

  • "TensorFlow not found": Ensure requirements.txt is installed.
  • "Camera Init Failed": Check if another app is using the webcam.
  • Low FPS: The system is optimized for speed. If slow, check your CPU usage or lower INFERENCE_WIDTH in src/config.py.

Based on the 'chandrikadeb7' reference architecture, enhanced with YuNet and Threaded I/O.

About

A robust, real-time Face Mask Detection system built with Python, OpenCV, and TensorFlow. Features automated environment setup, FPS monitoring, and fail-safe execution.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Languages