Exemple #1
0
def prepare_model(model_name, use_pretrained, pretrained_model_file_path):
    kwargs = {"pretrained": use_pretrained}

    net = get_model(model_name, **kwargs)

    if pretrained_model_file_path:
        assert (os.path.isfile(pretrained_model_file_path))
        logging.info("Loading model: {}".format(pretrained_model_file_path))
        net.load_weights(filepath=pretrained_model_file_path)

    return net
Exemple #2
0
def prepare_model(model_name, classes, use_pretrained,
                  pretrained_model_file_path):
    kwargs = {'pretrained': use_pretrained, 'classes': classes}

    net = get_model(model_name, **kwargs)

    if pretrained_model_file_path:
        assert (os.path.isfile(pretrained_model_file_path))
        logging.info('Loading model: {}'.format(pretrained_model_file_path))
        net.load_weights(filepath=pretrained_model_file_path)

    return net