keras TimeDistributed说明及用法
一般的网络输入为4维度(batch,height,width,channels),当有其他维度,时间或者其他,例如mask RCNN的ROI维度,这时就需要使用TimeDistributed。
# ROI Pooling
# Shape: [batch, num_rois, pool_height, pool_width, channels]
# Conv layers
x = KL.TimeDistributed(KL.Conv2D(256, (3, 3), padding="same"),
name="mrcnn_mask_conv1")(x)
x = KL.TimeDistributed(BatchNorm(axis=3),
name='mrcnn_mask_bn1')(x)
x = KL.Activation('relu')(x)