cant load mnist dataset in keras

倖福魔咒の 提交于 2019-12-13 19:21:46

问题


im trying to load the mnist dataset by :

import keras
from keras.datasets import mnist
(x_train,y_train),(x_test,y_test)=mnist.load_data()

but i get this error :

  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

what should i do?

thanks


回答1:


MNIST database of handwritten digits

Dataset of 60,000 28x28 grayscale images of the 10 digits, along with a test set of 10,000 images.

Usage:

  from keras.datasets import mnist

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

Returns:

2 tuples: x_train, x_test: uint8 array of grayscale image data with shape (num_samples, 28, 28).

y_train, y_test: uint8 array of digit labels (integers in range 0-9) with shape (num_samples,). Arguments:

Note(path: if you do not have the index file locally (at '~/.keras/datasets/' + path), it will be downloaded to this location.)



来源:https://stackoverflow.com/questions/34690906/cant-load-mnist-dataset-in-keras

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!