zoo/mobilenet/mobilenet_v1_c.py
def classifier(self, x, n_classes, **metaparameters):
        """ Construct the classifier group
            x         : input to the classifier
            alpha     : width multiplier
            dropout   : dropout percentage
            n_classes : number of output classes
        """
        alpha   = metaparameters['alpha']
        dropout = metaparameters['dropout']

        # Save encoding layer
        self.encoding = x

        # Flatten the feature maps into 1D feature maps (?, N)
        x = GlobalAveragePooling2D()(x)

        # Reshape the feature maps to (?, 1, 1, 1024)
        shape = (1, 1, int(1024 * alpha))
        x = Reshape(shape)(x)

        # Save embedding layer
        self.embedding = x
        
        # Perform dropout for preventing overfitting
        x = Dropout(dropout)(x)

        # Use convolution for classifying (emulates a fully connected layer)
        x = self.Conv2D(x, n_classes, (1, 1), padding='same', activation='softmax', **metaparameters)
        # Reshape the resulting output to 1D vector of number of classes
        outputs = Reshape((n_classes, ))(x)

        # Save the post-activation probabilities layer
        self.softmax = outputs
        return outputs
 Construct the classifier group
            x         : input to the classifier
            alpha     : width multiplier
            dropout   : dropout percentage
            n_classes : number of output classes
        
Construct the classifier group
x         : input to the classifier
alpha     : width multiplier
dropout   : dropout percentage
n_classes : number of output classes
Construct the classifier group x : input to the classifier alpha : width multiplier dropout : dropout percentage n_classes : number of output classes
def classifier(self, x, n_classes, **metaparameters):
        alpha   = metaparameters['alpha']
        dropout = metaparameters['dropout']
        self.encoding = x
        x = GlobalAveragePooling2D()(x)
        shape = (1, 1, int(1024 * alpha))
        x = Reshape(shape)(x)
        self.embedding = x
        x = Dropout(dropout)(x)
        x = self.Conv2D(x, n_classes, (1, 1), padding='same', activation='softmax', **metaparameters)
        outputs = Reshape((n_classes, ))(x)
        self.softmax = outputs
        return outputs
def classifier ( self , x , n_classes , ** metaparameters ) : alpha = metaparameters [ 'alpha' ] dropout = metaparameters [ 'dropout' ] self . encoding = x x = GlobalAveragePooling2D ( ) ( x ) shape = ( 1 , 1 , int ( 1024 * alpha ) ) x = Reshape ( shape ) ( x ) self . embedding = x x = Dropout ( dropout ) ( x ) x = self . Conv2D ( x , n_classes , ( 1 , 1 ) , padding = 'same' , activation = 'softmax' , ** metaparameters ) outputs = Reshape ( ( n_classes , ) ) ( x ) self . softmax = outputs return outputs
Construct the classifier group
x         : input to the classifier
alpha     : width multiplier
dropout   : dropout percentage
n_classes : number of output classes
Construct the classifier group x : input to the classifier alpha : width multiplier dropout : dropout percentage n_classes : number of output classes
""" Construct the classifier group
            x         : input to the classifier
            alpha     : width multiplier
            dropout   : dropout percentage
            n_classes : number of output classes
        """ # Save encoding layer # Flatten the feature maps into 1D feature maps (?, N) # Reshape the feature maps to (?, 1, 1, 1024) # Save embedding layer # Perform dropout for preventing overfitting # Use convolution for classifying (emulates a fully connected layer) # Reshape the resulting output to 1D vector of number of classes # Save the post-activation probabilities layer
self
x
n_classes