-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (37 loc) · 2.13 KB
/
main.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
from mode import *
import argparse
parser = argparse.ArgumentParser()
def str2bool(v):
return v.lower() in ('true')
parser.add_argument("--LR_path", type = str, default = '../../srganmaino/data/ImageNet/DIV2K/DIV2K_train_LR_bicubic/X4/')
parser.add_argument("--GT_path", type = str, default = '../../srganmaino/data/ImageNet/DIV2K/DIV2K_train_HR')
parser.add_argument("--LR_pathT", type = str, default = '../../srganmaino/data/Set5/LRbicx4/')
parser.add_argument("--GT_pathT", type = str, default = '../../srganmaino/data/Set5/original/')
parser.add_argument("--results_file", type = str, default = 'result.txt')
parser.add_argument("--model_dir", type = str, default = 'modelbest')
parser.add_argument("--output_dir", type = str, default = 'output')
parser.add_argument("--res_num", type = int, default = 16)
parser.add_argument("--num_workers", type = int, default = 16)
parser.add_argument("--batch_size", type = int, default = 256)
parser.add_argument("--L2_coeff", type = float, default = 1.0)
parser.add_argument("--adv_coeff", type = float, default = 1e-3)
parser.add_argument("--tv_loss_coeff", type = float, default = 0.0)
parser.add_argument("--pre_train_epoch", type = int, default = 8000)
parser.add_argument("--fine_train_epoch", type = int, default = 8000)
parser.add_argument("--scale", type = int, default = 4)
parser.add_argument("--patch_size", type = int, default = 24)
parser.add_argument("--feat_layer", type = str, default = 'relu5_4')
parser.add_argument("--vgg_rescale_coeff", type = float, default = 0.006)
parser.add_argument("--fine_tuning", type = str2bool, default = False)
parser.add_argument("--in_memory", type = str2bool, default = True)
parser.add_argument("--generator_path", type = str, default = 'SRGANT.pt')
parser.add_argument("--generator_pathS", type = str, default = 'model/SRGAN_gene_3998.pt')
parser.add_argument("--discriminator_path", type = str, default = 'model/SRGAN_discrim_3998.pt')
parser.add_argument("--mode", type = str, default = 'train')
args = parser.parse_args()
if args.mode == 'train':
train(args)
elif args.mode == 'test':
test(args)
elif args.mode == 'test_only':
test_only(args)