微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

tflite_runtime :“op builtin_code 超出范围:131您是否使用带有较新模型的旧 TFLite 二进制文件?” YAMNET 型号

如何解决tflite_runtime :“op builtin_code 超出范围:131您是否使用带有较新模型的旧 TFLite 二进制文件?” YAMNET 型号

我正在尝试在我的 Coral Dev Board Mini 上使用 YAMNET model made for the Coral Board,但我无法让它工作,因为我收到以下错误

Traceback (most recent call last):
  File "<stdin>",line 1,in <module>
  File "/home/mendel/classifier_env/lib/python3.7/site-packages/tflite_runtime/interpreter.py",line 207,in __init__
    custom_op_registerers_by_func))
ValueError: Op builtin_code out of range: 131. Are you using old TFLite binary with newer model?Registration Failed.

我使用的代码片段是:

import tflite_runtime.interpreter as tflite
delegate = tflite.load_delegate('libedgetpu.so.1')
interpreter = tflite.Interpreter(model_path='coral_yamnet.tflite',experimental_delegates=[delegate])

如果我不使用委托,我会得到同样的错误

我的 tflite_runtime 版本是:

>>> pip show tflite_runtime
Name: tflite-runtime
Version: 2.5.0
Summary: TensorFlow Lite is for mobile and embedded devices.
Home-page: https://www.tensorflow.org/lite/
Author: Google,LLC
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /home/mendel/classifier_env/lib/python3.7/site-packages
Requires: numpy
required-by:

我使用的是 Python 3.7.3。

我也尝试在我的计算机上使用 tensorflow.lite.Interpreter 使用它,但我遇到了完全相同的问题。我已经在互联网上搜索过,但我试过的都没有效果...

你知道为什么会出现这个问题吗?

解决方法

请使用 TensorFlow pip 的匹配版本,该版本用于 TFLite 转换,而不是 tflite_runtime 库。

上述 tflite_runtime 包与用于 TFLite 转换的 TensorFlow 版本不一致。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。