zoo/resnet/resnet_v2_c.py
def projection_block(self, x, strides=(2,2), **metaparameters):
        """ Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut
            Increase the number of filters by 4X
            x        : input into the block
            strides  : whether the first convolution is strided
            n_filters: number of filters
            reg      : kernel regularizer
        """
        n_filters = metaparameters['n_filters']
        del metaparameters['n_filters']

        # Construct the projection shortcut
        # Increase filters by 4X to match shape when added to output of block
        shortcut = self.BatchNormalization(x)
        shortcut = self.Conv2D(shortcut, 4 * n_filters, (1, 1), strides=strides, **metaparameters)

        ## Construct the 1x1, 3x3, 1x1 convolution block
    
        # Dimensionality reduction
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, n_filters, (1, 1), strides=(1,1), **metaparameters)

        # Bottleneck layer
        # Feature pooling when strides=(2, 2)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, n_filters, (3, 3), strides=strides, padding='same', **metaparameters)

        # Dimensionality restoration - increase the number of filters by 4X
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, 4 * n_filters, (1, 1), strides=(1, 1), **metaparameters)

        # Add the projection shortcut to the output of the residual block
        x = Add()([x, shortcut])
        return x
 Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut
            Increase the number of filters by 4X
            x        : input into the block
            strides  : whether the first convolution is strided
            n_filters: number of filters
            reg      : kernel regularizer
        
Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut
Increase the number of filters by 4X
x        : input into the block
strides  : whether the first convolution is strided
n_filters: number of filters
reg      : kernel regularizer
Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut Increase the number of filters by 4X x : input into the block strides : whether the first convolution is strided n_filters : number of filters reg : kernel regularizer
def projection_block(self, x, strides=(2,2), **metaparameters):
        n_filters = metaparameters['n_filters']
        del metaparameters['n_filters']
        shortcut = self.BatchNormalization(x)
        shortcut = self.Conv2D(shortcut, 4 * n_filters, (1, 1), strides=strides, **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, n_filters, (1, 1), strides=(1,1), **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, n_filters, (3, 3), strides=strides, padding='same', **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, 4 * n_filters, (1, 1), strides=(1, 1), **metaparameters)
        x = Add()([x, shortcut])
        return x
def projection_block ( self , x , strides = ( 2 , 2 ) , ** metaparameters ) : n_filters = metaparameters [ 'n_filters' ] del metaparameters [ 'n_filters' ] shortcut = self . BatchNormalization ( x ) shortcut = self . Conv2D ( shortcut , 4 * n_filters , ( 1 , 1 ) , strides = strides , ** metaparameters ) x = self . BatchNormalization ( x ) x = self . ReLU ( x ) x = self . Conv2D ( x , n_filters , ( 1 , 1 ) , strides = ( 1 , 1 ) , ** metaparameters ) x = self . BatchNormalization ( x ) x = self . ReLU ( x ) x = self . Conv2D ( x , n_filters , ( 3 , 3 ) , strides = strides , padding = 'same' , ** metaparameters ) x = self . BatchNormalization ( x ) x = self . ReLU ( x ) x = self . Conv2D ( x , 4 * n_filters , ( 1 , 1 ) , strides = ( 1 , 1 ) , ** metaparameters ) x = Add ( ) ( [ x , shortcut ] ) return x
Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut
Increase the number of filters by 4X
x        : input into the block
strides  : whether the first convolution is strided
n_filters: number of filters
reg      : kernel regularizer
Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut Increase the number of filters by 4X x : input into the block strides : whether the first convolution is strided n_filters : number of filters reg : kernel regularizer
""" Construct a Bottleneck Residual Block of Convolutions with Projection Shortcut
            Increase the number of filters by 4X
            x        : input into the block
            strides  : whether the first convolution is strided
            n_filters: number of filters
            reg      : kernel regularizer
        """ # Construct the projection shortcut # Increase filters by 4X to match shape when added to output of block ## Construct the 1x1, 3x3, 1x1 convolution block # Dimensionality reduction # Bottleneck layer # Feature pooling when strides=(2, 2) # Dimensionality restoration - increase the number of filters by 4X # Add the projection shortcut to the output of the residual block
self
x
strides