全网首发,人体姿态估计算法在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

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

相关推荐
ARM+FPGA+AI工业主板定制专家19 分钟前
基于GPS/PTP/gPTP的自动驾驶数据同步授时方案
人工智能·机器学习·自动驾驶
长鸳词羡22 分钟前
wordpiece、unigram、sentencepiece基本原理
人工智能
ㄣ知冷煖★24 分钟前
【GPT5系列】ChatGPT5 提示词工程指南
人工智能
科士威传动24 分钟前
丝杆支撑座在印刷设备如何精准运行?
人工智能·科技·自动化·制造
taxunjishu2 小时前
DeviceNet 转 Modbus TCP 协议转换在 S7-1200 PLC化工反应釜中的应用
运维·人工智能·物联网·自动化·区块链
kalvin_y_liu2 小时前
智能体框架大PK!谷歌ADK VS 微软Semantic Kernel
人工智能·microsoft·谷歌·智能体
爱看科技2 小时前
智能眼镜行业腾飞在即,苹果/微美全息锚定“AR+AI眼镜融合”之路抢滩市场!
人工智能·ar
Juchecar5 小时前
LLM模型与ML算法之间的关系
人工智能
FIN66685 小时前
昂瑞微:深耕射频“芯”赛道以硬核实力冲刺科创板大门
前端·人工智能·科技·前端框架·信息与通信·智能
benben0445 小时前
京东agent之joyagent解读
人工智能