M. Gaz
M. Gaz

Reputation: 1

Replace MNIST data in Tensorflow CNN models

I am trying to train a CNN model on my own dataset in tensorflow. I transformed my data in the same MNIST format with this code https://github.com/gskielian/JPG-PNG-to-MNIST-NN-Format/blob/master/convert-images-to-mnist-format.py.

Now I don't know how to replace the MNIST data with my own data. Is there a way to replace mnist data with my own data or import them in tensorflow?

Upvotes: 0

Views: 1493

Answers (1)

Tobias Scheithauer
Tobias Scheithauer

Reputation: 365

You might have a look at this file especially at the lines where the import of the mnist data is programmed.

from tensorflow.examples.tutorials.mnist import input_data    
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True)

This function imports the mnist data. According to the function's sourcecode (line 229 ff.) your files should have the following names so you need to rewrite the function you've linked to so there is a test set.

TRAIN_IMAGES = 'train-images-idx3-ubyte.gz'
TRAIN_LABELS = 'train-labels-idx1-ubyte.gz'
TEST_IMAGES = 't10k-images-idx3-ubyte.gz'
TEST_LABELS = 't10k-labels-idx1-ubyte.gz'

Alternatively you could adapt the function's source to your needs and write your own import function.

Upvotes: 0

Related Questions