Git Product home page Git Product logo

act's Introduction

arXiv License: GPL v3

Action Transformer
A Self-Attention Model for Short-Time Human Action Recognition

AcT Summary

This repository contains the official TensorFlow implementation of the paper "Action Transformer: A Self-Attention Model for Short-Time Pose-Based Human Action Recognition".

Action Transformer (AcT), a simple, fully self-attentional architecture that consistently outperforms more elaborated networks that mix convolutional, recurrent and attentive layers. In order to limit computational and energy requests, building on previous human action recognition research, the proposed approach exploits 2D pose representations over small temporal windows, providing a low latency solution for accurate and effective real-time performance.

To do so, we open-source MPOSE2021, a new large-scale dataset, as an attempt to build a formal training and evaluation benchmark for real-time, short-time HAR. MPOSE2021 is developed as an evolution of the MPOSE Dataset [1-3]. It is made by human pose data detected by OpenPose [4] and Posenet [5] on popular datasets for HAR.

AcT Results

This repository allows to easily run a benchmark of AcT models using MPOSE2021, as well as executing a random hyperparameter search.

Usage

First, clone the repository and install the required pip packages (virtual environment recommended!).

pip install -r requirements.txt

To run a random search:

python main.py -s

To run a benchmark:

python main.py -b

That's it!

This code uses the mpose pip package, a friendly tool to download and process MPOSE2021 pose data.

You can download pretrained weights from here!

Citations

AcT is intended for scientific research purposes. If you want to use this repository for your research, please cite our work (Action Transformer: A Self-Attention Model for Short-Time Pose-Based Human Action Recognition) as well as [1-5].

@article{mazzia2021action,
  title={Action Transformer: A Self-Attention Model for Short-Time Pose-Based Human Action Recognition},
  author={Mazzia, Vittorio and Angarano, Simone and Salvetti, Francesco and Angelini, Federico and Chiaberge, Marcello},
  journal={Pattern Recognition},
  pages={108487},
  year={2021},
  publisher={Elsevier}
}

References

[1] Angelini, F., Fu, Z., Long, Y., Shao, L., & Naqvi, S. M. (2019). 2D Pose-Based Real-Time Human Action Recognition With Occlusion-Handling. IEEE Transactions on Multimedia, 22(6), 1433-1446.

[2] Angelini, F., Yan, J., & Naqvi, S. M. (2019, May). Privacy-preserving Online Human Behaviour Anomaly Detection Based on Body Movements and Objects Positions. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP) (pp. 8444-8448). IEEE.

[3] Angelini, F., & Naqvi, S. M. (2019, July). Joint RGB-Pose Based Human Action Recognition for Anomaly Detection Applications. In 2019 22th International Conference on Information Fusion (FUSION) (pp. 1-7). IEEE.

[4] Cao, Z., Hidalgo, G., Simon, T., Wei, S. E., & Sheikh, Y. (2019). OpenPose: Realtime Multi-Person 2D Pose Estimation Using Part Affinity Fields. IEEE transactions on pattern analysis and machine intelligence, 43(1), 172-186.

[5] Papandreou, G., Zhu, T., Chen, L. C., Gidaris, S., Tompson, J., & Murphy, K. (2018). Personlab: Person Pose Estimation and Instance Segmentation with a Bottom-Up, Part-Based, Geometric Embedding Model. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 269-286).

[6] Mazzia, V., Angarano, S., Salvetti, F., Angelini, F., & Chiaberge, M. (2021). Action Transformer: A Self-Attention Model for Short-Time Pose-Based Human Action Recognition. Pattern Recognition, 108487.

animated

act's People

Contributors

simoneangarano 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

Watchers

 avatar  avatar  avatar  avatar

act's Issues

Issue running posenet benchmark

Hi,

I tried running the benchmark for posenet which is giving the following error:

ValueError: Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 30, 68), found shape=(None, 30, 52)

Please let me know what I can do about this.

Thank you!

Using videos with different length

Hi!

I have been digging into your code and I still don't understand how you cope with videos that have a different duration for the training set. Could you give me some more information?

Thanks!

Requesting for the trained best model

Hi,

Thanks for your work on real-time human action recognition. I am trying to apply a HAR application on a mobile device.

My question is: Could you provide the trained best model to the public?

If so, we don't need to train a model and we can use the best model to make inferences directly. It will provide much convenience. Thank you.

POS_EMB

Hello, when I was looking at the config.yaml file, I saw that POS_EMB on line 54 was commented out. I wanted to know how the pos_emb.npy file was formed.

Velocity

Good job @simoneangarano and thank you.

I just wanted to ask how do you get velocity features from the openpose pose estimation? do you subtract x2-y2 to get the velocity?

And do you have an inference.py possible or pretrained model for the purpose of testing.

Thank you very much.

About work license

I'm wondering if the license of this implementation is GPLv3 like it says in the README or Apache as it is written in the code.

error: Microsoft Visual C++ 14.0 is required

I ran into an issue while installing requirements with numpy==1.20.3. Here is the message Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/.

I'm assuming that downloading visual studio would solve the issue. However, I installed the latest version of numpy (1.21.6) and it now works. Sharing this in case others run into the same problem.

Inference

Could you show me how to infer your pretrained with video?

About pretrained weights

Hi, I want to know where should I put those pretrained weights files, since I have not found the information in the config file.

error about running a random search

Sorry to bother you,

I tried running a random search, but it show error about ValueError: Input 0 is incompatible with layer model: expected shape=(None, 7, 52), found shape=(None, 30, 52)

Please let me know what I can do about this.

Thank you!

KeyError problem

Sorry to bother you, when I running this program,it show KeyError: 'openpose_legacy' . I check the file and it shows that the problem is in python3.7/site-packages/mpose/mpose.py", line 81, in set_data_config self.K = self.config['DATASET'][self.pose_extractor]['K']
I want to know how to solve it.
Thank you!

Tensorflow and keras dependencies not met.

Hey there!!
I was using python version 9.7.12 in anaconda env and even after installing the requirements.txt file i get the below error.
Any help is much appreciated!! Thanks!!
Traceback (most recent call last):
File "main.py", line 12, in
from utils.tools import read_yaml, Logger
File "C:\Users\Utkarsh.Singh\Documents\Utkarsh\PoseTracking\AcT\utils\tools.py", line 21, in
from tensorflow.keras.optimizers.schedules import LearningRateSchedule
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\api_v2\keras_init_.py", line 12, in
from keras import version
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras_init_.py", line 21, in
from keras import models
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\models_init_.py", line 18, in
from keras.engine.functional import Functional
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\engine\functional.py", line 26, in
from keras import backend
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\backend.py", line 34, in
from keras.engine import keras_tensor
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\engine\keras_tensor.py", line 19, in
from keras.utils import object_identity
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\utils_init_.py", line 48, in
from keras.utils.layer_utils import get_source_inputs
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\utils\layer_utils.py", line 26, in
from keras import initializers
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\initializers_init_.py", line 22, in
from keras.initializers import initializers_v2
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\initializers\initializers_v2.py", line 23, in
from keras.dtensor import utils
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\dtensor_init_.py", line 22, in
from tensorflow.compat.v2.experimental import dtensor as dtensor_api
ImportError: cannot import name 'dtensor' from 'tensorflow.compat.v2.experimental' (C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\tensorflow_api\v2\compat\v2\experimental_init_.py)

(act) C:\Users\Utkarsh.Singh\Documents\Utkarsh\PoseTracking\AcT>python main.py -b
Traceback (most recent call last):
File "main.py", line 12, in
from utils.tools import read_yaml, Logger
File "C:\Users\Utkarsh.Singh\Documents\Utkarsh\PoseTracking\AcT\utils\tools.py", line 21, in
from tensorflow.keras.optimizers.schedules import LearningRateSchedule
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\api_v2\keras_init_.py", line 12, in
from keras import version
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras_init_.py", line 21, in
from keras import models
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\models_init_.py", line 18, in
from keras.engine.functional import Functional
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\engine\functional.py", line 26, in
from keras import backend
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\backend.py", line 34, in
from keras.engine import keras_tensor
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\engine\keras_tensor.py", line 19, in
from keras.utils import object_identity
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\utils_init_.py", line 48, in
from keras.utils.layer_utils import get_source_inputs
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\utils\layer_utils.py", line 26, in
from keras import initializers
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\initializers_init_.py", line 22, in
from keras.initializers import initializers_v2
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\initializers\initializers_v2.py", line 23, in
from keras.dtensor import utils
File "C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\keras\dtensor_init_.py", line 22, in
from tensorflow.compat.v2.experimental import dtensor as dtensor_api
ImportError: cannot import name 'dtensor' from 'tensorflow.compat.v2.experimental' (C:\Users\Utkarsh.Singh\anaconda3\envs\act\lib\site-packages\tensorflow_api\v2\compat\v2\experimental_init_.py)

Trying to train the network on different seq length instead of 30

Hi,

I am trying to run the code using Frames : 18 instead of 30 and train the model.
I saw that it is also reading the config file under mpose/config.yaml and i changed there as well T: 18 , but still in mpose.py line 122 in function load_data i still get that the x_train and test are (12562, 30, 17, 3). how can i change it to be 18?

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.