0% found this document useful (0 votes)
28 views4 pages

Face Mask Detection Using Convolutional Neural Network

The project 'Face Mask Detection using Convolutional Neural Network (CNN)' aims to create an automated system for detecting face mask usage through images or live video feeds, crucial during the COVID-19 pandemic. Utilizing Google Colab, TensorFlow, and OpenCV, the model achieved approximately 95% accuracy in classifying images into 'Wearing a Mask' and 'Not Wearing a Mask'. The project highlights the importance of data preprocessing, model architecture, and real-time detection applications in public health monitoring.

Uploaded by

nandhaakash04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views4 pages

Face Mask Detection Using Convolutional Neural Network

The project 'Face Mask Detection using Convolutional Neural Network (CNN)' aims to create an automated system for detecting face mask usage through images or live video feeds, crucial during the COVID-19 pandemic. Utilizing Google Colab, TensorFlow, and OpenCV, the model achieved approximately 95% accuracy in classifying images into 'Wearing a Mask' and 'Not Wearing a Mask'. The project highlights the importance of data preprocessing, model architecture, and real-time detection applications in public health monitoring.

Uploaded by

nandhaakash04
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Face Mask Detection using Convolutional Neural Network (CNN)

Project Overview

As part of the internship program, I completed a deep learning project titled “Face
Mask Detection using Convolutional Neural Network (CNN)”.
The aim of this project is to build an automated system capable of detecting whether a person
is wearing a face mask or not, using images or live video feed.
This task has gained significant importance during the COVID-19 pandemic, where
monitoring compliance with mask mandates has become a key public health requirement.

The entire project was developed and executed on Google Colab, a cloud-based
platform providing free GPU/TPU acceleration and an interactive environment for running
Python notebooks.

Objective

To develop a machine learning model that classifies images of people into two categories:

 Wearing a Mask
 Not Wearing a Mask

To implement the model in a real-time detection scenario using computer vision techniques.

Tools and Technologies Used

1. Development Platform: Google Colab


2. Programming Language: Python
3. Deep Learning Framework: TensorFlow & Keras
4. Computer Vision Library: OpenCV
5. Other Libraries: Numpy, Pandas, Matplotlib

Dataset
The dataset used for training and testing the model was sourced from Kaggle:
Face Mask Dataset – Omkar Gurav

Dataset Details:

1. Contains images of people with masks and without masks.


2. Labeled data that enables supervised learning.
3. Includes variations in:
o Lighting conditions
o Face angles and orientations
o Backgrounds and demographics
4. Dataset was split into:
o Training Set (~70%)
o Validation Set (~15%)
o Test Set (~15%)

This dataset provided a good balance of real-world diversity and clear labels for effective
model training.

Methodology

Platform: Google Colab

1. Google Colab was chosen because of its ease of use, free access to GPU/TPU
hardware, and seamless integration with Kaggle datasets.
2. The Kaggle dataset was downloaded directly into the Colab environment using the
Kaggle API.

Data Preprocessing

1. All images were resized to a fixed resolution (e.g., 128×128 pixels).


2. Pixel values were normalized to improve training stability.
3. Data augmentation (flipping, rotation, zoom) was applied to improve generalization.
4. Labels were encoded into numeric form (0: Without Mask, 1: With Mask).

Model Design & Architecture

1. A CNN architecture was designed to extract features and classify images effectively.
2. Layers used:
o Convolutional layers with ReLU activation
o MaxPooling layers to reduce dimensions
o Dropout layers to prevent overfitting
o Fully connected Dense layers
o Output layer with Sigmoid activation (for binary classification)

Model Training

1. Model compiled with binary cross-entropy loss function and Adam optimizer.
2. Trained over multiple epochs while monitoring validation loss and accuracy.
3. Early stopping was applied to prevent overfitting.

Evaluation

1. Model performance was evaluated using the test set.


2. Metrics:
o Accuracy: proportion of correct predictions.
o Precision & Recall: measure of classification performance.
o Confusion Matrix: to visualize predictions vs. actual labels.
3. Achieved test accuracy of around 95%, demonstrating good generalization.

Real-Time Detection

1. Integrated the trained model with OpenCV to work on live webcam or video feed.
2. Detected faces in each frame using Haar cascades or DNN face detectors.
3. Each detected face was passed to the model to predict mask status.
4. Results were displayed on screen with bounding boxes and labels (With Mask or
Without Mask).

Results & Observations

1. The model achieved high accuracy on both test data and live detection.
2. Performed robustly across different lighting conditions and diverse subjects.
3. Google Colab’s GPU support reduced training time and enabled efficient
experimentation.
4. Data augmentation improved model performance on unseen data.

Applications

1. Public places such as malls, airports, hospitals for monitoring mask compliance.
2. Can be integrated into CCTV systems for continuous surveillance.
3. Use in workplaces and educational institutions to enforce safety protocols.

Challenges Faced

1. Imbalance between mask and no-mask images required careful handling.


2. Lighting and occlusion in images sometimes reduced prediction confidence.
3. Ensuring real-time performance while maintaining high accuracy.

Future Enhancements

1. Extend to multi-class detection: proper mask, improper mask, and no mask.


2. Deploy the model as a cloud-based service or mobile application.
3. Train on a larger and more diverse dataset for improved accuracy.

Conclusion
This project demonstrates how deep learning techniques, particularly CNNs, can solve real-
world problems effectively.
By leveraging the Face Mask Dataset from Kaggle and the computational resources of
Google Colab, I was able to develop a reliable, accurate, and practical solution for detecting
face mask compliance.

This project deepened my understanding of data preprocessing, CNN architectures, model


evaluation, and deployment techniques, giving me valuable hands-on experience in building
AI-driven solutions with societal impact.

You might also like