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如何使用Hibernate映射所有这些表?   java我们可以使用泛型优化下面的代码吗   JAVA是php的MCRYPT_RIJNDAEL_256的可靠等价物   java同时按下两个鼠标按钮无法正常工作   在UbuntuLinux上获取Java中给定端口的进程名?   java为JMS队列创建JBoss连接池   java阻止Jackson XML映射器将WSTXN添加到名称空间   readLine()中的java“socket已关闭”;   从Eclipse中确定Java方法大小   java如何将BuffereImage转换为特定颜色?   java KeyEvent。向下移动遮罩与按键事件。移位掩模   java将文本文件转换为SequentialFileOutput格式   开关箱的java模式   java Graphics2D:我应该使用int还是float版本?   spring启动期间调用的java Tasklet execute方法   java如何获取具有父DataLakeDirectoryClient类实例的子文件/目录列表   java在我站在上面的时候删除“item”