AI-powered web application to detect face masks in real-time
The COVID-19 pandemic highlighted the importance of wearing face masks in public places. To automate monitoring and ensure safety, I built a Face Mask Detection System using YOLOv8 for object detection and Flask for deployment. This project detects whether a person is wearing a mask, not wearing a mask, or wearing it incorrectly.
The dataset was sourced from a public GitHub repository and contains images categorized into:
Data was organized into train, val, and test folders in YOLO format.
The model was trained using Ultralytics YOLOv8 with the following configuration:
Training was performed on CPU with data augmentation (rotation, flipping, scaling). Results included mAP@50 = 68.2%.
A Flask web application was built for easy image upload and detection. Users can drag & drop or browse an image, and the app displays predictions with bounding boxes.
face-mask-detection-starter/ │── app/ │ │── app.py │ │── templates/index.html │ │── static/preds/ │ │── uploads/ │── configs/data.yaml │── requirements.txt │── README.md
The system successfully detects whether people are wearing masks in uploaded images. Below is an example: