【发布时间】:2019-12-24 22:07:13
【问题描述】:
这个问题已经解决了,很抱歉由于硬件限制而浪费了我使用notepad++的时间,所以我不知道需要导入操作系统来定义文件路径
我正在尝试创建一个 TFLite 模型,我画了一个箭头,指向出现文件路径错误的位置:
错误:(NameError:名称'oranges'未定义)
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import tensorflow as tf
assert tf.__version__.startswith('2')
from tensorflow_examples.lite.model_customization.core.data_util.image_dataloader import ImageClassifierDataLoader
from tensorflow_examples.lite.model_customization.core.task import image_classifier
from tensorflow_examples.lite.model_customization.core.task.model_spec import efficientnet_b0_spec
from tensorflow_examples.lite.model_customization.core.task.model_spec import ImageModelSpec
import matplotlib.pyplot as plt
data = ImageClassifierDataLoader.from_folder(oranges) <-- oranges is a folder containing the test
images. It is in the same folder as this file
model = image_classifier.create(data)
loss, accuracy = model.evaluate()
model.export('image_classifier.tflite', 'image_labels.txt')
【问题讨论】:
-
你有没有研究过这个错误?即使是像一个好的 IDE 这样的东西也会指出这个问题......
-
我正在使用 google 代码实验室的示例,该示例使用了基于 googleapi 存储的图像路径,这让我很失望。
标签: python tensorflow artificial-intelligence tensorflow-lite