FocalLoss_Keras icon indicating copy to clipboard operation
FocalLoss_Keras copied to clipboard

Clipping y_pred for stability of loss

Open manyu90 opened this issue 7 years ago • 1 comments

I think adding in a clipping might improve the stability of the focal loss implementation. This prevents the log(0) and the gradient of log(x) at x=1 from blowing up and giving nans eps = 1e-12 y_pred=K.clip(y_pred,eps,1.-eps)

manyu90 avatar Feb 08 '18 01:02 manyu90

@manyu90 I think your view is correct and thank you for your supplements.

hwei-hw avatar Feb 27 '18 04:02 hwei-hw