deepinsight / insightface

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

partial_fc_v2.py how does the backward work ,if margin_softmax is arcface #2255

Open vinjancai opened 1 year ago

vinjancai commented 1 year ago

https://github.com/deepinsight/insightface/blob/master/recognition/arcface_torch/partial_fc_v2.py 165 rows
logits = self.margin_softmax(logits, labels)

there are many in_place operation . can the margin_softmax(arcface) backward ?

with torch.no_grad():
    target_logit.arccos_()
    logits.arccos_()
    final_target_logit = target_logit + self.m2
    logits[index_positive, labels[index_positive].view(-1)] = final_target_logit
    logits.cos_()
logits = logits * self.s  
WuKeyu commented 1 year ago

i have a same question. @vinjancai have you found the answer?

supertx commented 2 weeks ago

😢any answer?