Skip to content

Multi-person Human Pose Estimation with HRNet in Pytorch

License

Notifications You must be signed in to change notification settings

timtensor/simple-HRNet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-person Human Pose Estimation with HRNet in Pytorch

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.

Class usage

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)

Running the live demo

From a connected camera

python scripts/live-demo.py --camera_id 0

From a saved video

python scripts/live-demo.py --filename video.mp4

Requirements

  • 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 from PyTorch-YOLOv3 to yolo
    • Install YOLOv3 required packages
      pip install -r requirements.txt
    • Download the pre-trained weights running the script download_weights.sh from the weights 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)
      

About

Multi-person Human Pose Estimation with HRNet in Pytorch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%