type=str, help='datatset stroage directory', default='/data/datasets') args = vars(parser.parse_args()) print(args) modeldir = get_modeldir_ens(args['ind'], args['model_arch']) ensemble_num = args['model_num'] # ----- load dataset ----- transform = get_transform(args['ind']) std = get_std(args['ind']) ind_test_loader = get_dataloader(args['ind'], transform, "test", dataroot=args['dataroot'], batch_size=args['batch_size']) ood_test_loader = get_dataloader(args['ood'], transform, "test", dataroot=args['dataroot'], batch_size=args['batch_size']) ind_dataloader_val_for_train, ind_dataloader_val_for_test, ind_dataloader_test = split_dataloader( args['ind'], ind_test_loader, [500, 500, -1]) ood_dataloader_val_for_train, ood_dataloader_val_for_test, ood_dataloader_test = split_dataloader( args['ood'], ood_test_loader, [500, 500, -1]) # ----- Calculating and averaging maximum softmax probabilities ----- from lib.inference.ODIN import get_ODIN_score best_temperature = 1.0
args = vars(parser.parse_args()) print(args) # ----- load pre-trained model ----- model = get_model(args['ind'], args['model_arch']) # ----- load dataset ----- transform = get_transform(args['ind']) std = get_std(args['ind']) img_size = get_img_size(args['ind']) inp_channel = get_inp_channel(args['ind']) batch_size = args['batch_size'] # recommend: 64 for ImageNet, CelebA, MS1M ind_train_loader = get_dataloader(args['ind'], transform, "train", dataroot=args['dataroot'], batch_size=batch_size) ind_test_loader = get_dataloader(args['ind'], transform, "test", dataroot=args['dataroot'], batch_size=batch_size) ood_test_loader = get_dataloader(args['ood'], transform, "test", dataroot=args['dataroot'], batch_size=batch_size) ind_dataloader_val_for_train, ind_dataloader_val_for_test, ind_dataloader_test = split_dataloader( args['ind'], ind_test_loader, [500, 500, -1], random=True) ood_dataloader_val_for_train, ood_dataloader_val_for_test, ood_dataloader_test = split_dataloader(