dmitrysarov / clDice

pyTorch implementation of clDice
28 stars 5 forks source link

TensorFlow or Keras version #1

Closed ntelo007 closed 3 years ago

ntelo007 commented 4 years ago

Hi,

could you help me create a Keras or TensorFlow version of this loss function?

jacobkoenig commented 4 years ago

@ntelo007 try this repository where I converted this code to work with Keras/Tensorflow

ntelo007 commented 4 years ago

Thank you. Have you tested this loss function? Did you retrieve comparable results with the paper? Does it work?

dmitrysarov commented 4 years ago

on an experiment with noisy labels (labels came from something like Frangi filter + manual filtration), I retrieve sensible gain image On clean dataset usage of dice+cldice result in minor performance gain expressed in variance reduction image Please share your experience

ntelo007 commented 4 years ago

Unfortunately, it is probably not working. I tried training a road detection algorithm and these are the results of the training procedure (both for only clDice and with the combination with dice):

Only with the clDice loss:

image image

clDice + dice: image image

Any ideas why this is happening?

dmitrysarov commented 4 years ago

it looks like the whole training procedure is wrong. Try first to overfit your model on a small dataset (it can be several images, but not one if you use batchnorm). If the model is able to remember small dataset labels, then move to the evaluation of the validation procedure.

ntelo007 commented 4 years ago

The training procedure works well for many other loss functins. This means that the problem occurs only when I use the soft_clDice_loss function. This is the prediction result:

clDice_same_problem

It's obvious that the soft_skeletonization procedure is not correct. Because I don't think the math behind the comparison is the problem.

dmitrysarov commented 4 years ago

@ntelo007 have you look by eyes on the train image after soft_skeletonization? How is model loss log curves look like when you train only on dice?

dmitrysarov commented 4 years ago

in my experiments, cldice makes prediction prone to the thickness rather thinness