PaddlePaddle / Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
https://www.paddlepaddle.org.cn/lite
Apache License 2.0
6.93k stars 1.61k forks source link

调用nb格式模型时候报错:Segmentation fault (core dumped) #10525

Open Sun-k0903 opened 3 months ago

Sun-k0903 commented 3 months ago

为使您的问题得到快速解决,在建立 Issue 前,请您先通过如下方式搜索是否有相似问题: 历史 issue, FAQ 文档, 官方文档

建立 issue 时,为快速解决问题,请您根据使用情况给出如下信息:

(1) 设置配置信息

config = MobileConfig() config.set_model_from_file("/mnt/d/Python_project/test/onnx_nb/opt.nb")

(2) 创建预测器

predictor = create_paddle_predictor(config)

(3) 从图片读入数据

image = Image.open('/mnt/d/Python_project/test/seg_cert/test.jpg') resized_image = image.resize((640, 640), Image.BILINEAR) image_data = np.array(resized_image).transpose(2, 0, 1).reshape(1, 3, 640, 640)

(4) 设置输入数据

input_tensor = predictor.get_input(0) input_tensor.from_numpy(image_data.astype("float32"))

(5) 执行预测

predictor.run()

(6) 得到输出数据

output_tensor = predictor.get_output(0) print(output_tensor.shape()) print(output_tensor.numpy()) log.txt

hong19860320 commented 3 months ago
  1. 基于带 log 的库,执行前 export GLOG_v=5 ,执行时通过 >log.txt 2>&1 把log 保存到文件后再上传上来。
  2. 先用 https://netron.app/ 确认原始的 paddle 推理模型的输入、输出个数和 shape,调整你的测试代码,如果仍有问题,把原始的 paddle 推理模型上传一下。
  3. 如果2确认没问题,可以尝试自行编译 paddle lite 最新 develop 分支代码,具体可以参考文档 https://www.paddlepaddle.org.cn/lite/v2.12/source_compile/linux_x86_compile_linux_x86.html ,顺便提醒一下,Paddle Lite 主要是面向移动端 arm cpu 的推理,x86 cpu 推理建议使用 Paddle Inference https://www.paddlepaddle.org.cn/inference/v2.6/guides/introduction/index_intro.html