.. _MNIST_label:
=============================
Experiments on MNIST Database
=============================
The MNIST_ database is a large database of handwritten digits
commonly used to test image processing systems.
Preparation
^^^^^^^^^^^^
Get the raw data
################
To download the raw MNIST data set with the default parameters, run:
.. code-block:: console
python -m datasets.mnist.get_raw -m sacred
In this case, the process is very simple. We use Keras_ to download the MNIST data to :file:`~/.keras/datasets/mnist.npz.`
.. _MNIST: https://en.wikipedia.org/wiki/MNIST_database
.. _Keras: https://keras.io/
Serialize the raw data
######################
To serialize the raw data use:
.. code-block:: console
python -m datasets.mnist.serialize -m sacred
Unconditioned MNIST GAN
^^^^^^^^^^^^^^^^^^^^^^^
The following experiment shows how to generate random numbers between 0 and 9 with
the GanEstimator_ module. For implementation details see :ref:`components_label` or :ref:`API_label`
To run the code with the default parameters defined in the config function
just type from the root directory:
.. code-block:: console
python -m exps.mnist.train
Or use the command line to set different parameters:
.. code-block:: console
python -m exps.mnist.train with mnist_feeder.batch_size=16 gan_type="UNCOND" -m sacred
.. _GanEstimator: https://www.tensorflow.org/api_docs/python/tf/contrib/gan/estimator/GANEstimator
Example output
###############
With the default parameters we will obtain the following result for training steps 100, 400 and 2000:
.. raw:: html
Conditioned MNIST GAN
^^^^^^^^^^^^^^^^^^^^^^
In this experiment, we wish to condition on both the generator and discriminator.
We generate MNIST digits conditioned on class labels.
To run the conditioned MNIST GAN use:
.. code-block:: console
python -m exps.mnist.gan with mnist_feeder.batch_size=16 gan_type="COND" -m sacred
Example output
###############
With the default parameters we will obtain the following result for training steps 100, 400 and 2000:
.. raw:: html