This repo is TensorFlow implementation of Deep High-Resolution Representation Learning for Human Pose Estimation (CVPR 2019) of MSRA for 2D multi-person pose estimation from a single RGB image.
Python 3.7.1 version with Anaconda 3 is used for development.
The ${POSE_ROOT} is described as below.
${POSE_ROOT}
|-- core
|-- data
|-- hrnet
|-- nms
|-- tfflat
|-- tools
corecontains codes for train engine, test engine, basic dataloader and the pose model.datacontains the codes for data processing on COCO, MPII and PoseTrack.hrnetcontains codes for building HRNets.nmscontains codes for NMS.tfflatcontains useful codes for data parallel, multi-gpu training, model saving and loading.toolscontains codes that convert MPII and PoseTrack data into COCO format.
You need prepare the data in the dataset directory as below.
${POSE_ROOT}
|-- dataset
|-- MPII
|-- |-- dets
| | |-- human_detection.json
| |-- annotations
| | |-- train.json
| | `-- test.json
| |-- images
| | |-- 000001163.jpg
| `-- mpii2coco.py
|
|-- PoseTrack
|-- |-- dets
| | |-- human_detection.json
| |-- annotations
| | |-- train2018.json
| | |-- val2018.json
| | `-- test2018.json
| |-- original_annotations
| | |-- train/
| | |-- val/
| | `-- test/
| |-- images
| | |-- train/
| | |-- val/
| | `-- test/
| `-- posetrack2coco.py
|
|-- COCO
|-- |-- dets
| | |-- human_detection.json
| |-- annotations
| | |-- person_keypoints_train2017.json
| | |-- person_keypoints_val2017.json
| | `-- image_info_test-dev2017.json
| `-- images
| |-- train2017/
| |-- val2017/
| `-- test2017/
|
`-- imagenet_weights
|-- hrnet_w30.ckpt
|-- hrnet_w32.ckpt
|-- hrnet_w48.ckpt
- Creating
datasetfolder (or its sub-folders) as soft link(s) form is recommended instead of folder form because it would take large storage capacity. - Use the python script in
${POSE_ROOT}/tools/to convert MPII and PoseTrack annotation files to MS COCO format. - If you want to add your own dataset, you have to convert it to MS COCO format.
- Except for
annotationsof the MPII and PoseTrack, all other directories are original version of downloaded ones. - In the training stage, GT human bbox is used, and
human_detection.jsonis used in testing stage which should be prepared before testing and follow MS COCO format. - Download imagenet pre-trained hrnet models from here and place them in the
data/imagenet_weights.
You need to follow the directory structure of the output folder as below.
${POSE_ROOT}
|-- output
|-- log
|-- model_dump
`-- result
- Creating
outputfolder as soft link form is recommended instead of folder form because it would take large storage capacity. logfolder contains training log file.model_dumpfolder contains saved checkpoints for each epoch.resultfolder contains final estimation files generated in the testing stage.- You can change default directory structure of
outputby modifyingmain/config.py.
- Install the dependencies.
- Run
pip install -r requirements.txtto install other required modules. - Run
python setup.py build_ext --inplace; rm -rf buildin${POSE_ROOT}/nmsto build NMS modules. - In the
${POSE_ROOT}/config.py, you can change settings of the model including dataset to use, network backbone, input size and so on.
In ${POSE_ROOT}, run
python train.py --gpu 0,1,2,3to train the network on the GPU 0,1,2,3.
If you want to continue experiment, run
python train.py --gpu 0,1,2,3 --continueand the training will restart from the latest checkpoint.
Place trained model at the cfg.model_dump_dir and human detection result (human_detection.json) at dataset/$DATASET/dets/.
In ${POSE_ROOT}, run
python test.py --gpu 0,1,2,3 --test_epoch 210to test the network on the GPU 0,1,2,3 with 210th epoch trained model.