Computer/NN_Trainer/PretrainedModel.py
def add_new_last_layer(base_model, nb_classes, FC_size):
    """Add Last layer to the convnet
    :param base_model: keras model exluding last layer
    :param nb_classes: # of classes for output
    :param FC_size: Fully connected layer size (# of nodes)
    :return: new keras model with last layer
    """
    x = base_model.output;
    x = GlobalAveragePooling2D()(x) #converts the 3D tensor ouput into 1xC where c is # of channels
    x = Dense(FC_size)(x)
    predictions = Dense(nb_classes)(x)
    model = Model(input=base_model.input,outputs=predictions)
    return model;
Add Last layer to the convnet
    :param base_model: keras model exluding last layer
    :param nb_classes: # of classes for output
    :param FC_size: Fully connected layer size (# of nodes)
    :return: new keras model with last layer
    
Add Last layer to the convnet
Add Last layer to the convnet
def add_new_last_layer(base_model, nb_classes, FC_size):
    x = base_model.output;
    x = GlobalAveragePooling2D()(x) 
    x = Dense(FC_size)(x)
    predictions = Dense(nb_classes)(x)
    model = Model(input=base_model.input,outputs=predictions)
    return model;
def add_new_last_layer ( base_model , nb_classes , FC_size ) : x = base_model . output ; x = GlobalAveragePooling2D ( ) ( x ) x = Dense ( FC_size ) ( x ) predictions = Dense ( nb_classes ) ( x ) model = Model ( input = base_model . input , outputs = predictions ) return model ;
Add Last layer to the convnet
Add Last layer to the convnet
"""Add Last layer to the convnet
    :param base_model: keras model exluding last layer
    :param nb_classes: # of classes for output
    :param FC_size: Fully connected layer size (# of nodes)
    :return: new keras model with last layer
    """ #converts the 3D tensor ouput into 1xC where c is # of channels
new keras model with last layer
new keras model with last layer
base_model
keras model exluding last layer
keras model exluding last layer
nb_classes
of classes for output
of classes for output
FC_size
Fully connected layer size (# of nodes)
Fully connected layer size ( # of nodes )