VGGFace2-pytorch
VGGFace2-pytorch copied to clipboard
PyTorch Face Recognizer based on 'VGGFace2: A dataset for recognising faces across pose and age'
PyTorch Face Recognizer based on 'VGGFace2: A dataset for recognising faces across pose and age'.
This repo implements training and testing models, and feature extractor based on models for VGGFace2 [1].
Pretrained models for PyTorch are converted from Caffe models authors of [1] provide.
Dataset
To download VGGFace2 dataset, see authors' site.
Preprocessing images
Faces should be detected and cropped from images before face images are fed to this face recognizer(demo.py).
There are several face detection programs based on MTCNN [3].
- PyTorch version: mtcnn-pytorch
- MXNet version: mxnet_mtcnn_face_detection
- Matlab version: MTCNN_face_detection_alignment
Pretrained models
The followings are PyTorch models converted from Caffe models authors of [1] provide.
| arch_type | download link |
|---|---|
resnet50_ft |
link |
senet50_ft |
link |
resnet50_scratch |
link |
senet50_scratch |
link |
Extracting features
Usage:
python demo.py extract <options>
Options
--arch_typenetwork architecture type (default:resnet50_ft):resnet50_ftResNet-50 which are first pre-trained on MS1M, and then fine-tuned on VGGFace2senet50_ftSE-ResNet-50 trained likeresnet50_ftresnet50_scratchResNet-50 trained from scratch on VGGFace2senet50_scratchSE-ResNet-50 trained likeresnet50_scratch
--weight_fileweight file converted from Caffe model(see here)--resumecheckpoint file used in feature extraction (default: None). If set,--weight_fileis ignored.--dataset_dirdataset directory--feature_dirdirectory where extracted features are saved--test_img_list_fileimage file for which features are extracted--log_filelog file--meta_fileMeta information file for VGGFace2,identity_meta.csvin Meta.tar.gz--batch_sizebatch size (default: 32)--gpuGPU devide id (default: 0)--workersnumber of data loading workers (default: 4)--horizontal_fliphorizontally flip images specified in--test_img_list_file
Testing
Usage:
python demo.py test <options>
Options
--arch_typenetwork architecture type (default:resnet50_ft):resnet50_ftResNet-50 which are first pre-trained on MS1M, and then fine-tuned on VGGFace2senet50_ftSE-ResNet-50 trained likeresnet50_ftresnet50_scratchResNet-50 trained from scratch on VGGFace2senet50_scratchSE-ResNet-50 trained likeresnet50_scratch
--weight_fileweight file converted from Caffe model(see here)--resumecheckpoint file used in test (default: None). If set,--weight_fileis ignored.--dataset_dirdataset directory--test_img_list_filetext file containing image files used for validation, test or feature extraction--log_filelog file--meta_fileMeta information file for VGGFace2,identity_meta.csvin Meta.tar.gz--batch_sizebatch size (default: 32)--gpuGPU devide id (default: 0)--workersnumber of data loading workers (default: 4)
Training
Usage:
python demo.py train <options>
Options
--arch_typenetwork architecture type (default:resnet50_ft):resnet50_ftResNet-50 which are first pre-trained on MS1M, and then fine-tuned on VGGFace2senet50_ftSE-ResNet-50 trained likeresnet50_ftresnet50_scratchResNet-50 trained from scratch on VGGFace2senet50_scratchSE-ResNet-50 trained likeresnet50_scratch
--weight_fileweight file converted from Caffe model(see here), and used for fine-tuning--resumecheckpoint file used to resume training (default: None). If set,--weight_fileis ignored.--dataset_dirdataset directory--train_img_list_filetext file containing image files used for training--test_img_list_filetext file containing image files used for validation, test or feature extraction--log_filelog file--meta_fileMeta information file for VGGFace2,identity_meta.csvin Meta.tar.gz--checkpoint_dircheckpoint output directory--confignumber of settings and hyperparameters used in training--batch_sizebatch size (default: 32)--gpuGPU devide id (default: 0)--workersnumber of data loading workers (default: 4)
Note
VGG-Face dataset, described in [2], is not planned to be supported in this repo. If you are interested in models for VGG-Face, see keras-vggface.
References
-
ZQ. Cao, L. Shen, W. Xie, O. M. Parkhi, A. Zisserman, VGGFace2: A dataset for recognising faces across pose and age, 2018.
site, arXiv -
Parkhi, O. M. and Vedaldi, A. and Zisserman, A., Deep Face Recognition, British Machine Vision Conference, 2015. site
-
K. Zhang and Z. Zhang and Z. Li and Y. Qiao, Joint Face Detection and Alignment Using Multitask Cascaded Convolutional Networks, IEEE Signal Processing Letters, 2016. arXiv