tensorflow - CIFAR10 数据集没有属性 load_data()
问题描述
我正在使用 tensorflow 2.0.1 版。在我的 Jupyter 笔记本中,我使用:
(train_x, train_y), (test_x, test_y) = tf.keras.datasets.cifar100.load_data()
但是,它不起作用,我收到以下错误:
AttributeError: module 'tensorflow_core.python.keras.api._v2.keras.datasets.cifar10' has no attribute 'load_data'
此外,在自动完成中,我看到 CIFAR100 的 load_data(),但 CIFAR10 没有显示任何内容。
解决方案
我可以cifar10
使用load_data
如下所示的方法加载数据集
import tensorflow as tf
print(tf.__version__)
(train_x, train_y), (test_x, test_y) = tf.keras.datasets.cifar10.load_data()
输出:
2.0.1
Downloading data from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz
170500096/170498071 [==============================] - 5s 0us/step
有关更多信息,您可以参考加载 CIFAR10 数据集。
推荐阅读
- python - 使用 Python 在 MySQL 上执行 upsert 操作
- r - R中传单中聚类标记的聚合加权线串
- angular - RXJS:返回嵌套的 observables
- python - python函数计算图像中每个点到图像中心的欧几里得距离
- python - 我的正则表达式(re.sub)、重音符号(latin-1 模式)有什么问题?
- python - UnboundLocalError:分配前引用的局部变量“Y_p”
- java - 如何比较 E 元素
- python - 与 Map 相比,什么时候使用 Set 更合乎逻辑?
- reactjs - React Native useEffect Hooks 和 React Navigation setParams 在加载时不会更新
- javascript - React Native - 如何在 FlatList 属性上使用导航?