tensorflow - 加载时尚 mnist 数据集时出错
问题描述
import tensorflow as tf
from tensorflow import keras
fashion_mnist = tf.keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
我收到了这个错误
EOFError Traceback (most recent call last)
<ipython-input-1-d38ad79b1741> in <module>
3 fashion_mnist = tf.keras.datasets.fashion_mnist
4
----> 5 (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
~\miniconda3\lib\site-packages\tensorflow\python\keras\datasets\fashion_mnist.py in load_data()
82 with gzip.open(paths[1], 'rb') as imgpath:
83 x_train = np.frombuffer(
---> 84 imgpath.read(), np.uint8, offset=16).reshape(len(y_train), 28, 28)
85
86 with gzip.open(paths[2], 'rb') as lbpath:
~\miniconda3\lib\gzip.py in read(self, size)
290 import errno
291 raise OSError(errno.EBADF, "read() on write-only GzipFile object")
--> 292 return self._buffer.read(size)
293
294 def read1(self, size=-1):
~\miniconda3\lib\gzip.py in read(self, size)
496 break
497 if buf == b"":
--> 498 raise EOFError("Compressed file ended before the "
499 "end-of-stream marker was reached")
500
EOFError: Compressed file ended before the end-of-stream marker was reached
在stackoverflow上我找到了一个答案,说删除现有文件并再次下载,但这不起作用
解决方案
推荐阅读
- node.js - 如何为现有数据库构建 Graphql 后端服务器?
- c++ - C++ 20 工作草案是否包含别名导入的模块?
- javascript - 反应带有未定义属性的选项卡
- scala - 什么使递归函数是有限的
- apache - VirtualHost 允许 www 和非 www
- node.js - winston.debug 在终端上不显示任何内容
- java - 无法在 py4j 中从 Python 启动网关
- javascript - 如何处理以快递方式发送到服务器的数据?
- mysql - MySQL ORDER BY 来自同一多个表的多个列
- memory-management - 关于与数据结构相关的地址和参数