face-mask-detection-system

😷 Face Mask Detection System

Python TensorFlow OpenCV Streamlit Status

A deep learning-based Face Mask Detection System that identifies whether a person is wearing a mask or not using image input and real-time webcam.

Built using MobileNetV2 (Transfer Learning) and OpenCV DNN face detection.


🚀 Features


🎥 Demo

🟢 With Mask Detection

With Mask

🔴 Without Mask Detection

No Mask

🌐 Streamlit Web App Interface

UI


🛠️ Tech Stack


📂 Project Structure

```bash id=”p4u2hk” face-mask-detection-system/ │── app.py │── detect_realtime.py │── train_model.py │── requirements.txt │── README.md │── mask_detector.h5 │── deploy.prototxt │── res10_300x300_ssd_iter_140000.caffemodel │── screenshots/ │── .gitignore │── LICENSE


---

## 📊 Model Performance

* Training Accuracy: ~94%
* Validation Accuracy: ~96%

---

## 📁 Dataset

Dataset used: **Face Mask Detection Dataset (Kaggle)**

* Total Images: 7553
* Classes:

  * 😷 With Mask
  * ❌ Without Mask

👉 https://www.kaggle.com/datasets/omkargurav/face-mask-dataset

---

## ⚙️ Installation

```bash id="pj0wya"
git clone https://github.com/shanmukha0527/face-mask-detection-system.git
cd face-mask-detection-system
pip install -r requirements.txt

▶️ Usage

🔹 Run Streamlit Web App

```bash id=”czkmbx” streamlit run app.py


Upload image → get prediction instantly.

---

### 🔹 Run Real-Time Detection

```bash id="24i45z"
python detect_realtime.py

Press Q to exit.


🔹 Train Model (Optional)

bash id="4e4xdt" python train_model.py


⚡ How It Works

  1. Detect face using OpenCV DNN
  2. Extract face region
  3. Resize to 224×224
  4. MobileNetV2 predicts mask / no mask
  5. Display result with bounding box

⚠️ Important Notes


📌 Future Improvements


👨‍💻 Author

Gondrala Shanmukha Akhilesh B.Tech CSE (AI & ML)