Skip to main content

一种使用 pytorch 闪电的边缘设备人脸检测框架

项目描述

FastFace:轻量级人脸检测框架

派皮 文件状态 下载 PyPI - Python 版本 PyPI - 许可证

使用pytorch-lightning开发的易于使用的人脸检测框架。
结帐文档了解更多。

主要特征

  • :fire:使用预训练模型进行推理,只需几行代码
  • :chart_with_upwards_trend:评估不同数据集上的模型
  • :hammer_and_wrench:使用预定义的架构训练和制作新模型原型
  • :rocket:轻松导出训练模型,用于生产

内容

安装

来自 PyPI

pip install fastface -U

从源头

git clone https://github.com/borhanMorphy/light-face-detection.git
cd light-face-detection
pip install .

预训练模型

预训练模型可以通过以下方式访问fastface.FaceDetector.from_pretrained(<name>)

姓名 建筑学 配置 参数 型号尺寸 关联
lffd_original 左下角 原来的 2.3M 9mb 权重
lffd_slim 左下角 1.5M 6mb 权重

演示

使用包

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>, ...]
# }

使用demo.py脚本

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

样本输出; 替代文字

基准

使用此存储库获得以下结果

宽脸

验证集结果

姓名 简单的 中等的 难的
lffd_original 0.893 0.866 0.758
lffd_slim 0.866 0.854 0.742

教程

参考

引文

@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}
}

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

fastface-0.1.3.tar.gz (42.5 kB 查看哈希

已上传 source

内置分布

fastface-0.1.3-py3-none-any.whl (63.5 kB 查看哈希

已上传 py3