项目作者: ChunyuanLI

项目描述 :
Training a MNIST classifier, and use it to compute inception score (ICP)
高级语言: Python
项目地址: git://github.com/ChunyuanLI/MNIST_Inception_Score.git
创建时间: 2017-08-28T20:33:52Z
项目社区:https://github.com/ChunyuanLI/MNIST_Inception_Score

开源协议:

下载


Inception Score for MNIST

Train a “perfect” MNIST classifier, and use it to compute inception score (ICP)

With our ICP implementation (pre-trained model saved in directory ‘model’), the testing set of MNIST yields a score

Note that different pre-trained models may lead to slightly different inception scores.

Prerequisites: Tensorflow 1.0


The Format of Generated Images

The generated images are saved in a mat file, with a tensor named ‘images’ of size [10000,784], where 10000 is the number of images, and 784 is the dimension of a flattened MNIST image.

If you have multiple checkout points (each is a mat file) saved in a folder, you may specify the directory as

  1. # folders for generated images
  2. result_folder = './example_dir/'
  3. icp = []
  4. for k in range(50):
  5. k = k + 1
  6. mat = scipy.io.loadmat(result_folder+ '{}.mat'.format(str(k).zfill(3)))

If you have one checkout point saved in a mat file, you may specify the file as

  1. file_name = 'example.mat'
  2. mat = scipy.io.loadmat(result_folder+ file_name )

How to Use the Code: Evaluation, Re-train and Plot

To evaluate the ICP of generated images, run:

  1. mnist_cnn_icp_eval.py

If you would like to re-train your classifier model, run:

  1. mnist_cnn_train_slim.py

If you would like to plot your inception scores for multiple checkout points, run:

  1. mnist_icp_plot.py

Citation

This code is used in the following paper:

  1. @article{li2017alice,
  2. title={ALICE: Towards Understanding Adversarial Learning for Joint Distribution Matching},
  3. author={Li, Chunyuan and Liu, Hao and Chen, Changyou and Pu, Yunchen and Chen, Liqun and Henao, Ricardo and Carin, Lawrence},
  4. journal={Neural Information Processing Systems (NIPS)},
  5. year={2017}
  6. }