TensorFlow mnist Data Set Download Script input_data.py

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.