Skip to content

Instantly share code, notes, and snippets.

@ravnoor
Forked from prhbrt/Keras.ipynb
Created April 24, 2017 02:38
Show Gist options
  • Save ravnoor/a8d26c485cd39c1d9dd21af7c27ac232 to your computer and use it in GitHub Desktop.
Save ravnoor/a8d26c485cd39c1d9dd21af7c27ac232 to your computer and use it in GitHub Desktop.
V-Net in Keras and tensorflow
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MinuteswithMetrics
Copy link

What dataset was your model used on?

@pathak-ashutosh
Copy link

It's the PROMISE12 dataset.

@hakanbulu
Copy link

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 am using same dataset with yours.
  • Load data.ipynb works fine.
  • I have tried with different batch_size, i.e. 4,5,10,50
  • The model's summary is exactly same with yours.

I just wonder, do you have any idea, why I am getting this exception?

Thank you, regards.

  • Hakan

@jizhang02
Copy link

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