-
Notifications
You must be signed in to change notification settings - Fork 96
/
stl_aegan.py
executable file
·41 lines (32 loc) · 1.01 KB
/
stl_aegan.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
#!/usr/bin/env python
import os
import pickle
import dataset.stl
import aegan
def run():
experiment_name = 'stl'
img_size = 64
epoch_size = 250
batch_size = 64
train_feed = dataset.stl.unlabeled_feed(
img_size, batch_size=batch_size, epoch_size=epoch_size,
n_augment=int(5e5)
)
_, test_feed = dataset.stl.supervised_feed(img_size)
model, experiment_name = aegan.build_model(
experiment_name, img_size, n_hidden=128, recon_depth=9,
recon_vs_gan_weight=1e-6, real_vs_gen_weight=0.5,
discriminate_ae_recon=False, discriminate_sample_z=True,
)
print('experiment_name: %s' % experiment_name)
output_dir = os.path.join('out', experiment_name)
aegan.train(
model, output_dir, train_feed, test_feed, n_epochs=200,
)
model_path = os.path.join(output_dir, 'arch.pickle')
print('Saving model to disk')
print(model_path)
with open(model_path, 'wb') as f:
pickle.dump(model, f)
if __name__ == '__main__':
run()