I want to add this SE module to the ASPP to see if it can improve the accuracy of semantic segmentation. The tensorflow code of SE module is as follows:
def Global_Average_Pooling(x):
return global_avg_pool(x, name=‘Global_avg_pooling’)
def Dropout(x, rate, training) :
return tf.layers.dropout(inputs=x, rate=rate, training=training)
def Fully_connected(x, units):
return tf.layers.dense(inputs=x, use_bias=False, units=units)
def Squeeze_excitation_layer(inputs, n_filters):
n_filters=n_filters/16
net = Global_Average_Pooling(inputs)
net = Fully_connected(net, units=n_filters)
net = tf.nn.relu(net)
n_filters=n_filters*16
net = Fully_connected(net, units=n_filters)
net = tf.nn.sigmoid(net)
net = inputs * net
return net
I want to know how to convert this module to pytorch, because I just learned pytorch, and it can be converted to some basic statements, but this is a little difficult for me, I hope to get help