Skip to content

Commit

Permalink
update network
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhuXing committed Mar 31, 2020
1 parent 63ade49 commit eb19f54
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/02_train/02_01_train_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,23 @@ def build_model():

# share weights both inputs
inputs = layers.Input(shape = (160, 160, 1))
feature = layers.Conv2D(32, kernel_size = 3, padding = 'same', activation = 'relu')(inputs)
feature = layers.Conv2D(32, kernel_size = 3, activation = 'relu')(inputs)
feature = layers.MaxPooling2D(pool_size = 2)(feature)
feature = layers.Conv2D(32, kernel_size = 3, padding = 'same', activation = 'relu')(feature)
feature = layers.Conv2D(64, kernel_size = 3, activation = 'relu')(feature)
feature = layers.MaxPooling2D(pool_size = 2)(feature)
feature = layers.Conv2D(64, kernel_size = 3, activation = 'relu')(feature)
feature_model = Model(inputs = inputs, outputs = feature)

# show feature model summary
feature_model.summary()

# two feature models that sharing weights
x1_net = feature_model(x1)
x2_net = feature_model(x2)

# subtract features
net = layers.Subtract()([x1_net, x2_net])
net = layers.Conv2D(32, kernel_size = 3, padding = 'same', activation = 'relu')(net)
net = layers.Conv2D(64, kernel_size = 3, activation = 'relu')(net)
net = layers.MaxPooling2D(pool_size = 2)(net)
net = layers.Flatten()(net)
net = layers.Dense(64, activation = 'relu')(net)
Expand Down

0 comments on commit eb19f54

Please sign in to comment.