This is a deep learning-based Face Mask Detector built using Convolutional Neural Networks (CNN) in TensorFlow/Keras.
It classifies whether a person is wearing a mask or not using image data.
Trained on over 7,500 images with GPU acceleration using Google Colab, this model achieved 93.9% validation accuracy.
- β
with_mask/
β 3,725 images - β
without_mask/
β 3,828 images - Total: 7,553 images
- Format:
.jpg
images with two class folders
- Custom CNN with:
- 3 Convolutional Layers
- Batch Normalization
- Max Pooling
- Dropout Regularization
- Optimizer: Adam
- Loss Function: Categorical Crossentropy
- Accuracy Achieved: 93.9% on validation set
- Model File:
high_accuracy_mask_detector.h5
- Data Augmentation with ImageDataGenerator
- Train/Test Split using Scikit-Learn
- EarlyStopping to prevent overfitting
- Normalized input data
- One-hot label encoding
- Visualized training/validation accuracy
- Exported trained model for deployment
Final Training Result (93.9% Validation Accuracy)
- TensorFlow / Keras
- OpenCV
- NumPy
- Matplotlib
- Scikit-learn
- Clone the repository
- Load the dataset with
with_mask/
andwithout_mask/
folders - Run the notebook:
face_mask_detector.ipynb
in Google Colab - Trained model will be saved as
high_accuracy_mask_detector.h5
- You can deploy it using:
- Streamlit (web app)
- OpenCV (real-time webcam detection)
- Flask/Gradio (REST API or interface)
- Real-time detection with webcam
- Deploy on Streamlit or Hugging Face Spaces
- Convert model to TFLite for mobile apps
- Integrate into security systems or thermal cameras
Muhammad Rayan Shahid
Founder of ByteBrilliance AI
πΌ Future AI Engineer | π΅π° Pakistan | π§ AI Enthusiast
#DeepLearning
#CNN
#FaceMaskDetection
#AI
#TensorFlow
#Keras
#ComputerVision
#ByteBrillianceAI