| 628 | |
| 629 | |
| 630 | def mnist(): |
| 631 | X, Y = util.get_mnist() |
| 632 | X = X.reshape(len(X), 1, 28, 28) # remember! (N, color, D, D) |
| 633 | dim = X.shape[2] |
| 634 | colors = X.shape[1] |
| 635 | |
| 636 | # for mnist |
| 637 | d_sizes = { |
| 638 | 'conv_layers': [(2, 5, 2, False), (64, 5, 2, True)], |
| 639 | 'dense_layers': [(1024, True)], |
| 640 | } |
| 641 | g_sizes = { |
| 642 | 'z': 100, |
| 643 | 'projection': 128, |
| 644 | 'bn_after_project': False, |
| 645 | 'conv_layers': [(128, 5, 2, True), (colors, 5, 2, False)], |
| 646 | 'dense_layers': [(1024, True)], |
| 647 | 'output_activation': T.nnet.sigmoid, |
| 648 | } |
| 649 | |
| 650 | |
| 651 | # setup gan |
| 652 | # note: assume square images, so only need 1 dim |
| 653 | gan = DCGAN(dim, colors, d_sizes, g_sizes) |
| 654 | gan.fit(X) |
| 655 | |
| 656 | # since training will take a considerable |
| 657 | # amount of time, let's just save some |
| 658 | # samples to disk rather than plotting now |
| 659 | |
| 660 | |
| 661 | if __name__ == '__main__': |