【问题标题】:cant load mnist dataset in keras无法在 keras 中加载 mnist 数据集
【发布时间】:2016-01-09 07:30:22
【问题描述】:

我正在尝试通过以下方式加载 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

我该怎么办?

谢谢

【问题讨论】:

    标签: python machine-learning neural-network keras


    【解决方案1】:

    MNIST 手写数字数据库

    60,000 个 28x28 的 10 位灰度图像的数据集,以及 10,000 个图像的测试集。

    用法:

      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)。

    y_train, y_test: uint8 数字标签数组(0-9 范围内的整数),形状为 (num_samples,)。 参数:

    注意(路径:如果本地没有索引文件(在'~/.keras/datasets/'+路径),会下载到这个位置。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-14
      • 1970-01-01
      • 2018-08-11
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      • 2019-12-19
      相关资源
      最近更新 更多