orobix / retina-unet

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

UpSampling2D (mode='Concat' issue #25

Closed saeedalahmari3 closed 7 years ago

saeedalahmari3 commented 7 years ago

up1 = merge([UpSampling2D(size=(2, 2))(conv3),conv2], mode='concat', concat_axis=1) This line is causing this error (

Traceback (most recent call last): File "retinaNN_training.py", line 144, in model = get_unet(nb_epoch,img_width,img_hight) #the U-net model File "retinaNN_training.py", line 47, in get_unet up1 = merge([UpSampling2D(size=(2, 2))(conv3),conv2], mode='concat', concat_axis=1) File "/share/apps/tensorflow_anaconda2/envs/tensorflow/lib/python2.7/site-packages/Keras-1.2.0-py2.7.egg/keras/engine/topology.py", line 1680, in merge name=name) File "/share/apps/tensorflow_anaconda2/envs/tensorflow/lib/python2.7/site-packages/Keras-1.2.0-py2.7.egg/keras/engine/topology.py", line 1299, in init node_indices, tensor_indices) File "/share/apps/tensorflow_anaconda2/envs/tensorflow/lib/python2.7/site-packages/Keras-1.2.0-py2.7.egg/keras/engine/topology.py", line 1371, 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, 128, 84, 84), (None, 64, 85, 85)] ) Although I changed dim-ordering to "th", and Keras version 1.2.0. ???

saeedalahmari3 commented 7 years ago

Oh, my bad, The images dimensions I have are (1,170,170) which cause problems since maxpooling followed by Upsampling will not give the same dimensions when concatenating. I resized my images to (1,160,160) and it is working fine.