我有几个图像作为输入。我知道我可以使用三维卷积层,但我不想这样做。相反,我想在二维图像中找到模式
我的意思是每个图像都应该通过SeparableConv2D
,如下所示:
# this code raises an error ValueError: Input 0 of layer <name> is
# incompatible with the layer: expected ndim=4, found ndim=5.
model = Sequential([
Input(shape=(16, 128, 128, 1)),
SeparableConv2D(32, 3),
GlobalAvgPool3D(),
])
我知道,我可以在这里使用Conv3D
作为Conv2D
:
model = Sequential([
Input(shape=(16, 128, 128, 1)),
Conv3D(32, [1, 3, 3]),
GlobalAvgPool3D(),
])
但我需要的正是SeparableConv2D
也许我可以通过自定义图层或其他方式来完成?我甚至想不出一个解决办法
注意:每个输入包含多个图像
只是为了确保您的输入形状应该是4D。正如
SeparableConv2D
期望输入形状为4D的张量:(batch_size, channels, rows, cols)
如果数据格式为“首先通道”或形状为4D的张量:(batch_size, rows, cols, channels)
如果数据格式为“最后通道”工作示例
输出
如果你有像视频帧这样的图像,它们以某种方式相互连接 您可以在conv2d上循环并逐个传递它们
检查来自my git repo的视频动作识别示例
主要的想法是在这个模块中,我们将每个帧或图像分发到conv网络,然后我们对其进行重塑,甚至将其馈送到新的网络
相关问题 更多 >
编程相关推荐