ronghuaiyang / arcface-pytorch

1.74k stars 392 forks source link

The loss function seems to be error #29

Open Woolseyyy opened 5 years ago

Woolseyyy commented 5 years ago

The focal loss function seems to be differernt from the theory. The theory describes the loss as: -alpha (1-y')^gamma log(y') - (1-alpha) y'^gamma log(1-y') Besides, the arc metric also confuses me...ArcFace is modified based on softmax but there is nothing similiar to softmax in the metric code. Maybe I misunderstand the theory. I will be grateful if you point my errors out.

Woolseyyy commented 5 years ago

About the seconde question, I have found the answer. Torch.nn.CrossEntropyLoss() combines nn.LogSoftmax() and nn.NLLLoss() in one single class.

CodeMonkZy commented 5 years ago

About the seconde question, I have found the answer. Torch.nn.CrossEntropyLoss() combines nn.LogSoftmax() and nn.NLLLoss() in one single class.

have you try sphereloss in metric.py?i can`t make loss decrease

ReverseSystem001 commented 4 years ago

About the seconde question, I have found the answer. Torch.nn.CrossEntropyLoss() combines nn.LogSoftmax() and nn.NLLLoss() in one single class.

have you try sphereloss in metric.py?i can`t make loss decrease

my training loss is not decline too, how do you resolve this problem???

LucasWangZH commented 4 years ago

I think the focal loss here is wrong.

wenzhengzeng commented 3 years ago

About the seconde question, I have found the answer. Torch.nn.CrossEntropyLoss() combines nn.LogSoftmax() and nn.NLLLoss() in one single class.

So is the implementation here of ArcFace loss right?