Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 1.54 KB

README.md

File metadata and controls

50 lines (38 loc) · 1.54 KB

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