1. 程式人生 > >載入MNIST資料集

載入MNIST資料集

# -*- coding: utf-8 -*-
"""
Created on Thu Dec  6 00:53:44 2018
需要翻牆
#QQ群:476842922(歡迎加群討論學習
@author: Administrator
"""

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

print("Training data size: ",
mnist.train.num_examples) # 列印“Validating data size: 5000” print("Validating data size: ",mnist.validation.num_examples) # 列印“Testing data size: 10000” print("Testing data size: ",mnist.test.num_examples) # 列印“Example training data: [0. 0. 0. ... 0.380 0.376 ... 0.]” print("Example training data: ",mnist.train.images[
0]) # 列印“Example training data label: [0. 0. 0. 0. 0. 0. 0. 1. 0. 0.]” print("Example training data label: ",mnist.train.labels[0])

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
Training data size: 55000
Validating data size: 5000
Testing data size: 10000
Example training data: [0. 0. 0. … 0. 0. 0.]
Example training data label: [0. 0. 0. 0. 0. 0. 0. 1. 0. 0.]