Python tf转换器在仍然遇到未解析的自定义op时所有映射
为了将虚拟模型从tf部署到edgetpu板,我已经创建了一个模型,该模型将所有操作传递并映射到edgetpu。然而,当我使用tflite解释器运行推理时,它显示Python tf转换器在仍然遇到未解析的自定义op时所有映射,python,tensorflow,Python,Tensorflow,为了将虚拟模型从tf部署到edgetpu板,我已经创建了一个模型,该模型将所有操作传递并映射到edgetpu。然而,当我使用tflite解释器运行推理时,它显示 Traceback (most recent call last): File "run_model.py", line 6, in <module> interpreter.allocate_tensors() ... RuntimeError: Encountered unresolved custom op
Traceback (most recent call last):
File "run_model.py", line 6, in <module>
interpreter.allocate_tensors()
...
RuntimeError: Encountered unresolved custom op: edgetpu-custom-op.Node number 0 (edgetpu-custom-op) failed to prepare.
我检查过了,tf.add应该能够在cpu或边缘tpu上执行
但一件奇怪的事情是,当我使用visualize.py进行检查时,它显示了以下内容:
Tensors
index name type shape buffer quantization
0 input UINT8 [2, 3] 0 {'quantized_dimension': 0, 'scale': [0.003921], 'details_type': 'NONE', 'zero_point': [0]}
1 out UINT8 [2, 3] 0 {'quantized_dimension': 0, 'scale': [0.027404], 'details_type': 'NONE', 'zero_point': [0]}
Ops
index inputs outputs builtin_options opcode_index
0
[0]
[1] None CUSTOM (0)
所以,也许我的问题是:为什么加法运算在这里仍然被称为自定义运算?这就是为什么分配张量不能识别它的原因吗?我也有同样的问题。然后重新阅读:处的说明,发现我丢失了:
在这些更改之后,我的模型在Coral板上运行。我的主要目标是尝试将任何模型部署到edgetpu。关键是,它必须是一个定制的模型,而不是mobilenet或其他流行的东西。现在也可以使用任何可以映射到edgetpu的操作。您是否尝试在edgetpu设备上进行推断?另外,您能否提供有关如何生成模型和进行推理的更多详细信息?据我所知,edgetpu编译过程将模型转换为edgetpu(而不是CPU)只能“接受”的格式。如果希望在CPU上运行相同的模型,则不应为EdgeTPU编译该模型。
Tensors
index name type shape buffer quantization
0 input UINT8 [2, 3] 0 {'quantized_dimension': 0, 'scale': [0.003921], 'details_type': 'NONE', 'zero_point': [0]}
1 out UINT8 [2, 3] 0 {'quantized_dimension': 0, 'scale': [0.027404], 'details_type': 'NONE', 'zero_point': [0]}
Ops
index inputs outputs builtin_options opcode_index
0
[0]
[1] None CUSTOM (0)
from tflite_runtime.interpreter import load_delegate
interpreter = Interpreter(model_path,
experimental_delegates=[load_delegate('libedgetpu.so.1.0')])