Skip to content

olyadboka/face-Mask-Detection-using-CNN

Repository files navigation

Face Mask Detection Model

demo: https://face-mask-detection-using-cnn-1.onrender.com

A deep learning model for detecting whether a person is wearing a face mask or not, built with PyTorch.

The system can:

Classify single images

Process batches of images from a directory

Perform real-time face mask detection using webcam

Detect multiple faces in an image and classify each one

The model achieves high accuracy in distinguishing between "with_mask" and "without_mask" classes.

Model Architecture

The model is a custom convolutional neural network (CNN) with the following architecture:

Feature Extractor

  • ConvBlock 1: 3→32 channels, MaxPool (128×128→64×64)
  • ConvBlock 2: 32→64 channels, MaxPool (64×64→32×32)
  • ConvBlock 3: 64→128 channels, MaxPool (32×32→16×16)
  • ConvBlock 4: 128→256 channels, MaxPool (16×16→8×8)
  • ConvBlock 5: 256→512 channels, MaxPool (8×8→4×4)

Classifier

  • Fully Connected 1: 8192→512 units with Dropout (0.5)
  • Fully Connected 2: 512→2 units (with_mask, without_mask)
face_mask_video.mp4.mp4

Performance

  • Test Accuracy: 98.35%
  • Training Time: ~25 epochs
  • Input Size: 128×128 RGB images image

Installation

  1. Clone the repository:
git clone https://github.com/olyadboka/face-mask-detection.git
cd face-mask-detection
  1. Install dependencies:
pip install -r requirements.txt
  1. to Execute

    python test.py --camera
    or
    python test.py --image image1.jpeg 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published