models.py
def stack_decoder(self, input_tensor, skip_connection_tensor): # -> tensor
        """
        Performs one decoding stack of U-net but with batch norm and bilinear upsampling to keep image sizes the same.
        """
        # Set number of feature maps equal to the number of channels/maps in skip_connection_tensor:
        output_num_feature_channels = skip_connection_tensor.get_shape()[3].value
        up = tf.layers.conv2d_transpose(input_tensor, output_num_feature_channels, [3, 3], strides=2, padding="SAME", activation=tf.nn.relu, kernel_initializer=self.weights_initializer)#, name='Up')
        up = self.batch_normalization(up)

        old_height = up.get_shape()[1].value
        old_width = up.get_shape()[2].value
        new_height = skip_connection_tensor.get_shape()[1].value
        new_width = skip_connection_tensor.get_shape()[2].value
        # Bilinear upsample `input_tensor` if up and skip_connection_tensor image dims are not equal (If in put image dims are power of 2, this condition should not be entered):
        if (old_height != new_height) or (old_width != new_width):
            # Bilinear upscale so that up can be concatenated with skip_connection_tensor:
            upsample_size = tf.Variable([new_height, new_width], tf.int32)
            up = tf.image.resize_images(
                up,
                upsample_size, # size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images.
                method=ResizeMethod.BILINEAR,
                align_corners=True)

        up = tf.concat([skip_connection_tensor, up], 3)
        conv = tf.layers.conv2d(up,  output_num_feature_channels, [3, 3], padding="SAME", activation=tf.nn.relu, kernel_initializer=self.weights_initializer)
        conv = tf.layers.conv2d(conv,  output_num_feature_channels, [3, 3], padding="SAME", activation=tf.nn.relu, kernel_initializer=self.weights_initializer)
        return self.batch_normalization(conv)

        Performs one decoding stack of U-net but with batch norm and bilinear upsampling to keep image sizes the same.
        
Performs one decoding stack of U-net but with batch norm and bilinear upsampling to keep image sizes the same.
Performs one decoding stack of U - net but with batch norm and bilinear upsampling to keep image sizes the same .
def stack_decoder(self, input_tensor, skip_connection_tensor): 
        output_num_feature_channels = skip_connection_tensor.get_shape()[3].value
        up = tf.layers.conv2d_transpose(input_tensor, output_num_feature_channels, [3, 3], strides=2, padding="SAME", activation=tf.nn.relu, kernel_initializer=self.weights_initializer)
        up = self.batch_normalization(up)
        old_height = up.get_shape()[1].value
        old_width = up.get_shape()[2].value
        new_height = skip_connection_tensor.get_shape()[1].value
        new_width = skip_connection_tensor.get_shape()[2].value
        if (old_height != new_height) or (old_width != new_width):
            upsample_size = tf.Variable([new_height, new_width], tf.int32)
            up = tf.image.resize_images(
                up,
                upsample_size, 
                method=ResizeMethod.BILINEAR,
                align_corners=True)
        up = tf.concat([skip_connection_tensor, up], 3)
        conv = tf.layers.conv2d(up,  output_num_feature_channels, [3, 3], padding="SAME", activation=tf.nn.relu, kernel_initializer=self.weights_initializer)
        conv = tf.layers.conv2d(conv,  output_num_feature_channels, [3, 3], padding="SAME", activation=tf.nn.relu, kernel_initializer=self.weights_initializer)
        return self.batch_normalization(conv)
def stack_decoder ( self , input_tensor , skip_connection_tensor ) : output_num_feature_channels = skip_connection_tensor . get_shape ( ) [ 3 ] . value up = tf . layers . conv2d_transpose ( input_tensor , output_num_feature_channels , [ 3 , 3 ] , strides = 2 , padding = "SAME" , activation = tf . nn . relu , kernel_initializer = self . weights_initializer ) up = self . batch_normalization ( up ) old_height = up . get_shape ( ) [ 1 ] . value old_width = up . get_shape ( ) [ 2 ] . value new_height = skip_connection_tensor . get_shape ( ) [ 1 ] . value new_width = skip_connection_tensor . get_shape ( ) [ 2 ] . value if ( old_height != new_height ) or ( old_width != new_width ) : upsample_size = tf . Variable ( [ new_height , new_width ] , tf . int32 ) up = tf . image . resize_images ( up , upsample_size , method = ResizeMethod . BILINEAR , align_corners = True ) up = tf . concat ( [ skip_connection_tensor , up ] , 3 ) conv = tf . layers . conv2d ( up , output_num_feature_channels , [ 3 , 3 ] , padding = "SAME" , activation = tf . nn . relu , kernel_initializer = self . weights_initializer ) conv = tf . layers . conv2d ( conv , output_num_feature_channels , [ 3 , 3 ] , padding = "SAME" , activation = tf . nn . relu , kernel_initializer = self . weights_initializer ) return self . batch_normalization ( conv )
Performs one decoding stack of U-net but with batch norm and bilinear upsampling to keep image sizes the same.
Performs one decoding stack of U - net but with batch norm and bilinear upsampling to keep image sizes the same .
# -> tensor """
        Performs one decoding stack of U-net but with batch norm and bilinear upsampling to keep image sizes the same.
        """ # Set number of feature maps equal to the number of channels/maps in skip_connection_tensor: #, name='Up') # Bilinear upsample `input_tensor` if up and skip_connection_tensor image dims are not equal (If in put image dims are power of 2, this condition should not be entered): # Bilinear upscale so that up can be concatenated with skip_connection_tensor: # size: A 1-D int32 Tensor of 2 elements: new_height, new_width. The new size for the images.
self
input_tensor
skip_connection_tensor