TensorFlow MNIST example not running with fully_connected_feed.py
I checked this out and realized that input_data
was not built-in. So I downloaded the whole folder from here. How can I start the tutorial:
import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-a5af65173c89> in <module>()
----> 1 import input_data
2 mnist = tf.input_data.read_data_sets("MNIST_data/", one_hot=True)
ImportError: No module named input_data
I'm using iPython (Jupyter) so do I need to change my working directory to this folder I downloaded? or can I add this to my tensorflow
directory? If so, where do I add the files? I installed tensorflow
with pip
(on my OSX) and the current location is ~/anaconda/lib/python2.7/site-packages/tensorflow/__init__.py
Are these files meant to be accessed directly through tensorflow
like sklearn
datasets? or am I just supposed to cd into the directory and work from there? The example is not clear.
As TensorFlow official website shown, All MNIST data is hosted on http://yann.lecun.com/exdb/mnist/
There's now a much easier way to load MNIST data into tensorflow without having to download the data by using Tensorflow 2 and Tensorflow Datasets
To get started, make sure you import Tensorflow and specify the 2nd version:
Then load the data into a dictionary using the following code:
and Then split the data into train and test:
Now you can use these data generators however you like.
So let's assume that you are in the directory:
/somePath/tensorflow/tutorial
(and this is your working directory).All you need to do is to download the input_data.py and put it this. Let the file name where you invoke:
is
main.py
and it is also in this directory.Whenever this is done, you can just start running
main.py
which will start downloading the files and will put them in the MNIST_data folder (once they are there the script will not be downloading them next time).MNIST input_data was built-in, it's just not a individual module, it's inside Tensorflow module, try
MNIST data set included as a part of tensorflow examples tutorial, If we want to use this :
Import MNIST data to identify handwritten digites