Пример #1
0
    'img_indices': [373, 413, 428, 468],
    'cnnid': 26,
    'iterations': 100,
    'lr': 0.01,
    'octave_scale': 1.2,
    'num_octaves': 10,
    'device': 'cuda'
}
args = argparse.Namespace(**args)

# build model
model = Model(
    make_layers([
        32, 32, 32, 'M',
        64, 64, 64, 'M',
        128, 128, 128, 'M',
        256, 256, 256, 256, 'M',
        512, 512, 512, 512, 'M'
    ])
).to(args.device)

# load checkpoint
checkpoint = torch.load(args.ckptpath)
model.load_state_dict(checkpoint['model_state_dict'])

# prepare dataset
valid_paths, valid_labels = get_paths_labels(os.path.join(args.dataset_dir, 'validation'))
valid_set = ImgDataset(valid_paths, valid_labels, 512, data_transforms['test'])

# dream & deep_dream
layer_activations = None
Пример #2
0
    'dataset_dir': sys.argv[1],
    'output_dir': sys.argv[2],
    'img_indices': [373, 413, 428, 468],
    'cnnid': 26,
    'iterations': 100,
    'lr': 0.01,
    'octave_scale': 1.2,
    'num_octaves': 10,
    'device': 'cuda'
}
args = argparse.Namespace(**args)

# build model
model = Model(
    make_layers([
        32, 32, 32, 'M', 64, 64, 64, 'M', 128, 128, 128, 'M', 256, 256, 256,
        256, 'M', 512, 512, 512, 512, 'M'
    ])).to(args.device)

# load checkpoint
checkpoint = torch.load(args.ckptpath)
model.load_state_dict(checkpoint['model_state_dict'])

# prepare dataset
valid_paths, valid_labels = get_paths_labels(
    os.path.join(args.dataset_dir, 'validation'))
valid_set = ImgDataset(valid_paths, valid_labels, 512, data_transforms['test'])

# dream & deep_dream
layer_activations = None