【发布时间】:2021-10-02 15:30:24
【问题描述】:
我正在 Colab 中使用 Tensorflow Lite Model Maker 训练对象检测模型 (EfficientDet-Lite),并且我想使用 Cloud TPU。我有一个 GCS 存储桶中的所有图像并提供一个 CSV 文件。当我调用 object_detector.create 时,出现以下错误:
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py in shape(self)
1196 # `_tensor_shape` is declared and defined in the definition of
1197 # `EagerTensor`, in C.
-> 1198 self._tensor_shape = tensor_shape.TensorShape(self._shape_tuple())
1199 except core._NotOkStatusException as e:
1200 six.raise_from(core._status_to_exception(e.code, e.message), None)
InvalidArgumentError: Unsuccessful TensorSliceReader constructor: Failed to get matching files on /tmp/tfhub_modules/db7544dcac01f8894d77bea9d2ae3c41ba90574c/variables/variables: Unimplemented: File system scheme '[local]' not implemented (file: '/tmp/tfhub_modules/db7544dcac01f8894d77bea9d2ae3c41ba90574c/variables/variables')
看起来它正在尝试处理 CloudTPU 中的一些本地文件,这不起作用...
我正在做的事情的要点是:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
train_data, validation_data, test_data = object_detector.DataLoader.from_csv(
drive_dir + csv_name,
images_dir = "images" if not tpu else None,
cache_dir = drive_dir + "cub_cache",
)
spec = MODEL_SPEC(tflite_max_detections=10, strategy='tpu', tpu=tpu.master(), gcp_project="xxx")
model = object_detector.create(train_data=train_data,
model_spec=spec,
validation_data=validation_data,
epochs=epochs,
batch_size=batch_size,
train_whole_model=True)
我找不到任何使用 Cloud TPU 的 Model Maker 示例。
编辑:加载 EfficientDet 模型时似乎会发生错误,因此模型制作者必须以某种方式指向不适用于 CloudTPU 的本地文件?
【问题讨论】:
-
当您尝试使用本地系统加载数据集时,您的问题很常见。阅读本文以找出文件系统方案“本地”的可能解决方案。它不是模型制造商,但它会给你一些提示。 farmaker47.medium.com/…
-
感谢您的链接,但实际上我没有做任何事情,或者只是不适用于模型制造商......
-
我已经打开了一个 github 问题 @tensorflow:github.com/tensorflow/tensorflow/issues/50965,我可以通过 Colab 中的一个最小修改的股票教程重现该问题:gist.github.com/tve/615f4b51fa88dc643358176c86d6537e
-
不错!有兴趣我会关注的
标签: tensorflow google-colaboratory tensorflow2.0 tensorflow-lite google-cloud-tpu