Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
cl0ver012 committed May 18, 2018
1 parent 661d29e commit 6773e59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ def migrate_model(new_model):
new_layer = new_layers[i + 1]
new_layer.set_weights(old_layer.get_weights())

flatten = old_model.get_layer('flatten')
f_dim = flatten.input_shape
print('f_dim: ' + str(f_dim))
old_dense1 = old_model.get_layer('dense1')
input_shape = old_dense1.input_shape
output_dim = old_dense1.get_weights()[1].shape[0]
print('output_dim: ' + str(output_dim))
W, b = old_dense1.get_weights()
shape = (7, 7, 512, output_dim)
new_W = W.reshape(shape)
new_conv6 = new_model.get_layer('conv6')
new_conv6.set_weights([new_W, b])
# flatten = old_model.get_layer('flatten')
# f_dim = flatten.input_shape
# print('f_dim: ' + str(f_dim))
# old_dense1 = old_model.get_layer('dense1')
# input_shape = old_dense1.input_shape
# output_dim = old_dense1.get_weights()[1].shape[0]
# print('output_dim: ' + str(output_dim))
# W, b = old_dense1.get_weights()
# shape = (7, 7, 512, output_dim)
# new_W = W.reshape(shape)
# new_conv6 = new_model.get_layer('conv6')
# new_conv6.set_weights([new_W, b])

del old_model

Expand Down
6 changes: 3 additions & 3 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def build_encoder_decoder():
x = MaxPooling2D((2, 2), strides=(2, 2))(x)

# Decoder
x = Conv2D(4096, (7, 7), activation='relu', padding='valid', name='conv6')(x)
x = BatchNormalization()(x)
x = UpSampling2D(size=(7, 7))(x)
# x = Conv2D(4096, (7, 7), activation='relu', padding='valid', name='conv6')(x)
# x = BatchNormalization()(x)
# x = UpSampling2D(size=(7, 7))(x)

x = Conv2D(512, (1, 1), activation='relu', padding='same', name='deconv6', kernel_initializer='he_normal',
bias_initializer='zeros')(x)
Expand Down

0 comments on commit 6773e59

Please sign in to comment.