-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.py
82 lines (67 loc) · 6.63 KB
/
options.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import argparse
def ArgsParser():
parser = argparse.ArgumentParser()
# Datasets
parser.add_argument('--dataset_root', type=str, default="/media/sda/datasets/IHD", help='frequency of showing training results on screen')
parser.add_argument('--name', type=str, default='', help='name of the experiment. It decides where to store samples and models')
parser.add_argument('--gpu_ids', type=str, default='0', help='gpu ids: e.g. 0 0,1,2, 0,2. use -1 for CPU')
parser.add_argument('--checkpoints_dir', type=str, default='./checkpoints', help='models are saved here')
parser.add_argument('--preprocess', type=str, default='resize_and_crop', help='scaling and cropping of images at load time [resize_and_crop | none]')
parser.add_argument('--no_flip', action='store_true', help='if specified, do not flip the images for data augmentation')
parser.add_argument('--num_threads', default=4, type=int, help='# threads for loading data')
parser.add_argument('--batch_size', type=int, default=8, help='input batch size')
parser.add_argument('--load_size', type=int, default=256, help='scale images to this size')
parser.add_argument('--crop_size', type=int, default=256, help='then crop to this size')
parser.add_argument('--serial_batches', action='store_true', help='if true, takes images in order to make batches, otherwise takes them randomly')
parser.add_argument('--epoch', type=str, default='latest', help='which epoch to load? set to latest to use latest cached model')
parser.add_argument('--mean', type=str, default='0.485, 0.456, 0.406', help='which epoch to load? set to latest to use latest cached model')
parser.add_argument('--std', type=str, default='0.229, 0.224, 0.225', help='which epoch to load? set to latest to use latest cached model')
# Display
parser.add_argument('--display_freq', type=int, default=400, help='frequency of showing training results on screen')
parser.add_argument('--print_freq', type=int, default=50, help='frequency of showing training results on console')
# network saving and loading parameters
parser.add_argument('--input_nc', type=int, default=3, help='# of iter at starting learning rate')
parser.add_argument('--output_nc', type=int, default=1, help='# of iter at starting learning rate')
parser.add_argument('--save_latest_freq', type=int, default=5000, help='frequency of saving the latest results')
parser.add_argument('--save_epoch_freq', type=int, default=5, help='frequency of saving checkpoints at the end of epochs')
parser.add_argument('--save_by_iter', action='store_true', help='whether saves model by iteration')
parser.add_argument('--continue_train', action='store_true', help='continue training: load the latest model')
parser.add_argument('--epoch_count', type=int, default=1, help='the starting epoch count, we save the model by <epoch_count>, <epoch_count>+<save_latest_freq>, ...')
parser.add_argument('--phase', type=str, default='train', help='train, val, test, etc')
# training parameters
parser.add_argument('--resume', type=int, default=-3, help='# of iter at starting learning rate')
parser.add_argument('--nepochs', type=int, default=60, help='# of iter at starting learning rate')
parser.add_argument('--pretrain_nepochs', type=int, default=50, help='# of iter at starting learning rate')
parser.add_argument('--weight_decay', type=float, default=1e-4, help='# weight decay for the optimizer')
parser.add_argument('--beta1', type=float, default=0.9, help='momentum term of adam')
parser.add_argument('--lr', type=float, default=0.0001, help='initial learning rate for adam')
parser.add_argument('--lr_policy', type=str, default='linear', help='learning rate policy. [linear | step | plateau | cosine]')
parser.add_argument('--lr_decay_iters', type=int, default=50, help='multiply by a gamma every lr_decay_iters iterations')
parser.add_argument('--sync_bn', action='store_true', help='multiply by a gamma every lr_decay_iters iterations')
parser.add_argument('--lambda_attention', type=float, default=1, help='hyperparameter of attention loss')
parser.add_argument('--lambda_detection', type=float, default=1, help='hyperparameter of detection loss')
parser.add_argument('--lambda_ssim', type=float, default=0, help='hyperparameter of ssim loss')
parser.add_argument('--lambda_iou', type=float, default=1, help='hyperparameter of iou loss')
parser.add_argument('--lambda_tri',type=float, default=1e-3, help='Size of full-res input/output')
parser.add_argument('--lambda_reg', type=float, default=1e-3, help='# of iter at starting learning rate')
parser.add_argument('--is_train', type=int, default=1, help='# of iter at starting learning rate')
parser.add_argument('--is_val', type=int, default=0, help='# of iter at starting learning rate')
parser.add_argument('--port', type=str, default='tcp://192.168.1.201:12345', help='# of iter at starting learning rate')
parser.add_argument("--local_rank", type=int, default=0)
parser.add_argument('--backbone', type=str, default='resnet34', help='# of iter at starting learning rate')
parser.add_argument('--ggd_ch', type=int, default=32, help='# of iter at starting learning rate')
parser.add_argument('--mda_mode', type=str, default='mask', help='[ mask | vanilla ]')
parser.add_argument('--loss_mode', type=str, default='', help='# of iter at starting learning rate')
parser.add_argument('--model', type=str, default='dirl', help='which model will be used for inharmonious region localization')
parser.add_argument('--pretrain_path', type=str, default='', help='# of iter at starting learning rate')
# HDRNet
parser.add_argument('--luma_bins', type=int, default=16)
parser.add_argument('--channel_multiplier', default=1, type=int)
parser.add_argument('--spatial_bin', type=int, default=16)
parser.add_argument('--batch_norm', action='store_true', help='If set use batch norm')
parser.add_argument('--net_input_size', type=int, default=256, help='Size of low-res input')
parser.add_argument('--net_output_size', type=int, default=256, help='Size of full-res input/output')
parser.add_argument('--m',type=float, default=1e-3, help='Size of full-res input/output')
parser.add_argument('--theta',type=float, default=0.7, help='Size of full-res input/output')
parser = parser.parse_args()
return parser