-
Notifications
You must be signed in to change notification settings - Fork 261
/
train_imitator.py
48 lines (40 loc) · 2.1 KB
/
train_imitator.py
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
43
44
45
46
47
48
import argparse
import numpy as np
import matplotlib.pyplot as plt
import utils
from imitator import*
# settings
parser = argparse.ArgumentParser(description='ZZX TRAIN IMITATOR')
parser.add_argument('--renderer', type=str, default='oilpaintbrush', metavar='str',
help='renderer: [watercolor, markerpen, oilpaintbrush, rectangle'
'bezier, circle, square, rectangle] (default ...)')
parser.add_argument('--batch_size', type=int, default=64, metavar='N',
help='input batch size for training (default: 4)')
parser.add_argument('--print_models', action='store_true', default=False,
help='visualize and print networks')
parser.add_argument('--net_G', type=str, default='zou-fusion-net', metavar='str',
help='net_G: plain-dcgan or plain-unet or huang-net,'
'zou-fusion-net, or zou-fusion-net-light')
parser.add_argument('--checkpoint_dir', type=str, default=r'./checkpoints_G', metavar='str',
help='dir to save checkpoints (default: ...)')
parser.add_argument('--vis_dir', type=str, default=r'./val_out_G', metavar='str',
help='dir to save results during training (default: ./val_out_G)')
parser.add_argument('--lr', type=float, default=2e-4,
help='learning rate (default: 0.0002)')
parser.add_argument('--max_num_epochs', type=int, default=400, metavar='N',
help='max number of training epochs (default 400)')
args = parser.parse_args()
if __name__ == '__main__':
dataloaders = utils.get_renderer_loaders(args)
imt = Imitator(args=args, dataloaders=dataloaders)
# # How to check if the data is loading correctly?
# dataloaders = utils.get_renderer_loaders(args)
# for i in range(100):
# data = next(iter(dataloaders['train']))
# vis_A = data['A']
# vis_B = utils.make_numpy_grid(data['B'])
# print(data['A'].cpu().numpy().shape[1])
# print(data['B'].shape)
# plt.imshow(vis_B)
# plt.show()
imt.train_models()