更新时间:2024-01-15 GMT+08:00
使用现有模型进行推理
本小节以姿态估计ivgPose 的预训练模型simplepose_resnet50_coco_256x192为例进行图片人物的姿势估计推理。
Step1 安装算法套件
安装ivgPose算法套件。
python manage.py install algorithm ivgPose
Step2 安装预训练模型
默认下载到当前工程的./model_zoo/{算法类型}/{算法版本}目录下。
python manage.py install model ivgPose:body/simplepose_resnet50_coco_256x192
Step3 推理
- 准备好待推理的图片,本小节以算法套件里内置的推理图片为例,原图片如下。
图1 待推理的图片
- 在Terminal中执行下述推理命令,其中--img_file的值为待推理图片的路径。
python manage.py run --cfg algorithms/ivgPose/config/sample/config.py --pipeline infer --demo_type image_demo --load_from model_zoo/ivgPose/body/simplepose_resnet50_coco_256x192.pth.tar --img_path algorithms/ivgPose/algorithm/examples/images/body/human36m_s_01_act_02_subact_01_ca_01_000001.jpg --is_show
- 运行完毕后,在当前目录的output/simplepose_resnet50_coco_256x192/下可以看到推理后的文件human36m_s_01_act_02_subact_01_ca_01_000001_vis.jpg,打开后显示如下。
图2 推理后的文件
父主题: 使用样例