guppycodes
guppycodes

Reputation: 31

How do I use an imported MNIST dataset?

I'm not familiar with using python as a ML tool and wanted to train the MNIST data set. I have downloaded the MNIST library using pip install python-mnist but do not know what my next step should be. What would an import statement look like? Should I also import TensorFlow and or Keras to train the data?

I know the MNIST dataset is available in TensorFlow and Keras, however, importing via pip a necessary solution for my use case. Both TensorFlow and Keras have tutorials using the MNIST data set, but I was wondering if it is possible to use the data set without using their pre-downloaded library.

Upvotes: 1

Views: 1456

Answers (1)

vlizana
vlizana

Reputation: 3232

The import statement should look like this

from mnist import MNIST
mndata = MNIST('./dir_with_mnist_data_files')
images, labels = mndata.load_training()

then you can work directly with the arrays of raw images and labels.

Upvotes: 1

Related Questions