Skip to content

Repository files navigation

Safety Vision β€” Real-Time Face Mask Detection

An interactive technical presentation for an industrial-grade face mask detection system, built with YuNet face detection and MobileNetV2 classification.

Deploy to GitHub Pages Live Demo Detection Code

🐍 Looking for the actual detection system? The Python source code (OpenCV + TensorFlow) lives at
github.com/rebeeh/Face-Mask-Detection-Python


🎯 Overview

This repository is an interactive slideshow (React/Vite SPA) that documents the architecture, data pipeline, and performance analytics of a production-grade real-time face mask detection system.

Key system metrics:

Metric Value
Precision 98.2%
Recall 97.5%
F1 Score 0.978
Inference Latency 22ms
mAP@.5 0.962

πŸ—οΈ System Architecture

The underlying ML system uses a two-stage pipeline:

Camera Frame
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  YuNet Face Detector (ONNX) β”‚  ~5ms / face
β”‚  Score threshold: 0.60      β”‚
β”‚  NMS threshold: 0.30        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚  Face ROI crops
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Preprocessing Pipeline                   β”‚
β”‚  1. BGR β†’ RGB color conversion            β”‚
β”‚  2. Aspect-ratio-preserving square pad    β”‚
β”‚  3. Resize to 224Γ—224 + MobileNet norm   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚  Normalized tensor
             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MobileNetV2 Classifier (TFLite FP16)    β”‚
β”‚  Binary: With Mask / No Mask             β”‚
β”‚  Quantized: 3.4MB β†’ 1.8MB (47% savings) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Threading model: Camera I/O runs in a dedicated thread with a threading.Lock mutex, decoupling frame capture from inference to sustain 30+ FPS with 0ms input lag.


πŸ“Š Dataset

  • Base images: 3,833 (1,916 masked / 1,917 unmasked) β€” near-perfect class balance
  • Augmentations: Rotation, brightness, blur, zoom
  • Training: 8 epochs Β· Binary Cross-Entropy Β· Adam optimizer
  • Validation accuracy at epoch 8: 97.8%

πŸ–₯️ Presentation Tech Stack

Technology Purpose
React 19 + TypeScript UI framework
Vite 7 Build tool & dev server
TailwindCSS v4 Utility-first styling
Framer Motion Slide & element animations
Recharts Training analytics charts
Lucide React Icon system

πŸš€ Quick Start

Prerequisites

  • Node.js β‰₯ 18
  • npm β‰₯ 9

Local Development

# 1. Clone the repository
git clone https://github.com/rebeeh/Face-Mask-Detection-Overview.git
cd Face-Mask-Detection-Overview

# 2. Install dependencies
npm install

# 3. Start the dev server
npm run dev

Open http://localhost:5173 in your browser.

Build for Production

npm run build

The output is written to ./dist/.

Preview Production Build

npm run preview

πŸ“ Project Structure

src/
β”œβ”€β”€ types/
β”‚   └── index.ts              # Shared TypeScript interfaces
β”œβ”€β”€ data/
β”‚   └── constants.ts          # Chart data & code snippet constants
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   β”œβ”€β”€ GlassCard.tsx     # Reusable frosted-glass card
β”‚   β”‚   β”œβ”€β”€ CodeBlock.tsx     # Syntax-highlighted code display
β”‚   β”‚   └── SlideContainer.tsx# Animated slide wrapper
β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”œβ”€β”€ ProgressBar.tsx   # Top progress indicator
β”‚   β”‚   β”œβ”€β”€ SideNav.tsx       # Left dot-navigation
β”‚   β”‚   └── NavControls.tsx   # Bottom prev/next navigation
β”‚   └── slides/
β”‚       β”œβ”€β”€ HeroSlide.tsx
β”‚       β”œβ”€β”€ DataSlide.tsx
β”‚       β”œβ”€β”€ StackSlide.tsx
β”‚       β”œβ”€β”€ PreprocessingSlide.tsx
β”‚       β”œβ”€β”€ YuNetSlide.tsx
β”‚       β”œβ”€β”€ AnalyticsSlide.tsx
β”‚       β”œβ”€β”€ MobileNetSlide.tsx
β”‚       β”œβ”€β”€ ThreadingSlide.tsx
β”‚       β”œβ”€β”€ OptimizationSlide.tsx
β”‚       └── ConclusionSlide.tsx
└── App.tsx                   # Root orchestrator (~90 lines)

⌨️ Navigation

Action Control
Next slide β†’ Arrow / Space
Previous slide ← Arrow
Jump to slide Click the left sidebar dot

🌐 Deployment

This project is automatically deployed to GitHub Pages on every push to main via the workflow at .github/workflows/deploy.yaml.

Live URL: https://rebeeh.github.io/Face-Mask-Detection-Overview/

To deploy your own fork:

  1. Fork this repository
  2. Go to Settings β†’ Pages β†’ Source and select GitHub Actions
  3. Push any change to main β€” the workflow handles the rest

πŸ“„ License

MIT β€” see LICENSE for details.

About

An interactive technical presentation for an industrial-grade face mask detection system, built with YuNet face detection and MobileNetV2 classification.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages