title: Convolutional2D Siamese Network in Keras
body: <p>I'm trying to use Keras's <a href="http://keras.io/layers/core/#siamese" rel="noreferrer">Siamese</a> layer in conjunction with a shared <code>Convolution2D</code> layer.
  I don't need the input to pass through any other layers before the <code>Siamese</code> layer but the <code>Siamese</code> layer requires that input layers be specified. I can't figure out how to create the input layers to match the input of the conv layer. The only concrete example of the <code>Siamese</code> layer being used I could find is in the <a href="https://github.com/fchollet/keras/blob/master/tests/keras/test_models.py#L445" rel="noreferrer">tests</a> where <code>Dense</code> layers (with vector inputs) are used as input. Basically, I want an input layer that allows me to specify the image dimensions as input so they can be passed on to the shared conv layer.</p>
  
  <p>In code I have something like the following:</p>
  
  <pre><code>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'))
  # .... more layers, etc.
  
  right_input_layer = SomeInputLayer(input_shape=img_input_shape) # what should SomeInputLayer be?
  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')
  </code></pre>
  
  <p>What should <code>SomeInputLayer</code> be? Or is my appraoch in general incorrect?</p>