【发布时间】:2021-01-03 04:28:19
【问题描述】:
我正在学习使用 TensorFlow Lite Model Maker 创建图像分类器的教程:https://www.tensorflow.org/lite/tutorials/model_maker_image_classification#simple_end-to-end_example。即使我完全按照教程进行操作,我也无法显示加载数据集中的图像。以下是相关代码和错误消息: error code: AttributeError: 'ImageClassifierDataLoader' object has no attribute 'dataset'
为什么会发生这种情况,我该如何解决?
plt.figure(figsize=(10,10))
for i, (image, label) in enumerate(data.dataset.take(25)):
plt.subplot(5,5,i+1)
plt.xticks([])
plt.yticks([])
plt.grid(False)
plt.imshow(image.numpy(), cmap=plt.cm.gray)
plt.xlabel(data.index_to_label[label.numpy()])
plt.show()
AttributeError Traceback (most recent call last)
<ipython-input-9-160e876048da> in <module>()
1 plt.figure(figsize=(10,10))
----> 2 for i, (image, label) in enumerate(data.dataset.take(25)):
3 plt.subplot(5,5,i+1)
4 plt.xticks([])
5 plt.yticks([])
AttributeError: 'ImageClassifierDataLoader' object has no attribute 'dataset'
【问题讨论】:
标签: tensorflow tensorflow-lite dataloader image-classification