[英]TensorFlow: “FailedPreconditionError: Table not initialized” in Keras model layer
[英]Error when constructing Tensorflow Model: FailedPreconditionError
我正在尝试构建一个模型作为实践,以根据图像文件夹区分切片橙子和常规橙子。 一切顺利,直到我运行命令来训练模型。 代码/错误如下。
!pip install -q tf-hub-nightly==0.8.0.dev201911110007
!pip install -q git+https://github.com/tensorflow/examples
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
import os
oranges = os.path.abspath('/content/sample_data/oranges')
data = ImageClassifierDataLoader.from_folder(oranges)
//THIS LINE IS PRODUCING THE ERROR
model = image_classifier.create(data)
通过将笔记本的副本保存到我的驱动器并重新打开它,该问题得到了解决。 .ipynb 文件是您手动保存时笔记本使用的检查点,这就是错误消息所指的内容。 我假设笔记本的那个特定会话出了问题。 无论如何,在我的驱动器上保存一个新版本并重新打开/运行代码表明这个问题现在已经解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.