def train_cam_model(X_train, Y_train, X_test, Y_test, batch_size, nb_epoch):
    'Train CAM model based on your pretrained model\n\n\t# Arguments\n\t\tmodel: your pretrained model, CAM model is trained based on this model.\n\n\t'
    pretrained_model_path = ''
    pretrained_weights_path = ''
    pretrained_model_name = 'VGG16'
    num_classes = 10
    gap_spacial_size = 14
    if (pretrained_model_name == 'VGG16'):
        in_layer_name = 'block5_conv3'
    elif (pretrained_model_name == 'InceptionV3'):
        in_layer_name = 'batchnormalization_921'
    elif (pretrained_model_name == 'ResNet50'):
        in_layer_name = 'merge_13'
    else:
        in_layer_name = ''
    pretrained_model = read_model(pretrained_model_path, pretrained_weights_path)
    model = create_cam_model(pretrained_model, gap_spacial_size, num_classes, in_layer_name, CAM_CONV_LAYER)
    model.compile(loss='categorical_crossentropy', optimizer='adadelta', metrics=['accuracy'])
    model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch, shuffle=True, verbose=1, validation_data=(X_test, Y_test))
    model.save_weights('')
    return model
Train CAM model based on your pretrained model

# Arguments
        model: your pretrained model, CAM model is trained based on this model.
def train_cam_model(X_train, Y_train, X_test, Y_test, batch_size, nb_epoch):
    'Train CAM model based on your pretrained model\n\n\t# Arguments\n\t\tmodel: your pretrained model, CAM model is trained based on this model.\n\n\t'
    pretrained_model_path = 
    pretrained_weights_path = 
    pretrained_model_name = 'VGG16'
    num_classes = 10
    gap_spacial_size = 14
    if (pretrained_model_name == 'VGG16'):
        in_layer_name = 'block5_conv3'
    elif (pretrained_model_name == 'InceptionV3'):
        in_layer_name = 'batchnormalization_921'
    elif (pretrained_model_name == 'ResNet50'):
        in_layer_name = 'merge_13'
    else:
        in_layer_name = 
    pretrained_model = read_model(pretrained_model_path, pretrained_weights_path)
    model = create_cam_model(pretrained_model, gap_spacial_size, num_classes, in_layer_name, CAM_CONV_LAYER)
    model.compile(loss='categorical_crossentropy', optimizer='adadelta', metrics=['accuracy'])
    model.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch, shuffle=True, verbose=1, validation_data=(X_test, Y_test))
    model.save_weights()
    return model