如题,deeplabv3中提供的网络图如下所示:
tensorflow 的代码实现如下所示:
def atrous_spatial_pyramid_pooling(inputs, filters=256, regularizer=None): #ASPP层
'''
Atrous Spatial Pyramid Pooling (ASPP) Block
'''
pool_height = tf.shape(inputs)[1]
pool_width = tf.shape(inputs)[2]
resize_height = pool_height
resize_width = pool_width
# Atrous Spatial Pyramid Pooling
# Atrous 1x1
aspp1x1 = tf.layers.conv2d(inputs=inputs, filters=filters, kernel_size=(1, 1),
padding='same', kernel_regularizer=regularizer,
name='aspp1x1')
# Atrous 3x3, rate = 6
aspp3x3_1 = tf.layers.conv2d(inputs=inputs, filters=filters, kernel_size=(3, 3),
padding='same', dilation_rate=(12, 12), kernel_regulariz