import input_data MNIST tensorflow not working

前端 未结 15 1530
感情败类
感情败类 2020-12-09 14:44

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

相关标签:
15条回答
  • 2020-12-09 15:26

    I am using different version - following Install on Windows with Docker here - and had similar problem.

    An easy workaround I've found was:

    1.Into the Linux command line, figure out where is the input_data.py on my Docker image (in your case you mentionned that you had to download it manually. In my case, it was already here). I used the follwing linux command:

    $ sudo find . -print | grep -i '.*[.]py'
    

    I've got the files & path

    ./tensorflow/g3doc/tutorials/mnist/mnist.py
    ./tensorflow/g3doc/tutorials/mnist/input_data.py
    

    2.launch Python and type the following command using SYS:

    >> import sys
    >> print(sys.path)
    

    you will get the existing paths.

    ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat']
    

    4.add the path of inputa_data.py:

    >> sys.path.insert(1,'/tensorflow/tensorflow/g3doc/tutorials/mnist')
    

    Hope that it can help. If you found better option, let me know. :)

    0 讨论(0)
  • 2020-12-09 15:27

    MNIST input_data was built-in, it's just not a individual module, it's inside Tensorflow module, try

    from tensorflow.examples.tutorials.mnist import input_data
    
    0 讨论(0)
  • 2020-12-09 15:32

    MNIST data set included as a part of tensorflow examples tutorial, If we want to use this :

    Import MNIST data to identify handwritten digites

    from tensorflow.examples.tutorials.mnist import input_data
    mnist = input_data.read_data_sets("MNIST data", one_hot=True)
    
    0 讨论(0)
  • 2020-12-09 15:33

    The following steps work perfectly in my Notebook:

    step 1 : get Python files from github : !git clone https://github.com/tensorflow/tensorflow.git

    step 2 : append these files in my Python path :

    import sys

    sys.path.append('/content/tensorflow/tensorflow/examples/tutorials/mnist')

    step 3 : load the MNIST data with 'input_data' fonction

    import input_data

    mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

    That's all !

    0 讨论(0)
  • 2020-12-09 15:35
    cd your_mnist_dir &&\
    wget https://github.com/HIPS/hypergrad/raw/master/data/mnist/mnist_data.pkl &&\
    wget https://github.com/HIPS/hypergrad/raw/master/data/mnist/t10k-images-idx3-ubyte.gz &&\
    wget https://github.com/HIPS/hypergrad/raw/master/data/mnist/t10k-labels-idx1-ubyte.gz &&\
    wget https://github.com/HIPS/hypergrad/raw/master/data/mnist/train-images-idx3-ubyte.gz &&\
    wget https://github.com/HIPS/hypergrad/raw/master/data/mnist/train-labels-idx1-ubyte.gz
    
    0 讨论(0)
  • 2020-12-09 15:36

    The old tutorial said, to import the MNIST data, use:

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

    This will cause the error. The new tutorial uses the following code to do so:

    from tensorflow.examples.tutorials.mnist import input_data
    mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
    

    And this works well.

    0 讨论(0)
提交回复
热议问题