简体   繁体   English

尝试将 .pb 文件转换为 .tflite 时出错

[英]Error when trying to convert .pb file to .tflite

I am trying to convert the link template, to .tflite, using this code, but it always gives an error.我正在尝试使用此代码将链接模板转换为 .tflite,但它总是出现错误。 Model link: https://tfhub.dev/google/openimages_v4/ssd/mobilenet_v2/1模型链接: https : //tfhub.dev/google/openimages_v4/ssd/mobilenet_v2/1

Code:代码:

import tensorflow as tf

saved_model_dir = 'path of file'
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()

with open('model.tflite', 'wb') as f:
  f.write(tflite_model)

Error Message:错误信息:

SavedModel file does not exist at: openimages_v3_ssd_mobilenet_v2_1/{saved_model.pbtxt|saved_model.pb}

saved_model_dir should point to the SavedModel directory containing the assets, variables & .pb graph data. saved_model_dir应指向包含资产、变量和 .pb 图形数据的 SavedModel 目录 I think you are providing one of the files' path.我认为您正在提供文件的路径之一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM