So basically, I'm creating a CNN with Keras and Tensorflow backend. I'm at the point where I want to insert two layers that have the same input layer and then concatenate them, like so:
model = Sequential()
model.add(Convolution1D(128, (4), activation='relu',input_shape=(599,128))
model.add(MaxPooling1D(pool_size=(4)))
model.add(Convolution1D(256, (4), activation='relu')
model.add(MaxPooling1D(pool_size=(2)))
model.add(Convolution1D(256, (4), activation='relu')
model.add(MaxPooling1D(pool_size=(2)))
model.add(Convolution1D(512, (4), activation='relu')
# output 1 = GlobalMaxPooling1D() # from last conv layer
# output 2 = GlobalAveragePooling1D() # from last conv layer
# model.add(Concatenate((output 1, output 2))
# at this point output should have a shape of 1024,1 (from 512 * 2)
model.add(Dense(1024))
model.add(Dense(512))
To show this graphically in a simple way:
...
cv4
/ \
/ \
gMaxP|gAvrgP (each 512,)
\ /
\ /
dense(1024,)
I have the feeling I am missing something stupidly obvious. Can anybody wake me up?