Skip to content

Focal Loss implementation by Keras with TensorFlow backend

License

Notifications You must be signed in to change notification settings

BlueMelon715/FocalLoss_Keras

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Focal Loss

This is the keras implementation of focal loss with the backend of tensorflow. The Focal Loss is proposed for dealing with foreground-backgrou class imbalance. 论文中的结果图Fig1

Usage

Compile your model with focal loss as sample:

model.compile(optimizer = Adam(lr = 1e-4), loss = [focal_loss(gamma=2,alpha=0.6)], metrics = ['accuracy'])

Experiments

We implement U-Net: Convolutional Networks for Biomedical Image Segmentation with Focal Loss and get the results of different parameters as follows: 不同的图像fig2 fig1

曲线图fig3

fig2

From fig2, we found the improvement of focal is not ideal. And different parameters have a greater impact.

Breaks

We found that the Focal Loss is not stable and I think the main reason is parameters initialization. I wil try to fix it.

Others

The implemented code is based @zhixuhao' code

About

Focal Loss implementation by Keras with TensorFlow backend

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%