1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| show_every=50 figsize=5 pad = 'reflection' INPUT = 'noise' input_depth = 32 OPTIMIZER = 'adam' OPT_OVER = 'net' if 'barbara' in f: OPTIMIZER = 'adam' LR = 0.001 num_iter = 11000 reg_noise_std = 0.03 NET_TYPE = 'skip' net = get_net(input_depth, 'skip', pad, n_channels=1, skip_n33d=128, skip_n33u=128, skip_n11=4, num_scales=5, upsample_mode='bilinear').type(dtype) elif 'kate' in f: OPT_OVER = 'net' num_iter = 1000 LR = 0.01 reg_noise_std = 0.00 net = skip(input_depth, img_np.shape[0], num_channels_down = [16, 32, 64, 128, 128], num_channels_up = [16, 32, 64, 128, 128], num_channels_skip = [0, 0, 0, 0, 0], filter_size_down = 3, filter_size_up = 3, filter_skip_size=1, upsample_mode='bilinear', downsample_mode='avg', need_sigmoid=True, need_bias=True, pad=pad).type(dtype)
mse = torch.nn.MSELoss().type(dtype) img_var = np_to_torch(img_np).type(dtype)
net_input = get_noise(input_depth, INPUT, img_np.shape[1:]).type(dtype).detach()
|