-
-
Save ravnoor/a8d26c485cd39c1d9dd21af7c27ac232 to your computer and use it in GitHub Desktop.
V-Net in Keras and tensorflow
hello,
I run U-Net using dice loss, but the predicted images are all white. Do you know what's wrong?
def dice_coef(y_true, y_pred):
smooth = 1
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
intersection = K.sum(y_true_f * y_pred_f)
return (2. * intersection +smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) +smooth)
def dice_coef_loss(y_true, y_pred):
print("dice loss")
return 1-dice_coef(y_true, y_pred)
....
model.compile(optimizer = Adam(lr = 1e-5), loss = dice_coef_loss, metrics = ['accuracy'])
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Thanks for your implementation.
With;
model.fit(X, y, batch_size=4, epochs=5, verbose=1)
I have following exception;
InvalidArgumentError (see above for traceback): Incompatible shapes: [8388608] vs. [1048576]
I just wonder, do you have any idea, why I am getting this exception?
Thank you, regards.