huangyangyu / NoiseFace

Noise-Tolerant Paradigm for Training Face Recognition CNNs [Official, CVPR 2019]
https://arxiv.org/pdf/1903.10357.pdf
MIT License
136 stars 23 forks source link

About nosie_data layer? #2

Open maryhh opened 5 years ago

maryhh commented 5 years ago

https://github.com/huangyangyu/NoiseFace/blob/0b434a2c0eb664ca2af36c3bc619629fb27dcf3f/layer/noise_tolerant_fr_layer.cpp#L152 hi,can you explain the noise_data layer?

maryhh commented 5 years ago

useful for testing on lfw?

huangyangyu commented 5 years ago

NoiseFace/layer/noise_tolerant_fr_layer.cpp

Line 152 in 0b434a2

noise_data = bottom[3]->cpu_data();

hi,can you explain the noise_data layer?

A1: The data of bottom[3], which label whether a sample is noise, is just used for drawing the histogram figure. You can train the network without it.

A2: Please refer to the paper for details. The main process is as follows: Init layer -> Update pdf -> Find endpoints and toppoints of pdf -> Compute weight of each sample -> Forward with weight -> Backward with weight Note: shield_forward means method1 Not shield_forward means method2

huangyangyu commented 5 years ago

useful for testing on lfw?

Don't understand. Which part do you mean?

maryhh commented 5 years ago

thank you for your reply! there is another question https://github.com/huangyangyu/NoiseFace/blob/0b434a2c0eb664ca2af36c3bc619629fb27dcf3f/layer/noise_tolerant_fr_layer.cpp#L409 weight_data is the batch samples's gt weights , if we use method2 , fix_cos should be arc_gt_cos x weight_data[i] , i don't understand this line code. 我理解的是经过arcface后的fc6_margin在gt位置已经变成cos(a+m) ,论文提出的方法是在这里相应乘上经过计算后的权重对吗?那这里是不是应该是top[ixdim+gt] x= weight_data[i],top 在之前已经拷贝了 fc6_margin 的参数是吗?

huangyangyu commented 5 years ago

thank you for your reply! there is another question NoiseFace/layer/noise_tolerant_fr_layer.cpp

Line 409 in 0b434a2

for (int j = 0; j < dim; j++)

weight_data is the batch samples's gt weights , if we use method2 , fix_cos should be arc_gt_cos x weight_data[i] , i don't understand this line code. 我理解的是经过arcface后的fc6_margin在gt位置已经变成cos(a+m) ,论文提出的方法是在这里相应乘上经过计算后的权重对吗?那这里是不是应该是top[ixdim+gt] x= weight_data[i],top 在之前已经拷贝了 fc6_margin 的参数是吗?

是的,参考论文中的公式10,普通softmax是w s cos(\theta),sphereface、arcface、cosface之类的是w s [cos(a*\theta+b)-c]. 到所有类中心的cos都需要乘这个权重,可以参考normface.