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
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