无法在keras中加载mnist数据集 [英] cant load mnist dataset in keras
问题描述
im尝试通过以下方式加载mnist数据集:
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()
但是我得到这个错误:
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
我该怎么办?
谢谢
推荐答案
MNIST手写数字数据库
包含10位数的60,000张28x28灰度图像的数据集,以及10,000张图像的测试集.
Dataset of 60,000 28x28 grayscale images of the 10 digits, along with a test set of 10,000 images.
用法:
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
返回:
2个元组: x_train,x_test:uint8形状为(num_samples,28,28)的灰度图像数据数组.
2 tuples: x_train, x_test: uint8 array of grayscale image data with shape (num_samples, 28, 28).
y_train,y_test:uint8形状为(num_samples)的数字标签数组(范围为0-9的整数). 参数:
y_train, y_test: uint8 array of digit labels (integers in range 0-9) with shape (num_samples,). Arguments:
注意(路径:如果本地没有索引文件(位于'〜/.keras/datasets/'+路径),则它将下载到该位置.)
Note(path: if you do not have the index file locally (at '~/.keras/datasets/' + path), it will be downloaded to this location.)
这篇关于无法在keras中加载mnist数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!