This commit is contained in:
Jia Guo
2018-01-30 13:17:47 +08:00
3 changed files with 25 additions and 15 deletions

View File

@@ -5,7 +5,11 @@
### Recent Update
2018.01.26: Today we provide a pretrained *LResNet34E-IR* model on public drive. We also offer a simple python program to help you deploy this model to build your own face recognition application. The only requirement is using your own face detector to crop a face image before sending it to our program, no alignment needed. For single cropped face image(112x112), total inference time is only 17ms on my testing server(Intel E5-2660 @ 2.00GHz, Tesla M40, *LResNet34E-IR*). This model can archieve 99.65% on *LFW* and 96.7% on *MegaFace Rank1 Acc*. Please see deployment section for detail.
**`2018.01.29`**: Caffe *LResNet34E-IR* model is available now. We get it by converting original MXNet model to Caffe format but there's some performance drop. See [Pretrained-Models](#pretrained-models) for detail.
**`2018.01.27`**: MS1M clean list now available at [here](https://pan.baidu.com/s/1eTn6O62). Aligned facescrub images(112x112) can be downloaded [here](https://pan.baidu.com/s/1ghcpIH9).
**`2018.01.26`**: Today we provide a pretrained *LResNet34E-IR* model on public drive. We also offer a simple python program to help you deploy this model to build your own face recognition application. The only requirement is using your own face detector to crop a face image before sending it to our program, no alignment needed. For single cropped face image(112x112), total inference time is only 17ms on my testing server(Intel E5-2660 @ 2.00GHz, Tesla M40, *LResNet34E-IR*). This model can archieve 99.65% on *LFW* and 96.7% on *MegaFace Rank1 Acc*. Please see deployment section for detail.
### License
@@ -218,13 +222,21 @@ export MXNET_ENGINE_TYPE=ThreadedEnginePerDevice
4. Start to run megaface development kit to produce final result.
### Pretrained-Models
  1. [LResNet34E-IR@BaiduDrive](https://pan.baidu.com/s/1qZvZOxI)
  1. [LResNet34E-IR@BaiduDrive](https://pan.baidu.com/s/1jKahEXw)
Performance:
| Method | LFW(%) | CFP-FF(%) | CFP-FP(%) | AgeDB-30(%) | MegaFace1M(%) |
| ------- | ------ | --------- | --------- | ----------- | ------------- |
| Ours | 99.65 | 99.77 | 92.12 | 97.70 | **96.70** |
2. **`Caffe`** [LResNet34E-IR@BaiduDrive](https://pan.baidu.com/s/1bpRsvYR), got by converting above MXNet model.
Performance:
| Method | LFW(%) | CFP-FF(%) | CFP-FP(%) | AgeDB-30(%) | MegaFace1M(%) |
| ------- | ------ | --------- | --------- | ----------- | ------------- |
| Ours | 99.46 | 99.60 | 87.75 | 96.00 | **93.29** |
### Deployment
**Note:** In this part, we assume you are in the directory **`$INSIGHTFACE_ROOT/deploy/`**.

View File

@@ -2,19 +2,11 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from scipy import misc
import sys
import os
import argparse
import tensorflow as tf
import numpy as np
import mxnet as mx
import random
import cv2
import sklearn
from sklearn.decomposition import PCA
from time import sleep
from easydict import EasyDict as edict
parser = argparse.ArgumentParser(description='face model slim')
# general

View File

@@ -23,13 +23,19 @@ def get_fc1(last_conv, num_classes, fc_type):
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='pre_fc1')
fc1 = mx.sym.BatchNorm(data=fc1, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fc1')
elif fc_type=='F':
bn1 = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1')
relu1 = Act(data=bn1, act_type='relu', name='relu1')
body = mx.symbol.Dropout(data=relu1, p=0.4)
body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1')
body = mx.symbol.Dropout(data=body, p=0.4)
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='fc1')
elif fc_type=='G':
body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1')
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='fc1')
elif fc_type=='H':
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='fc1')
elif fc_type=='I':
body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=bn_mom, name='bn1')
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='pre_fc1')
fc1 = mx.sym.BatchNorm(data=fc1, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fc1')
elif fc_type=='G':
body = mx.symbol.Dropout(data=body, p=0.4)
elif fc_type=='J':
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='pre_fc1')
fc1 = mx.sym.BatchNorm(data=fc1, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fc1')
else: