wujiyang / face_pytorch Goto Github PK
View Code? Open in Web Editor NEWface recognition algorithms in pytorch framework, including arcface, cosface, sphereface and so on
License: Apache License 2.0
face recognition algorithms in pytorch framework, including arcface, cosface, sphereface and so on
License: Apache License 2.0
有些时候我们需要直接利用训练好的模型进行一些测试,而并没有训练的硬件条件。请问能分享一下训练好的模型吗?特别是ResNet50的两个(在CASIA和MS1M上训练的)模型。谢谢!
您好~运行了您的代码之后,训练集 训练了几个epoch之后,acc一直是0,数据和类别(webface)应该没有问题,您的代码我删去了最后一个bn(有这个bn会报错),请问这正常吗? 如果不正常可能是什么原因造成的呢?非常感谢
Hi~
Are the results reproducible from the default settings (e.g., total epochs = 11) in train.py?
Are there different hyper-parameters for different CNN under different scenarios?
(e.g., ResNet vs. MobileFaceNet, Small dataset vs. Large dataset?)
Thank you.
Could you tell me the detail about how to made the webface_align_train.list? I did not have this label of the casia-webface dataset.
Hi,
Do we need to normalize the images of Facescrub and Megaface before feeding them to the model to get features? Thank you for reading.
我用MTCNN裁剪成112X96,老是漏检
The test results of your recreated megaface are very different from those in Arcface paper. Do you know the problem there?
Hi~
Thank you for your great work!
The megaface devkit requires 2 files (i.e., megaface and facescrub) for performance evaluation.
However, the eval_megaface.py generates .feat in each folder. (do we wrongly used the script?)
How do we evaluate the performance on megaface?
Thank you.
我看代码中没有令 W = norm(W),只是在计算损失的时候没有将||W||乘进来,这样是正确的吗?
Hello,
I tested the output of your arcface loss function and compared it to the original implementation of Insightface (mxnet). I gave them the loss weights as a parameter. Unfortunately the output obtained is not the same for both functions. You can find the script for comparing both functions in the following link: https://github.com/williamCorrea85/arcface/blob/master/arcface_comp_for_github.py
I use net&margin to realize classification for three types, and i choose the “softmax” margin. Unfortunately, the output seems illegal, eg.[7266.1162, -10416.0654, 1476.0536] which not in [0,1].
Thank you for your reading.
-park jimin
phi_theta_ = (self.cur_lambda * cos_theta + phi_theta) / (1 + self.cur_lambda)
What is the purpose of this line?
It looks like taking a weighted sum of cos and the margined loss.
Could you please hint me?
Hi, I choose the MS-celeb-1M as the training set .But it seems that the training speed is very slow .How long does it take to train usually ?
class BottleNeck_IR_SE(nn.Module):
def init(self, in_channel, out_channel, stride):
super(BottleNeck_IR_SE, self).init()
if in_channel == out_channel:
self.shortcut_layer = nn.MaxPool2d(1, stride)
else:
self.shortcut_layer = nn.Sequential(
nn.Conv2d(in_channel, out_channel, kernel_size=(1, 1), stride=stride, bias=False),
nn.BatchNorm2d(out_channel)
)
I wonder why you use nn.MaxPool2d(1, stride) when in_channel == out_channel? I didn't find it in the raw ResNet and ArcFaceNet. I think there should be none like you write in the cbam.py:
if dim_match: self.shortcut_layer = None
Wating for your response and thanks a lot!
class SEResNet_IR(nn.Module):
def __init__(self, num_layers, feature_dim=512, drop_ratio=0.4, mode = 'ir'):
super(SEResNet_IR, self).__init__()
assert num_layers in [50, 100, 152], 'num_layers should be 50, 100 or 152'
assert mode in ['ir', 'se_ir'], 'mode should be ir or se_ir'
blocks = get_blocks(num_layers)
if mode == 'ir':
unit_module = BottleNeck_IR
elif mode == 'se_ir':
unit_module = BottleNeck_IR_SE
self.input_layer = nn.Sequential(nn.Conv2d(3, 64, (3, 3), 1, 1, bias=False),
nn.BatchNorm2d(64),
nn.PReLU(64))
self.output_layer = nn.Sequential(nn.BatchNorm2d(512),
nn.Dropout(drop_ratio),
Flatten(),
nn.Linear(512 * 7 * 7, feature_dim),
nn.BatchNorm1d(feature_dim))
您默认的是选择resnet100的,那如果我使用50以及152,需要修改 nn.Linear(512 * 7 * 7, feature_dim)吗?或者arcfacenet这个脚本需要修改吗?
我训练到4400次时出现了个问题 ValueError: Expected more than 1 value per channel when training, got input size [1, 512],百度之后是说我batchsize存在1个样本,可是我计算了没有出现1个样本,不知道怎么解决,如果您知道的话麻烦告诉我一下
I download the dataset produced in #5 ,and try to reproduce the result showed in README. However, the train accuracy stuck in 0. Can you give me some details about how modified the code?
我使用facenet里面的align_dataset_mtcnn.py将CASIA对齐,可是它会使人脸变胖,怎么才能像您提供的lfw一样对齐的那么好,还有仿射变换呢?我找了好几天都没有找到方法。我的英文不太好,我看到您的id猜测您是**人,所以写中文了,请见谅
您好,下载了您提供的数据集里面没有train.list文件,您可以提供吗?还是我们可以从哪里获取?刚刚做人脸还不太懂,如果问题太蠢还请多多包涵
Hi,
Thanks for this compilation.
I'm trying to do one on one face verification specifically based on mobilefacenet. How to compare distance between two feature vectors generated by model. I found loss function for mobilefacenet is arcface. If that is the similarity measure, how to compute arcface loss between two feature vectors.
Please share your thoughts.
Regards!
我使用自己的CASIA-WebFace的准确率只有98%,想试试您的
Hi~
Thank you for your great work.
Does the reported accuracy result on validation data (e.g. LFW, MegaFace) apply face alignment process (e.g., MTCNN)?
Thank you.
mu = np.mean(np.concatenate((featureLs[valFold[0], :], featureRs[valFold[0], :]), 0), 0)
mu = np.expand_dims(mu, 0)
featureLs = featureLs - mu
featureRs = featureRs - mu
HI,thanks for your jobs?. Could i ask you a problem? What does the "mu" mean in the lfw_eval.py?
您好,我正在尝试复现A-softmax。这是您的代码中的相关操作,想问一下您这个cur_lambda和Iter的作用是什么?非常感谢
`
def forward(self, input, label):
self.iter += 1
self.cur_lambda = max(self.lambda_min, self.base * (1 + self.gamma * self.iter) ** (-1 * self.power))
cos_theta = F.linear(F.normalize(input), F.normalize(self.weight))
cos_theta = cos_theta(-1, 1)
cos_m_theta = self.margin_formula(self.m)(cos_theta)
theta = cos_theta.data.acos()
k = ((self.m * theta) / math.pi).floor()
phi_theta = ((-1.0) ** k) * cos_m_theta - 2 * k
phi_theta_ = (self.cur_lambda * cos_theta + phi_theta) / (1 + self.cur_lambda)
norm_of_feature = torch.norm(input, 2, 1)
one_hot = torch.zeros_like(cos_theta)
one_hot.scatter_(1, label.view(-1, 1), 1)
output = one_hot * phi_theta_ + (1 - one_hot) * cos_theta
output *= norm_of_feature.view(-1, 1)
return output
`
Thanks a lot!
The link(http://trillionpairs.deepglint.com/data) provides 400400.When I resized the images to 112112,the train accuracy is 0.
I would very be grateful if you give me some advice!
Hi ,
Thanks for your great jobs, have you ever trained CBAM or Attention Nets, how about results?
Hi~
We trained mobilefacenet with 60 epochs on CASIA (small protocol) but still cannot achieved the reported accuracy (before removing noise).
Initial LR=0.1, and divided by 10 at epoch 36, 52, 58 respectively.
We wonder the required training epochs for achieving the reported results.
Thank you.
你好,我想麻烦问一下,--lfw_test_root', type=str, default='/media/sda/lfw/lfw_align_112',这个lfw_align_112里放的数据集是.bin格式的文件,还是包含.jpg图片的一个个文件夹。
您好:
使用您的代码我在lfw的得分可以达到99.6,但是实际应用场景会出现大批量的认错。为了不认错把阀值调高,又会出现认不出的情况。我初步分析是两个原因,一个是实际使用中有复杂的光照,还一个是训练数据集中大部分是欧美人脸,亚洲人脸很少。用欧美人脸训练出来的模型对亚洲人脸识别不好。请问您感觉还会有什么原因造成这种情况
You have done a great work!
But I have a question about the ArcFace_loss. How to understand the weigth as show bellow:
I think thay are stand for the parameters of the last fully connected layer. But I wonder how to upodate them. In your code, I think they are fixed values, are they?
Looking forward to your reply.
Hi,thank you for sharing this excellent repertory !
But when I want to eval my model, I have a question, what does the number 600 means in the ./dataset/lfw.py Line 47 ?
It has confuse me, could you tell me what does this number mean? Thanks.
Hi, could you provide the cleaned cropped MS-Celeb-1M training data and the list file. Thank you
I used the default parameters and train SE-ResNet50-IR on CASIA-WebFace dataset, but can't get the result on your ReadME page.
Finally Accuracy:
20200315-05:22:09 Finally Best Accuracy: LFW: 99.4000 in iters: 42000, AgeDB-30: 93.8333 in iters: 27000 and CFP-FP: 94.6714 in iters: 24000
So what are the skills in the training? Can you share the parameters of the results on the readme page?
Thank you.
我使用了默认的参数,在CASIA-WebFace数据集上训练。backbone是SE-ResNet50-IR。无法达到ReadME和论文的效果。能否分享下参数或者训练技巧呢?谢谢。
Thank for your work!
I want to convert arcface to tensorrt, but nn.BatchNorm1d(feature_dim)) do not support 2D in tensorrt. the error message is " what(): No converter registered for op type: Squeeze " .
In torch/onnx/symbolic.py, 2D tensor will be unsqueeze to 3D first and then squeeze to 2D after BatchNorm.
look forward to your replay! thank you!
Thank you for shareing your code.
I train the Mobilefacenet model,but only get 63% accuracy on LFW and 58% on AgeDB.
Can you give me some advice? I can not find reasons.
hi how are you using arcface as loss. I could only see Cross ENtropy loss in your implementation.
Hello,
Do you complete the ResNet100-based model?
Thanks
When I ran train.py, I got the error. Who knows why and how to solve it?
What does the parameter(scale_size) mean? Could I need to change it according to my dataset?
I got an error: RuntimeError: size mismatch, m1: [1 x 32768], m2: [25088 x 512] at /opt/conda/conda-bld/pytorch_1549628766161/work/aten/src/THC/generic/THCTensorMathBlas.cu:266.
My backbone is Res50_IR. I dont know how to fix this. What should i do ?
can you share pretrain?
您好!我在用您的代码跑的时候,训练时的accuracy信息一直显示为0,而loss则有下降,请问是什么原因呢?我的pytorch版本是0.4.0,是因为版本的原因吗?
Is there any chance to provide 112x112 aligned CASIA-WebFace and Cleaned MS-Celeb-1M dataset link with .jpg images and annotation files ? I am really sick on the .bin files ....
i am so sorry to ask for this easy question.....
but i dont know what the labels of casia webface dataset is..... and i dont know how to use it....
Hi~
Is the symbol @r represent the cleaned megaface dataset as stated in insighface paper?
The performance is improved significantly with symbol R in your experiments.
We tried the cleaned script, but it only cleaned 24 files which the improvement is little.
We would like to know the effect of the cleaned megaface if symbol R represents the noise removal.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.