我正在研究Coral开发板。我正在尝试在其上部署细分模型。当我运行深度实验室细分模型时,它给了我以下错误-
Traceback (most recent call last):
File "infer.py", line 17, in <module>
interpreter.allocate_tensors()
File "/home/mendel/.local/lib/python3.5/site-packages/tflite_runtime/interpreter.py", line 244, in allocate_tensors
return self._interpreter.AllocateTensors()
File "/home/mendel/.local/lib/python3.5/site-packages/tflite_runtime/interpreter_wrapper.py", line 114, in AllocateTensors
return _interpreter_wrapper.InterpreterWrapper_AllocateTensors(self)
RuntimeError: Internal: :71 tf_lite_type != kTfLiteUInt8 (9 != 3)Node number 79 (EdgeTpuDelegateForCustomOp) failed to prepare.
如果我不使用edgetpu_compiler使它与TPU兼容,则模型和脚本可以正常工作。
用于重现问题的代码
from tqdm import tqdm
import numpy as np
from tflite_runtime.interpreter import Interpreter
from tflite_runtime.interpreter import load_delegate
test_data = np.random.rand(480,480,3)
img = np.array([test_data], dtype=np.float32)
interpreter = Interpreter(
model_path="deep_lab_quant_edgetpu.tflite",
experimental_delegates=[load_delegate('libedgetpu.so.1.0')])
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
interpreter.set_tensor(input_details[0]['index'], img)
interpreter.invoke()
output_data = interpreter.get_tensor(output_details[0]['index'])