Python handwritten digital download

import tensorflow.examples.tutorials.mnist.input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

After the execution is completed, it will create a new folder MNIST_data in the current directory, download the data into the file folder. Download four files:

Downloaded data set is divided into three subsets: the training data set 5.5W line ( mnist.train), 5,000 rows validation data set (mnist.validation) and 1W line test data set ( mnist.test). Because each picture is 28x28 black and white picture, so every behavior 784-dimensional vector.

print (mnist.train.images.shape)
print (mnist.train.labels.shape)
print (mnist.validation.images.shape)
print (mnist.validation.labels.shape)
print (mnist.test.images.shape)
print (mnist.test.labels.shape)

(55000, 784)
(55000, 10)
(5000, 784)
(5000, 10)
(10000, 784)


(10000, 10)

Can be obtained by installment in the training process

from tensorflow.examples.tutorials.mnist Import Input_Data # Import handwritten digital data set 

MNIST = input_data.read_data_sets ( ' ../../MNIST_data ' , one_hot = True) # MNIST handwritten digital data set is 
X_mb, _ = mnist.train .next_batch (128 )
 Print (X_mb.shape)

Extracting ../../MNIST_data\train-images-idx3-ubyte.gz
Extracting ../../MNIST_data\train-labels-idx1-ubyte.gz
Extracting ../../MNIST_data\t10k-images-idx3-ubyte.gz
Extracting ../../MNIST_data\t10k-labels-idx1-ubyte.gz
(128, 784)

 

 

https://www.cnblogs.com/denny402/p/5852689.html

Guess you like

Origin www.cnblogs.com/gaona666/p/12349751.html