I am trying to use a Keras Siamese layer in combination with a common layer Convolution2D. I don’t need an input to go through other layers to a layer Siamese, but for a layer I Siameseneed to specify input layers. I can't figure out how to create input layers so that they match the conv level input. The only concrete example of the used layer Siamesethat I could find is in tests , where the Denselevels (with vector inputs) are used as input. Basically, I want the input level to allow me to specify image sizes as input so that they can be transferred to a common conv layer.
The code has something like the following:
img_rows = 28
img_cols = 28
img_input_shape = (1, img_rows, img_cols)
shared = Sequential()
shared.add(Convolution2D(nb_filters, nb_conv, nb_conv,
border_mode='valid',
input_shape=img_input_shape))
shared.add(Activation('relu'))
right_input_layer = SomeInputLayer(input_shape=img_input_shape)
left_input_layer = SomeInputLayer(input_shape=img_input_shape)
siamese = Siamese(shared, [left_input_layer, right_input_layer], merge_mode='concat')
model = Sequential()
model.add(siamese)
model.compile(loss=contrastive_loss, optimizer='rmsprop')
SomeInputLayer? ?