Modeling Temporal Dynamics and Spatial Configurations of Actions UsingTwo-Stream Recurrent Neural Networks
The Pytorch Implementation of 'Modeling Temporal Dynamics and Spatial Configurations of Actions UsingTwo-Stream Recurrent Neural Networks'
due to the limitation of time, we will only train on NTU RGB+D dataset . 25 joints are labeled for each person, and the original paper only have 20 joints for each skeleton, so the architecture of the two rnn have been modeified to fit the dataset. Check the code for details.
NTU RGB+D dataset | |
Model architecture |
Basically, there are 2x2 combination ways between the Spatial RNN and Temporal RNN, which are Chain + Stacked
, Traversal + Stacked
, Chain + Hierarchical
, Traversal + Hierarchical
. See codes down below in the model.py and you will know how to combine them
NTU-RGB-D
which consist of two subfiles namedxsub
and xview
. There are three .npy and .pkl files in each of them.data_path = "NTU-RGB-D/xview/val_data.npy"
label_path = "NTU-RGB-D/xview/val_label.pkl"
num_frame_path = "NTU-RGB-D/xview/val_num_frame.npy"
dataset = Feeder(data_path, label_path, num_frame_path,random_valid_choose=False,
random_shift=False,
random_move=False,
window_size=100,
normalization=True,
debug=False,
origin_transfer=False)
loader = torch.utils.data.DataLoader(
dataset=dataset,
batch_size=1,
shuffle=True,
num_workers=8, pin_memory=True)
data_path = "NTU-RGB-D/xview/val_data.npy"
label_path = "NTU-RGB-D/xview/val_label.pkl"
num_frame_path = "NTU-RGB-D/xview/val_num_frame.npy"
dataset = Feeder(data_path, label_path, num_frame_path,random_valid_choose=False,
random_shift=True,
random_move=True,
random_rotate=0.2,
window_size=100,
normalization=False,
debug=False,
origin_transfer=False)
loader = torch.utils.data.DataLoader(
dataset=dataset,
batch_size=1,
shuffle=True,
num_workers=8, pin_memory=True)
train.py
from line 35 to line 37, there are some basic Hyperparameters to modify. You can simply just use mine. And if you wanttrain.py
from line 84 to line 111, you can choose the different conbination of the two stream model. It will be easy to understand if you had checked the papertest.py
, you can change the path of the two checkpointstest.py
email me if you have any emergency issue