-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dice coef in keras #13085
Comments
shouldn't it be |
Hello sir, getting this error while training the model with the dice loss
ERROR :
Please help me resolve this :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to implement 3D U-net in keras for medical image segmention.My data(LiTS Dataset,3 classes,background\liver\tumor) ara very imbalance,so crossentropy loss will only predict background.So I try the dice loss for it.I had tried many implement of dice loss,it always got high dice coef,but only predict background either.Here are my implement,shape of tensor is (batch,width,height,depth,num of classes).
So I dicide to see the 3rd class's dice coef during the train(because the 3rd class(tumor) is so small).I use the follow implement for metrics.
Strange things happen here
1、My implement of dice coef,dice_coef_fun_mean and dice_coef_fun_flatten get the same result,but it have difference in mathematics
2、After training for a while,categorical_accuracy wil get the same result with dice_coef_fun_mean and dice_coef_fun_flatten
3、dice_coef_dice=(2*dice_coef_intersection+smooth)/(dice_coef_union+smooth) is mathematically correct,but the result is wrong
Here are the begining log of train:
The dice_coef_intersection,dice_coef_union and dice_coef_dice of the first batch ara correct,but after that they went all wrong.
Here are the log After training for a while:
System information
So what's wrong with my code?or it's a bug in keras?
#10890
#2994
#3611
#9395
The text was updated successfully, but these errors were encountered: