In this part the input must be prepared. 1 - The MNIST data will be downloaded. 2 - The images and labels for both training and testing will be extracted. 3 - The prepared data format(?,784) is different by the appropriate image shape(?,28,28,1) which needs to be fed to the CNN architecture. So it needs to be reshaped. ''' # Download and get MNIST dataset(available in tensorflow.contrib.learn.python.learn.datasets.mnist) # It checks and download MNIST if it's not already downloaded then extract it. # The 'reshape' is True by default to extract feature vectors but we set it to false to we get the original images. mnist = input_data.read_data_sets("MNIST_data/", reshape=False, one_hot=False) # The 'input.provide_data' is provided to organize any custom dataset which has specific characteristics. data = input.provide_data(mnist) # Dimentionality of train dimensionality_train = data.train.images.shape # Dimensions num_train_samples = dimensionality_train[0] height = dimensionality_train[1] width = dimensionality_train[2] num_channels = dimensionality_train[3] ####################################### ########## Defining Graph ############ ####################################### graph = tf.Graph()
In this part the input must be prepared. 1 - The MNIST data will be downloaded. 2 - The images and labels for both training and testing will be extracted. 3 - The prepared data format(?,784) is different by the appropriate image shape(?,28,28,1) which needs to be fed to the CNN architecture. So it needs to be reshaped. ''' # Download and get MNIST dataset(available in tensorflow.contrib.learn.python.learn.datasets.mnist) # It checks and download MNIST if it's not already downloaded then extract it. # The 'reshape' is True by default to extract feature vectors but we set it to false to we get the original images. mnist = input_data.read_data_sets("MNIST_data/", reshape=False, one_hot=False) # The 'input.provide_data' is provided to organize any custom dataset which has specific characteristics. data = input.provide_data(mnist) # Dimentionality of train dimensionality_train = data.train.images.shape # Dimensions num_train_samples = dimensionality_train[0] height = dimensionality_train[1] width = dimensionality_train[2] num_channels = dimensionality_train[3] ####################################### ########## Defining Graph ############ ####################################### graph = tf.Graph()