This repository contains a project for detecting face masks using Convolutional Neural Networks (CNN). The goal of this project is to build a model that can accurately classify whether a person is wearing a face mask or not.
Face mask detection is crucial in the current global scenario to ensure compliance with health guidelines. This project leverages CNN to classify images of faces as either "with mask" or "without mask". The project involves:
- Fetching and preprocessing image data: Collecting data from sources such as Kaggle and preparing it for training and evaluation.
- Building and training a CNN model: Designing a Convolutional Neural Network and training it using the preprocessed data.
- Evaluating the model performance: Assessing the trained model using various metrics to ensure its effectiveness.
- Deploying the model for real-time mask detection: Implementing the model to detect face masks in real-time scenarios. Certainly! Here’s a complete and detailed guide for setting up your Kaggle dataset in Google Colab:
This guide provides step-by-step instructions to set up and fetch the dataset for the Face Mask Detection project using Google Colab.
First, you need to install the Kaggle package if it’s not already available in your Colab environment. Run the following command:
!pip install kaggleTo access Kaggle datasets, you need to upload your Kaggle API key (kaggle.json) to your Colab environment. Follow these steps:
-
Upload the
kaggle.jsonfile:from google.colab import files files.upload() # Select and upload your kaggle.json file here
-
Move the
kaggle.jsonfile to the appropriate location:!mkdir -p ~/.kaggle !mv kaggle.json ~/.kaggle/
-
Set the correct permissions for the file:
!chmod 600 ~/.kaggle/kaggle.json
Use the Kaggle API to download the dataset. Replace omkargurav/face-mask-dataset with the appropriate dataset identifier if needed.
!kaggle datasets download -d omkargurav/face-mask-datasetAfter downloading, unzip the dataset to access its contents:
!unzip face-mask-dataset.zip -d dataCheck if the dataset files are extracted correctly:
!ls dataThis will list the contents of the data directory, allowing you to verify that the files have been extracted as expected.
- Ensure that you replace
omkargurav/face-mask-datasetwith the correct dataset identifier if you are using a different dataset. - The
kaggle.jsonfile should contain your Kaggle API credentials, which are necessary for accessing Kaggle datasets programmatically.
You can now proceed with your project by training and evaluating your model using the dataset you've set up.