{"id":24971229,"url":"https://github.com/ashithapallath/facemaskdetection-using-cnn","last_synced_at":"2026-05-02T14:32:44.573Z","repository":{"id":275302610,"uuid":"925693036","full_name":"ashithapallath/facemaskdetection-using-cnn","owner":"ashithapallath","description":"This project implements a CNN-based Face Mask Detection Model to classify images as with mask or without mask. Trained on a labeled dataset, the model achieves 90% accuracy, making it suitable for real-world applications like public safety monitoring. ","archived":false,"fork":false,"pushed_at":"2025-02-01T15:00:36.000Z","size":513,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T15:23:13.881Z","etag":null,"topics":["adam-optimizer","batch-normalization","detection","dropout-layers","machine-learning","python"],"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/ashithapallath.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}},"created_at":"2025-02-01T14:09:15.000Z","updated_at":"2025-02-01T15:00:39.000Z","dependencies_parsed_at":"2025-02-01T15:33:31.676Z","dependency_job_id":null,"html_url":"https://github.com/ashithapallath/facemaskdetection-using-cnn","commit_stats":null,"previous_names":["ashithapallath/facemaskdetection-using-cnn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashithapallath%2Ffacemaskdetection-using-cnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashithapallath%2Ffacemaskdetection-using-cnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashithapallath%2Ffacemaskdetection-using-cnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashithapallath%2Ffacemaskdetection-using-cnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashithapallath","download_url":"https://codeload.github.com/ashithapallath/facemaskdetection-using-cnn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145017,"owners_count":20730494,"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":["adam-optimizer","batch-normalization","detection","dropout-layers","machine-learning","python"],"created_at":"2025-02-03T16:10:04.391Z","updated_at":"2026-05-02T14:32:44.516Z","avatar_url":"https://github.com/ashithapallath.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## **Face Mask Detection Model using CNNs**  \n\n### **Overview**  \nThis project implements a **Convolutional Neural Network (CNN)** to detect whether a person is wearing a face mask or not. The model is trained on a labeled dataset of masked and unmasked faces.  \n\n### **Dataset**  \n- The dataset is sourced from Kaggle: [Face Mask Dataset](https://www.kaggle.com/datasets/omkargurav/face-mask-dataset).  \n- It contains images categorized as **with mask** and **without mask**.  \n\n### **Model Architecture**  \n- **Convolutional Layers**: Extract spatial features from images.  \n- **Batch Normalization \u0026 Dropout**: Prevent overfitting and improve generalization.  \n- **Fully Connected Layers**: Perform classification into mask/no-mask categories.  \n- **Activation Function**: ReLU (hidden layers) \u0026 Softmax (output layer).  \n- **Loss Function**: Categorical Crossentropy.  \n- **Optimizer**: Adam.  \n\n### **Training Details**  \n- **Batch Size**: 32  \n- **Epochs**: 30 (with Early Stopping based on validation loss)  \n- **Validation Split**: 20% of the dataset  \n\n### **Results**  \n**Classification Report:**  \n| Class          | Precision | Recall | F1-Score | Support |\n|---------------|-----------|--------|----------|---------|\n| **Without Mask** | 0.89      | 0.93   | 0.91     | 397     |\n| **With Mask**    | 0.92      | 0.87   | 0.90     | 366     |\n| **Accuracy**     | **0.90**  | -      | -        | 763     |\n| **Macro Avg**    | 0.91      | 0.90   | 0.90     | 763     |\n| **Weighted Avg** | 0.91      | 0.90   | 0.90     | 763     |\n\n![image](https://github.com/user-attachments/assets/f15a7579-800d-4e28-888c-adf0edfb6340)\n\n**Accuracy \u0026 Loss Plots:** \n\n![image](https://github.com/user-attachments/assets/330ea467-7030-4f21-b6ae-8dc09046d912)\n\n![image](https://github.com/user-attachments/assets/918aa0ac-f4dc-44f9-840b-18f8cdf23370)\n\n\n### **Usage**  \n1. **Install Dependencies**  \n   ```bash\n   pip install tensorflow opencv-python pandas numpy matplotlib\n   ```\n2. **Run the Model Training**  \n   ```python\n   python train.py\n   ```\n3. **Test the Model on New Images**  \n   ```python\n   python predict.py --image path/to/image.jpg\n   ```\n\n### **Future Improvements**  \n- Train on a **larger dataset** for better generalization.  \n- Implement **real-time detection** using OpenCV and a webcam.  \n- Optimize for **mobile deployment** using TensorFlow Lite.  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashithapallath%2Ffacemaskdetection-using-cnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashithapallath%2Ffacemaskdetection-using-cnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashithapallath%2Ffacemaskdetection-using-cnn/lists"}