FastFace: Lightweight Face Detection Framework
Easy-to-use face detection framework, developed using pytorch-lightning.
Checkout documentation for more.
Key Features
-
🔥 Use pretrained models for inference with just few lines of code -
📈 Evaluate models on different datasets -
🛠️ Train and prototype new models, using pre-defined architectures -
🚀 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/light-face-detection.git
cd light-face-detection
pip install .
Pretrained Models
Pretrained models can be accessable via fastface.FaceDetector.from_pretrained(
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 # load image as RGB img = imageio.imread("" )[:,:,:3] # build model with pretrained weights model = ff.FaceDetector.from_pretrained("lffd_original") # model: pl.LightningModule # get model summary model.summarize() # 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':[, ...] # }
Using demo.py script
python demo.py --model lffd_original --device cuda --input
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}
}