cavalleria / cavaface

face recognition training project(pytorch)
MIT License
456 stars 88 forks source link

CircleLoss correctness #12

Closed golunovas closed 4 years ago

golunovas commented 4 years ago

Hi, It seems like there is a difference in the CircleLoss implementation comparing to the original implementation. In your implementation, the loss is computed like this: log(sum(exp(logits_p))sum(exp(logits_n))) https://github.com/cavalleria/cavaface.pytorch/blob/90b8a1c2d689552b5d7e5c703c02c583dfce1a6c/head/metrics.py#L585 But the original formula is: log(1+sum(exp(logits_p))sum(exp(logits_n))) https://github.com/qianjinhao/circle-loss/blob/master/circle_loss.py#L38

cavalleria commented 4 years ago

thanks for your question, loss =softplus(output) in head setting. https://github.com/cavalleria/cavaface.pytorch/blob/534cda3d6a43c0daa314772bac80968f343de3c2/train.py#L186

golunovas commented 4 years ago

Sorry, I didn't notice it. Thank you for the quick response.