I am trying to make a Siamese convolutional neural network based on this tutorial 2. Basic form of the code i’m using to build this model:
def sister_cnn(inputShape, outputshape = 32): 

    inputs = Input(inputShape)    

    x = Conv2D(...)(inputs)                       
    x = MaxPooling2D(..)(x)
                .
                .
    outputs = Dense(outputshape, activation="..")(x)                                      

    model = Model(inputs, outputs)                                           
    return model

dataA = Input(shape=DATA_SHAPE)
dataB = Input(shape=DATA_SHAPE)
featureExtractor = sister_cnn(DATA_SHAPE)
featuresA = featureExtractor(dataA)
featuresB = featureExtractor(dataB)

distance = Lambda(custom_function)([featuresA, featuresB])
outputs = Dense(1, activation="sigmoid")(distance)
model = Model(inputs=[dataA, dataB], outputs=outputs)

# 'model' being the final siamese network i built


I want to get the output of an internal layewr of this model, more specifically, i want to get the output of the two 'sister_cnn’s which are essentially a 32 element arrays. None of these methods 4 worked for me. I keep getting some form of “Graph disconnected: cannot obtain value for tensor Tensor Input Keras Python” error when i acces model’s layer with index 2.
From what i could gather, it seems like these is some flaw with respect to connections of different layers in the way i build my model. But i’m not sure what to do to properly connect them, or maybe the issue is something else…
What should i do? Any help will be highly appreciated!