A simple baseline for 3d human pose estimation in tensorflow. Presented at ICCV 17.

Overview

3d-pose-baseline

This is the code for the paper

Julieta Martinez, Rayat Hossain, Javier Romero, James J. Little. A simple yet effective baseline for 3d human pose estimation. In ICCV, 2017. https://arxiv.org/pdf/1705.03098.pdf.

The code in this repository was mostly written by Julieta Martinez, Rayat Hossain and Javier Romero.

We provide a strong baseline for 3d human pose estimation that also sheds light on the challenges of current approaches. Our model is lightweight and we strive to make our code transparent, compact, and easy-to-understand.

Dependencies

First of all

  1. Watch our video: https://youtu.be/Hmi3Pd9x1BE

  2. Clone this repository

git clone https://github.com/una-dinosauria/3d-pose-baseline.git
cd 3d-pose-baseline
mkdir -p data/h36m/
  1. Get the data

Go to http://vision.imar.ro/human3.6m/, log in, and download the D3 Positions files for subjects [1, 5, 6, 7, 8, 9, 11], and put them under the folder data/h36m. Your directory structure should look like this

src/
README.md
LICENCE
...
data/
  └── h36m/
    ├── Poses_D3_Positions_S1.tgz
    ├── Poses_D3_Positions_S11.tgz
    ├── Poses_D3_Positions_S5.tgz
    ├── Poses_D3_Positions_S6.tgz
    ├── Poses_D3_Positions_S7.tgz
    ├── Poses_D3_Positions_S8.tgz
    └── Poses_D3_Positions_S9.tgz

Now, move to the data folder, and uncompress all the data

cd data/h36m/
for file in *.tgz; do tar -xvzf $file; done

Finally, download the code-v1.2.zip file, unzip it, and copy the metadata.xml file under data/h36m/

Now, your data directory should look like this:

data/
  └── h36m/
    ├── metadata.xml
    ├── S1/
    ├── S11/
    ├── S5/
    ├── S6/
    ├── S7/
    ├── S8/
    └── S9/

There is one little fix we need to run for the data to have consistent names:

mv h36m/S1/MyPoseFeatures/D3_Positions/TakingPhoto.cdf \
   h36m/S1/MyPoseFeatures/D3_Positions/Photo.cdf

mv h36m/S1/MyPoseFeatures/D3_Positions/TakingPhoto\ 1.cdf \
   h36m/S1/MyPoseFeatures/D3_Positions/Photo\ 1.cdf

mv h36m/S1/MyPoseFeatures/D3_Positions/WalkingDog.cdf \
   h36m/S1/MyPoseFeatures/D3_Positions/WalkDog.cdf

mv h36m/S1/MyPoseFeatures/D3_Positions/WalkingDog\ 1.cdf \
   h36m/S1/MyPoseFeatures/D3_Positions/WalkDog\ 1.cdf

And you are done!

Please note that we are currently not supporting SH detections anymore, only training from GT 2d detections is possible now.

Quick demo

For a quick demo, you can train for one epoch and visualize the results. To train, run

python src/predict_3dpose.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise --epochs 1

This should take about <5 minutes to complete on a GTX 1080, and give you around 56 mm of error on the test set.

Now, to visualize the results, simply run

python src/predict_3dpose.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise --epochs 1 --sample --load 24371

This will produce a visualization similar to this:

Visualization example

Training

To train a model with clean 2d detections, run:

python src/predict_3dpose.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise

This corresponds to Table 2, bottom row. Ours (GT detections) (MA)

Citing

If you use our code, please cite our work

@inproceedings{martinez_2017_3dbaseline,
  title={A simple yet effective baseline for 3d human pose estimation},
  author={Martinez, Julieta and Hossain, Rayat and Romero, Javier and Little, James J.},
  booktitle={ICCV},
  year={2017}
}

Other implementations

Extensions

License

MIT

Comments
  • openpose: visualization of 3D predictions joint

    openpose: visualization of 3D predictions joint

    Hello everyone,

    I'm trying to execute the following command for getting the 3D pose output:

    python src/openpose_3dpose_sandbox.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise --use_sh --epochs 200 --load 4874200 --pose_estimation_json output/ --write_gif --gif_fps 24

    But am getting the following error

    experiments\All\dropout_0.5\epochs_200\lr_0.001\residual\depth_2\linear_size1024\batch_size_64\no_procrustes\maxnorm\batch_normalization\use_stacked_hourglass\predict_17
    A subdirectory or file -p already exists.
    Error occurred while processing: -p.
    A subdirectory or file experiments\All\dropout_0.5\epochs_200\lr_0.001\residual\depth_2\linear_size1024\batch_size_64\no_procrustes\maxnorm\batch_normalization\use_stacked_hourglass\predict_17\log already exists.
    Error occurred while processing: experiments\All\dropout_0.5\epochs_200\lr_0.001\residual\depth_2\linear_size1024\batch_size_64\no_procrustes\maxnorm\batch_normalization\use_stacked_hourglass\predict_17\log.
    INFO:__main__:start reading json files
    Traceback (most recent call last):
     File "src/openpose_3dpose_sandbox.py", line 415, in <module>
       tf.app.run()
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
       _sys.exit(main(argv))
     File "src/openpose_3dpose_sandbox.py", line 232, in main
       smoothed = read_openpose_json()
     File "src/openpose_3dpose_sandbox.py", line 131, in read_openpose_json
       drop_curves_plot.savefig(pngName)
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\pyplot.py", line 689, in savefig
       res = fig.savefig(*args, **kwargs)
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\figure.py", line 2094, in savefig
       self.canvas.print_figure(fname, **kwargs)
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\backend_bases.py", line 2075, in print_figure
       **kwargs)
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\backends\backend_agg.py", line 521, in print_png
       cbook.open_file_cm(filename_or_obj, "wb") as fh:
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\contextlib.py", line 81, in __enter__
       return next(self.gen)
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\cbook\__init__.py", line 407, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
     File "C:\Program Files\Anaconda3\envs\pose3Drnn\lib\site-packages\matplotlib\cbook\__init__.py", line 392, in to_filehandle
       fh = open(fname, flag, encoding=encoding)
    FileNotFoundError: [Errno 2] No such file or directory: 'gif_output/dirty_plot.png'
    
    1. Operating system: Windows 10
    2. TensorFlow version: 1.13.1
    3. Python version:3.6.5

    Can anyone help me out with this?

    Thanks in advance

    help wanted question extensions 
    opened by ShaminiKoravuna 19
  • 3d output issue

    3d output issue

    Hi! We're running the following code (we've done the 150 epochs) : python src/openpose_3dpose_sandbox.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise --use_sh --epochs 150 --load 3655650 --openpose json_directory --write_gif --gif_fps 24

    This is one of the output frames from Openpose: capture

    This is the result we get from the code: animation

    Operating system Windows, tensorflow v 1.12.0 , python v 3.6.6

    Are we missing a flag? We tried with another video and we have the same issue with the legs

    Thank you a lot.

    enhancement 
    opened by gascione 14
  • Extension - Add Hrnet as 2D detector

    Extension - Add Hrnet as 2D detector

    Apparently HrNET , for 2d pose estimation has higher accuracy and i guess that will improve the lifting from the 2D keypoints much better. However the joint order is COCO keypoints order and thus the lifting fails. Is it possible to add it as an extension.

    Hrnet Keypoints output 2d keypoints which returns 1x17x3 where 1 is single person , followed by 17 keypoints and confidnce scores. The output was modified a bit to match with the input required for json files in openpose but i think , there has to be some more modifications to be done ?

    opened by timtensor 13
  • 3d_data.json

    3d_data.json

    @una-dinosauria

    1. operating system: win10
    2. tensorflow version :1.4
    3. python version :3.7 run python src/openpose_3dpose_sandbox.py --camera_frame --residual --batch_norm --dropout 0.5 --max_norm --evaluateActionWise --use_sh --epochs 200 --load 4874200 --pose_estimation_json /path/to/json_directory --write_gif --gif_fps 24 Used Pre-trained model .

    Generated 3d_data.json and animation.gif 3d_data.zip animation.zip

    but Why are there 32 points in 3d_data.json? How do these points correspond to joints?

    opened by AndroidUnityGit 9
  • Using data from other 2D pose estimation systems

    Using data from other 2D pose estimation systems

    Thanks for your interest in our research!

    Hi, First off, thank you very much for sharing this great work! It has been incredibly helpful to have this available.

    I have a quick question about OpenPose vs SH. I'm trying to estimate the pose based on the 16 feature point locations. I am using OpenPose for getting the estimation of pose in 2D. The features output by OpenPose can be found here: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/media/keypoints_pose.png

    I noticed that stacked hourglass method outputs slightly different features and I am looking for ways to correct my data for that. The feature points that are missing/questionable in OpenPose are:

    • hip center - not a huge problem, should be possible to just take the average from left/right hip
    • spine - slightly more problematic as I don't know what sh means by "spine" and OpenPose does not provide a direct match
    • thorax - could perhaps be replaced by base of neck?
    • head - could be replaced by nose

    My question is, have you tested or have you seen any results from using OpenPose and if you have, how were the results compared to sh after running it through your project(in your opinion, given that the model is trained on OP data)? Is it even worth correcting my data for the current pre-trained model or should I just go ahead and retrain using OP data/set up SH since the probability of getting any reasonable results otherwise would be very low?

    I would love to have a minimal system running asap and am trying to find some ways to cut corners :)

    Again, thank you very much for the great work that you have done. I hope the question isn't too much of a waste of time as this is not necessarily what the project was designed to do.

    opened by c-loob 9
  • When the tutorial to prepare the data is released?

    When the tutorial to prepare the data is released?

    It's written in ReadMe

    We are in the process of putting together a tutorial to prepare the data for this code. Please check back soon for an update.

    when the tutorial to prepare the data is released?

    data 
    opened by Uijeong97 8
  • the dataset download

    the dataset download

    Because I don't get a license for this dataset(human3.6).I hope to get it from https://www.dropbox.com/s/e35qv3n6zlkouki/h36m.zip. Show remote server can't connect. I just want to get the 3D joint position. Can you give me a new URL. Thank you very much

    question 
    opened by liuzitongtt 8
  • Adapt net for own 2d predictions

    Adapt net for own 2d predictions

    Hi,

    I am trying to run your code to infere 3d coordinates from the 2d coordinates from my own from one 2d keypoint extractor. I am converting my 2d positions into h5-files and storing them into S*/StackedHourglass/name.h5 but I am still having issues. It forces me to have 8 sequences, which I don't fully understand.

    Could you please give me a hint? am I doing it correctly? i understand, storing my 2d coordinates into StackedHourglass folders and running "predict_3dpose.py" would store into folder "MyPoses" the predicted 3d coordinates from the input 2d coordinates, is it correct?

    thanks in advance

    question 
    opened by Jugaris89 8
  • Performing 3D estimation on 2D Keypoints

    Performing 3D estimation on 2D Keypoints

    Hello,

    I noticed that each time a model.step() is performed, it needs the 3d data to be fed in as an input. Would we be able to perform inference without having the 3D ground truth for the keypoints?

    opened by JonathanCMitchell 8
  • A question about function evaluate_batches in predict_3dpose.py

    A question about function evaluate_batches in predict_3dpose.py

    Hi @una-dinosauria ,I am very appreciate for your job. when I read your code, a question puzzle for long time in the code

    step_loss, loss_summary, poses3d = model.step( sess, enc_in, dec_out, dp, isTraining=False )
    

    when getting the prediction pose3d,why I should the input of dec_out(the GT 3d) ?I try to reset the value dec_out to zero ,the return value of pose3d become different. Thx for your reply

    opened by andyqian2015 8
  • No 3dpose visualization in demo

    No 3dpose visualization in demo

    Hi, Thanks for your wonderful works, but when I try the code in README for quick demo, there is no skeleton of 3dpose in visualization, and I found something strange at the end of training.

    1. Operating system : windows 10

    2. Tensorflow version : 2.3.0

    3. Python version : 3.8.8

    4. The stack trace of the error that you see

      ============================= Global step: 24371 Learning rate: 9.90e-04 Train loss avg: 0.1195 ============================= ===Action=== ==mm== Directions nan Discussion nan Eating nan Greeting nan Phoning nan Photo nan Posing nan Purchases nan Sitting nan SittingDown nan Smoking nan Waiting nan WalkDog nan Walking nan WalkTogether nan Average nan =================== Saving the model... done in 1979.55 ms

    image

    opened by tiffany0117 7
  • Training error

    Training error

    Hello,

    Hope you are doing good.

    I am trying to train the model for 1 epoch on my custom dataset , it trains but at last it shows Average : nan. Something is wrong right rather its should show some value.

    This i am getting when traning 48 49 50 51 52 53 54 55 56] [ 0 1 2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56] nan Average nan

    Saving the model... done in 254.45 ms

    Any idea what is the problem , where i should look at to fix this problem ?

    opened by YuktiADY 0
  • cameras.h5

    cameras.h5

    Thanks for your interest in our research!

    If you have problems running our code, please include

    1. Your operating system
    2. Your tensorflow version
    3. Your python version
    4. The stack trace of the error that you see

    This is research code, and its primary purpose is to reproduce the scientific results that you see in our paper. If you are looking for ways to extend our work such as

    • handling arbitrary images
    • handling videos as input
    • using your webcam as input
    • using other 2d detectors
    • large-scale deployment
    • handling missing data
    • you want to make a startup out of this code

    then pull requests are welcome, but it is very unlikely we will have the time to help you.

    Thanks for your research, but when I want to recurrent your results, the system always remind me of "Not found file, data/h36m/cameras.h5". I seek for the h36m dataset from classmate's clouddisk and he believes that's integral, but I couldn't found that file either when your download link has already failed. I'm very grateful if you can solve this question

    opened by WindBlowMyAss 0
  • Can I get the file metadata.xml?

    Can I get the file metadata.xml?

    I am not able to get data from the H3.6M official website and the data resources from the internet is not complete. I'd appreciate if you can help me.

    opened by Dengbujiu 0
  • Can I get your data?

    Can I get your data?

    I get the data from Internet but I only have code-v1.1. Maybe because of this, when I use your quick demo, the loss is nan. I'm sorry to disturb you, but can you help me solve the question?

    opened by zdl-hub 0
  • Predict wrong joints

    Predict wrong joints

    Hello everyone,

    I'm trying to rebuild the result of this code and follow the introduction that provide on this website, however, I got the wrong predicted joints, which are not the 16 joints we want to show the skeleton. Could anyone help me change the code to train the model with the joints we want?

    1. Operating system : windows 10 home
    2. Tensorflow version : 2.3.0
    3. Python version : 3.8.8
    opened by tiffany0117 4
Owner
Julieta Martinez
Not affiliated with the University of Toronto
Julieta Martinez
This is an official implementation for "DeciWatch: A Simple Baseline for 10x Efficient 2D and 3D Pose Estimation"

DeciWatch: A Simple Baseline for 10× Efficient 2D and 3D Pose Estimation This repo is the official implementation of "DeciWatch: A Simple Baseline for

null 117 Dec 24, 2022
Human POSEitioning System (HPS): 3D Human Pose Estimation and Self-localization in Large Scenes from Body-Mounted Sensors, CVPR 2021

Human POSEitioning System (HPS): 3D Human Pose Estimation and Self-localization in Large Scenes from Body-Mounted Sensors Human POSEitioning System (H

Aymen Mir 66 Dec 21, 2022
Code for "Human Pose Regression with Residual Log-likelihood Estimation", ICCV 2021 Oral

Human Pose Regression with Residual Log-likelihood Estimation [Paper] [arXiv] [Project Page] Human Pose Regression with Residual Log-likelihood Estima

JeffLi 347 Dec 24, 2022
[ICCV 2021] Encoder-decoder with Multi-level Attention for 3D Human Shape and Pose Estimation

MAED: Encoder-decoder with Multi-level Attention for 3D Human Shape and Pose Estimation Getting Started Our codes are implemented and tested with pyth

ZiNiU WaN 176 Dec 15, 2022
[ICCV-2021] An Empirical Study of the Collapsing Problem in Semi-Supervised 2D Human Pose Estimation

An Empirical Study of the Collapsing Problem in Semi-Supervised 2D Human Pose Estimation (ICCV 2021) Introduction This is an official pytorch implemen

rongchangxie 42 Jan 4, 2023
Code for ICCV 2021 paper "HuMoR: 3D Human Motion Model for Robust Pose Estimation"

Code for ICCV 2021 paper "HuMoR: 3D Human Motion Model for Robust Pose Estimation"

Davis Rempe 367 Dec 24, 2022
Human head pose estimation using Keras over TensorFlow.

RealHePoNet: a robust single-stage ConvNet for head pose estimation in the wild.

Rafael Berral Soler 71 Jan 5, 2023
Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation

SimplePose Code and pre-trained models for our paper, “Simple Pose: Rethinking and Improving a Bottom-up Approach for Multi-Person Pose Estimation”, a

Jia Li 256 Dec 24, 2022
SE3 Pose Interp - Interpolate camera pose or trajectory in SE3, pose interpolation, trajectory interpolation

SE3 Pose Interpolation Pose estimated from SLAM system are always discrete, and

Ran Cheng 4 Dec 15, 2022
Image-retrieval-baseline - MUGE Multimodal Retrieval Baseline

MUGE Multimodal Retrieval Baseline This repo is implemented based on the open_cl

null 47 Dec 16, 2022
Image-generation-baseline - MUGE Text To Image Generation Baseline

MUGE Text To Image Generation Baseline Requirements and Installation More detail

null 23 Oct 17, 2022
Jingju baseline - A baseline model of our project of Beijing opera script generation

Jingju Baseline It is a baseline of our project about Beijing opera script gener

midon 1 Jan 14, 2022
《Unsupervised 3D Human Pose Representation with Viewpoint and Pose Disentanglement》(ECCV 2020) GitHub: [fig9]

Unsupervised 3D Human Pose Representation [Paper] The implementation of our paper Unsupervised 3D Human Pose Representation with Viewpoint and Pose Di

null 42 Nov 24, 2022
This repository contains codes of ICCV2021 paper: SO-Pose: Exploiting Self-Occlusion for Direct 6D Pose Estimation

SO-Pose This repository contains codes of ICCV2021 paper: SO-Pose: Exploiting Self-Occlusion for Direct 6D Pose Estimation This paper is basically an

shangbuhuan 52 Nov 25, 2022
Official implementation of the network presented in the paper "M4Depth: A motion-based approach for monocular depth estimation on video sequences"

M4Depth This is the reference TensorFlow implementation for training and testing depth estimation models using the method described in M4Depth: A moti

Michaël Fonder 76 Jan 3, 2023
The project is an official implementation of our CVPR2019 paper "Deep High-Resolution Representation Learning for Human Pose Estimation"

Deep High-Resolution Representation Learning for Human Pose Estimation (CVPR 2019) News [2020/07/05] A very nice blog from Towards Data Science introd

Leo Xiao 3.9k Jan 5, 2023
Deep Dual Consecutive Network for Human Pose Estimation (CVPR2021)

Deep Dual Consecutive Network for Human Pose Estimation (CVPR2021) Introduction This is the official code of Deep Dual Consecutive Network for Human P

null 295 Dec 29, 2022
Bottom-up Human Pose Estimation

Introduction This is the official code of Rethinking the Heatmap Regression for Bottom-up Human Pose Estimation. This paper has been accepted to CVPR2

null 108 Dec 1, 2022
This is an official implementation of our CVPR 2021 paper "Bottom-Up Human Pose Estimation Via Disentangled Keypoint Regression" (https://arxiv.org/abs/2104.02300)

Bottom-Up Human Pose Estimation Via Disentangled Keypoint Regression Introduction In this paper, we are interested in the bottom-up paradigm of estima

HRNet 367 Dec 27, 2022