deepinsight / insightface

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

Issue on computing `target_logit` in `CombinedMarginLoss` #2583

Closed 2proveit closed 1 month ago

2proveit commented 1 month ago

I have a trouble in customizing your code in to my project, in CombinedMarginLoss in target_logit computing. https://github.com/deepinsight/insightface/blob/15396be41e4b885cbdd0e17b3018dedbbcfb28b0/recognition/arcface_torch/losses.py#L40 In my opinion, the positive samples so does the positive label index should be added a margin, so the target_logit shape should be the shape of [len(index_positive),len(index_positive)], so every positive dim in every positive samples could get a mrigin, but after print the shape of the target_logit during training, i found the shape of the target_logit is [len(index_positive)] so, I guess the code of taeget_logit computing is as follows: target_logit = logits[index_positive][:, labels[index_positive].view(-1)] Thank you for your attention to this issue.