基于PyTorch的人脸识别框架(翻译)

内容来源:https://github.com/XiaohangZhan/face_recognition_framework

基于PyTorch的人脸识别框架

Face recognition framework based on PyTorch.

一、介绍

        This is a face recognition framework based on PyTorch with convenient training, evaluation and feature extraction functions. It is originally a multi-task face recognition framework for our accpeted ECCV 2018 paper, "Consensus-Driven Propagation in Massive Unlabeled Data for Face Recognition". However, it is also a common framework for face recognition. You can freely customize your experiments with your data and configurations with it.

        这是一个基于PyTorch的人脸识别框架,具有便捷训练、评估和特征提取功能。 它最初是我们已被ECCV 2018接收的论文“Consensus-Driven Propagation in Massive Unlabeled Data for Face Recognition”的多任务人脸识别框架。 但是,它也是人脸识别的通用框架。 您可以使用您的数据和配置自由定制您的实验。

二、文章

Xiaohang Zhan, Ziwei Liu, Junjie Yan, Dahua Lin, Chen Change Loy, "Consensus-Driven Propagation in Massive Unlabeled Data for Face Recognition", ECCV 2018

工程链接:Consensus-Driven Propagation in Massive Unlabeled Data for Face Recognition

三、为什么要多任务?Why multi-task?

        Different datasets have different identity (category) sets. We do not know the intersection between them. Hence instead of merging identity sets of different datasets, regarding them as different tasks is an effective alternative way.

      不同的数据集有不同的身份(类别)集。 我们不知道它们之间的交集。 因此,我们没有合并不同数据集的身份集,而是将它们视为不同的任务,这也是一种有效的替代方法。

四、特色Features

Framework: Multi-task, Single Task

Loss: Softmax Loss, ArcFace

Backbone CNN: ResNet, DenseNet, Inception, InceptionResNet, NASNet, VGG

Benchmarks: Megaface (FaceScrub), IJB-A, LFW, CFP-FF, CFP-FP, AgeDB-30, calfw, cplfw

Data aug: flip, scale, translation

Online testing and visualization with Tensorboard.

框架:多任务,单任务

损失:Softmax Loss,ArcFace

主干 CNN:ResNet、DenseNet、Inception、InceptionResNet、NASNet、VGG

基准数据集:Megaface (FaceScrub)、IJB-A、LFW、CFP-FF、CFP-FP、AgeDB-30、calfw、cplfw

数据增强:翻转、缩放、平移

使用 Tensorboard 进行在线测试和可视化。

五、设置步骤

1、克隆项目Clone the project.

git clone git@github.com:XiaohangZhan/face_recognition_framework.git
cd face_recognition_framework

2、依赖库Dependency.

python=3.6, tensorboardX, pytorch=0.3.1, mxnet, sklearn

3、数据集准备Data Preparation.

Download datasets from insightface into your data storage folder, e.g., ~/data/face_recognition/. Taking CASIA-Webface for example:

insightface下载数据集到你的数据存储文件夹,例如~/data/face_recognition/。

以CASIA-Webface为例:

cd ~/data/face_recognition/
mkdir -p megaface_test/raw
cd megaface_test/raw
mv ../../megaface_testpack_v1.0.zip .
unzip -q megaface_testpack_v1.0.zip
cd $THIS_REPO # back to the repo root
ln -s  ~/data/face_recognition/megaface_test data/megaface_test

Optionally, if you want to test on MegaFace. Download testing set from here into your data storage folder, e.g., ~/data/face_recognition/. Then:

或者,如果您想在 MegaFace 上进行测试。 从这里将测试集下载到您的数据存储文件夹中,例如 ~/data/face_recognition/。 然后:

cd ~/data/face_recognition/
mkdir -p megaface_test/raw
cd megaface_test/raw
mv ../../megaface_testpack_v1.0.zip .
unzip -q megaface_testpack_v1.0.zip
cd $THIS_REPO # back to the repo root
ln -s  ~/data/face_recognition/megaface_test data/megaface_test

Next, download MegaFace lists from here into ~/data/face_recognition/megaface_test/. Finally, the folder data/megaface_test/ looks like:

接下来,从这里下载 MegaFace 列表到 ~/data/face_recognition/megaface_test/。

最后,文件夹 data/megaface_test/ 是以下格式:

data
  ├── megaface_test
    ├── concat_list.txt
    ├── facescrub3530
    ├── megaface_distractor
    ├── raw
 

4、训练Training.

sh experiments/webface/res50-bs64-sz224-ep35/train.sh

5、监测Monitoring.

tensorboard --logdir experiments

6、恢复训练Resume training.

sh experiments/webface/res50-bs64-sz224-ep35/resume.sh 10 # e.g., resume from epoch 10

7、评估Evalution.

sh experiments/webface/res50-bs64-sz224-ep35/evaluation.sh 35 # e.g., evaluate epoch 35

8、特征值提取Feature extraction.

Firstly, specify the data_namedata_root and data_list under extract_info in the config file. The data_list is a txt file containing an image relative filename in each line. Then execute:

首先在配置文件extract_info下指定data_name、data_root和data_list。 data_list 是一个 txt 文件,每行包含一个图像相关文件名。 然后执行:

# e.g., extract features with epoch 35 model.
# The feature file is stored in checkpoints/ckpt_epoch_35_[data_name].bin
sh experiments/webface/res50-bs64-sz224-ep35/extract.sh 35 

六、Baselines

1、Trained using Webface

archLFWCFP-FFCFP-FPAgeDB-30calfwcplfw
resnet-500.98500.98040.91170.89670.90130.8423

2、Trained using MS1M

archLFWCFP-FFCFP-FPAgeDB-30calfwcplfwvgg2-FPmegaface
densenet-1210.99480.99460.95940.96150.95000.90570.94180.8665
densenet-121-arc0.99730.99790.96010.97280.95580.90630.94960.9287

Note that the hyper-parameters are not adjusted to optimal. Hence, they are not the state-of-the-art face recognition models. You may download those pre-trained models here.

请注意,超参数未调整为最佳。 因此,它们不是最先进的人脸识别模型。 您可以在此处下载这些预训练模型。

七、引用

If you find this code useful in your research, please cite:

@inproceedings{zhan2018consensus,
  title={Consensus-Driven Propagation in Massive Unlabeled Data for Face Recognition},
  author={Zhan, Xiaohang and Liu, Ziwei and Yan, Junjie and Lin, Dahua and Change Loy, Chen},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  pages={568--583},
  year={2018}
}

八、待续

TODO (Will carry out in a "Buddha-like" way)

  1. Implement distributed training.
  2. Adjust hyper-parameters.
  3. Multi-task experiments.

TODO(会以“佛性”的方式进行)
1、实施分布式训练。
2、调整超参数。
3、多任务实验。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

易小侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值