We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为使您的问题得到快速解决,在建立 Issue 前,请您先通过如下方式搜索是否有相似问题: 历史 issue, FAQ 文档, 官方文档
建立 issue 时,为快速解决问题,请您根据使用情况给出如下信息:
config = MobileConfig() config.set_model_from_file("/mnt/d/Python_project/test/onnx_nb/opt.nb")
predictor = create_paddle_predictor(config)
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)
input_tensor = predictor.get_input(0) input_tensor.from_numpy(image_data.astype("float32"))
predictor.run()
output_tensor = predictor.get_output(0) print(output_tensor.shape()) print(output_tensor.numpy()) log.txt
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
hong19860320
No branches or pull requests
为使您的问题得到快速解决,在建立 Issue 前,请您先通过如下方式搜索是否有相似问题: 历史 issue, FAQ 文档, 官方文档
建立 issue 时,为快速解决问题,请您根据使用情况给出如下信息:
1)Paddle Lite 版本:2.13rc0
2)Host 环境:Ubuntu 20.04
1)模型名称:利用ultralytics提供的yolov8模型转换为onnx格式,然后再将onnx转为nb格式
2)模型链接
from paddlelite.lite import *
import numpy as np
from PIL import Image
(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
The text was updated successfully, but these errors were encountered: