我通过重新训练模型成功地将 ssd_mobilenet_v3 模型转换为 .tflite。(之前在 coco 数据集上训练过)
但是,在使用此模型进行对象检测以使用以下代码对单个图像运行推理时:
interpreter = tf.lite.Interpreter(model_path)
我收到以下错误:
ValueError Traceback (most recent call last)
<ipython-input-15-e1c9008b610c> in <module>
----> 1 interpreter = tf.lite.Interpreter("/home/sushanth/Documents /nuts_poc/tflite_od/nam_model_quantized.lite")
2 interpreter.allocate_tensors()
3 input_details = interpreter.get_input_details()
4 output_details = interpreter.get_output_details()
5 input_tensor_index = interpreter.get_input_details()[0]["index"]
~/.local/lib/python3.7/site-packages/tensorflow/lite/python/interpreter.py in __init__(self, model_path, model_content)
75 self._interpreter = (
76 _interpreter_wrapper.InterpreterWrapper_CreateWrapperCPPFromFile(
---> 77 model_path))
78 if not self._interpreter:
79 raise ValueError('Failed to open {}'.format(model_path))
ValueError: Op builtin_code out of range: 117. Are you using old TFLite binary with newer model?Registration failed.
请解释错误和可能的解决方案。
张量流版本:1.1.4
操作系统:Ubuntu 18.04
蟒蛇:3.7
PS:我将分类器模型(inception_v2)转换为tflite并使用上面的代码(“interpreter = tf.lite.Interpreter(model_path)”)没有任何错误!