Home

Awesome

HigherHRNet: Scale-Aware Representation Learning for Bottom-Up Human Pose Estimation (CVPR 2020)

News

Introduction

This is the official code of HigherHRNet: Scale-Aware Representation Learning for Bottom-Up Human Pose Estimation.
Bottom-up human pose estimation methods have difficulties in predicting the correct pose for small persons due to challenges in scale variation. In this paper, we present HigherHRNet: a novel bottom-up human pose estimation method for learning scale-aware representations using high-resolution feature pyramids. Equipped with multi-resolution supervision for training and multi-resolution aggregation for inference, the proposed approach is able to solve the scale variation challenge in bottom-up multi-person pose estimation and localize keypoints more precisely, especially for small person. The feature pyramid in HigherHRNet consists of feature map outputs from HRNet and upsampled higher-resolution outputs through a transposed convolution. HigherHRNet outperforms the previous best bottom-up method by 2.5% AP for medium person on COCO test-dev, showing its effectiveness in handling scale variation. Furthermore, HigherHRNet achieves new state-of-the-art result on COCO test-dev (70.5% AP) without using refinement or other post-processing techniques, surpassing all existing bottom-up methods. HigherHRNet even surpasses all top-down methods on CrowdPose test (67.6% AP), suggesting its robustness in crowded scene.

Illustrating the architecture of the proposed Higher-HRNet

Main Results

Results on COCO val2017 without multi-scale test

MethodBackboneInput size#ParamsGFLOPsAPAp .5AP .75AP (M)AP (L)
HigherHRNetHRNet-w3251228.6M47.967.186.273.061.576.1
HigherHRNetHRNet-w3264028.6M74.868.587.174.764.375.3
HigherHRNetHRNet-w4864063.8M154.369.987.276.165.476.4

Results on COCO val2017 with multi-scale test

MethodBackboneInput size#ParamsGFLOPsAPAp .5AP .75AP (M)AP (L)
HigherHRNetHRNet-w3251228.6M47.969.987.176.065.377.0
HigherHRNetHRNet-w3264028.6M74.870.688.176.966.676.5
HigherHRNetHRNet-w4864063.8M154.372.188.478.267.878.3

Results on COCO test-dev2017 without multi-scale test

MethodBackboneInput size#ParamsGFLOPsAPAp .5AP .75AP (M)AP (L)
OpenPose*----61.884.967.557.168.2
HourglassHourglass512277.8M206.956.681.861.849.867.0
PersonLabResNet-152140168.7M405.566.588.072.662.472.3
PifPaf----66.7--62.472.9
Bottom-up HRNetHRNet-w3251228.5M38.964.186.370.457.473.9
HigherHRNetHRNet-w3251228.6M47.966.487.572.861.274.2
HigherHRNetHRNet-w4864063.8M154.368.488.275.164.474.2

Results on COCO test-dev2017 with multi-scale test

MethodBackboneInput size#ParamsGFLOPsAPAp .5AP .75AP (M)AP (L)
HourglassHourglass512277.8M206.963.085.768.958.070.4
Hourglass*Hourglass512277.8M206.965.586.872.360.672.6
PersonLabResNet-152140168.7M405.568.789.075.464.175.5
HigherHRNetHRNet-w4864063.8M154.370.589.377.266.675.8

Results on CrowdPose test

MethodAPAp .5AP .75AP (E)AP (M)AP (H)
Mask-RCNN57.283.560.369.457.945.8
AlphaPose61.081.366.071.261.451.1
SPPE66.0.84.271.575.566.357.4
OpenPose---62.748.732.3
HigherHRNet65.986.470.673.366.557.9
HigherHRNet+67.687.472.675.868.158.9

Note: + indicates using multi-scale test.

Environment

The code is developed using python 3.6 on Ubuntu 16.04. NVIDIA GPUs are needed. The code is developed and tested using 4 NVIDIA P100 GPU cards. Other platforms or GPU cards are not fully tested.

Quick start

Installation

  1. Install pytorch >= v1.1.0 following official instruction.

    • Tested with pytorch v1.4.0
  2. Clone this repo, and we'll call the directory that you cloned as ${POSE_ROOT}.

  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Install COCOAPI:

    # COCOAPI=/path/to/clone/cocoapi
    git clone https://github.com/cocodataset/cocoapi.git $COCOAPI
    cd $COCOAPI/PythonAPI
    # Install into global site-packages
    make install
    # Alternatively, if you do not have permissions or prefer
    # not to install the COCO API into global site-packages
    python3 setup.py install --user
    

    Note that instructions like # COCOAPI=/path/to/install/cocoapi indicate that you should pick a path where you'd like to have the software cloned and then set an environment variable (COCOAPI in this case) accordingly.

  5. Install CrowdPoseAPI exactly the same as COCOAPI.

  6. Init output(training model output directory) and log(tensorboard log directory) directory:

    mkdir output 
    mkdir log
    

    Your directory tree should look like this:

    ${POSE_ROOT}
    ├── data
    ├── experiments
    ├── lib
    ├── log
    ├── models
    ├── output
    ├── tools 
    ├── README.md
    └── requirements.txt
    
  7. Download pretrained models from our model zoo(GoogleDrive or OneDrive)

    ${POSE_ROOT}
     `-- models
         `-- pytorch
             |-- imagenet
             |   `-- hrnet_w32-36af842e.pth
             `-- pose_coco
                 `-- pose_higher_hrnet_w32_512.pth
    
    

Data preparation

For COCO data, please download from COCO download, 2017 Train/Val is needed for COCO keypoints training and validation. Download and extract them under {POSE_ROOT}/data, and make them look like this:

${POSE_ROOT}
|-- data
`-- |-- coco
    `-- |-- annotations
        |   |-- person_keypoints_train2017.json
        |   `-- person_keypoints_val2017.json
        `-- images
            |-- train2017
            |   |-- 000000000009.jpg
            |   |-- 000000000025.jpg
            |   |-- 000000000030.jpg
            |   |-- ... 
            `-- val2017
                |-- 000000000139.jpg
                |-- 000000000285.jpg
                |-- 000000000632.jpg
                |-- ... 

For CrowdPose data, please download from CrowdPose download, Train/Val is needed for CrowdPose keypoints training and validation. Download and extract them under {POSE_ROOT}/data, and make them look like this:

${POSE_ROOT}
|-- data
`-- |-- crowd_pose
    `-- |-- json
        |   |-- crowdpose_train.json
        |   |-- crowdpose_val.json
        |   |-- crowdpose_trainval.json (generated by tools/crowdpose_concat_train_val.py)
        |   `-- crowdpose_test.json
        `-- images
            |-- 100000.jpg
            |-- 100001.jpg
            |-- 100002.jpg
            |-- 100003.jpg
            |-- 100004.jpg
            |-- 100005.jpg
            |-- ... 

After downloading data, run python tools/crowdpose_concat_train_val.py under ${POSE_ROOT} to create trainval set.

Training and Testing

Testing on COCO val2017 dataset using model zoo's models (GoogleDrive)

For single-scale testing:

python tools/valid.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml \
    TEST.MODEL_FILE models/pytorch/pose_coco/pose_higher_hrnet_w32_512.pth

By default, we use horizontal flip. To test without flip:

python tools/valid.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml \
    TEST.MODEL_FILE models/pytorch/pose_coco/pose_higher_hrnet_w32_512.pth \
    TEST.FLIP_TEST False

Multi-scale testing is also supported, although we do not report results in our paper:

python tools/valid.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml \
    TEST.MODEL_FILE models/pytorch/pose_coco/pose_higher_hrnet_w32_512.pth \
    TEST.SCALE_FACTOR '[0.5, 1.0, 2.0]'

Training on COCO train2017 dataset

python tools/dist_train.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml 

By default, it will use all available GPUs on the machine for training. To specify GPUs, use

CUDA_VISIBLE_DEVICES=0,1 python tools/dist_train.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml 

Mixed-precision training

Due to large input size for bottom-up methods, we use mixed-precision training to train our Higher-HRNet by using the following command:

python tools/dist_train.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml \
    FP16.ENABLED True FP16.DYNAMIC_LOSS_SCALE True

Synchronized BatchNorm training

If you have limited GPU memory, please try to reduce batch size and use SyncBN to train our Higher-HRNet by using the following command:

python tools/dist_train.py \
    --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml \
    FP16.ENABLED True FP16.DYNAMIC_LOSS_SCALE True \
    MODEL.SYNC_BN True

Our code for mixed-precision training is borrowed from NVIDIA Apex API.

Training on CrowdPose trainval dataset

python tools/dist_train.py \
    --cfg experiments/crowd_pose/higher_hrnet/w32_512_adam_lr1e-3.yaml 

Other applications

Many other dense prediction tasks, such as segmentation, face alignment and object detection, etc. have been benefited by HRNet. More information can be found at Deep High-Resolution Representation Learning.

Other implementations

mmpose

Citation

If you find this work or code is helpful in your research, please cite:

@inproceedings{cheng2020bottom,
  title={HigherHRNet: Scale-Aware Representation Learning for Bottom-Up Human Pose Estimation},
  author={Bowen Cheng and Bin Xiao and Jingdong Wang and Honghui Shi and Thomas S. Huang and Lei Zhang},
  booktitle={CVPR},
  year={2020}
}

@inproceedings{SunXLW19,
  title={Deep High-Resolution Representation Learning for Human Pose Estimation},
  author={Ke Sun and Bin Xiao and Dong Liu and Jingdong Wang},
  booktitle={CVPR},
  year={2019}
}

@article{wang2019deep,
  title={Deep High-Resolution Representation Learning for Visual Recognition},
  author={Wang, Jingdong and Sun, Ke and Cheng, Tianheng and Jiang, Borui and Deng, Chaorui and Zhao, Yang and Liu, Dong and Mu, Yadong and Tan, Mingkui and Wang, Xinggang and Liu, Wenyu and Xiao, Bin},
  journal={TPAMI},
  year={2019}
}