全网首发,人体姿态估计算法在OK3588上部署应用(十三)

一、主机模型转换

采用FastDeploy来部署应用深度学习模型到OK3588板卡上

进入主机Ubuntu的虚拟环境

conda activate ok3588

主机环境搭建可以参考上一篇 《OK3588板卡实现人像抠图(十二)》

生成onnx文件
python 复制代码
cd FastDeploy
# 下载Paddle静态图模型并解压
wget https://bj.bcebos.com/paddlehub/fastdeploy/PP_TinyPose_256x192_infer.tgz
tar -xvf PP_TinyPose_256x192_infer.tgz

# 静态图转ONNX模型,注意,这里的save_file请和压缩包名对齐
paddle2onnx --model_dir PP_TinyPose_256x192_infer \
            --model_filename model.pdmodel \
            --params_filename model.pdiparams \
            --save_file PP_TinyPose_256x192_infer/PP_TinyPose_256x192_infer.onnx \
            --enable_dev_version True

# 固定shape
python -m paddle2onnx.optimize --input_model PP_TinyPose_256x192_infer/PP_TinyPose_256x192_infer.onnx \
                                --output_model PP_TinyPose_256x192_infer/PP_TinyPose_256x192_infer.onnx \
                                --input_shape_dict "{'image':[1,3,256,192]}"

转换成RKNN模型

python 复制代码
python tools/rknpu2/export.py --config_path tools/rknpu2/config/PP_TinyPose_256x192_unquantized.yaml \
                              --target_platform rk3588

把PP_TinyPose_256x192_infer文件夹打包放到OK3588板卡上

二、板卡模型部署

进入虚拟环境

conda activate ok3588

cd FastDeploy/examples/vision/keypointdetection/tiny_pose/rknpu2/cpp

mkdir build

cd build

cmake .. -DFASTDEPLOY_INSTALL_DIR=/home/forlinx/FastDeploy/build/fastdeploy-0.0.0/

make -j

得到了编译后的文件 infer_tinypose_demo

三、执行推理

PP_TinyPose_256x192_infer 文件夹放在build里面

NPU推理

sudo ./infer_tinypose_demo PP_TinyPose_256x192_infer pose.jpg

推理结果展示,即便是个钢铁侠模型,还是可以准确的识别出关键点哈

相关推荐
MomentYY6 分钟前
AI 到底是“懂”,还是在“猜”?
前端·人工智能·ai编程
拾光拾趣录31 分钟前
为什么采用多路检索而不是单一向量检索?
人工智能
拾光拾趣录32 分钟前
Agent 编排器是怎么设计的?为什么这样设计?
人工智能
拾光拾趣录43 分钟前
为什么选择 ReAct 模式而不是 Plan-and-Execute?
人工智能
武子康1 小时前
调查研究-196 CEO-Bench:Agent 不再只是“做任务“,而是要学会“经营一个系统“
人工智能
用户329901675051 小时前
把AI返回的Markdown表格渲染成可排序表格
人工智能
还好还好不是吗1 小时前
MatrixMedia HTTP 发布接口:让 AI 工作流直接驱动多平台视频发布
人工智能
贵慜_Derek1 小时前
复杂系统没法一把梭重构:Semi-Autoresearch 怎么小步迁移还不掉功能
人工智能·agent·ai编程
ctxinf1 小时前
Vercel Eve 实际上手初探
人工智能
用户5191495848451 小时前
利用ShellcodePack实现DLL劫持与COM对象劫持技术详解
人工智能·aigc