In my computational pipeline, I have used custom function which is going to create custom keras blocks, and I used this blocks multiple times with Conv2D. At the end, I got two different tensor which is features maps with different tensor shape: TensorShape([None, 21, 21, 64]) and TensorShape([None, 10, 10, 192]). In this case, using tf.keras.layers.concatenate to do concatenation is not working for me. Can anyone point me out how to concatenate this two tensors into one? Any idea to make this happen?
if I could able to concatenate the tensors with shape of TensorShape([None, 21, 21, 64]) and TensorShape([None, 10, 10, 192]), I want to do the following after the concatenation.
x = Conv2D(32, (2, 2), strides=(1,1), padding='same')(merged_tensors)
x = BatchNormalization(axis=-1)(x)
x = Activation('relu')(x)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Flatten()(x)
x = Dense(256)(x)
x = BatchNormalization()(x)
x = Activation('relu')(x)
x = Dropout(0.25)(x)
x = Dropout(0.25)(x)
x = Dense(10)(x)
x = Activation('softmax')(x)
outputs = x
model = tf.keras.Model(inputs=inputs, outputs=outputs)
I tried to reshape the tensors with shape of TensorShape([None, 21, 21, 64]) and TensorShape([None, 10, 10, 192]) in 1D convolution and do merge, then reshape the output back to 2d convolution. My way is not working. Can anyone suggest possible way of doing this? Any thoughts?
update
I am still not sure the way of getting output shape of concatenation is going to be TensorShape([None, 21+10, 21+10, 192+64]) or not because I am not sure it does make sense in terms of mathematics standpoint. How to make this concatenation easily and correct? what would be right shape of concatenated one? Any idea?