Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Image To MNIST using Python 3.6

Firstly, many thanks to gskielian for getting it to work with Python 2.7 https://github.com/gskielian/JPG-PNG-to-MNIST-NN-Format

Dependencies:

pip install pillow

Create a custom dataset for TensorFlow MNIST tutorials

1. MNIST requires train and test files to be classified under folder names: 0,1,2...

2. To resize images use the following bash script resize-script.sh (use https://github.com/gskielian/JPG-PNG-to-MNIST-NN-Format/blob/master/resize-script.sh)

3. Run python main.py -h to get help. Results look as follows:

alt text

4. Run python main.py -m ./ -r training-images -e test-images Results look as follows when converting PNG to MNIST:

alt text

Required files should be in this order

MainFolder
β”œβ”€β”€ test-images (testfolder)
β”‚   β”œβ”€β”€ 0
β”‚   β”‚   β”œβ”€β”€ img00.png
β”‚   β”‚   └── img01.png
β”‚   β”œβ”€β”€ 1
β”‚   β”‚   β”œβ”€β”€ img10.png
β”‚   β”‚   └── img11.png
β”‚   β”œβ”€β”€ 2
β”‚   β”‚   β”œβ”€β”€ img20.png
β”‚   β”‚   └── img21.png
└── training-images (trainfolder)
    β”œβ”€β”€ 0
    β”‚   β”œβ”€β”€ img00.png
    β”‚   β”œβ”€β”€ img01.png
    β”œβ”€β”€ 1
    β”‚   β”œβ”€β”€ img10.png
    β”‚   └── img11.png
    └── 2
        β”œβ”€β”€ img20.png
        └── img21.png

About

Convert PNG images to MNIST format using Python 3.6

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages