costapt / vess2ret

A Keras implementation of pix2pix code adapted to generate retinal images from vessel networks.
MIT License
94 stars 42 forks source link

What is the backend? #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

I use tensorflow1.0, but it reports error as:

ValueError: Negative dimension size caused by subtracting 2 from 1 for 'Conv2D_8' (op: 'Conv2D') with input shapes: [?,1,1,512], [2,2,512,512]

costapt commented 7 years ago

We mainly developed the code using the Theano backend. But we tested on Tensorflow and it was working.

Can you provide a bit more information? What is the line that throws the exception?

ghost commented 7 years ago

Thanks for the reply. I thinks it is in models.oy, line 46 i = Input(shape=(in_ch, 512, 512)), and some similar lines. Because I notice that keras uses different conventions for 2D data, as:

For 2D data (e.g. image), "tf" assumes (rows, cols, channels) while "th" assumes (channels, rows, cols).[1]

costapt commented 7 years ago

Yes, that is true, thanks for reminding me that. You should set the "image_dim_ordering" to "th" on the ~/.keras/keras.json file.

Let me now if that solves your problem.

ghost commented 7 years ago

Thanks. It is OK now.