Skip to main content

A face detection framework for edge devices using pytorch lightning

Project description

FastFace: Lightweight Face Detection Framework

PyPI Documentation Status Downloads PyPI - Python Version PyPI - License

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/light-face-detection.git
cd light-face-detection
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

# 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
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':[<float>, ...]
# }

Using demo.py script

python demo.py --model lffd_original --device cuda --input <your_image_file_path>

sample output; alt text

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

fastface-0.1.3.tar.gz (42.5 kB view details)

Uploaded Source

Built Distribution

fastface-0.1.3-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file fastface-0.1.3.tar.gz.

File metadata

  • Download URL: fastface-0.1.3.tar.gz
  • Upload date:
  • Size: 42.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.11

File hashes

Hashes for fastface-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3e5ffc60774bc17157d725fd064b380e2cecb138662b1befd869419932dd00bd
MD5 f1d0a8c9adad2422b326c96739d09078
BLAKE2b-256 1885e84e3ee3c11db34d5eb433d12b5e95727a17f3a24664534da5c951030b04

See more details on using hashes here.

File details

Details for the file fastface-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fastface-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.11

File hashes

Hashes for fastface-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fe6658ec68c2b83ef7b0779d02b6c9e0a5ecd165760ca4a6e2981efc2ea525b5
MD5 b7414de45aa8deee85cbdf8faf66b1b4
BLAKE2b-256 48e3cac2d0bbb6f29230fa1e137231a03bc5f9368c1fd993205ddb98783a1fcd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page