{"id":15659471,"url":"https://github.com/cansik/yolo-mask-detection","last_synced_at":"2025-05-05T19:29:53.426Z","repository":{"id":79718036,"uuid":"306314228","full_name":"cansik/yolo-mask-detection","owner":"cansik","description":"A pre-trained YOLOv3 based mask detection network.","archived":false,"fork":false,"pushed_at":"2020-11-09T11:37:18.000Z","size":1208,"stargazers_count":22,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-10T03:20:45.518Z","etag":null,"topics":["computer-vision","machine-learning","mask-detection","processing","python","yolov3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/cansik.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":"2020-10-22T11:24:47.000Z","updated_at":"2024-12-24T05:33:12.000Z","dependencies_parsed_at":"2023-05-15T11:45:08.718Z","dependency_job_id":null,"html_url":"https://github.com/cansik/yolo-mask-detection","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fyolo-mask-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fyolo-mask-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fyolo-mask-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cansik%2Fyolo-mask-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cansik","download_url":"https://codeload.github.com/cansik/yolo-mask-detection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235208944,"owners_count":18953003,"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":["computer-vision","machine-learning","mask-detection","processing","python","yolov3"],"created_at":"2024-10-03T13:17:04.920Z","updated_at":"2025-01-23T00:32:34.343Z","avatar_url":"https://github.com/cansik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YOLO Mask Detection\n\nFast scene mask detection for real world images based on the [darknet](https://pjreddie.com/darknet/yolo/) framework and it's [YOLOv3 Tiny PRN architecture](https://github.com/WongKinYiu/PartialResidualNetworks). \n\nNow also **YOLOv4** and **YOLOv4-tiny** are supported!\n\n![Demo](readme/bag.jpg)\n\n*Image Source: [Twitter @BAG_OFSP_UFSP](https://twitter.com/BAG_OFSP_UFSP/status/1321126674692530176)*\n\n### Dataset\nThe dataset for this pre-trained network is provided by [VictorLin000](https://github.com/VictorLin000/YOLOv3_mask_detect) and contains 678 images of people with and without masks. In total there are 3 different classes annotated:\n\n* `NONE` - No mask at all.\n* `BAD` - Partial covered face.\n* `GOOD` - Mask coveres the essential parts.\n\nYou can download the dataset directly from [google drive](https://drive.google.com/drive/folders/1aAXDTl5kMPKAHE08WKGP2PifIdc21-ZG).\n\n### Training\nThe model has been trained on a 1080TI for about 2h over 6000 iteration with a batch size of 64 and 16 subdivisons (PRN \u0026 yolov4-tiny), 64 / 64 for yolov4.\n\n![Char](readme/multi-chart.png)\n\n*YOLOv3-tiny-prn / YOLOv4 / YOLOv4-tiny*\n\nTo train the network yourself download the [dataset](https://drive.google.com/drive/folders/1aAXDTl5kMPKAHE08WKGP2PifIdc21-ZG), extract it into the `training` folder (`/training/yolo/Mask_1.jpg`) and download the [initial weights](https://drive.google.com/file/d/18v36esoXCh-PsOKwyP2GWrpYDptDY8Zf/view) into the `training` folder. To start the training run the following command:\n\n```bash\ndarknet detector train obj.data yolov3-tiny-prn.cfg yolov3-tiny.conv.11\n```\n\nAfter the training, the resulting weights should be in the `/training/backup/` folder.\nFor instructions regarding YOLOv4, head over to [AlexeyAB/darknet](https://github.com/AlexeyAB/darknet).\n\n### Inferencing\nThe weights have been trained on an image size 416x416 (PRN \u0026 tiny) / 608x608 (YOLOv4). It is also possible to inference it with a lower model size to increase the speed. A good performance / accuracy mix on CPUs has been discovered by using an image size of 128x128.\n\nThe model itself is fully compatible with the opencv dnn module and just ready to use.\n\n### Demo\nThere are either a python or a processing (java) demo you can run to test out your model directly with a webcam.\n\n#### Python\nTo run the demo, please first install all the dependencies (`requirements.txt`) into a virtual environment and download the model and weights into the model folder (or run the shell script).\n\nThen run the following command to start a webcam detector with Yolov3-Tiny-PRN:\n\n```python\n# with python 3\npython demo_webcam.py -n prn\n\n# yolov4\npython demo_webcam.py -s 608\n\n# yolov4-tiny\npython demo_webcam.-n tiny\n```\n\n#### Processing\nFor artists and makers there is also a [basic example](https://github.com/cansik/yolo-mask-detection/blob/main/MaskP5/MaskP5.pde) on how to use this network in [Processing](https://processing.org/). The sketch itself is based on the following libraries:\n\n* [Video Library 2.0](https://github.com/processing/processing-video)\n* [Deep Vision Library](https://github.com/cansik/deep-vision-processing)\n\n### Download\nTo download the models just run the `download-models.sh` in `/models` or use the following links:\n\n* [mask-yolov3-tiny-prn.cfg](https://github.com/cansik/yolo-mask-detection/releases/download/pre-trained/mask-yolov3-tiny-prn.cfg)\n* [mask-yolov3-tiny-prn.weights](https://github.com/cansik/yolo-mask-detection/releases/download/pre-trained/mask-yolov3-tiny-prn.weights)\n\nIf you are interested into the full size YOLOv3 pre-trained network, head over to this repository: [VictorLin000/YOLOv3_mask_detect](https://github.com/VictorLin000/YOLOv3_mask_detect)\n\n### About\n\nTrained by [cansik](https://github.com/cansik), the dataset fall under the terms and conditions of their owners ([VictorLin000](https://github.com/VictorLin000)).\n\nDemo images are from [Unsplash](https://unsplash.com/):\n\n* [Jérémy Stenuit](https://unsplash.com/photos/3mErKfgolzM)\n* [Victor He](https://unsplash.com/photos/lf1ivjbtF2Q)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcansik%2Fyolo-mask-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcansik%2Fyolo-mask-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcansik%2Fyolo-mask-detection/lists"}