This is an unofficial implementation of the paper
Deep High-Resolution Representation Learning for Human Pose Estimation.
The code is a simplified version of the official code
with the ease-of-use in mind.
The code is fully compatible with the official pre-trained weights and the results are the same of the original implementation (only slight differences on gpu due to CUDA).
This repository provides:
- A simple
HRNet
implementation in Pytorch (>=1.0) - compatible with official weights. - A simple class (
SimpleHRNet
) that loads the HRNet network for the human pose estimation, loads the pre-trained weights, and make human predictions on single images. - Multi-person support with YOLOv3 (enabled by default).
- A reference code that runs a live demo reading frames from a webcam or a video file.
import cv2
from SimpleHRNet import SimpleHRNet
model = SimpleHRNet(48, 17, "./weights/pose_hrnet_w48_384x288.pth")
image = cv2.imread("image.png", cv2.IMREAD_COLOR)
joints = hrnet.predict(image)
From a connected camera
python scripts/live-demo.py --camera_id 0
From a saved video
python scripts/live-demo.py --filename video.mp4
- Install the required packages
pip install -r requirements.txt
- Download the official pre-trained weights from https://github.com/leoxiaobin/deep-high-resolution-net.pytorch
- For multi-person support:
- Clone
YOLOv3
in the folder
./models/detectors
and change the folder name fromPyTorch-YOLOv3
toyolo
- Install YOLOv3 required packages
pip install -r requirements.txt
- Download the pre-trained weights running the script
download_weights.sh
from theweights
folder - Your folders should look like:
simple-HRNet ├── datasets (unused) ├── misc (misc) ├── models (pytorch models) │ └── detectors (people detectors) │ └── yolo (PyTorch-YOLOv3 repository) │ ├── ... │ └── weights (YOLOv3 weights) ├── weights (HRnet weights) └── scripts (scripts)
- Clone
YOLOv3
in the folder