zoo/senet/se_resnext_c.py
def identity_block(self, x, **metaparameters):
        """ Construct a ResNeXT block with identity link
            x          : input to block
            filters_in : number of filters  (channels) at the input convolution
            filters_out: number of filters (channels) at the output convolution
            cardinality: width of cardinality layer
        """ 
        filters_in  = metaparameters['filters_in']
        filters_out = metaparameters['filters_out']
        cardinality = metaparameters['cardinality']
    
        # Remember the input
        shortcut = x

        # Dimensionality Reduction
        x = self.Conv2D(x, filters_in, kernel_size=(1, 1), strides=(1, 1), padding='same', 
                        **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)

        # Cardinality (Wide) Layer (split-transform)
        filters_card = filters_in // cardinality
        groups = []
        for i in range(cardinality):
            group = Lambda(lambda z: z[:, :, :, i * filters_card:i * filters_card + filters_card])(x)
            groups.append(self.Conv2D(group, filters_card, kernel_size=(3, 3), strides=(1, 1), padding='same', 
                                      **metaparameters))

        # Concatenate the outputs of the cardinality layer together (merge)
        x = Concatenate()(groups)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)

        # Dimensionality restoration
        x = self.Conv2D(x, filters_out, kernel_size=(1, 1), strides=(1, 1), padding='same', 
                        **metaparameters)
        x = self.BatchNormalization(x)
    
        # Pass the output through the squeeze and excitation block
        x = self.squeeze_excite_block(x, **metaparameters)

        # Identity Link: Add the shortcut (input) to the output of the block
        x = Add()([shortcut, x])
        x = self.ReLU(x)
        return x
 Construct a ResNeXT block with identity link
            x          : input to block
            filters_in : number of filters  (channels) at the input convolution
            filters_out: number of filters (channels) at the output convolution
            cardinality: width of cardinality layer
        
Construct a ResNeXT block with identity link
x          : input to block
filters_in : number of filters  (channels) at the input convolution
filters_out: number of filters (channels) at the output convolution
cardinality: width of cardinality layer
Construct a ResNeXT block with identity link x : input to block filters_in : number of filters ( channels ) at the input convolution filters_out : number of filters ( channels ) at the output convolution cardinality : width of cardinality layer
def identity_block(self, x, **metaparameters):
        filters_in  = metaparameters['filters_in']
        filters_out = metaparameters['filters_out']
        cardinality = metaparameters['cardinality']
        shortcut = x
        x = self.Conv2D(x, filters_in, kernel_size=(1, 1), strides=(1, 1), padding='same', 
                        **metaparameters)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        filters_card = filters_in // cardinality
        groups = []
        for i in range(cardinality):
            group = Lambda(lambda z: z[:, :, :, i * filters_card:i * filters_card + filters_card])(x)
            groups.append(self.Conv2D(group, filters_card, kernel_size=(3, 3), strides=(1, 1), padding='same', 
                                      **metaparameters))
        x = Concatenate()(groups)
        x = self.BatchNormalization(x)
        x = self.ReLU(x)
        x = self.Conv2D(x, filters_out, kernel_size=(1, 1), strides=(1, 1), padding='same', 
                        **metaparameters)
        x = self.BatchNormalization(x)
        x = self.squeeze_excite_block(x, **metaparameters)
        x = Add()([shortcut, x])
        x = self.ReLU(x)
        return x
def identity_block ( self , x , ** metaparameters ) : filters_in = metaparameters [ 'filters_in' ] filters_out = metaparameters [ 'filters_out' ] cardinality = metaparameters [ 'cardinality' ] shortcut = x x = self . Conv2D ( x , filters_in , kernel_size = ( 1 , 1 ) , strides = ( 1 , 1 ) , padding = 'same' , ** metaparameters ) x = self . BatchNormalization ( x ) x = self . ReLU ( x ) filters_card = filters_in // cardinality groups = [ ] for i in range ( cardinality ) : group = Lambda ( lambda z : z [ : , : , : , i * filters_card : i * filters_card + filters_card ] ) ( x ) groups . append ( self . Conv2D ( group , filters_card , kernel_size = ( 3 , 3 ) , strides = ( 1 , 1 ) , padding = 'same' , ** metaparameters ) ) x = Concatenate ( ) ( groups ) x = self . BatchNormalization ( x ) x = self . ReLU ( x ) x = self . Conv2D ( x , filters_out , kernel_size = ( 1 , 1 ) , strides = ( 1 , 1 ) , padding = 'same' , ** metaparameters ) x = self . BatchNormalization ( x ) x = self . squeeze_excite_block ( x , ** metaparameters ) x = Add ( ) ( [ shortcut , x ] ) x = self . ReLU ( x ) return x
Construct a ResNeXT block with identity link
x          : input to block
filters_in : number of filters  (channels) at the input convolution
filters_out: number of filters (channels) at the output convolution
cardinality: width of cardinality layer
Construct a ResNeXT block with identity link x : input to block filters_in : number of filters ( channels ) at the input convolution filters_out : number of filters ( channels ) at the output convolution cardinality : width of cardinality layer
""" Construct a ResNeXT block with identity link
            x          : input to block
            filters_in : number of filters  (channels) at the input convolution
            filters_out: number of filters (channels) at the output convolution
            cardinality: width of cardinality layer
        """ # Remember the input # Dimensionality Reduction # Cardinality (Wide) Layer (split-transform) # Concatenate the outputs of the cardinality layer together (merge) # Dimensionality restoration # Pass the output through the squeeze and excitation block # Identity Link: Add the shortcut (input) to the output of the block
self
x