orobix / retina-unet

Retina blood vessel segmentation with a convolutional neural network
1.26k stars 468 forks source link

Exception: "concat" mode can only merge layers with matching output shapes except for the concat axis. #11

Closed ccccly closed 7 years ago

ccccly commented 7 years ago

Hi, I met this problem when I training the model: Traceback (most recent call last): File "./src/retinaNN_training.py", line 107, in model = get_unet(n_ch, patch_height, patch_width) #the U-net model File "./src/retinaNN_training.py", line 48, in get_unet up1 = merge([UpSampling2D(size=(2, 2))(conv3), conv2], mode='concat', concat_axis=1) File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.2-py2.7.egg/keras/engine/topology.py", line 1539, in merge name=name) File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.2-py2.7.egg/keras/engine/topology.py", line 1170, in init node_indices, tensor_indices) File "/usr/local/lib/python2.7/dist-packages/Keras-1.1.2-py2.7.egg/keras/engine/topology.py", line 1237, in _arguments_validation 'Layer shapes: %s' % (input_shapes)) Exception: "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)]

I don't know how to fix it. I'm new to keras, could you please to help me? Thank you for reading my question.

ccccly commented 7 years ago

I found the right way to solve the problem just as Filter size error #6 said: change "tf" in "image_dim_ordering" to "th", and the training works fine.