简体   繁体   English

尝试读取MNIST数据集时出现问题

[英]Issue when trying to read MNIST data set

I am about to learn about Neural Networks and I am about to reproduce a tutorial which trains a Neural Network with the target to identify handwritten letters. 我将要学习神经网络,并且要重现一个教程,该教程将训练神经网络,目标是识别手写字母。 The training of the Neural Network should be done with the MNIST data set. 神经网络的训练应使用MNIST数据集进行。 Unfortunately, exactly where my issue comes as I am not able to read in the MNIST data set. 不幸的是,由于我无法读取MNIST数据集,所以问题出在哪里。 The environment I am using is a Jupyter Notebook and Python 3. 我使用的环境是Jupyter Notebook和Python 3。

These are the lines of code I have (line 2 causes the issue): 这些是我拥有的代码行(第2行导致了问题):

import tensorflow as tf

from tensorflow.examples.tutorials.mnist import input_data

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

Line 2 causes this error message: 第2行导致此错误消息:

ModuleNotFoundError: No module named 'tensorflow.contrib' ModuleNotFoundError:没有名为“ tensorflow.contrib”的模块

Ok, what the error tells me, is clear. 好的,错误告诉我的是清楚的。 Reason is, that in my tensorflow installation folder a directory /tensorflow/contrib/... does not exist. 原因是,在我的tensorflow安装文件夹中,目录/ tensorflow / contrib / ...不存在。

The issues is caused by line 2, as the module input_data.py contains this line of code: 问题是由第2行引起的,因为模块input_data.py包含以下代码行:

from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets

So, the core of my issue is, that I do not know, where to get the module read_data_sets from. 因此,我的问题的核心是,我不知道从哪里获取模块read_data_sets。 I was searching at GitHub , but the path /tensorflow/contrib/learn/python/learn/datasets/mnist/ does not exist there. 我在GitHub上搜索,但路径/ tensorflow / contrib / learn / python / learn / datasets / mnist /不存在。

In detail: Subfolder 'mnist' is not to be found in GitHub. 详细信息:在GitHub中找不到子文件夹'mnist' Therefore, I also do not find the file read_data_sets.py . 因此,我也找不到文件read_data_sets.py

So, where do I find the missing module 'read_data_sets' ? 因此,在哪里可以找到缺少的模块“ read_data_sets”

Would be great, if someone could help me as this issue stops my attempt to deal with Neural Networks already at the very beginning. 如果有人可以帮助我,那就太好了,因为这个问题一开始就阻止了我与神经网络打交道的尝试。

Thanks a lot and kind regards, Matthias 非常感谢您,Matthias

似乎您使用的是新版本的tensorflow> = 1.13.0,因此如果要加载MNIST数据集,则可以单击此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM