{"id":26451047,"url":"https://github.com/allanotieno254/face-mask-detection---object-detection","last_synced_at":"2026-05-05T18:35:06.023Z","repository":{"id":282297123,"uuid":"948120749","full_name":"AllanOtieno254/Face-Mask-Detection---Object-Detection","owner":"AllanOtieno254","description":"The model is trained using a labeled dataset containing images of people with and without masks. It utilizes a convolutional neural network (CNN) for object detection and classification. The implementation is done using TensorFlow/Keras, OpenCV, and other essential libraries.","archived":false,"fork":false,"pushed_at":"2025-03-13T19:41:49.000Z","size":1395,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T20:33:57.498Z","etag":null,"topics":["cnn","computer-vision","deep-learning","opencv","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/AllanOtieno254.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-03-13T19:32:44.000Z","updated_at":"2025-03-13T19:41:52.000Z","dependencies_parsed_at":"2025-03-13T20:44:47.361Z","dependency_job_id":null,"html_url":"https://github.com/AllanOtieno254/Face-Mask-Detection---Object-Detection","commit_stats":null,"previous_names":["allanotieno254/face-mask-detection---object-detection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllanOtieno254%2FFace-Mask-Detection---Object-Detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllanOtieno254%2FFace-Mask-Detection---Object-Detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllanOtieno254%2FFace-Mask-Detection---Object-Detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllanOtieno254%2FFace-Mask-Detection---Object-Detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AllanOtieno254","download_url":"https://codeload.github.com/AllanOtieno254/Face-Mask-Detection---Object-Detection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244259971,"owners_count":20424649,"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":["cnn","computer-vision","deep-learning","opencv","tensorflow"],"created_at":"2025-03-18T16:31:24.598Z","updated_at":"2025-10-27T07:12:29.404Z","avatar_url":"https://github.com/AllanOtieno254.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Face Mask Detection - Object Detection\n![4](https://github.com/user-attachments/assets/26c3e7b5-a0f8-486d-954c-74ac0c840de6)\n![1](https://github.com/user-attachments/assets/0542bf4f-fa0c-4898-80bd-9f7cfec698aa)\n\n\n\n## Description\nThis project focuses on face mask detection using object detection techniques. The model is designed to classify whether a person is wearing a mask or not, using deep learning-based image processing. This is especially relevant in health and safety applications, such as ensuring compliance with mask mandates in public places.\n\nThe model is trained using a labeled dataset containing images of people with and without masks. It utilizes a convolutional neural network (CNN) for object detection and classification. The implementation is done using TensorFlow/Keras, OpenCV, and other essential libraries.\n\n## Table of Contents\n- [Installation](#installation)\n- [Usage](#usage)\n- [Dataset](#dataset)\n- [Model Training \u0026 Evaluation](#model-training--evaluation)\n- [File Structure](#file-structure)\n- [Results \u0026 Visualization](#results--visualization)\n- [Challenges \u0026 Future Improvements](#challenges--future-improvements)\n- [License](#license)\n\n## Installation\nBefore running the project, ensure that you have all the required dependencies installed. The easiest way to do this is by running:\n\n```bash\npip install -r requirements.txt\n```\n\nDependencies include:\n- TensorFlow/Keras (for deep learning model training and inference)\n- OpenCV (for image processing and real-time face detection)\n- NumPy (for numerical operations)\n- Pandas (for dataset manipulation)\n- Matplotlib (for visualizing training progress and results)\n\nEnsure you have Jupyter Notebook installed to run the `.ipynb` file:\n\n```bash\npip install jupyter\n```\n\n## Usage\nTo use this project, follow these steps:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/yourusername/face-mask-detection.git\ncd face-mask-detection\n```\n\n2. Install dependencies using:\n\n```bash\npip install -r requirements.txt\n```\n\n3. Run the Jupyter Notebook:\n\n```bash\njupyter notebook \"Face Mask Detection - Object Detection.ipynb\"\n```\n\n4. Follow the steps outlined in the notebook to train and evaluate the model.\n\n## Dataset\nThe dataset consists of labeled images of people wearing masks and those without masks. The dataset is sourced from various public image repositories or manually collected and annotated.\n\n### Preprocessing Steps:\n- Image resizing to a fixed dimension (e.g., 224x224 pixels)\n- Image augmentation techniques like rotation, flipping, and brightness adjustments\n- Normalization to improve model performance\n- Splitting into training, validation, and test sets\n\n## Model Training \u0026 Evaluation\nThe face mask detection model is built using a CNN architecture trained on labeled images. The training process includes:\n\n- Defining the CNN model architecture\n- Compiling with an appropriate optimizer (e.g., Adam) and loss function (e.g., categorical crossentropy)\n- Training the model on labeled images for multiple epochs\n- Evaluating model performance using accuracy, precision, recall, and confusion matrix\n\n### Hyperparameters:\n- Batch size: 32\n- Learning rate: 0.001\n- Number of epochs: 25-50 (depending on dataset size)\n- Activation function: ReLU (hidden layers), Softmax (output layer)\n\n### Evaluation Metrics:\n- **Accuracy**: Measures overall correctness of predictions.\n- **Precision \u0026 Recall**: Evaluates class-specific performance.\n- **Confusion Matrix**: Displays misclassifications.\n\n## File Structure\n```\nFace Mask Detection\n│── dataset/\n│   ├── with_mask/\n│   ├── without_mask/\n│\n│── models/\n│   ├── mask_detector_model.h5\n│\n│── Face Mask Detection - Object Detection.ipynb\n│── requirements.txt\n│── README.md\n│── LICENSE\n│── utils/\n│   ├── preprocess.py\n│   ├── train.py\n│   ├── test.py\n```\n\n## Results \u0026 Visualization\nThe trained model detects faces in images and determines whether they are wearing masks. Key outputs include:\n\n- Bounding boxes around detected faces\n- Labels: \"Mask\" or \"No Mask\"\n- Probability scores for each classification\n\n### Accuracy \u0026 Loss Graphs:\nTraining accuracy and loss plots are generated to evaluate model performance over epochs.\n\n### Example Detections:\nImages with model-predicted labels are displayed for visual inspection.\n\n## Challenges \u0026 Future Improvements\n### Challenges:\n- Handling occlusions (e.g., sunglasses, scarves, or multiple masks)\n- Dataset imbalance (more images of one class than the other)\n- Real-time performance optimization\n\n### Future Improvements:\n- Implementing real-time face mask detection using webcam integration\n- Using Transfer Learning with pre-trained models like MobileNetV2\n- Deploying the model as a web or mobile application\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n---\n**Contributors:**\n- [Your Name](https://github.com/yourusername)\n\nIf you find this project useful, consider giving it a ⭐ on GitHub!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallanotieno254%2Fface-mask-detection---object-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallanotieno254%2Fface-mask-detection---object-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallanotieno254%2Fface-mask-detection---object-detection/lists"}