python-3.x - 难以导入“fashion_mnist”数据
问题描述
当我运行以下代码导入fashion_mnist
数据时:
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
我得到:
ValueError Traceback (last last call last) in () 1 fashion_mnist = keras.datasets.fashion_mnist 2 ----> 3 (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
~/Asha/machineLearningAsha/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/datasets/fashion_mnist.py
在 load_data() 64 中,gzip.open(paths[3], 'rb') as imgpath: 65 x_test = np.frombuffer( ---> 66 imgpath.read(), np.uint8, offset=16).reshape (len(y_test), 28, 28) 67 68 返回 (x_train, y_train), (x_test, y_test)
ValueError: offset must be non-negative and no greater than buffer length (0)
有人可以帮我导入“fashion_mnist”数据吗?
解决方案
在执行对我有用的这个命令之后从 keras 文件夹中删除该数据集之后
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
train_images.shape
推荐阅读
- php - 按月分组并在 Laravel Eloquent 上排序日期
- r - 我可以在 R 中使用聚集函数匹配多列的“键”和“值”吗?
- python - 运气平衡问题解决方案产生错误的结果
- excel - Excel - 单元格中文件名的一部分
- vue.js - Vue 组件中的动态 x 模板
- javascript - 使用密码确认进行引导 4 验证并禁用提交,直到表单验证(注册表单)
- spring - 如何在 WebClient 上记录“真实”的 Http 标头
- html - 图片不像链接
- c# - 使用动态参数调用泛型扩展方法时,C# 编译器失败并出现误导性错误
- c# - 如何使cookie提取区分大小写