- We will start by loading the necessary libraries for our script.
import tensorflow as tffrom sklearn.preprocessing import MultiLabelBinarizerfrom keras.utils import to_categoricalfrom tensorflow import kerasfrom tensorflow.python.framework import opsops.reset_default_graph()# Load MNIST datafrom tensorflow.examples.tutorials.mnist import input_data
- We can load the library with the provided MNIST data import function in TensorFlow. Although the original MNIST images are 28 pixels by 28 pixels, the imported data is a flattened version of them, where each observation is a row of 784 greyscale points between 0 and 1. The y-labels are imported as integers between 0 and 9.
mnist = input_data.read_data_sets("MNIST_data/")