我尝试过使用相同的给定代码在mnist数据集上使用keras对CNN进行培训和测试。现在,我想在emnist数据集上尝试相同的代码,但会出现以下错误:
我正在尝试以下代码
!!pip安装emnist
import numpy as np
import emnist
from tensorflow import keras
train_images = emnist.train_images()
train_labels = emnist.train_labels()
print(train_images.shape)
print(train_labels.shape)
以下是输出:
Error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-812445794c0d> in <module>
5 # The first time you run this might be a bit slow, since the
6 # mnist package has to download and cache the data.
----> 7 train_images = emnist.train_images()
8 train_labels = emnist.train_labels()
9
AttributeError: module 'emnist' has no attribute 'train_images'
请帮忙
如果您查看emnist包的网站https://pypi.org/project/emnist/
您可以看到正确的用法是(例如,使用数字数据集):
没有列车图像方法
您可以在这里查看emnist python包以观察如何正确导入函数:https://pypi.org/project/emnist/
您可以通过导入以下函数来检查它们拥有哪些数据集:
以byclass数据集为例,我们提取样本:
相关问题 更多 >
编程相关推荐