我正在修改MASK R-CNN模型,并且想在模型中添加环境信息。 在源模型中,在roi池之后,tensor_shape应该是[batch,num_boxes,col,行,通道],我添加了两个子锚,所以现在tensor_shape是[batch,num_boxes,3,col,行,通道]。 然后,我想使用TimeDistributed和ConvLSTM2D,但出现错误。这是我的代码:
x = PyramidROIAlign([pool_size, pool_size],
name="roi_align_classifier")([rois, image_meta] + feature_maps)
# Two 1024 FC layers (implemented with Conv2D for consistency)
x = KL.TimeDistributed(KL.ConvLSTM2D(filters=fc_layers_size, kernel_size=(pool_size, pool_size), padding='same',
return_sequences=True), name='mrcnn_class_LSTMConv1')(x)
x = KL.Activation('relu')(x)
x = KL.TimeDistributed(KL.ConvLSTM2D(filters=fc_layers_size, kernel_size=(1, 1),
return_sequences=False), name='mrcnn_class_LSTMConv2')(x)
x = KL.Activation('relu')(x)
x = KL.Lambda(lambda x: K.squeeze(x, [2,3,4]))(x)
错误:输入0与mrcnn_class_LSTMConv1层不兼容:预期ndim = 5,找到ndim = 6
我想知道为什么TimeDistributed函数似乎无法正常工作吗?