Hi everyone,
i'm trying to implement a specific architecture in Keras and i'm in trouble. The architecture is explained in this paper
https://www.mdpi.com/2076-3417/10/16/5426 and i also add images here to be more explicative.
I try to explain in the simplest way i can what i want:
- two cnn in parallel
- a concatenation layer for the outputs
- one dense layer
- a lstm layer
- two dense layer in parallel
- two output layer
This is my code for now
def build_model():
rgb = MobileNetV2(input_shape=(640, 480, 6), include_top=False, weights= None, pooling='avg')
depth = MobileNetV2(input_shape=(640, 480, 6), include_top=False, weights= None, pooling='avg')
for layer in rgb.layers:
for layer in depth.layers:
rgbd = Concatenate(name="rgbd_concatenate")([rgb.output, depth.output])
out = Dense(rgbd.shape[1], activation='relu')(rgbd)
cnn = Model(inputs=[rgb.input, depth.input], outputs=[out])
"""
return Sequential(
[
TimeDistributed(cnn, input_shape=[???]),
LSTM(256, return_sequences=True),
TimeDistributed(Dense(256, 'relu')),
TimeDistributed(Dense(256, 'relu')),
TimeDistributed(Dense(7))
]
)
"""
For now the model is ok, but then i try to use the commented part, i don't understand what shape i has to give to the input in order to concatenate the cnn with the lstm using TimeDistributed layer. In addition, I think TimeDistributed cannot accept two inputs so i don't know how to pass my input shape to TimeDistributed
Does anyone know how to implement this kind of architecture?
Thank in advance for the attention.