https://github.com/x-raylaser/generative-rnn
This repository is made as supplementary material for a tutorial. The tutorial shows how to use Recurrent Neural Nets as generative models.
https://github.com/x-raylaser/generative-rnn
bayes-rule bayesian-inference deep-learning digit-generation generative-model mnist pixel-prediction recurrent-neural-nets recurrent-neural-networks tutorial
Last synced: about 1 month ago
JSON representation
This repository is made as supplementary material for a tutorial. The tutorial shows how to use Recurrent Neural Nets as generative models.
- Host: GitHub
- URL: https://github.com/x-raylaser/generative-rnn
- Owner: X-rayLaser
- License: mit
- Created: 2019-08-02T17:05:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-03T12:27:38.000Z (almost 6 years ago)
- Last Synced: 2025-02-16T02:24:57.549Z (3 months ago)
- Topics: bayes-rule, bayesian-inference, deep-learning, digit-generation, generative-model, mnist, pixel-prediction, recurrent-neural-nets, recurrent-neural-networks, tutorial
- Language: Python
- Homepage:
- Size: 21.5 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Intro
This repository is made as supplementary material for a tutorial.
The tutorial shows how to use Recurrent Neural Nets as generative
models. Specifically, it shows how such a model can be used to
sample images and classify them. For more information, see the
file "tutorial.md" in the repository.This repository contains pre-trained generative models. The
"trained/minst_models" folder contains all 10 models for each of
MNIST digits. Each pre-trained model was trained on MNIST training
data for 12 epochs using "Adam" optimizer with a standard set of
hyperparameters and a batch size of 32 examples. Cross-entropy was
used as a loss function.Here are a few examples of generated digits:


# Installing and preparing the environment
Clone the repository,
```
git clone https://github.com/X-rayLaser/generative-rnn.git
```
switch to the project's directory,
```
cd generative-rnn
```create a virtual environment for Python and activate it,
```
which python3
/usr/bin/python3
```
```
virtualenv --python='/usr/bin/python3' venv
. venv/bin/activate
```finally, install dependencies with pip
```
pip install -r requirements.txt
```# Usage
Generate images of a digit "8"
```
python generate_mnist.py --digit=8
```Estimate classification accuracy on 500 MNIST test examples
```
python classification.py --num_images=500
```Train a model on a digit "8" using 200 MNIST images for 100 epochs
```
python train_mnist.py --digit=8 --num_images=200 --epochs=100
```Train all 10 models, one for each digit for 10 epochs on 1000 images
```
python train_mnist.py --all_digits=True --num_images=1000 --epochs=10
```# License
This software is licensed under MIT license (see LICENSE).## Third party libraries licenses
The software uses third party libraries that are distributed under
their own terms (see LICENSE-3RD-PARTY).