keras-team / keras-contrib

Keras community contributions
MIT License
1.58k stars 651 forks source link

Questiona about jaccard loss #329

Open mrgloom opened 5 years ago

mrgloom commented 5 years ago

Here is jaccard loss implementation: https://github.com/keras-team/keras-contrib/blob/master/keras_contrib/losses/jaccard.py

Why jaccard loss is prefered to dice loss?

Why we apply K.abs? as I understand y_true, y_pred should be already in [0,1] range. https://github.com/keras-team/keras-contrib/blob/master/keras_contrib/losses/jaccard.py#L31

Why default smooth=100? how smooth parameter affect training?

As I understand adding smooth to denominator prevents division by zero(why not smooth=eps=1e-6?), but why it's added to numerator?

Why we multiply loss by smooth at the end? https://github.com/keras-team/keras-contrib/blob/master/keras_contrib/losses/jaccard.py#L34

hmeine commented 5 years ago

I wonder if there are some problems with that definition:

  1. Does it work with one-hot-encoded data? In particular, I would've expected axis to be everything but the channel dimension, but it is just the channel dimension.
  2. Shouldn't it skip the background label? (At least optionally)
  3. I also wondered about the multiplication at the end.
  4. Furthermore, smooth = 100 looks like a really arbitrary default.