This is the implementation of "PixelCNN" for grayscale image.
Original paper: A. v. d. Oord, N. Kalchbrenner, and K. Kavukcuoglu. Pixel Recurrent Neural Networks. In Proceedings of The 33rd International Conference on Machine Learning, 2016. link
Please build the source file according to the procedure.
$ mkdir build
$ cd build
$ cmake ..
$ make -j4
$ cd ..
- THE MNIST DATABASE of handwritten digits
This is the dataset of 28x28 grayscale for handwritten digits in 10 classes that has a training set of 60000 images and a test set of 10000 images.
Link: official
Please create a link for the dataset.
The following hierarchical relationships are recommended.
datasets
|--Dataset1
| |--train
| | |--image1.png
| | |--image2.bmp
| | |--image3.jpg
| |
| |--valid
| |--test
|
|--Dataset2
|--Dataset3
You should substitute the path of training data for "<training_path>", test data for "<test_path>", respectively.
The following is an example for "MNIST".
$ cd datasets
$ mkdir MNIST
$ cd MNIST
$ ln -s <training_path> ./train
$ ln -s <test_path> ./test
$ cd ../..
Please set the shell for executable file.
$ vi scripts/train.sh
The following is an example of the training phase.
If you want to view specific examples of command line arguments, please view "src/main.cpp" or add "--help" to the argument.
#!/bin/bash
DATA='MNIST'
./PixelCNN-Gray \
--train true \
--epochs 300 \
--dataset ${DATA} \
--size 64 \
--batch_size 16 \
--gpu_id 0
Please execute the following to start the program.
$ sh scripts/train.sh
Please set the shell for executable file.
$ vi scripts/test.sh
The following is an example of the test phase.
If you want to view specific examples of command line arguments, please view "src/main.cpp" or add "--help" to the argument.
#!/bin/bash
DATA='MNIST'
./PixelCNN-Gray \
--test true \
--dataset ${DATA} \
--size 64 \
--gpu_id 0
Please execute the following to start the program.
$ sh scripts/test.sh
Please set the shell for executable file.
$ vi scripts/sample.sh
The following is an example of the sampling phase.
If you want to view specific examples of command line arguments, please view "src/main.cpp" or add "--help" to the argument.
#!/bin/bash
DATA='MNIST'
./PixelCNN-Gray \
--sample true \
--dataset ${DATA} \
--sample_total 100 \
--size 64 \
--gpu_id 0
If you want to generate image, the above settings will work.
Please execute the following to start the program.
$ sh scripts/sample.sh