1
votes

I'm building a convolutional neural network which will contain a certain number of convolution and pooling layers. The problem is that i wanted to add some extra inputs after the feature extraction steps (convolution+pooling).

This extra inputs will be added to the flattened feature maps (first layer of the fully connected layer). I wanted to ask if is there any documentation to implement this, in tensorflow or (if i'm lucky) in keras. Thank you in advance and have a nice day.

1

1 Answers

2
votes

You can create such a model with tf.keras.models.Model class.

First, we can build the tf.keras.models.Sequential model for the Convolution and Pooling layers.

conv_model = tf.keras.models.Sequential( [ ... ] )

Then as you said, we need a fully connected Dense network. We create it similarly like the above model.

fc_model = tf.keras.models.Sequential( [ ... ] )

Then assemble the Input layers with the models we created.

input1 = Input( ... )
input2 = Input( ... )

cnn_output = conv_model( input1 )
output = fc_model( [ cnn_output , input2 ] )

model = tf.keras.models.Model( [ input1 , input2 ] , output )