ravens/models/resnet.py
def identity_block(input_tensor, kernel_size, filters, stage, block, activation=True, include_batchnorm=False):
    """The identity block is the block that has no conv layer at shortcut.

    # Arguments
        input_tensor: input tensor
        kernel_size: default 3, the kernel size of
            middle conv layer at main path
        filters: list of integers, the filters of 3 conv layer at main path
        stage: integer, current stage label, used for generating layer names
        block: 'a','b'..., current block label, used for generating layer names

    # Returns
        Output tensor for the block.
    """
    filters1, filters2, filters3 = filters
    batchnorm_axis = 3
    conv_name_base = 'res' + str(stage) + block + '_branch'
    bn_name_base = 'bn' + str(stage) + block + '_branch'

    x = tf.keras.layers.Conv2D(filters1, (1, 1),
                               dilation_rate=(1, 1),
                               kernel_initializer='glorot_uniform',
                               name=conv_name_base + '2a')(input_tensor)
    if include_batchnorm:
        x = tf.keras.layers.BatchNormalization(axis=batchnorm_axis, name=bn_name_base + '2a')(x)
    x = tf.keras.layers.ReLU()(x)

    x = tf.keras.layers.Conv2D(filters2, kernel_size,
                               dilation_rate=(1, 1),
                               padding='same',
                               kernel_initializer='glorot_uniform',
                               name=conv_name_base + '2b')(x)
    if include_batchnorm:
        x = tf.keras.layers.BatchNormalization(axis=batchnorm_axis, name=bn_name_base + '2b')(x)
    x = tf.keras.layers.ReLU()(x)

    x = tf.keras.layers.Conv2D(filters3, (1, 1),
                               dilation_rate=(1, 1),
                               kernel_initializer='glorot_uniform',
                               name=conv_name_base + '2c')(x)
    if include_batchnorm:
        x = tf.keras.layers.BatchNormalization(axis=batchnorm_axis, name=bn_name_base + '2c')(x)

    x = tf.keras.layers.add([x, input_tensor])

    if activation:
        x = tf.keras.layers.ReLU()(x)
    return x
The identity block is the block that has no conv layer at shortcut.

    # Arguments
        input_tensor: input tensor
        kernel_size: default 3, the kernel size of
            middle conv layer at main path
        filters: list of integers, the filters of 3 conv layer at main path
        stage: integer, current stage label, used for generating layer names
        block: 'a','b'..., current block label, used for generating layer names

    # Returns
        Output tensor for the block.
    
The identity block is the block that has no conv layer at shortcut.

Returns
Output tensor for the block.
The identity block is the block that has no conv layer at shortcut . Returns Output tensor for the block .
def identity_block(input_tensor, kernel_size, filters, stage, block, activation=True, include_batchnorm=False):
    filters1, filters2, filters3 = filters
    batchnorm_axis = 3
    conv_name_base = 'res' + str(stage) + block + '_branch'
    bn_name_base = 'bn' + str(stage) + block + '_branch'
    x = tf.keras.layers.Conv2D(filters1, (1, 1),
                               dilation_rate=(1, 1),
                               kernel_initializer='glorot_uniform',
                               name=conv_name_base + '2a')(input_tensor)
    if include_batchnorm:
        x = tf.keras.layers.BatchNormalization(axis=batchnorm_axis, name=bn_name_base + '2a')(x)
    x = tf.keras.layers.ReLU()(x)
    x = tf.keras.layers.Conv2D(filters2, kernel_size,
                               dilation_rate=(1, 1),
                               padding='same',
                               kernel_initializer='glorot_uniform',
                               name=conv_name_base + '2b')(x)
    if include_batchnorm:
        x = tf.keras.layers.BatchNormalization(axis=batchnorm_axis, name=bn_name_base + '2b')(x)
    x = tf.keras.layers.ReLU()(x)
    x = tf.keras.layers.Conv2D(filters3, (1, 1),
                               dilation_rate=(1, 1),
                               kernel_initializer='glorot_uniform',
                               name=conv_name_base + '2c')(x)
    if include_batchnorm:
        x = tf.keras.layers.BatchNormalization(axis=batchnorm_axis, name=bn_name_base + '2c')(x)
    x = tf.keras.layers.add([x, input_tensor])
    if activation:
        x = tf.keras.layers.ReLU()(x)
    return x
def identity_block ( input_tensor , kernel_size , filters , stage , block , activation = True , include_batchnorm = False ) : filters1 , filters2 , filters3 = filters batchnorm_axis = 3 conv_name_base = 'res' + str ( stage ) + block + '_branch' bn_name_base = 'bn' + str ( stage ) + block + '_branch' x = tf . keras . layers . Conv2D ( filters1 , ( 1 , 1 ) , dilation_rate = ( 1 , 1 ) , kernel_initializer = 'glorot_uniform' , name = conv_name_base + '2a' ) ( input_tensor ) if include_batchnorm : x = tf . keras . layers . BatchNormalization ( axis = batchnorm_axis , name = bn_name_base + '2a' ) ( x ) x = tf . keras . layers . ReLU ( ) ( x ) x = tf . keras . layers . Conv2D ( filters2 , kernel_size , dilation_rate = ( 1 , 1 ) , padding = 'same' , kernel_initializer = 'glorot_uniform' , name = conv_name_base + '2b' ) ( x ) if include_batchnorm : x = tf . keras . layers . BatchNormalization ( axis = batchnorm_axis , name = bn_name_base + '2b' ) ( x ) x = tf . keras . layers . ReLU ( ) ( x ) x = tf . keras . layers . Conv2D ( filters3 , ( 1 , 1 ) , dilation_rate = ( 1 , 1 ) , kernel_initializer = 'glorot_uniform' , name = conv_name_base + '2c' ) ( x ) if include_batchnorm : x = tf . keras . layers . BatchNormalization ( axis = batchnorm_axis , name = bn_name_base + '2c' ) ( x ) x = tf . keras . layers . add ( [ x , input_tensor ] ) if activation : x = tf . keras . layers . ReLU ( ) ( x ) return x
The identity block is the block that has no conv layer at shortcut.
The identity block is the block that has no conv layer at shortcut .
"""The identity block is the block that has no conv layer at shortcut.

    # Arguments
        input_tensor: input tensor
        kernel_size: default 3, the kernel size of
            middle conv layer at main path
        filters: list of integers, the filters of 3 conv layer at main path
        stage: integer, current stage label, used for generating layer names
        block: 'a','b'..., current block label, used for generating layer names

    # Returns
        Output tensor for the block.
    """
input_tensor
kernel_size
filters
stage
block
activation
include_batchnorm