This is an official implementation for "Exploiting Temporal Contexts with Strided Transformer for 3D Human Pose Estimation".

Overview

Exploiting Temporal Contexts with Strided Transformer for 3D Human Pose Estimation

This repo is the official implementation of Exploiting Temporal Contexts with Strided Transformer for 3D Human Pose Estimation in Pytorch.

Dependencies

  • Cuda 11.1
  • Python 3.6
  • Pytorch 1.7.1

Dataset setup

Please download the dataset from Human3.6m website and refer to VideoPose3D to set up the Human3.6M dataset ('./dataset' directory).

${POSE_ROOT}/
|-- dataset
|   |-- data_3d_h36m.npz
|   |-- data_2d_h36m_gt.npz
|   |-- data_2d_h36m_cpn_ft_h36m_dbb.npz

Download pretrained model

The pretrained model can be found in Google_Drive, please download it and put in the './checkpoint' dictory.

Test the model

To test on pretrained model on Human3.6M with 351-frames:

python main.py --frames 351 --refine --reload 1  --refine_reload 1 --previous_dir 'checkpoint/351'

Train the model

To train on Human3.6M with 351-frame:

python main.py --frames 351 --train 1 \

After training for several epoches, add refine module

python main.py --frames 351 --train 1 --refine --lr 1e-5 --reload 1 --previous_dir [your model saved path] \

Citation

If you find our work useful in your research, please consider citing:

@article{li2021exploiting,
  title={Exploiting Temporal Contexts with Strided Transformer for 3D Human Pose Estimation},
  author={Li, Wenhao and Liu, Hong and Ding, Runwei and Liu, Mengyuan and Wang, Pichao and Yang, Wenming},
  journal={arXiv preprint arXiv:2103.14304},
  year={2021}
}

Acknowledgement

Our code is built on top of ST-GCN and is extended from the following repositories. We thank the authors for releasing the codes.

Comments
  • multi-GPU for training

    multi-GPU for training

    hello, thank you for your awesome work. I have toubles of using multi-gpus when training:

    I added "model = nn.DataParallel(model)" before main.py line187: "all_param = []", but it doesn't work and gives an error: Traceback (most recent call last): File "main.py", line 190, in for i_model in model: TypeError: 'DataParallel' object is not iterable

    can you please tell me how to solve this question? thank you!

    opened by chentianyangWHU 4
  • How to use the refine network in inference?

    How to use the refine network in inference?

    The code for testing uses the GT 3D as well as camera parameters in the refine step. I got the normal step working, but with a wild input, what should I feed into the refine network?

    opened by tempstudio 4
  • when refine, the loss is always 0

    when refine, the loss is always 0

    When try to python main.py --refine --lr 1e-5 --reload --previous_dir [your model saved path], the loss is always 0 overall process, is it normal? I can't get the same result in the paper 《Exploiting Temporal Contexts with Strided Transformer for 3D Human Pose Estimation》.

    opened by nora1827 3
  • After training for several epochs, add refine module?

    After training for several epochs, add refine module?

    is it refer to Exploiting Spatial-temporal Relationships for 3D Pose Estimation via Graph Convolutional Networks, the refinement module? how many epochs do I need to train to add this module?

    opened by Elliot-hao 3
  • how to use 27 frames

    how to use 27 frames

    Thank you for providing the inference code. I am very interested in your paper. According to the paper and code, it seems like using 351 frames apparently. I tried to modify vis.py code to use 27 frames. Unfortunately I faced a hardship. The following is the error code that I got. Could you give me a instruction?


    size mismatch for Transformer.pos_embedding: copying a param with shape torch.Size([1, 351, 256]) from checkpoint, the shape in current model is torch.Size([1, 27, 256]). size mismatch for Transformer_reduce.model.pos_embedding_1: copying a param with shape torch.Size([1, 351, 256]) from checkpoint, the shape in current model is torch.Size([1, 27, 256]). size mismatch for Transformer_reduce.model.pos_embedding_2: copying a param with shape torch.Size([1, 351, 256]) from checkpoint, the shape in current model is torch.Size([1, 27, 256]). size mismatch for Transformer_reduce.model.pos_embedding_3: copying a param with shape torch.Size([1, 351, 256]) from checkpoint, the shape in current model is torch.Size([1, 27, 256]).

    opened by parkjin0903 3
  • GPU usage when running demo code - low fps

    GPU usage when running demo code - low fps

    Dear author,

    Thank you for your amazing work. I trying run your demo code with in-the-wild video and I got only about 15fps with 3D pose estimation (with HRnet and yolo detection) on my RTX3090 GPU. I checked gpu usage and it use only about 2GB of my memory. I want to ask that is there any setting that limmit my gpu usage and anyway to increase fps when running demo? I have install CUDA 11.x already. According to the paper, the method can achieve real-time application. Am I doing wrong some where? sorry, I'm new to this deeplearning field. Thank you very much for your time!

    opened by SonNguyen2510 3
  • evaluation on those frames at the begging or the end of one video

    evaluation on those frames at the begging or the end of one video

    How did you deal with the situation when the target frame is the first one of the video? then there isn't any perceding frames to make the target frame as the 'center frame'. Or you just ignore it and start the evaluation from the 13th frame when the input sequence length is 27?

    opened by Albertchen98 3
  • refine problem

    refine problem

    When I train the model using python main.py , it works well. But when I try to refine the model, using python main.py --refine --lr 1e-5 --reload --previous_dir it reports error:

    Traceback (most recent call last): File "main.py", line 225, in loss = train(opt, actions, train_dataloader, model, optimizer_all, epoch) File "main.py", line 23, in train return step('train', opt, actions, train_loader, model, optimizer, epoch) File "main.py", line 94, in step loss.backward() File "D:\Anaconda\envs\pose\lib\site-packages\torch_tensor.py", line 307, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs) File "D:\Anaconda\envs\pose\lib\site-packages\torch\autograd_init_.py", line 156, in backward allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [64, 1024]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

    I can't fine the problem, I almostly use with torch.autograd.set_detect_anomaly(True): , but still can't find the crux.

    opened by nora1827 2
  • NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.

    NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.

    After training the model according to README, I typed python demo/vis.py --video back.webm and got the following error.

    (venv) yuki@take-ubuntu2:~/workspace/StridedTransformer-Pose3D$ python demo/vis.py --video back.webm
    
    Generating 2D pose...
    100%|███████████████████████████████████████████████████████████████████████████| 499/499 [00:44<00:00, 11.21it/s]
    Generating 2D pose successful!
    
    Generating 3D pose...
      0%|                                                                                     | 0/499 [00:00<?, ?it/s]
    Traceback (most recent call last):
      File "demo/vis.py", line 276, in <module>
        get_pose3D(video_path, output_dir)
      File "demo/vis.py", line 222, in get_pose3D
        show3Dpose( post_out, ax)
      File "demo/vis.py", line 68, in show3Dpose
        ax.set_aspect('equal')
      File "/home/yuki/workspace/StridedTransformer-Pose3D/venv/lib/python3.6/site-packages/mpl_toolkits/mplot3d/axes3d.py", line 324, in set_aspect
        "Axes3D currently only supports the aspect argument "
    NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.
    

    I looked into this error and found that the following line seems to be the cause.

    https://github.com/Vegetebird/StridedTransformer-Pose3D/blob/5fbb0248ce6dd7db51f669422ed2dc86556e3f7a/demo/vis.py#L68

    I replaced this line with ax.set_aspect('auto') or ax.set_box_aspect([1,1,1]) according to https://github.com/fabro66/GAST-Net-3DPoseEstimation/issues/51 and it works fine.

    Why do you write ax.set_aspect('equal')?

    If there is no particular reason then it needs to be fixed.

    opened by takeyamayuki 2
  • About visualization

    About visualization

    Hello, I am very interested in your work, but I have not been successful in trying to use a general visualization method. Could you please provide the visualization code?

    opened by miraito-wa 2
  • Reloading a .pth file

    Reloading a .pth file

    Wonderful work! I just noticed this teeny-tiny error, in main.py < line 175< refine_path object initialize as a list (While it needn't be). This causes the following error:

    Screen Shot 2022-11-22 at 4 09 32 PM

    So, either line 175 should be removed or line 178 should become "refine_path.append(path)", which may cause further downstream errors due to refine_path being a list. Please check that out!

    Thanks!

    opened by harish-prakash-99 1
Owner
Vegetabird
Vegetabird also wants to fly!
Vegetabird
Official implementation of AAAI-21 paper "Label Confusion Learning to Enhance Text Classification Models"

Description: This is the official implementation of our AAAI-21 accepted paper Label Confusion Learning to Enhance Text Classification Models. The str

null 101 Nov 25, 2022
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
The official implementation of NeMo: Neural Mesh Models of Contrastive Features for Robust 3D Pose Estimation [ICLR-2021]. https://arxiv.org/pdf/2101.12378.pdf

NeMo: Neural Mesh Models of Contrastive Features for Robust 3D Pose Estimation [ICLR-2021] Release Notes The offical PyTorch implementation of NeMo, p

Angtian Wang 76 Nov 23, 2022
StyleGAN2-ADA - Official PyTorch implementation

Abstract: Training generative adversarial networks (GAN) using too little data typically leads to discriminator overfitting, causing training to diverge. We propose an adaptive discriminator augmentation mechanism that significantly stabilizes training in limited data regimes.

NVIDIA Research Projects 3.2k Dec 30, 2022
Official implementation of the ICLR 2021 paper

You Only Need Adversarial Supervision for Semantic Image Synthesis Official PyTorch implementation of the ICLR 2021 paper "You Only Need Adversarial S

Bosch Research 272 Dec 28, 2022
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
Official implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis https://arxiv.org/abs/2011.13775

CIPS -- Official Pytorch Implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis Requirements pip install -r requi

Multimodal Lab @ Samsung AI Center Moscow 201 Dec 21, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official PyTorch Implementation of Unsupervised Learning of Scene Flow Estimation Fusing with Local Rigidity

UnRigidFlow This is the official PyTorch implementation of UnRigidFlow (IJCAI2019). Here are two sample results (~10MB gif for each) of our unsupervis

Liang Liu 28 Nov 16, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
Official implementation of Self-supervised Graph Attention Networks (SuperGAT), ICLR 2021.

SuperGAT Official implementation of Self-supervised Graph Attention Networks (SuperGAT). This model is presented at How to Find Your Friendly Neighbor

Dongkwan Kim 127 Dec 28, 2022
An official implementation of "SFNet: Learning Object-aware Semantic Correspondence" (CVPR 2019, TPAMI 2020) in PyTorch.

PyTorch implementation of SFNet This is the implementation of the paper "SFNet: Learning Object-aware Semantic Correspondence". For more information,

CV Lab @ Yonsei University 87 Dec 30, 2022
This project is the official implementation of our accepted ICLR 2021 paper BiPointNet: Binary Neural Network for Point Clouds.

BiPointNet: Binary Neural Network for Point Clouds Created by Haotong Qin, Zhongang Cai, Mingyuan Zhang, Yifu Ding, Haiyu Zhao, Shuai Yi, Xianglong Li

Haotong Qin 59 Dec 17, 2022
Official code implementation for "Personalized Federated Learning using Hypernetworks"

Personalized Federated Learning using Hypernetworks This is an official implementation of Personalized Federated Learning using Hypernetworks paper. [

Aviv Shamsian 121 Dec 25, 2022
StyleGAN2 - Official TensorFlow Implementation

StyleGAN2 - Official TensorFlow Implementation

NVIDIA Research Projects 10.1k Dec 28, 2022
Old Photo Restoration (Official PyTorch Implementation)

Bringing Old Photo Back to Life (CVPR 2020 oral)

Microsoft 11.3k Dec 30, 2022
Official implementation of "GS-WGAN: A Gradient-Sanitized Approach for Learning Differentially Private Generators" (NeurIPS 2020)

GS-WGAN This repository contains the implementation for GS-WGAN: A Gradient-Sanitized Approach for Learning Differentially Private Generators (NeurIPS

null 46 Nov 9, 2022
Official PyTorch implementation of Spatial Dependency Networks.

Spatial Dependency Networks: Neural Layers for Improved Generative Image Modeling Đorđe Miladinović   Aleksandar Stanić   Stefan Bauer   Jürgen Schmid

Djordje Miladinovic 34 Jan 19, 2022