# TensorFlow函数：tf.nn.atrous_conv2d

## tf.nn.atrous_conv2d函数

``````tf.nn.atrous_conv2d(
value,
filters,
rate,
name=None
)``````

Atrous卷积.

``````output[batch, height, width, out_channel] =
sum_{dheight, dwidth, in_channel} (
filters[dheight, dwidth, in_channel, out_channel] *
value[batch, height + rate*dheight, width + rate*dwidth, in_channel]
)``````

Atrous卷积允许我们明确地控制在完全卷积网络中计算特征响应的密集程度.与双线性插值结合使用,它为 conv2d_transpose 在密集的预测任务(如语义图像分割、光流计算或深度估计) 中提供了一种替代方案.它还允许我们有效地扩大滤波器的视野,而不增加参数的数量或计算量.

``atrous_conv2d(value, filters, rate, padding=padding)``

``````paddings = ...
net = conv2d(net, filters, strides=[1, 1, 1, 1], padding="VALID")
crops = ...
net = batch_to_space(net, crops, block_size=rate)``````

``````net = atrous_conv2d(net, filters1, rate, padding="SAME")
net = atrous_conv2d(net, filters2, rate, padding="SAME")
...
net = atrous_conv2d(net, filtersK, rate, padding="SAME")``````

``````pad = ...  # padding so that the input dims are multiples of rate
net = conv2d(net, filters1, strides=[1, 1, 1, 1], padding="SAME")
net = conv2d(net, filters2, strides=[1, 1, 1, 1], padding="SAME")
...
net = conv2d(net, filtersK, strides=[1, 1, 1, 1], padding="SAME")

• value：类型为float的4-D Tensor,它需要采用默认的“NHWC”格式,它的形状是[batch, in_height, in_width, in_channels].
• filters：4-D Tensor与value具有相同类型并且形状为[filter_height, filter_width, in_channels, out_channels].filters的in_channels维度必须匹配value.Atrous卷积等效于具有有效高度filter_height + (filter_height - 1) * (rate - 1)和有效宽度filter_width + (filter_width - 1) * (rate - 1)的高采样滤波器的标准卷积,通过在filters的空间维度上沿着连续元素插入rate - 1零来产生.
• rate：正的int32.我们在整个height和width维度上对输入值进行采样的步幅.等效地,我们通过在height和width维度上插入零来上采样过滤器值的速率.在文献中,有时称相同的参数为input stride或dilation.
• name：返回张量的可选名称.

``````[batch, height - 2 * (filter_width - 1),
width - 2 * (filter_height - 1), out_channels]``````

``[batch, height, width, out_channels]``

• ValueError：如果输入/输出深度与filters形状不匹配,或者填充不是'VALID'或者'SAME'.

App下载