TensorFlow Official document, mnist data set download script. The original URL of the webpage cannot be opened, this gives the GitHub address. The following also posted source code.
The following code is saved as a input_data.py file
# Copyright TensorFlow Authors.
All rights Reserved.
# # Licensed under the Apache License, Version 2.0 (the "License");
# You are not a use of this file except in compliance with the License. # Obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # unless required by applic Able law or agreed to in writing, software # Distributed under the License are distributed on a "as is" BASIS, # without W
Arranties or CONDITIONS of any KIND, either express OR implied.
# See the License for the specific language governing permissions and # Limitations under the License. # ============================================================================== "" "Functions for Downloading and Reading MNIST data. "" From __future__ import absolute_import from __future__ Import division from __future__ Import print _function Import gzip Import OS import tempfile import numpy from six.moves import urllib from six.moves import xrange # pylint:disable=redefined-builtIn import TensorFlow as TF from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
Create a new test.py file when you use it (with input_data.py in the same project directory, like mine is E:\Anaconda3\Lib\site-packages\tensorflow\examples\ Tutorials\mnist), execute the command below to download the Mnist dataset, and a data folder will be generated under the Mnist folder, as shown in the figure:
#下载用于训练和测试的mnist数据集的源码
Import Input_data # call Input_data
mnist = input_data.read_data_sets (' data/', one_hot= True)
You can see 55000 training data and 10000 test data.