{"id":20826816,"url":"https://github.com/arkaung/facemask_rcnn","last_synced_at":"2026-06-22T01:31:17.396Z","repository":{"id":70135130,"uuid":"447816795","full_name":"ArkAung/faceMask_rcnn","owner":"ArkAung","description":"Step by step tutorial to build a simple mask-rcnn for face mask detetion and to serve a simple Flask webserver","archived":false,"fork":false,"pushed_at":"2022-01-14T03:48:16.000Z","size":3671,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T07:27:51.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ArkAung.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":"2022-01-14T02:22:49.000Z","updated_at":"2022-08-10T15:49:22.000Z","dependencies_parsed_at":"2023-02-21T14:45:13.831Z","dependency_job_id":null,"html_url":"https://github.com/ArkAung/faceMask_rcnn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ArkAung/faceMask_rcnn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArkAung%2FfaceMask_rcnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArkAung%2FfaceMask_rcnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArkAung%2FfaceMask_rcnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArkAung%2FfaceMask_rcnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArkAung","download_url":"https://codeload.github.com/ArkAung/faceMask_rcnn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArkAung%2FfaceMask_rcnn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34630770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-17T23:10:09.719Z","updated_at":"2026-06-22T01:31:17.383Z","avatar_url":"https://github.com/ArkAung.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FaceMask-RCNN\n\nThis repo demonstrates how you can build your own face mask detection mask-rcnn and set up a simple Flask webserver\nto run inference on real world images.\n\nWhat we want to achieve:\n![Sample result](rss/sample_result.png)\n\n\n# Step 1: Training the Model\n\nView [Step_1_Working_Process.md](Step_1_Working_Process.md) for steps taken while working for this step.\n\n### How to Fine-Tune Mask RCNN with Annotated Face Mask Dataset\n* Download annotated dataset. [Link](https://drive.google.com/file/d/1b-G3QmwC0JtlfI6IKsSjw3K3xGxWHLJo/view)\n* Unzip the directory and place the `dataset` folder (which should contain `train` and `val`) .\n* Create a conda environment: `conda create -n face_mask python=3.7`.\n* Activate conda environment: `conda activate face_mask`\n* Install requirements: `pip install -r requirements.txt`.\n* Training: `python train.py --dataset /path/where/you/downloaded/dataset --weights \"coco\" --training_type \"heads\" --epochs 5`.\n* Fine tuning: `python train.py --dataset /path/where/you/downloaded/dataset --weights \"last\" --training_type \"all\" --epochs 10`.\n\n### Running Evaluation Script\n* Download trained weights: [link](https://drive.google.com/file/d/1qjAJwsS6Rx2niTIVbak24oKlLitPWZU-/view?usp=sharing)\n* `python eval.py --dataset /path/where/you/downloaded/dataset --weights \"/path/to/weight/file\" --device \"cpu\"`\n\n### Training steps, validation and testing\n* You can take a look at `Step_1_Retrain_Mask_RCNN.ipynb` for training setps,\nvalidation and testing on unseen images.\n\n# Step 2: Simple Webserver\n\nSimple Flask webserver which uses Mask RCNN trained to detect and segment face masks in images.\n\nIf you don't want to set things up in your computer and just want to try out, here \nis all-containing co-lab notebook to server a simple webserver.\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ArkAung/faceMask_rcnn/blob/master/Step_2_Serve_a_Simple_Webserver.ipynb) \n\n### Preparation\n* Download weights file: [link](https://drive.google.com/file/d/1qjAJwsS6Rx2niTIVbak24oKlLitPWZU-/view?usp=sharing)\n\n### How to Run\n* If you haven't created a conda environment in Step 1, create conda environment: `conda create -n face_mask python=3.7`\n* Activate environment: `conda activate face_mask`\n* Install required libraries: `pip install -r requirements.txt`\n* Start webserver: `python webserver.py --weights \u003c/path/to/downloaded/weight/file\u003e --device [cpu|gpu]`\n* For local deployment, go to `http://127.0.0.1:5000/`\n    * Navigate to `/upload` and upload an image.\n        * You will receive a JSON response which includes the URL of the image.\n        * Go to that URL to download the result image.\n    * Alternatively, you can try out with cURL\n        ```shell script\n            curl --location --request POST 'http://localhost:5000/upload' --form 'file=@/path/to/image.jpg'\n        ``` \n\nSample JSON response:\n```json\n{\n  \"output\":\"http://localhost:5000/results/output_image.jpg\",\n  \"percent_masked\":1.8,\n  \"success\":true\n}\n```\n\n*Browser caching*: Normally, when you access the image URL, the browser should download the result image. \nBut some browsers open a new tab to show the image. Sometimes, you may see \ncached result image from previous API call. If that's the case, clear cache and refresh by \"Ctrl+Shift+R\".","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkaung%2Ffacemask_rcnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farkaung%2Ffacemask_rcnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkaung%2Ffacemask_rcnn/lists"}