Open jganzabal opened 6 years ago
did you find the solution? i am getting nan loss
@gulzainali98 adding K.epsilon() fixed Nan
can this be used on simple classification? i.e i am using CelebA dataset. Image just have to be classified into 40 different classes there is no object detection.
can this be used on simple classification? i.e i am using CelebA dataset. Image just have to be classified into 40 different classes there is no object detection.
did you fixed your problem? I add K.epsilon() and still get nan
@roywang2011 you need to make sure pt_1
does not become 1 and pt_0
does not become 0 when using gamma<1.0
. Clip both with K.epsilon()
.
I add K.epsilon()
,and it works! :thumbsup:
I guess I would be safe to add epsilon to the log. Something like: return -K.sum(alpha K.pow(1. - pt_1, gamma) K.log(K.epsilon()+pt_1))-K.sum((1-alpha) K.pow( pt_0, gamma) K.log(1. - pt_0 + K.epsilon()))