Closed JunMa11 closed 6 years ago
When create the Unet,
with tf.name_scope('unet'): pred = UNet().create_model(img_shape, backend='tf', tf_input=img)
The following error occurred
Traceback (most recent call last): File "G:/Tensorflow/unet-tensorflow-keras-master/train.py", line 52, in <module> pred = UNet().create_model(img_shape, backend='tf', tf_input=img) File "G:\Tensorflow\unet-tensorflow-keras-master\model.py", line 84, in create_model conv9 = ZeroPadding2D(padding=(ch[0], ch[1], cw[0], cw[1]), dim_ordering=dim_ordering)(conv9) File "E:\Program Files\python35\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper return func(*args, **kwargs) File "E:\Program Files\python35\lib\site-packages\keras\layers\convolutional.py", line 1307, in __init__ 'Found: ' + str(padding)) ValueError: `padding` should have two elements. Found: (6, 6, 6, 6)
Besides, there are many warning
build UNet ... G:\Tensorflow\unet-tensorflow-keras-master\model.py:37: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), name="conv1_1", activation="relu", data_format="channels_last", padding="same")` conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same', dim_ordering=dim_ordering, name='conv1_1')(inputs) G:\Tensorflow\unet-tensorflow-keras-master\model.py:38: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), activation="relu", padding="same", data_format="channels_last")` conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same', dim_ordering=dim_ordering)(conv1) G:\Tensorflow\unet-tensorflow-keras-master\model.py:39: UserWarning: Update your `MaxPooling2D` call to the Keras 2 API: `MaxPooling2D(data_format="channels_last", pool_size=(2, 2))` pool1 = MaxPooling2D(pool_size=(2, 2), dim_ordering=dim_ordering)(conv1) G:\Tensorflow\unet-tensorflow-keras-master\model.py:40: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), activation="relu", padding="same", data_format="channels_last")` conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same', dim_ordering=dim_ordering)(pool1) ...
Looking forward to your reply Best wishes to you
Just change the conv9 in model.py to : conv9 = ZeroPadding2D(padding=((ch[0], ch[1]),( cw[0], cw[1])), dim_ordering=dim_ordering)(conv9)
I assume you are using Keras 2+
When create the Unet,
The following error occurred
Besides, there are many warning
Looking forward to your reply Best wishes to you