deepinsight / insightface

State-of-the-art 2D and 3D Face Analysis Project
https://insightface.ai
22.84k stars 5.35k forks source link

CurricularFace loss #2016

Open eeric opened 2 years ago

eeric commented 2 years ago

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 commented 2 years ago

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.

wzhiyuan2016 commented 2 years ago

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

eeric commented 2 years ago

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

littlegaofei commented 2 years ago

你好,我仿照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,请问这是什么问题,你具体是怎么解决的呢

eeric commented 2 years ago

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