Coder Social home page Coder Social logo

thufuturelab / gluon-face Goto Github PK

View Code? Open in Web Editor NEW
268.0 20.0 51.0 1.41 MB

An unofficial Gluon FR Toolkit for face recognition. https://gluon-face.readthedocs.io

License: MIT License

Python 99.69% Shell 0.31%
mxnet gluon face-recognition loss-functions pretrained-models arcface center-loss gluoncv sphereface cosine-loss

gluon-face's People

Contributors

haoxintong avatar jiqirenno1 avatar pistony avatar smartadpole avatar thomasdelteil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gluon-face's Issues

Stop Updating Announcement.

We have a good time when writing this and I still love this project. We seem to have done a awesome thing.
But for some irresistible cause we may hard to update this.
This project is still could be used for some time so don't worry.
We sincerely thank for all of contributors and people who love this.
I may contribute part of this to Gluon-cv when I'm not busy.

-- Comes from @PistonY @haoxintong

为什么在examples中有些LOSS要对features和weights做L2归一化??

NormDense中有些LOSS会对features和weights做L2归一化后再用全连接来分类?

class NormDense(HybridBlock):
# noinspection PyMethodOverriding
def hybrid_forward(self, F, x, weight, *args, **kwargs):
if self._weight_norm:
weight = F.L2Normalization(weight, mode='instance')
if self._feature_norm:
x = F.L2Normalization(x, mode='instance', name='fc1n')
return F.FullyConnected(data=x, weight=weight, no_bias=True,
num_hidden=self._classes, name='fc7')

pls help me

Help me. I want to run arcface.

This problem occurs.

[03:25:12] src/base.cc:84: Upgrade advisory: this mxnet has been built against cuDNN lib version 7301, which is older thanthe oldest version tested by CI (7600). Set MXNET_CUDNN_LIB_CHECKING=0 to quiet this warning.Traceback (most recent call last): File "train_arcloss.py", line 93, in warmup_lr=lr / 10, warmup_epochs=warmup_epochs, 3='linear'TypeError: init() got an unexpected keyword argument 'warmup_lr'

In the gluon docs,
warmup_lr, warmup_epochs, and warmup_mode
don't seem to be commented.

So when I commented out line 93, I also ran into the following problem:

It seems to work well but at the end

Traceback (most recent call last): File "train_arcloss.py", line 110, in lr_scheduler.update(i, epoch)
TypeError: update() takes 2 positional arguments but 3 were given

关于center_loss的疑问

在center_loss中为了可视化:
增加一个(256,2)的全连接层来学习出坐标x,y,用它来和中心点计算center_loss
增加的这个全连接层形状输出是(batch,2),后面接分类的全连接层后输出是(batch,10)
就是把256通道变成2个通道,再由2个通道变成10个通道(10分类,10个数字),
网络结构通道都是图像减小通道数增加的过程,现在为了可视化最后2层变成了
通道急剧减少然后再增加,这个过程会不会影响最后一层信息的流动啊?
难道这样不影响分类??

手机端测试速度很慢?

你好,我使用训练好的模型移植到ncnn中,在手机端(小米8 高通845处理器)测试,一张人脸图像112*112仅抽取特征要50ms左右,使用insightface提供的训练好的模型来测试,基本也是一样的时间。但是mobilefacenet的论文中给出的测试时间是25ms之内,请问你们在手机端测试过吗?为什么会有这么大的差距呢?谢谢

Inf in label and predictions using float16

The reason why float 16 yields nan is because the number of classes exceeds the range of float16. Thus, some of the labels are inf and cause the network to diverge. Some of the predictions are also inf. Any solutions?

使用不同大小的图片进行训练

我们想测试一下不同分辨率的识别精度问题,如果要不同的分辨率,是不是只用修改transform函数增加一个resize,还有backbone对应修改下采样就可以了。其它有和分辨率有关的要求吗?

I found that using -IR actually make model smaller....

suppose in_c == out_c
for basic_block:
total_params = 1 * 1 * in_c * 4 * out_c + 3 * 3 * 4 * out_c * 4 * out_c + 1 * 1 * 4 * out_c * out_c = 152 * out_c * out_c
-IR block:
total_params = 3 * 3 * in_c * 4 * out_c + 3 * 3 * 4 * out_c * out_c = 72 * out_c * out_c

A question about ringloss on minst dataset.

In resources/mnist-euclidean directory, several pictures show how feature distribution changes on different training sets.I'm a little confused about the result of ringloss.

with a higher learning rate of 0.1, ringloss leads to a better result on trainset; but with a lower learning rate of 0.01, it leads to a better result on valset. Why would ringloss lead to such a strange result?

unittest of your lossess

请问 有写关于这些loss的单元测试吗,这样的话修改和学习都会方便很多呢

MXNet Nightly Builds Moved to S3

Hi,

MXNet nightly builds have been moved from PyPI to S3 (pypi/support#243). If this project requires the nightly builds for CI validation, please make sure that your CI pipeline now takes the nightly builds from https://dist.mxnet.io/python. Furthermore, as MXNet 1.7 and 2.0 are currently in progress simultaneously, we are releasing nightly builds for both 1.x and 2.x. Take mxnet-cu102 for example:

If you need the nightly builds for 1.x:

pip install --pre "mxnet-cu102<2" -f https://dist.mxnet.io/python

If you need the nightly builds for 2.x:

pip install --pre "mxnet-cu102>=2" -f https://dist.mxnet.io/python

Feel free to close this issue if the necessary changes have been made, or If the project doesn't rely on MXNet nightly builds. Thanks.

与inisightFace处理FC7层不一样

代码中处理FC7层权重的学习率和权重衰减与insightFace不一样
insightFace中是单独对FC7层权重做了学习率和权重衰减的:
_weight = mx.symbol.Variable("fc7_weight", shape=(args.num_classes, args.emb_size), lr_mult=args.fc7_lr_mult, wd_mult=args.fc7_wd_mult)
但是gluon-face是做的全局学习率和权重衰减

loss warm up 后使用arcloss会挂掉

我在训练过程中,也是按照你脚本中设定的loss warm up =35000来设置,先使用softmax做warm up,然后使用arcloss,到34500个迭代后就挂掉,出现下面错误:

Traceback (most recent call last): File "train_script.py", line 269, in <module> train() File "train_script.py", line 201, in train losses = [Loss(yhat, y.astype(dtype, copy=False)) for yhat, y in zip(outputs, labels)] File "train_script.py", line 201, in <listcomp> losses = [Loss(yhat, y.astype(dtype, copy=False)) for yhat, y in zip(outputs, labels)] File "/home/trainer/anaconda3/envs/mxnet_py36/lib/python3.6/site-packages/mxnet/gluon/block.py", line 548, in __call__ out = self.forward(*args) File "/home/trainer/anaconda3/envs/mxnet_py36/lib/python3.6/site-packages/mxnet/gluon/block.py", line 925, in forward return self.hybrid_forward(ndarray, x, *args, **params) File "/home/trainer/anaconda3/envs/mxnet_py36/lib/python3.6/site-packages/gluonfr-1.0.1-py3.6.egg/gluonfr/loss.py", line 210, in hybrid_forward File "/home/trainer/anaconda3/envs/mxnet_py36/lib/python3.6/site-packages/mxnet/gluon/loss.py", line 347, in hybrid_forward loss = -F.pick(pred, label, axis=self._axis, keepdims=True) File "<string>", line 89, in pick File "/home/trainer/anaconda3/envs/mxnet_py36/lib/python3.6/site-packages/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke ctypes.byref(out_stypes))) File "/home/trainer/anaconda3/envs/mxnet_py36/lib/python3.6/site-packages/mxnet/base.py", line 253, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: Shape inconsistent, Provided = [256,1], inferred shape=[256,256]

float16训练

你好,请问你们使用float16训练了吗?精度和速度如何呢?使用float16训练会经常出现NAN,你们的训练log可以提供一下吗?谢谢

Collection of face related papers

Moved to https://gluon-face.readthedocs.io/zh/latest/papers/index.html


2018

Recognition

  • 1810.09951 GhostVLAD for set-based face recognition

2019

Recognition

  • 1901.05903 A Performance Comparison of Loss Functions for Deep Face Recognition
  • 1902.11007 MassFace: an efficient implementation using triplet loss for face recognition
  • 1904.09658 Probabilistic Face Embeddings

Detection

  • 1904.00386 PyramidBox++: High Performance Detector for Finding Tiny Face

Others

  • 1904.11685 A Survey on Face Data Augmentation
  • 1904.01740 FaceQnet: Quality Assessment for Face Recognition based on Deep Learning

代码无法训练

昨天使用代码来跑一下模型试试,结果发现一直卡在 train_script.py中的这一行batch = next(batch_generator),我用的是4个v100,显存占用是正常的,但是gpu利用率一直为零,应该是一直卡在数据加载这一块。
单步调试发现在函数中

def inf_train_gen(loader):
    while True:
        for batch in loader:
            yield batch       

执行完这一句for batch in loader:,就一直卡在这里了

环境如下:
ubuntu16.04
mxnet版本是1.5.0

代码只修改了如下2处:
(1)将~/.mxnet/datasets/face的所有路径替换为自己的数据路径
(2)mobilefacenet-arcface.sh内容修改如下:
python train_script.py --dataset emore --batch-size 1760 --ctx 0,1,2,3 --dtype float32 -j 24 --lr 0.35 --lr-mode cosine --lr-warmup-iters 5000 --wd 0.00004 --no-wd -s 64 -m 0.5 -t lfw,agedb_30 -n mobilefacenet --niters 86000 --loss arcface --loss-warmup-iters 35000 --hybrid --cat-interval 500

Exposing model_zoo package in API

Hi,

Great work on the gluon-fr toolkit. Any reason why the model_zoo package is not exposed in the API ? I see it has been commented out.

Thanks

About pretrained models.

We got some awesome results in FaceFrecognition.

Please look at our model_zoo

Network Loss Train Dataset Weight Norm Feature Norm Hyperparameter LFW Best Details
mobile-facenet ringloss emore Yes No lamda=0.01, lr=0.01, emb_size=512, batch_size=96*4 0.988167+-0.006431 Initialize of R is important, it's preferred to use a large value, like 20.
mobile-facenet arcloss emore Yes Yes lr=0.01, emb_size=512, s=32, m=0.5, batch_size=128*4 0.994667+-0.004137 Finetune the model of ringloss with acc 0.988
se_resnet18L arcloss emore Yes Yes lr=0.1, emb_size=512, s=64, m=0.5, batch_size=128*4 0.992167+-0.004947 Finetune the model of L2Loss with acc 0.655070
se_resnet50L arcloss emore Yes Yes lr=0.1, emb_size=512, s=64, m=0.5, batch_size=(32*4)*4 0.997000+-0.002867 Finetune the model of L2Loss with acc 0.97
attention56-nobnprelu arcloss emore Yes Yes lr=0.1, emb_size=256, s=64, m=0.5, batch_size=32*32 0.997000+-0.002867 Finetune the model of L2Loss at iter 5000

InsightFace result with L-Resnet50-IR:

Flip False True
lfw: 0.997167+-0.002693 0.998167+-0.002291
calfw: 0.957833+-0.012089 0.977583+-0.020624
cplfw: 0.886500+-0.017020 0.943944+-0.045293
cfp_fp: 0.910571+-0.018683 0.932960+-0.036008
agedb_30: 0.977667+-0.005925 0.936161+-0.040025
cfp_ff: 0.998286+-0.001895 0.948447+-0.040840

Our SE_LResnet50:

Flip False True
lfw: 0.997000+-0.002867 0.997167+-0.002587
calfw: 0.957167+-0.010410 0.977083+-0.020488
cplfw: 0.914333+-0.013421 0.955389+-0.033797
cfp_fp: 0.968714+-0.008438 0.955800+-0.025998
agedb_30: 0.963167+-0.008896 0.958387+-0.023843
cfp_ff: 0.997429+-0.002195 0.964105+-0.025539
vgg2_fp: 0.951400+-0.008002 0.962209+-0.022288

怎样输出params和json?

你好,训练完模型之后,原始代码在训练过程中只保存了params文件,并没有json文件。我在训练过程中使用train_net.export()函数来导出params和json文件,我看了一下params有45.7MB,json文件147kb。和你给的训练好的模型对比了一下,差别好大,你给的params才3.9MB,并且你给的json文件和我导出的json文件网络结构不一样,你是怎么做的呢?麻烦指导一下哈,谢谢

prediction code?

how get the output vector from a picture?can you provide the prediction codes? thank you

使用ArcLoss时loss值nan?

您好,感谢您的工作,最近训练模型时用到了arcloss,得到的loss值是nan,请问您有遇到这个问题吗?另外cosloss看代码实现没有看到跟余弦、正弦相关的 计算,这个感觉跟定义不太一样。希望能得到您的解答!

Eval on megaface, IJB and IFRT

I'm now writing a eval script on megaface, IJB(B/C) and a black-box feature ext for IFRT test.
I should do this two years before actually. I'll make a pr when I finish this.

update pip installation

Could you please release the current version to 1.0.2, the model_zoo package is still missing at this point that would be helpful to have it in the pip release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.