共享视觉模型

共享视觉模型

'''
from keras.layers import merge, Conv2D, MaxPooling2D, Input, Dense, Flatten
from keras.models import Model
digit_input = Input(shape=(27, 27,1))
x = Conv2D(64, (3, 3))(digit_input)
x = Conv2D(64, (3, 3))(x)
x = MaxPooling2D((2, 2))(x)
out = Flatten()(x)
vision_model = Model(digit_input, out)
digit_a = Input(shape=(27, 27,1))
digit_b = Input(shape=(27, 27,1))
out_a = vision_model(digit_a)
out_b = vision_model(digit_b)
concatenated = Concatenate(axis=-1)([out_a, out_b])
out = Dense(1, activation='sigmoid')(concatenated)
classification_model = Model([digit_a, digit_b], out)
print(classification_model.summary())
'''

你可能感兴趣的:(共享视觉模型)