Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法在keras中加载mnist数据集_Python_Machine Learning_Neural Network_Keras - Fatal编程技术网

Python 无法在keras中加载mnist数据集

Python 无法在keras中加载mnist数据集,python,machine-learning,neural-network,keras,Python,Machine Learning,Neural Network,Keras,我正在尝试通过以下方式加载mnist数据集: import keras from keras.datasets import mnist (x_train,y_train),(x_test,y_test)=mnist.load_data() 但我得到了这个错误: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "E:\anaconda\lib\site-p

我正在尝试通过以下方式加载mnist数据集:

import keras
from keras.datasets import mnist
(x_train,y_train),(x_test,y_test)=mnist.load_data()
但我得到了这个错误:

  Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\anaconda\lib\site-packages\keras\datasets\mnist.py", line 15, in load_data
  data = cPickle.load(f)
  File "E:\anaconda\lib\gzip.py", line 252, in read
  raise IOError(errno.EBADF, "read() on write-only GzipFile object")
  IOError: [Errno 9] read() on write-only GzipFile object
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“E:\anaconda\lib\site packages\keras\datasets\mnist.py”,第15行,在load\U数据中
数据=cPickle.load(f)
文件“E:\anaconda\lib\gzip.py”,第252行,已读
raise IOError(errno.EBADF,“只写GzipFile对象上的read()”)
IOError:[Errno 9]只读GzipFile对象上的read()
我该怎么办


谢谢

MNIST手写数字数据库

60000个10位28x28灰度图像的数据集,以及10000个图像的测试集

用法:

  from keras.datasets import mnist

  (x_train, y_train), (x_test, y_test) = mnist.load_data()
返回:

2元组: x_序列,x_测试:uint8具有形状的灰度图像数据数组(num_samples,28,28)

y_序列,y_测试:uint8数字标签数组(0-9范围内的整数)和形状(num_样本,)。 论据:


注意(路径:如果您没有本地索引文件(位于“~/.keras/datasets/”+路径),它将下载到此位置。)

MNIST手写数字数据库

60000个10位28x28灰度图像的数据集,以及10000个图像的测试集

用法:

  from keras.datasets import mnist

  (x_train, y_train), (x_test, y_test) = mnist.load_data()
返回:

2元组: x_序列,x_测试:uint8具有形状的灰度图像数据数组(num_samples,28,28)

y_序列,y_测试:uint8数字标签数组(0-9范围内的整数)和形状(num_样本,)。 论据:

注意(路径:如果您在本地没有索引文件(位于“~/.keras/datasets/”+路径),它将下载到此位置。)