質問編集履歴
4
コードをフォーマットの中にいれて見やすくしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -70,190 +70,186 @@
|
|
70
70
|
|
71
71
|
flags.DEFINE_integer("batch_size", 64, "The size of batch images [64]")```
|
72
72
|
|
73
|
+
flags.DEFINE_integer("input_height", 108, "The size of image to use (will be center cropped). [108]")
|
74
|
+
|
75
|
+
flags.DEFINE_integer("input_width", None, "The size of image to use (will be center cropped). If None, same value as input_height [None]")
|
76
|
+
|
77
|
+
flags.DEFINE_integer("output_height", 64, "The size of the output images to produce [64]")
|
78
|
+
|
79
|
+
flags.DEFINE_integer("output_width", None, "The size of the output images to produce. If None, same value as output_height [None]")
|
80
|
+
|
81
|
+
flags.DEFINE_string("dataset", "celebA", "The name of dataset [celebA, mnist, lsun]")
|
82
|
+
|
83
|
+
flags.DEFINE_string("input_fname_pattern", "*.jpg", "Glob pattern of filename of input images [*]")
|
84
|
+
|
85
|
+
flags.DEFINE_string("checkpoint_dir", "checkpoint", "Directory name to save the checkpoints [checkpoint]")
|
86
|
+
|
87
|
+
flags.DEFINE_string("data_dir", "./data", "Root directory of dataset [data]")
|
88
|
+
|
89
|
+
flags.DEFINE_string("sample_dir", "samples", "Directory name to save the image samples [samples]")
|
90
|
+
|
91
|
+
flags.DEFINE_boolean("train", False, "True for training, False for testing [False]")
|
92
|
+
|
93
|
+
flags.DEFINE_boolean("crop", False, "True for training, False for testing [False]")
|
94
|
+
|
95
|
+
flags.DEFINE_boolean("visualize", False, "True for visualizing, False for nothing [False]")
|
96
|
+
|
97
|
+
flags.DEFINE_integer("generate_test_images", 100, "Number of images to generate during test. [100]")
|
98
|
+
|
99
|
+
FLAGS = flags.FLAGS
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
def main(_):
|
106
|
+
|
107
|
+
pp.pprint(flags.FLAGS.__flags)
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
if FLAGS.input_width is None:
|
112
|
+
|
113
|
+
FLAGS.input_width = FLAGS.input_height
|
114
|
+
|
115
|
+
if FLAGS.output_width is None:
|
116
|
+
|
117
|
+
FLAGS.output_width = FLAGS.output_height
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
if not os.path.exists(FLAGS.checkpoint_dir):
|
122
|
+
|
123
|
+
os.makedirs(FLAGS.checkpoint_dir)
|
124
|
+
|
125
|
+
if not os.path.exists(FLAGS.sample_dir):
|
126
|
+
|
127
|
+
os.makedirs(FLAGS.sample_dir)
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
|
132
|
+
|
133
|
+
run_config = tf.ConfigProto()
|
134
|
+
|
135
|
+
run_config.gpu_options.allow_growth=True
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
with tf.Session(config=run_config) as sess:
|
140
|
+
|
141
|
+
if FLAGS.dataset == 'mnist':
|
142
|
+
|
143
|
+
dcgan = DCGAN(
|
144
|
+
|
145
|
+
sess,
|
146
|
+
|
147
|
+
input_width=FLAGS.input_width,
|
148
|
+
|
149
|
+
input_height=FLAGS.input_height,
|
150
|
+
|
151
|
+
output_width=FLAGS.output_width,
|
152
|
+
|
153
|
+
output_height=FLAGS.output_height,
|
154
|
+
|
155
|
+
batch_size=FLAGS.batch_size,
|
156
|
+
|
157
|
+
sample_num=FLAGS.batch_size,
|
158
|
+
|
159
|
+
y_dim=10,
|
160
|
+
|
161
|
+
z_dim=FLAGS.generate_test_images,
|
162
|
+
|
163
|
+
dataset_name=FLAGS.dataset,
|
164
|
+
|
165
|
+
input_fname_pattern=FLAGS.input_fname_pattern,
|
166
|
+
|
167
|
+
crop=FLAGS.crop,
|
168
|
+
|
169
|
+
checkpoint_dir=FLAGS.checkpoint_dir,
|
170
|
+
|
171
|
+
sample_dir=FLAGS.sample_dir,
|
172
|
+
|
173
|
+
data_dir=FLAGS.data_dir )
|
174
|
+
|
175
|
+
else:
|
176
|
+
|
177
|
+
dcgan = DCGAN(
|
178
|
+
|
179
|
+
sess,
|
180
|
+
|
181
|
+
input_width=FLAGS.input_width,
|
182
|
+
|
183
|
+
input_height=FLAGS.input_height,
|
184
|
+
|
185
|
+
output_width=FLAGS.output_width,
|
186
|
+
|
187
|
+
output_height=FLAGS.output_height,
|
188
|
+
|
189
|
+
batch_size=FLAGS.batch_size,
|
190
|
+
|
191
|
+
sample_num=FLAGS.batch_size,
|
192
|
+
|
193
|
+
z_dim=FLAGS.generate_test_images,
|
194
|
+
|
195
|
+
dataset_name=FLAGS.dataset,
|
196
|
+
|
197
|
+
input_fname_pattern=FLAGS.input_fname_pattern,
|
198
|
+
|
199
|
+
crop=FLAGS.crop,
|
200
|
+
|
201
|
+
checkpoint_dir=FLAGS.checkpoint_dir,
|
202
|
+
|
203
|
+
sample_dir=FLAGS.sample_dir,
|
204
|
+
|
205
|
+
data_dir=FLAGS.data_dir)
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
show_all_variables()
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
if FLAGS.train:
|
214
|
+
|
215
|
+
dcgan.train(FLAGS)
|
216
|
+
|
217
|
+
else:
|
218
|
+
|
219
|
+
if not dcgan.load(FLAGS.checkpoint_dir)[0]:
|
220
|
+
|
221
|
+
raise Exception("[!] Train a model first, then run test mode")
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
to_json("./web/js/layers.js", [dcgan.h0_w, dcgan.h0_b, dcgan.g_bn0],
|
228
|
+
|
229
|
+
[dcgan.h1_w, dcgan.h1_b, dcgan.g_bn1],
|
230
|
+
|
231
|
+
[dcgan.h2_w, dcgan.h2_b, dcgan.g_bn2],
|
232
|
+
|
233
|
+
[dcgan.h3_w, dcgan.h3_b, dcgan.g_bn3],
|
234
|
+
|
235
|
+
[dcgan.h4_w, dcgan.h4_b, None])
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
Below is codes for visualization
|
240
|
+
|
241
|
+
OPTION = 1
|
242
|
+
|
243
|
+
visualize(sess, dcgan, FLAGS, OPTION)
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
if __name__ == '__main__':
|
248
|
+
|
249
|
+
tf.app.run()
|
250
|
+
|
73
251
|
```
|
74
252
|
|
75
|
-
flags.DEFINE_integer("input_height", 108, "The size of image to use (will be center cropped). [108]")
|
76
|
-
|
77
|
-
flags.DEFINE_integer("input_width", None, "The size of image to use (will be center cropped). If None, same value as input_height [None]")
|
78
|
-
|
79
|
-
flags.DEFINE_integer("output_height", 64, "The size of the output images to produce [64]")
|
80
|
-
|
81
|
-
flags.DEFINE_integer("output_width", None, "The size of the output images to produce. If None, same value as output_height [None]")
|
82
|
-
|
83
|
-
flags.DEFINE_string("dataset", "celebA", "The name of dataset [celebA, mnist, lsun]")
|
84
|
-
|
85
|
-
flags.DEFINE_string("input_fname_pattern", "*.jpg", "Glob pattern of filename of input images [*]")
|
86
|
-
|
87
|
-
flags.DEFINE_string("checkpoint_dir", "checkpoint", "Directory name to save the checkpoints [checkpoint]")
|
88
|
-
|
89
|
-
flags.DEFINE_string("data_dir", "./data", "Root directory of dataset [data]")
|
90
|
-
|
91
|
-
flags.DEFINE_string("sample_dir", "samples", "Directory name to save the image samples [samples]")
|
92
|
-
|
93
|
-
flags.DEFINE_boolean("train", False, "True for training, False for testing [False]")
|
94
|
-
|
95
|
-
flags.DEFINE_boolean("crop", False, "True for training, False for testing [False]")
|
96
|
-
|
97
|
-
flags.DEFINE_boolean("visualize", False, "True for visualizing, False for nothing [False]")
|
98
|
-
|
99
|
-
flags.DEFINE_integer("generate_test_images", 100, "Number of images to generate during test. [100]")
|
100
|
-
|
101
|
-
FLAGS = flags.FLAGS
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
def main(_):
|
108
|
-
|
109
|
-
pp.pprint(flags.FLAGS.__flags)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
if FLAGS.input_width is None:
|
114
|
-
|
115
|
-
FLAGS.input_width = FLAGS.input_height
|
116
|
-
|
117
|
-
if FLAGS.output_width is None:
|
118
|
-
|
119
|
-
FLAGS.output_width = FLAGS.output_height
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
if not os.path.exists(FLAGS.checkpoint_dir):
|
124
|
-
|
125
|
-
os.makedirs(FLAGS.checkpoint_dir)
|
126
|
-
|
127
|
-
if not os.path.exists(FLAGS.sample_dir):
|
128
|
-
|
129
|
-
os.makedirs(FLAGS.sample_dir)
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
|
134
|
-
|
135
|
-
run_config = tf.ConfigProto()
|
136
|
-
|
137
|
-
run_config.gpu_options.allow_growth=True
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
with tf.Session(config=run_config) as sess:
|
142
|
-
|
143
|
-
if FLAGS.dataset == 'mnist':
|
144
|
-
|
145
|
-
dcgan = DCGAN(
|
146
|
-
|
147
|
-
sess,
|
148
|
-
|
149
|
-
input_width=FLAGS.input_width,
|
150
|
-
|
151
|
-
input_height=FLAGS.input_height,
|
152
|
-
|
153
|
-
output_width=FLAGS.output_width,
|
154
|
-
|
155
|
-
output_height=FLAGS.output_height,
|
156
|
-
|
157
|
-
batch_size=FLAGS.batch_size,
|
158
|
-
|
159
|
-
sample_num=FLAGS.batch_size,
|
160
|
-
|
161
|
-
y_dim=10,
|
162
|
-
|
163
|
-
z_dim=FLAGS.generate_test_images,
|
164
|
-
|
165
|
-
dataset_name=FLAGS.dataset,
|
166
|
-
|
167
|
-
input_fname_pattern=FLAGS.input_fname_pattern,
|
168
|
-
|
169
|
-
crop=FLAGS.crop,
|
170
|
-
|
171
|
-
checkpoint_dir=FLAGS.checkpoint_dir,
|
172
|
-
|
173
|
-
sample_dir=FLAGS.sample_dir,
|
174
|
-
|
175
|
-
data_dir=FLAGS.data_dir )
|
176
|
-
|
177
|
-
else:
|
178
|
-
|
179
|
-
dcgan = DCGAN(
|
180
|
-
|
181
|
-
sess,
|
182
|
-
|
183
|
-
input_width=FLAGS.input_width,
|
184
|
-
|
185
|
-
input_height=FLAGS.input_height,
|
186
|
-
|
187
|
-
output_width=FLAGS.output_width,
|
188
|
-
|
189
|
-
output_height=FLAGS.output_height,
|
190
|
-
|
191
|
-
batch_size=FLAGS.batch_size,
|
192
|
-
|
193
|
-
sample_num=FLAGS.batch_size,
|
194
|
-
|
195
|
-
z_dim=FLAGS.generate_test_images,
|
196
|
-
|
197
|
-
dataset_name=FLAGS.dataset,
|
198
|
-
|
199
|
-
input_fname_pattern=FLAGS.input_fname_pattern,
|
200
|
-
|
201
|
-
crop=FLAGS.crop,
|
202
|
-
|
203
|
-
checkpoint_dir=FLAGS.checkpoint_dir,
|
204
|
-
|
205
|
-
sample_dir=FLAGS.sample_dir,
|
206
|
-
|
207
|
-
data_dir=FLAGS.data_dir)
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
show_all_variables()
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
if FLAGS.train:
|
216
|
-
|
217
|
-
dcgan.train(FLAGS)
|
218
|
-
|
219
|
-
else:
|
220
|
-
|
221
|
-
if not dcgan.load(FLAGS.checkpoint_dir)[0]:
|
222
|
-
|
223
|
-
raise Exception("[!] Train a model first, then run test mode")
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
to_json("./web/js/layers.js", [dcgan.h0_w, dcgan.h0_b, dcgan.g_bn0],
|
230
|
-
|
231
|
-
[dcgan.h1_w, dcgan.h1_b, dcgan.g_bn1],
|
232
|
-
|
233
|
-
[dcgan.h2_w, dcgan.h2_b, dcgan.g_bn2],
|
234
|
-
|
235
|
-
[dcgan.h3_w, dcgan.h3_b, dcgan.g_bn3],
|
236
|
-
|
237
|
-
[dcgan.h4_w, dcgan.h4_b, None])
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
Below is codes for visualization
|
242
|
-
|
243
|
-
OPTION = 1
|
244
|
-
|
245
|
-
visualize(sess, dcgan, FLAGS, OPTION)
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
if __name__ == '__main__':
|
250
|
-
|
251
|
-
tf.app.run()
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
```
|
256
|
-
|
257
253
|
|
258
254
|
|
259
255
|
|
3
コードをフォーマットの中にいれて見やすくしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -250,6 +250,8 @@
|
|
250
250
|
|
251
251
|
tf.app.run()
|
252
252
|
|
253
|
+
|
254
|
+
|
253
255
|
```
|
254
256
|
|
255
257
|
|
2
コードをフォーマットの中に入れて見やすくしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,158 +100,160 @@
|
|
100
100
|
|
101
101
|
FLAGS = flags.FLAGS
|
102
102
|
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
def main(_):
|
108
|
+
|
109
|
+
pp.pprint(flags.FLAGS.__flags)
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
if FLAGS.input_width is None:
|
114
|
+
|
115
|
+
FLAGS.input_width = FLAGS.input_height
|
116
|
+
|
117
|
+
if FLAGS.output_width is None:
|
118
|
+
|
119
|
+
FLAGS.output_width = FLAGS.output_height
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
if not os.path.exists(FLAGS.checkpoint_dir):
|
124
|
+
|
125
|
+
os.makedirs(FLAGS.checkpoint_dir)
|
126
|
+
|
127
|
+
if not os.path.exists(FLAGS.sample_dir):
|
128
|
+
|
129
|
+
os.makedirs(FLAGS.sample_dir)
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
|
134
|
+
|
135
|
+
run_config = tf.ConfigProto()
|
136
|
+
|
137
|
+
run_config.gpu_options.allow_growth=True
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
with tf.Session(config=run_config) as sess:
|
142
|
+
|
143
|
+
if FLAGS.dataset == 'mnist':
|
144
|
+
|
145
|
+
dcgan = DCGAN(
|
146
|
+
|
147
|
+
sess,
|
148
|
+
|
149
|
+
input_width=FLAGS.input_width,
|
150
|
+
|
151
|
+
input_height=FLAGS.input_height,
|
152
|
+
|
153
|
+
output_width=FLAGS.output_width,
|
154
|
+
|
155
|
+
output_height=FLAGS.output_height,
|
156
|
+
|
157
|
+
batch_size=FLAGS.batch_size,
|
158
|
+
|
159
|
+
sample_num=FLAGS.batch_size,
|
160
|
+
|
161
|
+
y_dim=10,
|
162
|
+
|
163
|
+
z_dim=FLAGS.generate_test_images,
|
164
|
+
|
165
|
+
dataset_name=FLAGS.dataset,
|
166
|
+
|
167
|
+
input_fname_pattern=FLAGS.input_fname_pattern,
|
168
|
+
|
169
|
+
crop=FLAGS.crop,
|
170
|
+
|
171
|
+
checkpoint_dir=FLAGS.checkpoint_dir,
|
172
|
+
|
173
|
+
sample_dir=FLAGS.sample_dir,
|
174
|
+
|
175
|
+
data_dir=FLAGS.data_dir )
|
176
|
+
|
177
|
+
else:
|
178
|
+
|
179
|
+
dcgan = DCGAN(
|
180
|
+
|
181
|
+
sess,
|
182
|
+
|
183
|
+
input_width=FLAGS.input_width,
|
184
|
+
|
185
|
+
input_height=FLAGS.input_height,
|
186
|
+
|
187
|
+
output_width=FLAGS.output_width,
|
188
|
+
|
189
|
+
output_height=FLAGS.output_height,
|
190
|
+
|
191
|
+
batch_size=FLAGS.batch_size,
|
192
|
+
|
193
|
+
sample_num=FLAGS.batch_size,
|
194
|
+
|
195
|
+
z_dim=FLAGS.generate_test_images,
|
196
|
+
|
197
|
+
dataset_name=FLAGS.dataset,
|
198
|
+
|
199
|
+
input_fname_pattern=FLAGS.input_fname_pattern,
|
200
|
+
|
201
|
+
crop=FLAGS.crop,
|
202
|
+
|
203
|
+
checkpoint_dir=FLAGS.checkpoint_dir,
|
204
|
+
|
205
|
+
sample_dir=FLAGS.sample_dir,
|
206
|
+
|
207
|
+
data_dir=FLAGS.data_dir)
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
show_all_variables()
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
if FLAGS.train:
|
216
|
+
|
217
|
+
dcgan.train(FLAGS)
|
218
|
+
|
219
|
+
else:
|
220
|
+
|
221
|
+
if not dcgan.load(FLAGS.checkpoint_dir)[0]:
|
222
|
+
|
223
|
+
raise Exception("[!] Train a model first, then run test mode")
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
to_json("./web/js/layers.js", [dcgan.h0_w, dcgan.h0_b, dcgan.g_bn0],
|
230
|
+
|
231
|
+
[dcgan.h1_w, dcgan.h1_b, dcgan.g_bn1],
|
232
|
+
|
233
|
+
[dcgan.h2_w, dcgan.h2_b, dcgan.g_bn2],
|
234
|
+
|
235
|
+
[dcgan.h3_w, dcgan.h3_b, dcgan.g_bn3],
|
236
|
+
|
237
|
+
[dcgan.h4_w, dcgan.h4_b, None])
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
Below is codes for visualization
|
242
|
+
|
243
|
+
OPTION = 1
|
244
|
+
|
245
|
+
visualize(sess, dcgan, FLAGS, OPTION)
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
if __name__ == '__main__':
|
250
|
+
|
251
|
+
tf.app.run()
|
252
|
+
|
103
253
|
```
|
104
254
|
|
105
255
|
|
106
256
|
|
107
|
-
def main(_):
|
108
|
-
|
109
|
-
pp.pprint(flags.FLAGS.__flags)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
if FLAGS.input_width is None:
|
114
|
-
|
115
|
-
FLAGS.input_width = FLAGS.input_height
|
116
|
-
|
117
|
-
if FLAGS.output_width is None:
|
118
|
-
|
119
|
-
FLAGS.output_width = FLAGS.output_height
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
if not os.path.exists(FLAGS.checkpoint_dir):
|
124
|
-
|
125
|
-
os.makedirs(FLAGS.checkpoint_dir)
|
126
|
-
|
127
|
-
if not os.path.exists(FLAGS.sample_dir):
|
128
|
-
|
129
|
-
os.makedirs(FLAGS.sample_dir)
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
|
134
|
-
|
135
|
-
run_config = tf.ConfigProto()
|
136
|
-
|
137
|
-
run_config.gpu_options.allow_growth=True
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
with tf.Session(config=run_config) as sess:
|
142
|
-
|
143
|
-
if FLAGS.dataset == 'mnist':
|
144
|
-
|
145
|
-
dcgan = DCGAN(
|
146
|
-
|
147
|
-
sess,
|
148
|
-
|
149
|
-
input_width=FLAGS.input_width,
|
150
|
-
|
151
|
-
input_height=FLAGS.input_height,
|
152
|
-
|
153
|
-
output_width=FLAGS.output_width,
|
154
|
-
|
155
|
-
output_height=FLAGS.output_height,
|
156
|
-
|
157
|
-
batch_size=FLAGS.batch_size,
|
158
|
-
|
159
|
-
sample_num=FLAGS.batch_size,
|
160
|
-
|
161
|
-
y_dim=10,
|
162
|
-
|
163
|
-
z_dim=FLAGS.generate_test_images,
|
164
|
-
|
165
|
-
dataset_name=FLAGS.dataset,
|
166
|
-
|
167
|
-
input_fname_pattern=FLAGS.input_fname_pattern,
|
168
|
-
|
169
|
-
crop=FLAGS.crop,
|
170
|
-
|
171
|
-
checkpoint_dir=FLAGS.checkpoint_dir,
|
172
|
-
|
173
|
-
sample_dir=FLAGS.sample_dir,
|
174
|
-
|
175
|
-
data_dir=FLAGS.data_dir )
|
176
|
-
|
177
|
-
else:
|
178
|
-
|
179
|
-
dcgan = DCGAN(
|
180
|
-
|
181
|
-
sess,
|
182
|
-
|
183
|
-
input_width=FLAGS.input_width,
|
184
|
-
|
185
|
-
input_height=FLAGS.input_height,
|
186
|
-
|
187
|
-
output_width=FLAGS.output_width,
|
188
|
-
|
189
|
-
output_height=FLAGS.output_height,
|
190
|
-
|
191
|
-
batch_size=FLAGS.batch_size,
|
192
|
-
|
193
|
-
sample_num=FLAGS.batch_size,
|
194
|
-
|
195
|
-
z_dim=FLAGS.generate_test_images,
|
196
|
-
|
197
|
-
dataset_name=FLAGS.dataset,
|
198
|
-
|
199
|
-
input_fname_pattern=FLAGS.input_fname_pattern,
|
200
|
-
|
201
|
-
crop=FLAGS.crop,
|
202
|
-
|
203
|
-
checkpoint_dir=FLAGS.checkpoint_dir,
|
204
|
-
|
205
|
-
sample_dir=FLAGS.sample_dir,
|
206
|
-
|
207
|
-
data_dir=FLAGS.data_dir)
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
show_all_variables()
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
if FLAGS.train:
|
216
|
-
|
217
|
-
dcgan.train(FLAGS)
|
218
|
-
|
219
|
-
else:
|
220
|
-
|
221
|
-
if not dcgan.load(FLAGS.checkpoint_dir)[0]:
|
222
|
-
|
223
|
-
raise Exception("[!] Train a model first, then run test mode")
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
to_json("./web/js/layers.js", [dcgan.h0_w, dcgan.h0_b, dcgan.g_bn0],
|
230
|
-
|
231
|
-
[dcgan.h1_w, dcgan.h1_b, dcgan.g_bn1],
|
232
|
-
|
233
|
-
[dcgan.h2_w, dcgan.h2_b, dcgan.g_bn2],
|
234
|
-
|
235
|
-
[dcgan.h3_w, dcgan.h3_b, dcgan.g_bn3],
|
236
|
-
|
237
|
-
[dcgan.h4_w, dcgan.h4_b, None])
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
Below is codes for visualization
|
242
|
-
|
243
|
-
OPTION = 1
|
244
|
-
|
245
|
-
visualize(sess, dcgan, FLAGS, OPTION)
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
if __name__ == '__main__':
|
250
|
-
|
251
|
-
tf.app.run()
|
252
|
-
|
253
|
-
|
254
|
-
|
255
257
|
|
256
258
|
|
257
259
|
### 試したこと
|
1
コードをフォーマットの中に入れて見やすくしました
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
tensorflow の実行が途中から進まないです
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
```python
|
8
8
|
|
9
9
|
### 発生している問題・エラーメッセージ
|
10
10
|
|
@@ -28,6 +28,10 @@
|
|
28
28
|
|
29
29
|
Exception: [!] No data found in './data/celebA/*.jpg'
|
30
30
|
|
31
|
+
```
|
32
|
+
|
33
|
+
```python
|
34
|
+
|
31
35
|
|
32
36
|
|
33
37
|
|
@@ -64,7 +68,9 @@
|
|
64
68
|
|
65
69
|
flags.DEFINE_float("train_size", np.inf, "The size of train images [np.inf]")
|
66
70
|
|
67
|
-
flags.DEFINE_integer("batch_size", 64, "The size of batch images [64]")
|
71
|
+
flags.DEFINE_integer("batch_size", 64, "The size of batch images [64]")```
|
72
|
+
|
73
|
+
```
|
68
74
|
|
69
75
|
flags.DEFINE_integer("input_height", 108, "The size of image to use (will be center cropped). [108]")
|
70
76
|
|
@@ -94,6 +100,8 @@
|
|
94
100
|
|
95
101
|
FLAGS = flags.FLAGS
|
96
102
|
|
103
|
+
```
|
104
|
+
|
97
105
|
|
98
106
|
|
99
107
|
def main(_):
|