{"id":28924054,"url":"https://github.com/subhajit0210/face-mask-detection-using-cnn","last_synced_at":"2026-04-09T18:56:23.305Z","repository":{"id":291437198,"uuid":"977612712","full_name":"Subhajit0210/Face-Mask-Detection-using-CNN","owner":"Subhajit0210","description":"This project demonstrates how to build a Face Mask Detection System using CNN","archived":false,"fork":false,"pushed_at":"2025-05-15T21:23:51.000Z","size":1080,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T10:04:18.371Z","etag":null,"topics":["activation-functions","cnn","convolutional-neural-networks","cv2","deep-learning","deep-neural-networks","face-mask-detection","keras","loss-functions","matplotlib","neural-network","numpy","optimizer","python3","sklearn","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Subhajit0210.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-04T15:51:34.000Z","updated_at":"2025-05-15T21:23:54.000Z","dependencies_parsed_at":"2025-05-04T17:23:23.294Z","dependency_job_id":"5ee6167a-1201-45bc-8f3e-fa89e4b61e03","html_url":"https://github.com/Subhajit0210/Face-Mask-Detection-using-CNN","commit_stats":null,"previous_names":["subhajit0210/face-mask-detection-using-cnn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Subhajit0210/Face-Mask-Detection-using-CNN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhajit0210%2FFace-Mask-Detection-using-CNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhajit0210%2FFace-Mask-Detection-using-CNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhajit0210%2FFace-Mask-Detection-using-CNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhajit0210%2FFace-Mask-Detection-using-CNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Subhajit0210","download_url":"https://codeload.github.com/Subhajit0210/Face-Mask-Detection-using-CNN/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhajit0210%2FFace-Mask-Detection-using-CNN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263339928,"owners_count":23451516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activation-functions","cnn","convolutional-neural-networks","cv2","deep-learning","deep-neural-networks","face-mask-detection","keras","loss-functions","matplotlib","neural-network","numpy","optimizer","python3","sklearn","tensorflow"],"created_at":"2025-06-22T10:03:24.609Z","updated_at":"2026-04-09T18:56:23.235Z","avatar_url":"https://github.com/Subhajit0210.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Mask Detection using CNN\n\n## Table of Contents\n- [Project Overview](#project-overview)\n- [Dependencies](#dependencies)\n- [Data Collection](#data-collection)\n- [Data Preparation](#data-preparation)\n- [CNN Model](#cnn-model)\n- [Results and Insights](#results-and-insights)\n- [Usage](#usage)\n- [Contributing](#contributing)\n\n## Project Overview\nThe goal of this project is to create a model that can accurately detect whether a person in an image is wearing a face mask or not. This is achieved by training a CNN on a dataset of images of people with and without masks. The trained model can then be used to classify new images and predict whether a person is wearing a mask.\n\n## Dependencies\nThe following libraries are required to run this project:\n- TensorFlow\n- Keras\n- OpenCV\n- NumPy\n- Matplotlib\n- PIL\n- Scikit-learn\n\n## Data Collection\nThe project uses the \"Face Mask Dataset\" available on Kaggle. This dataset contains images of people wearing and not wearing face masks. It is used to train and evaluate the CNN model. You can download it using the Kaggle API.\n* **Source:** Kaggle Datasets\n* **Link:** https://www.kaggle.com/datasets/omkargurav/face-mask-dataset\n* **Content:** Images of people with and without face masks.\n* **Classes:** \n    * with_mask: Images of individuals wearing face masks correctly.\n    * without_mask: Images of individuals not wearing face masks.\n    * mask_weared_incorrect: Images of individuals wearing masks incorrectly (e.g., covering the mouth but not the nose).\n* **Size:** 853 images\n* **Labeled Objects:** 4072 labeled objects belonging to the 3 classes mentioned above.\n* **Image Format:** JPEG\n* **Resolution:** Varies\n\n## Data Preparation\n* **Download:** The Dataset is downloaded from Kaggle using the Kaggle API.\n* **Extract:** The downloaded dataset is extracted.\n* **Resize:** All images are resized to 128x128 pixels for consistency.\n* **Convert:** Images are converted into NumPy arrays for processing.\n* **Label:** Images are labeled as 'with_mask' or 'without_mask'.\n* **Split:** Data is split into training and testing sets.\n* **Scale:** Pixel values are scaled to a range of 0-1.\n\n## CNN Model\nThis project employs a Convolutional Neural Network (CNN) to classify images of people with and without masks. CNNs are particularly well-suited for image recognition tasks due to their ability to learn spatial hierarchies of features.\n\n**Model Architecture:**\n\nThe CNN model consists of the following layers:\n* **Convolutional Layers:** These layers extract features from the input images using learnable filters. We use multiple convolutional layers with increasing filter sizes to capture both low-level and high-level features.\n* **Max Pooling Layers:** These layers downsample the feature maps, reducing their dimensionality and computational complexity. They also help to make the model more robust to variations in the input images.\n* **Flatten Layer:** This layer converts the multi-dimensional feature maps into a single vector, preparing them for input to the fully connected layers.\n* **Fully Connected Layers:** These layers perform the final classification based on the extracted features. We use two fully connected layers with ReLU activation functions, followed by a final output layer with a sigmoid activation function for binary classification (mask or no mask).\n\n## Results and Insights\n* **High Accuracy:** Our CNN model achieved over 92% accuracy in detecting face masks.\n* **Effective for Real-world Use:** This shows its potential for applications like public health monitoring.\n* **Further Improvements:** We can explore data augmentation and model architecture for even better results.\n\n## Usage\nTo run the project, follow these steps:\n1. Clone the repository:\n```bash\ngit clone https://github.com/yourusername/Face-Mask-Detection-using-CNN.git\n```\n2. Navigate to the project directory:\n```bash\ncd Face-Mask-Detection-using-CNN\n```\n4. Run the Jupyter notebook:\n```bash\njupyter notebook Face_Mask_Detection_using_CNN.ipynb\n```\n\n## Contributing\nContributions are welcome! Please create a new branch for any changes and submit a pull request for review.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubhajit0210%2Fface-mask-detection-using-cnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubhajit0210%2Fface-mask-detection-using-cnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubhajit0210%2Fface-mask-detection-using-cnn/lists"}