insightface icon indicating copy to clipboard operation
insightface copied to clipboard

CurricularFace loss

Open eeric opened this issue 3 years ago • 5 comments

could author add CurricularFace loss to your insightface? CurricularFace loss: https://github.com/HuangYG123/CurricularFace/blob/master/head/metrics.py

it was occur error to mask = cos_theta > cos_theta_m with multi gpu

RuntimeError: The size of tensor a (6387) must match the size of tensor b (110) at non-singleton dimension 1

eeric avatar May 25 '22 11:05 eeric

the problem was temporarily resolved, to mask = cos_theta > cos_theta_m, it should be calculate again according to original code, while other code mimic the Arcface loss code.

eeric avatar May 26 '22 07:05 eeric

你好,如果使用partFc train 使用curricular loss计算会有问题,需要所有的logits值,请问你是怎么实现的呢,你是用distributed.all_gather么

wzhiyuan2016 avatar Jun 02 '22 09:06 wzhiyuan2016

1.首先要使用logits,不是embedding; 2.其次,你仿照Arcface loss(是insightface版本); 不涉及distributed.all_gather good luck!

eeric avatar Jun 02 '22 10:06 eeric

你好,我仿照Arcface loss将CurricularFace loss放在insightface下,但是多gpu使用的时候还是会报RuntimeError: The size of tensor a (256) must match the size of tensor b (90) at non-singleton dimension 0,请问这是什么问题,你具体是怎么解决的呢

littlegaofei avatar Sep 15 '22 06:09 littlegaofei

key content: index = torch.where(label != -1)[0] target_logit = cos_theta[index, label[index].view(-1)]

eeric avatar Sep 15 '22 13:09 eeric