A face detection framework for edge devices using pytorch lightning
Project description
FastFace: Lightweight Face Detection Framework
Easy-to-use face detection framework, developed using pytorch-lightning.
Checkout documentation 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
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 |
| lffd_slim | lffd | slim | 1.5M | 6mb | weights |
Demo
Using package
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 script
python demo.py --model lffd_original --device cuda --input <your_image_file_path>
sample output;
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
References
Citations
@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}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastface-0.1.4.tar.gz.
File metadata
- Download URL: fastface-0.1.4.tar.gz
- Upload date:
- Size: 44.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf44d824d5ea7a70d1b7bc87392639102d15f02d72ee14f80f25d51a65a4b45d
|
|
| MD5 |
ceabf1c26fb55fa649461784add2a5b6
|
|
| BLAKE2b-256 |
f4c0308be676e50dc851da85fa9f5d4c4d496951a678c166daf5b3ec882487d0
|
File details
Details for the file fastface-0.1.4-py3-none-any.whl.
File metadata
- Download URL: fastface-0.1.4-py3-none-any.whl
- Upload date:
- Size: 63.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98e7ba635d7d546c6a589c97f6c3e4cb8144cdaf0b53023cef05afe18d39564a
|
|
| MD5 |
591d87d9019685358c94f0e5c5ae1928
|
|
| BLAKE2b-256 |
64c084054047450efec76960884512223766f378f006b2f29967d4d15ae18444
|