黄埔学院 paddle lite 推理
Created by: yajiezhu
paddle lite推理报错如下: /home/zyj/anaconda3/bin/python3.6 /home/zyj/pythonProgram/PaddleNER/123.py Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) 模型是paddle lite模型 bi-lstm-crf 代码如下:
from paddlelite.lite import *
import numpy as np
config = MobileConfig()
config.set_model_from_file('./test.lite_inference.model/model.nb')
# 创建predictor
predictor = create_paddle_predictor(config)
# 从图片读入数据
# image = Image.open('./example.jpg')
# resized_image = image.resize((224, 224), Image.BILINEAR)
# image_data = np.array(resized_image).flatten().tolist()
image_data = [1, 3, 9, 11, 0, 0, 0]
# 设置输入数据
input_tensor = predictor.get_input(0)
# input_tensor.resize([1, 3, 224, 224])
input_tensor.set_float_data(image_data)
# 执行预测
predictor.run()
print('ok')
# 得到输出数据
output_tensor = predictor.get_output(0)
print(output_tensor)