()
| 540 | |
| 541 | |
| 542 | def mnist(): |
| 543 | X, Y = util.get_mnist() |
| 544 | X = X.reshape(len(X), 28, 28, 1) |
| 545 | dim = X.shape[1] |
| 546 | colors = X.shape[-1] |
| 547 | |
| 548 | # for mnist |
| 549 | d_sizes = { |
| 550 | 'conv_layers': [(2, 5, 2, False), (64, 5, 2, True)], |
| 551 | 'dense_layers': [(1024, True)], |
| 552 | } |
| 553 | g_sizes = { |
| 554 | 'z': 100, |
| 555 | 'projection': 128, |
| 556 | 'bn_after_project': False, |
| 557 | 'conv_layers': [(128, 5, 2, True), (colors, 5, 2, False)], |
| 558 | 'dense_layers': [(1024, True)], |
| 559 | 'output_activation': tf.sigmoid, |
| 560 | } |
| 561 | |
| 562 | |
| 563 | # setup gan |
| 564 | # note: assume square images, so only need 1 dim |
| 565 | gan = DCGAN(dim, colors, d_sizes, g_sizes) |
| 566 | gan.fit(X) |
| 567 | # samples = gan.sample(1) # just making sure it works |
| 568 | |
| 569 | # since training will take a considerable |
| 570 | # amount of time, let's just save some |
| 571 | # samples to disk rather than plotting now |
| 572 | |
| 573 | |
| 574 | if __name__ == '__main__': |
no test coverage detected