def resnet_PanSharpening_model_dense(self, pan_img, ms_img): def residual_block(inputs, output_channel, stride, scope): with tf.variable_scope(scope): net1 = Op.conv2(inputs, 3, output_channel, stride, use_bias=False, scope='conv_1') net1 = Op.batchnorm(net1) net1 = tf.nn.relu(net1) net2 = Op.conv2(tf.concat([inputs, net1], -1), 3, output_channel, stride, use_bias=False, scope='conv_2') net2 = Op.batchnorm(net2) net2 = tf.nn.relu(net2) return net2 with tf.variable_scope('Pan_model'): if self.is_training: with tf.name_scope('upscale'): ms_img = tf.image.resize_images( ms_img, [self.pan_size, self.pan_size], method=2) inputs = tf.concat([ms_img, pan_img], axis=-1) with tf.variable_scope('generator_unit'): # The input layer with tf.variable_scope('input_stage'): net = Op.conv2(inputs, 3, 64, 1, scope='conv') net = Op.batchnorm(net) net = tf.nn.relu(net) net = tf.concat([inputs, net], -1) # The residual block parts for i in range(1, 5 + 1, 1): name_scope = 'resblock_%d' % (i) net = residual_block(net, 64, 1, name_scope) with tf.variable_scope('resblock_output'): net = Op.conv2(net, 3, 4, 1, use_bias=False, scope='conv') net = tf.tanh(net) return net
def residual_block(inputs, output_channel, stride, scope): with tf.variable_scope(scope): net1 = Op.conv2(inputs, 3, output_channel, stride, use_bias=False, scope='conv_1') net1 = Op.batchnorm(net1) net1 = tf.nn.relu(net1) net2 = Op.conv2(tf.concat([inputs, net1], -1), 3, output_channel, stride, use_bias=False, scope='conv_2') net2 = Op.batchnorm(net2) net2 = tf.nn.relu(net2) return net2
def residual_block(inputs, output_channel, stride, scope): with tf.variable_scope(scope): net = Op.conv2(inputs, 3, output_channel, stride, use_bias=False, scope='conv_1') net = Op.batchnorm(net) net = Op.prelu_tf(net) net = Op.conv2(net, 3, output_channel, stride, use_bias=False, scope='conv_2') net = Op.batchnorm(net) net = net + inputs return net