Giter VIP home page Giter VIP logo

hyperformer's Introduction

Hyperformer

This is the official implementation of our paper Hypergraph Transformer for Skeleton-based Action Recognition.

Excellent Efficiency

Model Parameters FLOPs Training Time/Epoch Accuracy
ST-TR 12.1M 259.4G 11m48s 89.9
DSTA 4.1M 64.7G 10m36s 91.5
Efficient-GCN-B4 * 2.0M 15.2G* 15m37s* 91.7*
Hyperformer 2.6M 14.8G 6m52s 92.9

Remark: Comparing computation budget under the same setting (1 Tesla V100-32GB, 64 batch size, etc.) on NTU RGB+D 60 Cross-Subject Benchmark. *EfficientNet-B4 requires 4 times higher temporal resolution (288 vs 64 frames) and thus 2 GPUs to fit into memory and reach their reported accuracy.

Attention on Hypergraph

drawing

Hyperformer architecture

drawing

Preparation

Install torchlight

Run pip install -e torchlight

Download datasets.

There are 3 datasets to download:

  • NTU RGB+D 60 Skeleton
  • NTU RGB+D 120 Skeleton
  • NW-UCLA

NTU RGB+D 60 and 120

  1. Request dataset here: https://rose1.ntu.edu.sg/dataset/actionRecognition
  2. Download the skeleton-only datasets:
    1. nturgbd_skeletons_s001_to_s017.zip (NTU RGB+D 60)
    2. nturgbd_skeletons_s018_to_s032.zip (NTU RGB+D 120)
    3. Extract above files to ./data/nturgbd_raw

NW-UCLA

  1. Download dataset from CTR-GCN
  2. Move all_sqe to ./data/NW-UCLA

Data Processing

Directory Structure

Put downloaded data into the following directory structure:

- data/
  - NW-UCLA/
    - all_sqe
      ... # raw data of NW-UCLA
  - ntu/
  - ntu120/
  - nturgbd_raw/
    - nturgb+d_skeletons/     # from `nturgbd_skeletons_s001_to_s017.zip`
      ...
    - nturgb+d_skeletons120/  # from `nturgbd_skeletons_s018_to_s032.zip`
      ...

Generating Data

  • Generate NTU RGB+D 60 or NTU RGB+D 120 dataset:
 cd ./data/ntu # or cd ./data/ntu120
 # Get skeleton of each performer
 python get_raw_skes_data.py
 # Remove the bad skeleton 
 python get_raw_denoised_data.py
 # Transform the skeleton to the center of the first frame
 python seq_transformation.py

Evaluation

We provide the pretrained model weights for NTURGB+D 60 and NTURGB+D 120 benchmarks.

To use the pretrained weights for evaluation, please run the following command:

bash evaluate.sh

Training & Testing

Training

bash train.sh

Please check the configuration in the config directory.

Testing

bash evaluate.sh

To ensemble the results of different modalities, run the following command:

bash ensemble.sh

Acknowledgements

This repo is based on 2s-AGCN and CTR-GCN. The data processing is borrowed from SGN and HCN, and the training strategy is based on InfoGCN.

Thanks to the original authors for their work!

Citation

Please cite this work if you find it useful:

 @article{zhou2022hypergraph,
  title={Hypergraph Transformer for Skeleton-based Action Recognition},
  author={Zhou, Yuxuan and Cheng, Zhi-Qi and Li, Chao and Geng, Yifeng and Xie, Xuansong and Keuper, Margret},
  journal={arXiv preprint arXiv:2211.09590},
  year={2022}
}

Contact

For any questions, feel free to contact: [email protected]

hyperformer's People

Contributors

zhiqic avatar zhouyuxuanyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hyperformer's Issues

关于NW-UCLA的精度

您好,请问您在实验过程中是否使用CTR-GCN跑了NW-UCLA数据集,是否能达到CTR-GCN提供的精度?
我在实验过程中发现,CTR-GCN在NW-UCLA的进度仅仅达到95.5?请问您是否遇到过同样的问题?
期待您的回复。

关于表4的实验:HyperSA的有效性

你好,我尝试验证HyperSA的有效性,也就是复现原论文表格4的内容。
我通过修改此处的attn = a + b + c + d为attn = a、attn = a + b 等去复现表格4的内容,但Full HyperSA并没有比SA带来如表4一样特别大的提升,具体结果如下:

Model val_acc remark
Full HyperSA + MS-TC 0.90277 attn = a + b + c + d
SA + MS-TC 0.90083 attn = a
SA + MS-TC + K-Hop RPE 0.90301 attn = a + b
SA + MS-TC + Joint-to-hyperedge attn 0.90101 attn = a + c
SA + MS-TC + Hyperedge-Attentive-Bias 0.90240 attn = a + d

我使用的是3090,其他设置与原代码一致。
我猜测可能是我没有完全复现90.7%的结果或者是我对模型的修改不对?
如果有别的遗漏,请帮我指出一下,谢谢!

How to train joint_label

Hello,

I am interested in training the joint_label. Based on the discussion in the previous issue, it was mentioned that a parameterized partition matrix could be used. Could you guide me on how to initialize this matrix and then apply the softmax? should the dimensions of this matrix be set to 25x25?

Thank you very much for the help.

可以给出joint label的训练代码吗

您好,在之前的议题中您有详细解释过如何训练joint label,但是很抱歉由于愚笨我没能复现出来。可以劳烦您给出代码吗?

文章收录

您好,请问现在文章收录有结果了吗?

hyperedge

Hello, I would like to ask how you constructed the hyperedge and how to obtain the hyperedge representation

Partition

Hello, I can only see that you use joint_label as partition matrix while you are supposed to use partition strategy to learn the partition matrix. Do I miss anything? If so, could you let me where your learnable partition matrix code is. Thanks!

收录期刊或会议

你好,想问一下这篇工作最后是被哪个期刊或会议接收的吗,看到你的代码仓库上写的是 preprint版的

Hello,I encountered a problem during the implementation process and would like to consult with you

Traceback (most recent call last):
File "/home/hcao/Hyperformer-main/main.py", line 777, in
processor.start()
File "/home/hcao/Hyperformer-main/main.py", line 756, in start
self.eval(epoch=0, save_score=self.arg.save_score, loader_name=['test'], wrong_file=wf, result_file=rf)
File "/home/hcao/Hyperformer-main/main.py", line 573, in eval
output, z = self.model(data, F.one_hot(label, num_classes=self.model.module.num_class))
^^^^^^^^^^^^^^^^^
File "/home/hcao/.conda/envs/Hyperformer/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1614, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Model' object has no attribute 'module'. Did you mean: 'modules'?

About the learning method for joint_label.

Hello,

our paper has been very informative to me.
In the paper, it mentions using 'soft' partitions with the application of softmax. Does this mean that during training, labels are handled as probabilistic values rather than binary values? Also, how is this matrix initialized during training (zeros or a normal distribution)?"

Thank you very much for the help.

No module named 'torchpack.runner'

Hello!

I am trying to install all the required dependencies for running bash evaluate.sh. Unfortunatelly I keep getting this error that I cannot seem to resolve:

Traceback (most recent call last):
  File "main.py", line 26, in <module>
    from torchlight import DictAction
  File "/home/teresa/GitLab/basket/hyperformer/torchlight/torchlight/__init__.py", line 1, in <module>
    from .util import IO
  File "/home/teresa/GitLab/basket/hyperformer/torchlight/torchlight/util.py", line 16, in <module>
    from torchpack.runner.hooks import PaviLogger
ModuleNotFoundError: No module named 'torchpack.runner'

I am currently working on a conda environment with these packages installed:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
blinker                   1.6.2                    pypi_0    pypi
ca-certificates           2023.05.30           h06a4308_0  
certifi                   2023.7.22                pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
cmake                     3.27.2                   pypi_0    pypi
colorama                  0.4.4                    pypi_0    pypi
contourpy                 1.1.0                    pypi_0    pypi
cryptography              41.0.3                   pypi_0    pypi
docker                    6.1.3                    pypi_0    pypi
entrypoints               0.4                      pypi_0    pypi
flask                     2.3.2                    pypi_0    pypi
fonttools                 4.42.0                   pypi_0    pypi
google-auth               2.22.0                   pypi_0    pypi
google-auth-oauthlib      0.4.6                    pypi_0    pypi
grpcio                    1.57.0                   pypi_0    pypi
h5py                      3.9.0                    pypi_0    pypi
idna                      3.4                      pypi_0    pypi
importlib-resources       6.0.1                    pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
kiwisolver                1.4.4                    pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1  
libffi                    3.4.4                h6a678d5_0  
libgcc-ng                 11.2.0               h1234567_1  
libgomp                   11.2.0               h1234567_1  
libstdcxx-ng              11.2.0               h1234567_1  
lit                       16.0.6                   pypi_0    pypi
matplotlib                3.7.2                    pypi_0    pypi
mpmath                    1.3.0                    pypi_0    pypi
msgpack                   1.0.5                    pypi_0    pypi
msgpack-numpy             0.4.8                    pypi_0    pypi
multimethod               1.9.1                    pypi_0    pypi
ncurses                   6.4                  h6a678d5_0  
numpy                     1.24.4                   pypi_0    pypi
nvidia-cublas-cu11        11.10.3.66               pypi_0    pypi
nvidia-cuda-cupti-cu11    11.7.101                 pypi_0    pypi
nvidia-cuda-nvrtc-cu11    11.7.99                  pypi_0    pypi
nvidia-cuda-runtime-cu11  11.7.99                  pypi_0    pypi
nvidia-cudnn-cu11         8.5.0.96                 pypi_0    pypi
nvidia-cufft-cu11         10.9.0.58                pypi_0    pypi
nvidia-curand-cu11        10.2.10.91               pypi_0    pypi
nvidia-cusolver-cu11      11.4.0.1                 pypi_0    pypi
nvidia-cusparse-cu11      11.7.4.91                pypi_0    pypi
nvidia-nccl-cu11          2.14.3                   pypi_0    pypi
nvidia-nvtx-cu11          11.7.91                  pypi_0    pypi
oauthlib                  3.2.2                    pypi_0    pypi
openssl                   3.0.10               h7f8727e_0  
packaging                 23.1                     pypi_0    pypi
pillow                    10.0.0                   pypi_0    pypi
pip                       23.2.1           py38h06a4308_0  
protobuf                  4.24.0                   pypi_0    pypi
psutil                    5.9.5                    pypi_0    pypi
pyjwt                     2.8.0                    pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
python                    3.8.17               h955ad1f_0  
pyyaml                    5.4.1                    pypi_0    pypi
readline                  8.2                  h5eee18b_0  
scipy                     1.10.1                   pypi_0    pypi
setuptools                68.0.0           py38h06a4308_0  
six                       1.16.0                   pypi_0    pypi
sqlite                    3.41.2               h5eee18b_0  
sympy                     1.12                     pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tensorboard               2.8.0                    pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboardx              2.6.2                    pypi_0    pypi
tensorpack                0.11                     pypi_0    pypi
tk                        8.6.12               h1ccaba5_0  
toml                      0.10.2                   pypi_0    pypi
torch                     2.0.1                    pypi_0    pypi
torchlight                1.0                       dev_0    <develop>
torchpack                 0.3.1                    pypi_0    pypi
torchvision               0.15.2                   pypi_0    pypi
tqdm                      4.66.1                   pypi_0    pypi
triton                    2.0.0                    pypi_0    pypi
urllib3                   1.26.16                  pypi_0    pypi
websocket-client          1.6.1                    pypi_0    pypi
werkzeug                  2.3.7                    pypi_0    pypi
wheel                     0.38.4           py38h06a4308_0  
xz                        5.4.2                h5eee18b_0  
zipp                      3.16.2                   pypi_0    pypi
zlib                      1.2.13               h5eee18b_0

Could you please lend me a hand? :)
Thanks in advance and great work!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.