ultrasound-nerve-segmentation icon indicating copy to clipboard operation
ultrasound-nerve-segmentation copied to clipboard

About model.fit

Open pratikgorji opened this issue 7 years ago • 1 comments

When i try to run this model.fit, now i am getting the following Error

model.fit(X_train, Y_train, batch_size= 10, epochs=3, verbose=1)

ValueError: Error when checking target: expected conv2d_60 to have shape (None, 1, 320, 1) but got array with shape (286, 1, 320, 528)

I am implementing Unet in Keras using theano as backend, X_train - total 286 images Y_train - total 286 above images but it is segmented by some local thresholding method.

Actual image image size : rows, cols = 327, 532 But i am giving this : rows, cols = 320, 528 because there are 4 MaxPooling2D layers in my topology !! (As it is suggested by Marko Jocić )

Can someone Please help me to resolve this error ?

pratikgorji avatar Jun 23 '17 05:06 pratikgorji

If you are using Theano backend, make sure you specify that in the code:

K.set_image_data_format('channels_first')

and

Input((1, img_rows, img_cols))

Also make sure you change your preprocessing functions accordingly.

jocicmarko avatar Jun 27 '17 10:06 jocicmarko