تفاصيل العمل

# Face Mask Detection with Deep Learning and Real-Time Video Inference

## This project presents a robust deep learning pipeline for real-time face mask detection, combining computer vision techniques with transfer learning. The system is capable of detecting faces from live webcam feeds and classifying them as either "With Mask" or "Without Mask", with confidence scores displayed on-screen.

## The model is trained on a well-balanced and augmented dataset containing over 12,000 labeled images. It uses InceptionResNetV2 as a powerful feature extractor, followed by custom dense layers for final classification. Comprehensive data augmentation strategies were applied to enhance the model’s generalization and reduce overfitting.

## Evaluation Results

### The model was evaluated on three levels:

#### Training Set Accuracy: 98.66%

#### Validation Set Accuracy: 98.12%

#### Real-World Test Set Accuracy (Friends Dataset): 83.33%

#### The test set consisted of real, non-curated photos of people, captured in uncontrolled environments. Despite a drop in performance compared to the training/validation sets, the model demonstrated solid generalization capabilities — especially when facing variations in lighting, facial orientation, and background clutter.

## Classification Report on Real-World Test Set

### On 18 real-world test images:

### For faces with masks, the model achieved a precision of 0.50, a recall of 0.67, and an F1-score of 0.57.

### For faces without masks, the model had a precision of 0.50, a recall of 0.33, and an F1-score of 0.40.

### The overall classification accuracy across the dataset was 50%.

### These results emphasize the importance of incorporating more real-world data in future training to improve robustness and reliability.

## System Highlights

### Real-time face detection using OpenCV’s DNN-based SSD face detector

### Live classification with prediction labels and confidence percentages

### Clean and interactive visualization tools for training curves and evaluation metrics

### Scripts to generate confusion matrices, classification reports, and visual test predictions

## Use Cases

### Smart surveillance systems in public places and transportation

### Health compliance monitoring in hospitals and businesses

### Educational projects demonstrating the integration of deep learning and computer vision

### COVID-19 awareness and safety applications