(base_model, nb_classes)
return model
Add last layer to the convnet
        Args:
            base_model: keras model excluding top
            nb_classes: # of classes
        Returns:
            new keras model with last layer
Add last layer to the convnet
        Args:
            base_model: keras model excluding top
            nb_classes: # of classes
        Returns:
            new keras model with last layer
Add last layer to the convnet Args : base_model : keras model excluding top nb_classes : # of classes Returns : new keras model with last layer
def setup_new_classifier(base_model, nb_classes):
    """Add last layer to the convnet
        Args:
            base_model: keras model excluding top
            nb_classes: # of classes
        Returns:
            new keras model with last layer
    """
    FC_SIZE = 1024
    
    x = base_model.output
    x = GlobalAveragePooling2D()(x)
    x = Dense(FC_SIZE, activation='relu')(x) #new FC layer, random init
    predictions = Dense(nb_classes, activation='softmax')(x) #new softmax layer
    model = Model(inputs=base_model.input, outputs=predictions)
    return model
def setup_new_classifier ( base_model , nb_classes ) : FC_SIZE = 1024 x = base_model . output x = GlobalAveragePooling2D ( ) ( x ) x = Dense ( FC_SIZE , activation = 'relu' ) ( x ) #new FC layer, random init predictions = Dense ( nb_classes , activation = 'softmax' ) ( x ) #new softmax layer model = Model ( inputs = base_model . input , outputs = predictions ) return model