-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
36 lines (31 loc) · 1.36 KB
/
config.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
"""
参数和配置信息
"""
import argparse
from collections import OrderedDict
class Config():
def __init__(self):
self.name = 'CycleGAN model in TensorFlow'
self.args = OrderedDict(
datadir=('datasets/horse2zebra', 'path of datasets'),
imsize=(256, 'image size'),
mode=('train', 'train or A2B or B2A'),
nb_epoch=(200, 'number of epochs'),
nb_batch=(1000, 'number of batches in a signle epoch'),
clambda=(10.0, 'weight of cyclic loss'),
lr_g=(2e-4, 'learning rate of G'),
lr_d=(2e-4, 'learning rate of D'),
pool_size=(10, 'size of image pool that using by training discriminator'),
num_resblock=(9, 'size of resblocks in generator'),
sample_freq=(100, 'frequency of updating sample images'),
sample_to_file=(True, 'save samples to image file'),
logdir=('logs', 'path to save logs'),
sampledir=('samples', 'path to save examples'),
checkpointdir=('checkpoint', 'path to save checkpoints')
)
def __call__(self):
parser = argparse.ArgumentParser(prog=self.name)
for key, value in self.args.items():
var, doc = value
parser.add_argument('--%s'%key, dest=key, type=type(var), default=var, help=doc)
return parser.parse_args()