Skip to content

Commit

Permalink
ValueError: total size of new array must be unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
cl0ver012 committed May 14, 2018
1 parent 931e23c commit bf4414c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions model.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
import keras.backend as K
from keras.layers import Input, Conv2D, UpSampling2D, BatchNormalization, ZeroPadding2D, MaxPooling2D
from keras.models import Model
from custom_layers.unpooling_layer import Unpooling
from keras.utils import plot_model

from custom_layers.unpooling_layer import Unpooling


def create_model(img_rows, img_cols, channel=4):
# Encoder
input_tensor = Input(shape=(img_rows, img_cols, channel), name='input')
x = ZeroPadding2D((1, 1))(input_tensor)
x = Conv2D(64, (3, 3), activation='relu', name='conv1_1')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(64, (3, 3), activation='relu', name='conv1_2')(x)
x = MaxPooling2D((2, 2), strides=(2, 2))(x)
orig_1 = x
x = MaxPooling2D((2, 2), strides=(2, 2))(x)

x = ZeroPadding2D((1, 1))(x)
x = Conv2D(128, (3, 3), activation='relu', name='conv2_1')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(128, (3, 3), activation='relu', name='conv2_2')(x)
x = MaxPooling2D((2, 2), strides=(2, 2))(x)
orig_2 = x
x = MaxPooling2D((2, 2), strides=(2, 2))(x)

x = ZeroPadding2D((1, 1))(x)
x = Conv2D(256, (3, 3), activation='relu', name='conv3_1')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(256, (3, 3), activation='relu', name='conv3_2')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(256, (3, 3), activation='relu', name='conv3_3')(x)
x = MaxPooling2D((2, 2), strides=(2, 2))(x)
orig_3 = x
x = MaxPooling2D((2, 2), strides=(2, 2))(x)

x = ZeroPadding2D((1, 1))(x)
x = Conv2D(512, (3, 3), activation='relu', name='conv4_1')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(512, (3, 3), activation='relu', name='conv4_2')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(512, (3, 3), activation='relu', name='conv4_3')(x)
x = MaxPooling2D((2, 2), strides=(2, 2))(x)
orig_4 = x
x = MaxPooling2D((2, 2), strides=(2, 2))(x)

x = ZeroPadding2D((1, 1))(x)
x = Conv2D(512, (3, 3), activation='relu', name='conv5_1')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(512, (3, 3), activation='relu', name='conv5_2')(x)
x = ZeroPadding2D((1, 1))(x)
x = Conv2D(512, (3, 3), activation='relu', name='conv5_3')(x)
x = MaxPooling2D((2, 2), strides=(2, 2))(x)
orig_5 = x
x = MaxPooling2D((2, 2), strides=(2, 2))(x)

# Decoder
# x = Conv2D(4096, (7, 7), activation='relu', padding='valid', name='conv6')(x)
Expand Down

0 comments on commit bf4414c

Please sign in to comment.