tensorflow读取本地MNIST数据集
数据放入文件夹(不要解压gz):
>>> import tensorflow as tf
>>> from tensorflow.examples.tutorials.mnist import input_data
>>> MNIST_data =r‘D:\tensorflow\mnist‘
>>> mnist = input_data.read_data_sets(MNIST_data,one_hot=True)
Extracting D:\tensorflow\mnist\train-images-idx3-ubyte.gz
WARNING:tensorflow:From d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.data to implement this functionality.
Extracting D:\tensorflow\mnist\train-labels-idx1-ubyte.gz
WARNING:tensorflow:From d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py:110: dense_to_one_hot (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use tf.one_hot on tensors.
Extracting D:\tensorflow\mnist\t10k-images-idx3-ubyte.gz
Extracting D:\tensorflow\mnist\t10k-labels-idx1-ubyte.gz
WARNING:tensorflow:From d:\ProgramData\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.
Instructions for updating:
Please use alternatives such as official/mnist/dataset.py from tensorflow/models.
原文:https://www.cnblogs.com/xiexiaokui/p/10409676.html