{"id":33141953,"url":"https://github.com/cheese-roll/light-anime-face-detector","last_synced_at":"2025-11-20T06:03:08.582Z","repository":{"id":215965671,"uuid":"255994585","full_name":"cheese-roll/light-anime-face-detector","owner":"cheese-roll","description":"A fast and light-weighted anime face detection based on LFFD.","archived":false,"fork":false,"pushed_at":"2023-06-22T10:18:26.000Z","size":11127,"stargazers_count":57,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-17T21:47:50.775Z","etag":null,"topics":["anime","computer-vision","face-detection","lffd","mxnet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheese-roll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-04-15T17:49:28.000Z","updated_at":"2024-02-05T07:34:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"85c61a63-6bc0-47b0-8e38-8bb7afe85376","html_url":"https://github.com/cheese-roll/light-anime-face-detector","commit_stats":null,"previous_names":["cheese-roll/light-anime-face-detector"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cheese-roll/light-anime-face-detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheese-roll%2Flight-anime-face-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheese-roll%2Flight-anime-face-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheese-roll%2Flight-anime-face-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheese-roll%2Flight-anime-face-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheese-roll","download_url":"https://codeload.github.com/cheese-roll/light-anime-face-detector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheese-roll%2Flight-anime-face-detector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285382190,"owners_count":27162159,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","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":["anime","computer-vision","face-detection","lffd","mxnet"],"created_at":"2025-11-15T12:00:48.322Z","updated_at":"2025-11-20T06:03:08.577Z","avatar_url":"https://github.com/cheese-roll.png","language":"Python","funding_links":[],"categories":["Image Recognition"],"sub_categories":[],"readme":"# Light (and Fast) Anime Face Detector\n\n![Demo GIF](/assets/demo.gif)\n\nThis repository is based on [a light and fast face detector (LFFD)](https://github.com/YonghaoHe/A-Light-and-Fast-Face-Detector-for-Edge-Devices) ([paper](https://arxiv.org/abs/1904.10633)). The model is trained on data from [Anime-Face-Detector](https://github.com/qhgz2013/anime-face-detector) repository by qhgz2013 plus additional ~600 pseudo semi-supervised images sourced from [danbooru2019](https://www.gwern.net/Danbooru2019). This detector can theoretically run at \u003e100 FPS while retaining an acceptable level of accuracy.\n\nThis repository is tested under the following settings:\n- Ubuntu 18.04.4 LTS\n- Python 3.6.8\n- GeForce GTX 1060 6GB (Mobile)\n- NVIDIA Driver 440.64\n- CUDA 10.0.130 (installed via conda as cudatoolkit) \n- CUDNN 7.6.5 (installed via conda)\n- mxnet 1.6.0\n\n## Core Dependencies\n\n- Python 3.6+\n- opencv-contrib-python\n- mxnet\n- numpy\n\nYou might need other libraries (e.g. tqdm, imutils, etc.) in order to run the demo. If you want to utilize your GPU, please consult [MXNet's official installation guide](https://mxnet.apache.org/get_started).\n\n## Usage\n\nRun demo on a video from command line:\n```\n    python run_video.py --input-path INPUT_PATH --output-path OUTPUT_PATH --detector-path configs/anime.json\n```\n\nRun demo on images in a directory from command line:\n```\n    python run_directory.py --input-directory INPUT_DIR --detector-path configs/anime.json\n```\n\nAs a Python library:\n\n```\n    import os\n    from core.detector import LFFDDetector\n    \n    \"\"\"\n        !!! IMPORTANT !!!\n        Disable auto-tuning\n        You might experience a major slow-down if you run the model on images with varied resolution / aspect ratio.\n        This is because MXNet is attempting to find the best convolution algorithm for each input size, \n        so we should disable this behavior if it is not desirable.\n    \"\"\" \n    os.environ[\"MXNET_CUDNN_AUTOTUNE_DEFAULT\"] = \"0\"\n\n    with open(CONFIG_PATH, \"r\") as f:\n        config = json.load(f)\n    detector = LFFDDetector(config, use_gpu=True)\n    image = cv2.imread(IMAGE_PATH)\n    boxes = detector.detect(image)\n```\n\n## Examples\n\n![Demo Image](/assets/touhou-cannonball.jpg)\n\u003cp align=\"center\"\u003eCredit: \u003ca href=\"https://touhoucannonball.com/\"\u003ePromotional art from Touhou Cannonball\u003c/a\u003e\u003c/p\u003e\n\n![Demo Image](/assets/demo2.jpg)\n\u003cp align=\"center\"\u003e(Size 640) Credit: \u003ca href=\"https://www.pixiv.net/en/artworks/77538304\"\u003e素敵な墓場で暮しましょ！\u003c/a\u003e by \u003ca href=\"https://www.pixiv.net/en/users/132450\"\u003esyuri22@例大祭た14a\u003c/a\u003e\u003c/p\u003e\n\n![Demo Image](/assets/demo.jpg)\n\u003cp align=\"center\"\u003eCredit: \u003ca href=\"https://www.pixiv.net/en/artworks/76553042\"\u003eMe\u003c/a\u003e\u003c/p\u003e\n\n## Inference Time\n\nThe inference speed for this detector is varied depending on the `size` (or `resize_scale`) parameter in the config. By lowering the parameters, there can be a significant speed gain with potentially worse model performance. \n\n`Input Resolution` in the following table is after the image resizing is done. `Inference Time` is calculated by timing `LFFDDetector.detect()` method.\n\nBase | Input Resolution (WxH) | Inference Time\n--- | --- | --- \nIntel® Core™ i7-8750H CPU @ 2.20GHz × 12 (CPU) | 384x259 | 115ms\nIntel® Core™ i7-8750H CPU @ 2.20GHz × 12 (CPU) | 384x216 | 96ms\nIntel® Core™ i7-8750H CPU @ 2.20GHz × 12 (CPU) | 276x384 | 125ms\nGeForce GTX 1060 6GB (Mobile) | 384x259 | 13.7ms\nGeForce GTX 1060 6GB (Mobile) | 384x216 | 10.6ms\nGeForce GTX 1060 6GB (Mobile) | 276x384 | 17.7ms\n\nMXNet auto-tuning is disabled for GPU benchmarking (by setting `MXNET_CUDNN_AUTOTUNE_DEFAULT` to `0` in environment variable). There is a potential gain by enabling it in case that the detector runs on images with the same resolution / aspect ratio.\n\n## Training \n\nPlease refer to [the original LFFD implementation](https://github.com/YonghaoHe/A-Light-and-Fast-Face-Detector-for-Edge-Devices) for details. \n\n## Known Issues / Improvements\n\nCurrently, the detector cannot handle these cases well.\n\n- Extreme size (the whole image is a face or extremely small face)\n- \"Non-standard\" (e.g. chibi) stylistic choices\n- Rotation\n- Side views\n- Ornaments / headdresses (e.g. helmet)\n- Faces that are very close to others\n\nAll of these except the last one could be solvable by using more data and / or image augmentation. We could let the detector pre-label the data for us, which should reduce the workload when we manually correct them afterwards.\n\nA consistent rule for bounding box might also be needed to minimize the bounding box loss (right now, it's a rough estimation of how much padding we will need for a face).\n\n`size` (and `resize_scale`) also needs to be carefully chosen since the trained dataset is not big enough for the model to learn continuous face scaling.\n\nSpeed-wise, we could implement a batch processing. Non-maximum suppression function could also be written as `cython` or to be compatiable with `numba` to gain more speed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheese-roll%2Flight-anime-face-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheese-roll%2Flight-anime-face-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheese-roll%2Flight-anime-face-detector/lists"}