forked from bamos/dcgan-completion.tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomplete.py
executable file
·37 lines (31 loc) · 1.19 KB
/
complete.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
#!/usr/bin/env python
#
# Brandon Amos (http://bamos.github.io)
# License: MIT
# 2016-08-05
import argparse
import os
import tensorflow as tf
from model import DCGAN
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float, default=0.01)
parser.add_argument('--momentum', type=float, default=0.9)
parser.add_argument('--nIter', type=int, default=1000)
parser.add_argument('--imgSize', type=int, default=64)
parser.add_argument('--lam', type=float, default=0.1)
parser.add_argument('--checkpointDir', type=str, default='checkpoint')
parser.add_argument('--outDir', type=str, default='completions')
parser.add_argument('--maskType', type=str,
choices=['random', 'center', 'left', 'full', 'image'],
default='center')
parser.add_argument('--mask', type=str)
parser.add_argument('imgs', type=str, nargs='+')
args = parser.parse_args()
assert(os.path.exists(args.checkpointDir))
tf.set_random_seed(1234)
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
with tf.Session(config=config) as sess:
dcgan = DCGAN(sess, image_size=args.imgSize, is_crop=True,
checkpoint_dir=args.checkpointDir, lam=args.lam)
dcgan.complete(args)