简体   繁体   English

这个 mnist 下载错误是什么? (Python)

[英]What is this mnist download error? (python)

I am eager to self-learn deep-learning with tutorial books.我渴望通过教程书自学深度学习。 Almost every book has an example of mnist, and I am having a hard time to load the data.几乎每本书都有一个mnist的例子,我很难加载数据。 The book I am using is "Deep-learning with scratch".我正在使用的书是“Deep-learning with scratch”。 The recommended code is below.推荐的代码如下。


import sys, os
sys.path.append(os.pardir)
from dataset.mnist import load_mnist

I've created the folder "dataset" in the same location with my code file, and downloaded the source code "mnist.py" to the dataset folder.我已经在与我的代码文件相同的位置创建了文件夹“dataset”,并将源代码“mnist.py”下载到了数据集文件夹。

and the error message is as below.错误信息如下。 Please help me on this.请帮我解决这个问题。

Traceback (most recent call last):回溯(最近一次调用最后一次):

File "/Users/hyyoon/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns)文件“/Users/hyyoon/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py”,第3296行,在run_code exec(code_obj, self.user_global_ns, self.user_ns)

File "", line 1, in from dataset.mnist import load_mnist文件“”,第 1 行,in from dataset.mnist import load_mnist

File "/Users/hyyoon/STUDY_Machine_2019/dataset/mnist.py", line 7 ^ SyntaxError: invalid syntax文件“/Users/hyyoon/STUDY_Machine_2019/dataset/mnist.py”,第 7 行 ^ SyntaxError: invalid syntax

You did not give any details on what framework you're working with ( skearn ? tensorflow ? keras ?, ... )您没有提供有关您正在使用的框架的任何详细信息( skearntensorflowkeras ?,...)

But since you said 'deep learning', I guess it might be keras or tensorflow.但既然你说的是“深度学习”,我猜它可能是 keras 或 tensorflow。 Please edit your post with 1) more details on what you are working with 2) tags reflecting that as well.请使用 1) 有关您正在使用的内容的更多详细信息 2) 标签来编辑您的帖子。

As for keras, it might look like this:至于 keras,它可能是这样的:

from keras.datasets import mnist

... 

(x_train, y_train), (x_test, y_test) = mnist.load_data()

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

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