# FastFace: Lightweight Face Detection Framework
![PyPI](https://img.shields.io/pypi/v/fastface)
[![Documentation Status](https://readthedocs.org/projects/fastface/badge/?version=latest)](https://fastface.readthedocs.io/en/latest/?badge=latest)
[![Downloads](https://pepy.tech/badge/fastface)](https://pepy.tech/project/fastface)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fastface)
![PyPI - License](https://img.shields.io/pypi/l/fastface)
**Easy-to-use face detection framework, developed using [pytorch-lightning](https://www.pytorchlightning.ai/).**<br>
**Checkout [documentation](https://fastface.readthedocs.io/en/latest/) for more.**
## Key Features
- :fire: **Use pretrained models for inference with just few lines of code**
- :chart_with_upwards_trend: **Evaluate models on different datasets**
- :hammer_and_wrench: **Train and prototype new models, using pre-defined architectures**
- :rocket: **Export trained models with ease, to use in production**
## Contents
- [Installation](#installation)
- [Pretrained Models](#pretrained-models)
- [Demo](#demo)
- [Benchmarks](#benchmarks)
- [Tutorials](#tutorials)
- [References](#references)
- [Citations](#citations)
## Installation
From PyPI
```
pip install fastface -U
```
From source
```
git clone https://github.com/borhanMorphy/fastface.git
cd fastface
pip install .
```
## Pretrained Models
Pretrained models can be accessable via `fastface.FaceDetector.from_pretrained(<name>)`
| Name | Architecture | Configuration | Parameters | Model Size | Link |
| :---------------: | :----------: | :-----------: | :--------: | :--------: | :-------------------------------------------------------------------------------------------: |
| **lffd_original** | lffd | original | 2.3M | 9mb | [weights](https://drive.google.com/file/d/1qFRuGhzoMWrW9WNlWw9jHXPY51MBssQD/view?usp=sharing) |
| **lffd_slim** | lffd | slim | 1.5M | 6mb | [weights](https://drive.google.com/file/d/1UOHllYp5NY4mV7lHmq0c9xsryRIufpAQ/view?usp=sharing) |
## Demo
Using package
```python
import fastface as ff
import imageio
from pytorch_lightning.utilities.model_summary import ModelSummary
# load image as RGB
img = imageio.imread("<your_image_file_path>")[:,:,:3]
# build model with pretrained weights
model = ff.FaceDetector.from_pretrained("lffd_original")
# model: pl.LightningModule
# get model summary
ModelSummary(model, max_depth=1)
# set model to eval mode
model.eval()
# [optional] move model to gpu
model.to("cuda")
# model inference
preds, = model.predict(img, det_threshold=.8, iou_threshold=.4)
# preds: {
# 'boxes': [[xmin, ymin, xmax, ymax], ...],
# 'scores':[<float>, ...]
# }
```
Using [demo.py](/demo.py) script
```
python demo.py --model lffd_original --device cuda --input <your_image_file_path>
```
sample output;
![alt text](resources/friends.jpg)
## Benchmarks
**Following results are obtained with this repository**
#### WIDER FACE
validation set results
| Name | Easy | Medium | Hard |
| :---------------: | :-------: | :-------: | :-------: |
| **lffd_original** | **0.893** | **0.866** | **0.758** |
| **lffd_slim** | **0.866** | **0.854** | **0.742** |
## Tutorials
- [Widerface Benchmark](./tutorials/widerface_benchmark/README.md)
- [BentoML Deployment](./tutorials/bentoml_deployment/README.md)
## References
- [LFFD Paper](https://arxiv.org/pdf/1904.10633.pdf)
- [Official LFFD Implementation](https://github.com/YonghaoHe/A-Light-and-Fast-Face-Detector-for-Edge-Devices)
## Citations
```bibtex
@inproceedings{LFFD,
title={LFFD: A Light and Fast Face Detector for Edge Devices},
author={He, Yonghao and Xu, Dezhong and Wu, Lifang and Jian, Meng and Xiang, Shiming and Pan, Chunhong},
booktitle={arXiv:1904.10633},
year={2019}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/borhanMorphy/light-face-detection",
"name": "fastface",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pytorch_lightning,face detection,edge AI,LFFD",
"author": "\u00d6mer BORHAN",
"author_email": "borhano.f.42@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f4/c0/308be676e50dc851da85fa9f5d4c4d496951a678c166daf5b3ec882487d0/fastface-0.1.4.tar.gz",
"platform": null,
"description": "# FastFace: Lightweight Face Detection Framework\n\n![PyPI](https://img.shields.io/pypi/v/fastface)\n[![Documentation Status](https://readthedocs.org/projects/fastface/badge/?version=latest)](https://fastface.readthedocs.io/en/latest/?badge=latest)\n[![Downloads](https://pepy.tech/badge/fastface)](https://pepy.tech/project/fastface)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fastface)\n![PyPI - License](https://img.shields.io/pypi/l/fastface)\n\n**Easy-to-use face detection framework, developed using [pytorch-lightning](https://www.pytorchlightning.ai/).**<br>\n**Checkout [documentation](https://fastface.readthedocs.io/en/latest/) for more.**\n\n## Key Features\n\n- :fire: **Use pretrained models for inference with just few lines of code**\n- :chart_with_upwards_trend: **Evaluate models on different datasets**\n- :hammer_and_wrench: **Train and prototype new models, using pre-defined architectures**\n- :rocket: **Export trained models with ease, to use in production**\n\n## Contents\n\n- [Installation](#installation)\n- [Pretrained Models](#pretrained-models)\n- [Demo](#demo)\n- [Benchmarks](#benchmarks)\n- [Tutorials](#tutorials)\n- [References](#references)\n- [Citations](#citations)\n\n## Installation\n\nFrom PyPI\n\n```\npip install fastface -U\n```\n\nFrom source\n\n```\ngit clone https://github.com/borhanMorphy/fastface.git\ncd fastface\npip install .\n```\n\n## Pretrained Models\n\nPretrained models can be accessable via `fastface.FaceDetector.from_pretrained(<name>)`\n\n| Name | Architecture | Configuration | Parameters | Model Size | Link |\n| :---------------: | :----------: | :-----------: | :--------: | :--------: | :-------------------------------------------------------------------------------------------: |\n| **lffd_original** | lffd | original | 2.3M | 9mb | [weights](https://drive.google.com/file/d/1qFRuGhzoMWrW9WNlWw9jHXPY51MBssQD/view?usp=sharing) |\n| **lffd_slim** | lffd | slim | 1.5M | 6mb | [weights](https://drive.google.com/file/d/1UOHllYp5NY4mV7lHmq0c9xsryRIufpAQ/view?usp=sharing) |\n\n## Demo\n\nUsing package\n\n```python\nimport fastface as ff\nimport imageio\nfrom pytorch_lightning.utilities.model_summary import ModelSummary\n\n# load image as RGB\nimg = imageio.imread(\"<your_image_file_path>\")[:,:,:3]\n\n# build model with pretrained weights\nmodel = ff.FaceDetector.from_pretrained(\"lffd_original\")\n# model: pl.LightningModule\n\n# get model summary\nModelSummary(model, max_depth=1)\n\n# set model to eval mode\nmodel.eval()\n\n# [optional] move model to gpu\nmodel.to(\"cuda\")\n\n# model inference\npreds, = model.predict(img, det_threshold=.8, iou_threshold=.4)\n# preds: {\n# 'boxes': [[xmin, ymin, xmax, ymax], ...],\n# 'scores':[<float>, ...]\n# }\n\n```\n\nUsing [demo.py](/demo.py) script\n\n```\npython demo.py --model lffd_original --device cuda --input <your_image_file_path>\n```\n\nsample output;\n![alt text](resources/friends.jpg)\n\n## Benchmarks\n\n**Following results are obtained with this repository**\n\n#### WIDER FACE\n\nvalidation set results\n\n| Name | Easy | Medium | Hard |\n| :---------------: | :-------: | :-------: | :-------: |\n| **lffd_original** | **0.893** | **0.866** | **0.758** |\n| **lffd_slim** | **0.866** | **0.854** | **0.742** |\n\n## Tutorials\n\n- [Widerface Benchmark](./tutorials/widerface_benchmark/README.md)\n- [BentoML Deployment](./tutorials/bentoml_deployment/README.md)\n\n## References\n\n- [LFFD Paper](https://arxiv.org/pdf/1904.10633.pdf)\n- [Official LFFD Implementation](https://github.com/YonghaoHe/A-Light-and-Fast-Face-Detector-for-Edge-Devices)\n\n## Citations\n\n```bibtex\n@inproceedings{LFFD,\n title={LFFD: A Light and Fast Face Detector for Edge Devices},\n author={He, Yonghao and Xu, Dezhong and Wu, Lifang and Jian, Meng and Xiang, Shiming and Pan, Chunhong},\n booktitle={arXiv:1904.10633},\n year={2019}\n}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A face detection framework for edge devices using pytorch lightning",
"version": "0.1.4",
"project_urls": {
"Documentation": "https://fastface.readthedocs.io/en/latest/",
"Homepage": "https://github.com/borhanMorphy/light-face-detection"
},
"split_keywords": [
"pytorch_lightning",
"face detection",
"edge ai",
"lffd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "64c084054047450efec76960884512223766f378f006b2f29967d4d15ae18444",
"md5": "591d87d9019685358c94f0e5c5ae1928",
"sha256": "98e7ba635d7d546c6a589c97f6c3e4cb8144cdaf0b53023cef05afe18d39564a"
},
"downloads": -1,
"filename": "fastface-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "591d87d9019685358c94f0e5c5ae1928",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 63203,
"upload_time": "2023-08-15T23:03:23",
"upload_time_iso_8601": "2023-08-15T23:03:23.591911Z",
"url": "https://files.pythonhosted.org/packages/64/c0/84054047450efec76960884512223766f378f006b2f29967d4d15ae18444/fastface-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f4c0308be676e50dc851da85fa9f5d4c4d496951a678c166daf5b3ec882487d0",
"md5": "ceabf1c26fb55fa649461784add2a5b6",
"sha256": "bf44d824d5ea7a70d1b7bc87392639102d15f02d72ee14f80f25d51a65a4b45d"
},
"downloads": -1,
"filename": "fastface-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "ceabf1c26fb55fa649461784add2a5b6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 44905,
"upload_time": "2023-08-15T23:03:25",
"upload_time_iso_8601": "2023-08-15T23:03:25.614882Z",
"url": "https://files.pythonhosted.org/packages/f4/c0/308be676e50dc851da85fa9f5d4c4d496951a678c166daf5b3ec882487d0/fastface-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-15 23:03:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "borhanMorphy",
"github_project": "light-face-detection",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"tox": true,
"lcname": "fastface"
}