代码拉取完成,页面将自动刷新
中文|English
此链接提供OpenPose TensorFlow模型在NPU上离线推理的脚本和方法
此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。
在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。
Conditions | Need |
---|---|
CANN版本 | >=5.0.3 |
芯片平台 | Ascend310/Ascend310P3 |
第三方依赖 | 请参考 'requirements.txt' |
git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git
cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/OpenPose_for_ACL
请自行下载COCO2014测试数据集, 详情见: dataset
获取OpenPose pb模型, 详情见: models
pafprocess、slidingwindow 下载链接: tf_openpose and put them into libs
数据预处理
python3 preprocess.py \
--resize 656x368 \
--model cmu \
--coco-year 2014 \
--coco-dir ../dataset/coco/ \
--output-dir ../input/
Pb模型转换为om模型
环境变量设置
请参考说明,设置环境变量
Pb模型转换为om模型
atc --framework=3 \
--model=./models/OpenPose_for_TensorFlow_BatchSize_1.pb \
--output=./models/OpenPose_for_TensorFlow_BatchSize_1 \
--soc_version=Ascend310 \
--input_shape="image:1,368,656,3"
编译程序 编译推理应用程序, 详情见: xacl_fmk
开始运行
/xacl_fmk -m ./models/OpenPose_for_TensorFlow_BatchSize_1.om \
-o ./output/openpose \
-i ./input \
-b 1
后处理
python3 postprocess.py \
--resize 656x368 \
--resize-out-ratio 8.0 \
--model cmu \
--coco-year 2014 \
--coco-dir ../dataset/coco/ \
--data-idx 100 \
--output-dir ../output/openpose
样本脚本 我们还支持使用predict_openpose.sh运行上述所有步骤,构建程序除外
OpenPose 推理 :
Type | IoU | Area | MaxDets | Result |
---|---|---|---|---|
Average Precision (AP) | 0.50:0.95 | all | 20 | 0.399 |
Average Precision (AP) | 0.50 | all | 20 | 0.648 |
Average Precision (AP) | 0.75 | all | 20 | 0.400 |
Average Precision (AP) | 0.50:0.95 | medium | 20 | 0.364 |
Average Precision (AP) | 0.50:0.95 | large | 20 | 0.443 |
Average Recall (AR) | 0.50:0.95 | all | 20 | 0.456 |
Average Recall (AR) | 0.50 | all | 20 | 0.683 |
Average Recall (AR) | 0.75 | all | 20 | 0.465 |
Average Recall (AR) | 0.50:0.95 | medium | 20 | 0.371 |
Average Recall (AR) | 0.50:0.95 | large | 20 | 0.547 |
[1] https://github.com/ildoonet/tf-pose-estimation/tree/master/tf_pose/pafprocess/
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。