Implementing a Siamese NN in Keras

As mentioned by Matias Valdenegro, Keras already has an example of Siamese network. The example uses only dense layers, though.

Your problem is that you need to add a Flatten layer between the convolutional layers and the dense layers to have a correct shape, see this Keras CNN example

These 2 examples should help you build your Siamese network.


You don't need a Siamese Layer, you just need to use the Keras functional API to create a model with two inputs and one output.

Seems that Keras examples already contain a model that is very similar to the one you are implementing.