zoo/senet/se_resnet_c.py
def projection_block(self, x, strides=(2,2), **metaparameters):
        """ Create Bottleneck Residual Block with Projection Shortcut
            Increase the number of filters by 4X
            x        : input into the block
            strides  : whether entry convolution is strided (i.e., (2, 2) vs (1, 1))
            n_filters: number of filters
        """
        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.Conv2D(x, 4 * n_filters, (1, 1), strides=strides, 
                               **metaparameters)
        shortcut = self.BatchNormalization(shortcut)

        ## Construct the 1x1, 3x3, 1x1 residual block (fig 3c)

        # Dimensionality reduction
        # Feature pooling when strides=(2, 2)
        x = self.Conv2D(x, n_filters, (1, 1), strides=strides, **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)

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

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

        # Pass the output through the squeeze and excitation block
        x = self.squeeze_excite_block(x, **metaparameters)

        # Add the projection shortcut link to the output of the residual block
        x = Add()([x, shortcut])
        x = self.ReLU(x)
        return x
 Create Bottleneck Residual Block with Projection Shortcut
            Increase the number of filters by 4X
            x        : input into the block
            strides  : whether entry convolution is strided (i.e., (2, 2) vs (1, 1))
            n_filters: number of filters
        
Create Bottleneck Residual Block with Projection Shortcut
Increase the number of filters by 4X
x        : input into the block
strides  : whether entry convolution is strided  vs (1, 1))
n_filters: number of filters
Create Bottleneck Residual Block with Projection Shortcut Increase the number of filters by 4X x : input into the block strides : whether entry convolution is strided vs ( 1 1 )) n_filters : number of filters
def projection_block(self, x, strides=(2,2), **metaparameters):
        n_filters = metaparameters['n_filters']
        del metaparameters['n_filters']
        shortcut = self.Conv2D(x, 4 * n_filters, (1, 1), strides=strides, 
                               **metaparameters)
        shortcut = self.BatchNormalization(shortcut)
        x = self.Conv2D(x, n_filters, (1, 1), strides=strides, **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, n_filters, (3, 3), strides=(1, 1), 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 = self.BatchNormalization(x)
        x = self.squeeze_excite_block(x, **metaparameters)
        x = Add()([x, shortcut])
        x = self.ReLU(x)
        return x
def projection_block ( self , x , strides = ( 2 , 2 ) , ** metaparameters ) : n_filters = metaparameters [ 'n_filters' ] del metaparameters [ 'n_filters' ] shortcut = self . Conv2D ( x , 4 * n_filters , ( 1 , 1 ) , strides = strides , ** metaparameters ) shortcut = self . BatchNormalization ( shortcut ) x = self . Conv2D ( x , n_filters , ( 1 , 1 ) , strides = strides , ** metaparameters ) x = self . BatchNormalization ( x ) x = self . ReLU ( x ) x = self . Conv2D ( x , n_filters , ( 3 , 3 ) , strides = ( 1 , 1 ) , 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 = self . BatchNormalization ( x ) x = self . squeeze_excite_block ( x , ** metaparameters ) x = Add ( ) ( [ x , shortcut ] ) x = self . ReLU ( x ) return x
Create Bottleneck Residual Block with Projection Shortcut
Increase the number of filters by 4X
x        : input into the block
strides  : whether entry convolution is strided (i.e., (2, 2) vs (1, 1))
n_filters: number of filters
Create Bottleneck Residual Block with Projection Shortcut Increase the number of filters by 4X x : input into the block strides : whether entry convolution is strided ( i . e . ( 2 2 ) vs ( 1 1 )) n_filters : number of filters
""" Create Bottleneck Residual Block with Projection Shortcut
            Increase the number of filters by 4X
            x        : input into the block
            strides  : whether entry convolution is strided (i.e., (2, 2) vs (1, 1))
            n_filters: number of filters
        """ # Construct the projection shortcut # Increase filters by 4X to match shape when added to output of block ## Construct the 1x1, 3x3, 1x1 residual block (fig 3c) # Dimensionality reduction # Feature pooling when strides=(2, 2) # Bottleneck layer # Dimensionality restoration - increase the number of filters by 4X # Pass the output through the squeeze and excitation block # Add the projection shortcut link to the output of the residual block
self
x
strides