FMDz is a deep learning-based image classification system that detects whether a person in an image is wearing a face mask or not. It uses a Convolutional Neural Network (CNN) trained on labeled face images..
- Binary classification: With Mask vs Without Mask
- CNN-based model built with TensorFlow / Keras
- Real-time image prediction via input path
- Training accuracy and loss visualization
- Trained on ~7,500+ images
The dataset is sourced from Kaggle (omkargurav/face-mask-dataset) and contains two classes:
| Class | Label | Count |
|---|---|---|
| With Mask | 1 | 3,725 |
| Without Mask | 0 | 3,828 |
Images are resized to 128×128 pixels and normalized to the [0, 1] range.
Input: (128, 128, 3)
│
├── Conv2D(32, 3×3, ReLU)
├── MaxPooling2D(2×2)
├── Conv2D(64, 3×3, ReLU)
├── MaxPooling2D(2×2)
├── Flatten
├── Dense(128, ReLU) + Dropout(0.5)
├── Dense(64, ReLU) + Dropout(0.5)
└── Dense(2, Sigmoid) → Output
- Optimizer: Adam
- Loss: Sparse Categorical Crossentropy
- Metric: Accuracy
- Epochs: 10
- Validation Split: 10%
numpy
matplotlib
opencv-python
Pillow
scikit-learn
tensorflow
kaggle
git clone https://github.com/your-username/FMDz.git
cd FMDzpip install numpy matplotlib opencv-python pillow scikit-learn tensorflow kagglePlace your kaggle.json credentials file in ~/.kaggle/ and set permissions:
mkdir -p ~/.kaggle
cp kaggle.json ~/.kaggle/
chmod 600 ~/.kaggle/kaggle.jsonkaggle datasets download -d omkargurav/face-mask-dataset
unzip face-mask-dataset.zipOpen Face_Mask_Detection.ipynb in Google Colab or Jupyter and run all cells.
After training, use the predictive system cell to test on a new image:
Path of the image to be predicted: /path/to/image.jpgOutput:
The person in the image is wearing a mask.The person in the image is not wearing a mask.
Training plots are generated for:
- Loss — Training vs Validation
- Accuracy — Training vs Validation
FMDz/
├── Face_Mask_Detection.ipynb # Main notebook
├── kaggle.json # Kaggle API credentials (not committed)
├── data/
│ ├── with_mask/ # Mask images
│ └── without_mask/ # No-mask images
└── README.md
This project is open-source and available under the MIT License.
- Dataset by Omkar Gurav on Kaggle
- Built with TensorFlow & Keras