(self, kernel_size, filters, stage, block, strides=(2, 2))
A block that has a conv layer at shortcut.
    # Arguments
        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
        strides: Strides for the first conv layer in the block.
    # Returns
        Output tensor for the block.
    Note that from stage 3,
    the first conv layer at main path is with strides=(2, 2)
    And the shortcut should have strides=(2, 2) as well
A block that has a conv layer at shortcut.
    # Arguments
        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
        strides: Strides for the first conv layer in the block.
    # Returns
        Output tensor for the block.
    Note that from stage 3,
    the first conv layer at main path is with strides=(2, 2)
    And the shortcut should have strides=(2, 2) as well
A block that has a conv layer at shortcut . # Arguments 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 strides : Strides for the first conv layer in the block . # Returns Output tensor for the block . Note that from stage 3 the first conv layer at main path is with strides = ( 2 2 ) And the shortcut should have strides = ( 2 2 ) as well
def __init__(self, kernel_size, filters, stage, block, strides=(2, 2)):
    """A block that has a conv layer at shortcut.
    # Arguments
        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
        strides: Strides for the first conv layer in the block.
    # Returns
        Output tensor for the block.
    Note that from stage 3,
    the first conv layer at main path is with strides=(2, 2)
    And the shortcut should have strides=(2, 2) as well
    """
    super().__init__(name='conv_block' + str(stage) + block)
    filters1, filters2, filters3 = filters
    if K.image_data_format() == 'channels_last':
      bn_axis = 3
    else:
      bn_axis = 1
    conv_name_base = 'res' + str(stage) + block + '_branch'
    bn_name_base = 'bn' + str(stage) + block + '_branch'

    self.conv1 = layers.Conv2D(
        filters1, (1, 1),
        strides=strides,
        kernel_initializer='he_normal',
        name=conv_name_base + '2a')
    self.bn1 = layers.BatchNormalization(axis=bn_axis, name=bn_name_base + '2a')
    self.act1 = layers.Activation('relu')

    self.conv2 = layers.Conv2D(
        filters2,
        kernel_size,
        padding='same',
        kernel_initializer='he_normal',
        name=conv_name_base + '2b')
    self.bn2 = layers.BatchNormalization(axis=bn_axis, name=bn_name_base + '2b')
    self.act2 = layers.Activation('relu')

    self.conv3 = layers.Conv2D(
        filters3, (1, 1),
        kernel_initializer='he_normal',
        name=conv_name_base + '2c')
    self.bn3 = layers.BatchNormalization(axis=bn_axis, name=bn_name_base + '2c')

    self.shortcut_conv = layers.Conv2D(
        filters3, (1, 1),
        strides=strides,
        kernel_initializer='he_normal',
        name=conv_name_base + '1')
    self.shortcut_bn = layers.BatchNormalization(
        axis=bn_axis, name=bn_name_base + '1')

    self.add = layers.Add()
    self.act = layers.Activation('relu')
def __init__ ( self , kernel_size , filters , stage , block , strides = ( 2 , 2 ) ) : super ( ) . __init__ ( name = 'conv_block' + str ( stage ) + block ) filters1 , filters2 , filters3 = filters if K . image_data_format ( ) == 'channels_last' : bn_axis = 3 else : bn_axis = 1 conv_name_base = 'res' + str ( stage ) + block + '_branch' bn_name_base = 'bn' + str ( stage ) + block + '_branch' self . conv1 = layers . Conv2D ( filters1 , ( 1 , 1 ) , strides = strides , kernel_initializer = 'he_normal' , name = conv_name_base + '2a' ) self . bn1 = layers . BatchNormalization ( axis = bn_axis , name = bn_name_base + '2a' ) self . act1 = layers . Activation ( 'relu' ) self . conv2 = layers . Conv2D ( filters2 , kernel_size , padding = 'same' , kernel_initializer = 'he_normal' , name = conv_name_base + '2b' ) self . bn2 = layers . BatchNormalization ( axis = bn_axis , name = bn_name_base + '2b' ) self . act2 = layers . Activation ( 'relu' ) self . conv3 = layers . Conv2D ( filters3 , ( 1 , 1 ) , kernel_initializer = 'he_normal' , name = conv_name_base + '2c' ) self . bn3 = layers . BatchNormalization ( axis = bn_axis , name = bn_name_base + '2c' ) self . shortcut_conv = layers . Conv2D ( filters3 , ( 1 , 1 ) , strides = strides , kernel_initializer = 'he_normal' , name = conv_name_base + '1' ) self . shortcut_bn = layers . BatchNormalization ( axis = bn_axis , name = bn_name_base + '1' ) self . add = layers . Add ( ) self . act = layers . Activation ( 'relu' )