Linux CPU | Linux GPU | Mac OS CPU | Windows CPU |
|---|---|---|---|
免费和开源的面部检测。基于mtcnn
官方网站(https://dface.tech)
我们还提供完全识别SDK,包含跟踪,检测,面部识别,抗散热性等等。有关详细信息,请参见Dface.Tech。
Dface是用于面部检测和识别的开源软件。 Pytorch (Facebook深度学习框架)实现的所有功能。使用Pytorch,我们使用一种称为反向模式自动差异的技术,该技术使开发人员可以使用零滞后或开销任意网络行为的方式更改您的网络行为方式。 dface继承了这些高级特征,使其使其动态和轻松的代码审查。
dface用nvidia cuda支持GPU加速度。我们强烈建议您使用Linux GPU版本。它的快速和非常实时。
我们的灵感来自有关该主题的几篇研究论文,以及使用多任务级联卷积网络和面部识别主题面部的当前和过去的工作,例如联合面部检测和对齐方式:面部识别和聚类的统一嵌入
mtcnn结构
如果您想为dface做出贡献,请查看项目中的贡献。我们使用Slack来跟踪请求和错误。您也可以遵循QQ组681403076或我的微信Jinkuaikuai005
Dface有两个主要模块,即检测和识别。在这两个中,我们提供了有关如何训练模型和运行的所有教程。首先设置Pytorch和CV2。我们建议Anaconda做一个虚拟和独立的Python环境。如果您想在GPU上训练,请安装Nvidia Cuda和Cudnn。
git clone https://github.com/kuaikuaikim/dface.git另外,我们在根路径中提供了一个称为环境的Anaconda环境依赖列表。您可以非常轻松地创建DCEARENUSER。
cd DFace
conda env create -f path/to/environment.yml将dface添加到您当地的Python路径
export PYTHONPATH= $PYTHONPATH :{your local DFace root path}如果您对如何培训MTCNN型号感兴趣,则可以按照下一步进行操作。
MTCNN有三个称为PNET , RNET和ONET的网络。因此,我们应该在三阶段进行训练,每个阶段都取决于先前的网络,该网络将生成火车数据以供电到电流火车网,也可以推动两个网络之间的最小损失。在培训之前,请下载火车面部数据集。我们使用较宽的脸部和Celeba 。原始的较宽的面部注释文件是MATLAB格式,您必须将其转换为文本。我已经将转换的注释文本文件放入anno_store/wider_origin_anno.txt中。该文件与称为-Anno_file的以下参数有关。
mkdir {your dface traindata folder}python dface/prepare_data/gen_Pnet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file {wider face original combined annotation file, default anno_store/wider_origin_anno.txt}python dface/prepare_data/assemble_pnet_imglist.pypython dface/train_net/train_p_net.pypython dface/prepare_data/gen_Rnet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file {wider face original combined annotation file, default anno_store/wider_origin_anno.txt} --pmodel_file {your PNet model file trained before}python dface/prepare_data/assemble_rnet_imglist.pypython dface/train_net/train_r_net.pypython dface/prepare_data/gen_Onet_train_data.py --prefix_path {annotation file image prefix path, just your local wider face images folder} --dface_traindata_store {dface train data temporary folder you made before } --anno_file {wider face original combined annotation file, default anno_store/wider_origin_anno.txt} --pmodel_file {your PNet model file trained before} --rmodel_file {your RNet model file trained before}python dface/prepare_data/gen_landmark_48.pypython dface/prepare_data/assemble_onet_imglist.pypython dface/train_net/train_o_net.py如果您不想训练,我已经将onet_epoch.pt,pnet_epoch.pt,rnet_epoch.pt放在model_store文件夹中。
python test_image.pyApache许可证2.0