orobix / retina-unet

Retina blood vessel segmentation with a convolutional neural network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 0, 24, 128), (None, 0, 24, 64)]

baodingge opened this issue · comments

up1 = merge([UpSampling2D(size=(2, 2))(conv3), conv2], mode='concat', concat_axis=1)
File "/usr/local/lib/python2.7/dist-packages/keras/legacy/layers.py", line 460, in merge
name=name)
File "/usr/local/lib/python2.7/dist-packages/keras/legacy/layers.py", line 111, in init
node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/keras/legacy/layers.py", line 191, in _arguments_validation
'Layer shapes: %s' % (input_shapes))
ValueError: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 0, 24, 128), (None, 0, 24, 64)]

my keras version is 2.0.4
and i also change the keras.json file.
I try my best, and can not deal with this problem

I have solved this problem, my keras version is 2.0.4 . One important thing is thar conv2d has the attribute
data_format, we should explicitly specify data_format='channels_first', because we are using theano.data format is [channel, height, width].

Yes, the code was developed with keras 1.1, i'm working to upgrade to keras 2.

Sorry, did not have time to fix it. However, thanks to @GlastonburyC now the code is compatible with keras 2

You can ref https://zhuanlan.zhihu.com/p/29673286 for the solution. May be you also need Google translate.