pifpaf:用于人体姿态估计的复合场

openpifpaf的Python项目详细描述


打开pifpaf

Build Status

We propose a new bottom-up method for multi-person 2D human pose estimation that is particularly well suited for urban mobility such as self-driving cars and delivery robots. The new method, PifPaf, uses a Part Intensity Field (PIF) to localize body parts and a Part Association Field (PAF) to associate body parts with each other to form full human poses. Our method outperforms previous methods at low resolution and in crowded, cluttered and occluded scenes thanks to (i) our new composite field PAF encoding fine-grained information and (ii) the choice of Laplace loss for regressions which incorporates a notion of uncertainty. Our architecture is based on a fully convolutional, single-shot, box-free design. We perform on par with the existing state-of-the-art bottom-up method on the standard COCO keypoint task and produce state-of-the-art results on a modified COCO keypoint task for the transportation domain.

@article{kreiss2019pifpaf,
  title={PifPaf: Composite Fields for Human Pose Estimation},
  author={Kreiss, Sven and Bertoni, Lorenzo and Alahi, Alexandre},
  journal={CVPR, arXiv preprint arXiv:1903.06593},
  year={2019}
}

arxiv.org/abs/1903.06593

演示

example image with overlaid pose skeleton

图像信用:“Learning to surf”由Fotologic提供,在CC-BY-2.0下获得许可。
创建时间: python3 -m openpifpaf.predict --show docs/coco/000000081988.jpg

有关更多演示,请参见 openpifpafwebdemo项目和 openpifpaf.webcam命令。 还有一个Google Colab demo

example image

安装

python 3是必需的。不支持Python2。 不要克隆此存储库 并确保当前目录中没有名为openpifpaf的文件夹。

pip3 install openpifpaf

对于现场演示,我们建议尝试 openpifpafwebdemo项目。 或者,openpifpaf.webcam也提供了一个现场演示。 它需要opencv。使用全局安装的 从虚拟环境中打开cv,使用 --system-site-packages选项并验证是否可以执行import cv2

为了开发openpifpaf源代码本身,您需要克隆这个存储库,然后:

pip3 install numpy cython
pip3 install --editable '.[train,test]'

最后一个命令在当前目录中安装python包 (由点表示)具有培训和 测试。

接口

  • python3 -m openpifpaf.predict --help
  • python3 -m openpifpaf.webcam --help
  • python3 -m openpifpaf.train --help
  • python3 -m openpifpaf.eval_coco --help
  • python3 -m openpifpaf.logs --help

要尝试的命令示例:

# live demoMPLBACKEND=macosx python3 -m openpifpaf.webcam --scale 0.1 --source=0# single image
python3 -m openpifpaf.predict my_image.jpg --show

预先培训的车型

使用GTX1080Ti获得的CoCo VAL集上0.9.0版的性能指标:

BackboneAPAPᴹAPᴸt_{total} [ms]t_{dec} [ms]
shufflenetv2x150.247.055.45644
shufflenetv2x258.555.263.66041
resnet5063.360.767.87938
resnext5063.861.168.19333
resnet10166.563.171.910035
resnet15267.864.473.312230

预处理的模型文件在此共享 Google Drive 你可以放进outputs文件夹。预先训练的模型是 自动下载时间 使用命令行选项--checkpoint backbonenameasintableabove

要可视化日志:

python3 -m openpifpaf.logs \
  outputs/resnet50block5-pif-paf-edge401-190424-122009.pkl.log \
  outputs/resnet101block5-pif-paf-edge401-190412-151013.pkl.log \
  outputs/resnet152block5-pif-paf-edge401-190412-121848.pkl.log

列车

有关安装说明,请参见datasets。 以前的研究见studies.ipynb

训练模型:

python3 -m openpifpaf.train \
  --lr=1e-3 \
  --momentum=0.95 \
  --epochs=75\
  --lr-decay 6070\
  --batch-size=8\
  --basenet=resnet50block5 \
  --head-quad=1\
  --headnets pif paf \
  --square-edge=401\
  --regression-loss=laplace \
  --lambdas 30225033\
  --freeze-base=1

可以用^ {CD14>}选项精化现有模型。

要在每个纪元生成计算,请检查目录中的新 每5分钟快照一次:

while true; do \
  CUDA_VISIBLE_DEVICES=0 find outputs/ -name "resnet101block5-pif-paf-l1-190109-113346.pkl.epoch???" -exec \
    python3 -m openpifpaf.eval_coco --checkpoint {} -n 500 --long-edge=641 --skip-existing \; \
  ; \
  sleep 300; \
done

人体骨骼

可可树/运动树/密度:

python3 -m openpifpaf.data创建。

视频

使用ffmpeg从video.avivideo.pose.mp4逐帧处理视频:

exportVIDEO=video.avi  # change to your video file

mkdir ${VIDEO}.images
ffmpeg -i ${VIDEO} -qscale:v 2 -vf scale=641:-1 -f image2 ${VIDEO}.images/%05d.jpg
python3 -m openpifpaf.predict --checkpoint resnet152 ${VIDEO}.images/*.jpg
ffmpeg -framerate 24 -pattern_type glob -i ${VIDEO}.images/'*.jpg.skeleton.png' -vf scale=640:-1 -c:v libx264 -pix_fmt yuv420p ${VIDEO}.pose.mp4

在此过程中,ffmpeg将视频缩放到可以调整的641px

文档页

相关项目

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有本地和在线数据库的java桌面应用程序   corePoolSize=0的java ScheduledThreadPoolExecutor会在一个CPU内核上产生100%的负载   Java打印2D数组,就像带边框的表格一样   优化有没有办法通过方法回调在代码中捕获Java中的对象分配?   java为什么我的变量不能工作?   jface树项上的java刷新存在绘制问题   内存管理在Java中如何在一行中返回数组?   java向云端点添加参数会导致404 GoogleJsonResponseException   java如何定义webservice端点url   来自play store的安卓 AdneEngine错误:java。lang.NoSuchMethodError   java是否可以在Gluon移动应用程序中加载网页?   java Maven OSGi项目已编译,但不会运行   java如何修复布局抖动?   xml Java SoapMessage添加空命名空间   在Java中从派生类调用基类构造函数   java使用netbeans从jtable中的mysql检索数据   使用FIPS 1402库在Java中创建OpenPGP消息的加密   java编程语言的第二个实现可以用这种语言编写吗?   java如何使用带多个参数的分隔符