A PyTorch implementation of the paper https://arxiv.org/abs/1709.04875
Spatio-Temporal Graph Convolutional Networks (STGCN), author's code repo: https://github.com/VeritasYin/STGCN_IJCAI-18.
PyTorch >= 1.1.0
DGL >= 0.4.3.post2
Other dependencies: Please refer to the code
Run with following to train STGCN
on the METR-LA dataset:
python train_stgcn.py
Run with following to train STGCN_WAVE
on the METR-LA dataset:
python train_stgcn_wave.py
As for layers:
TemporalConvLayer_Residual
is same as author's implementationSpatialConvLayer
is based on DGL's GCNOutputLayer
is same as author's implementation
As for network:
STGCN
has the same default structure of author's implementation withTSTN+TSTN+OutputLayer
, i.e. Two ST-blocks with the output layer. The main difference is thatSpatialConvLayer
has differentin_channel
andout_channel
, i.e.c_in
!=c_out
.STGCN_WAVE
is an improved variation ofSTGCN
where the main differences are:- Extra
TemporalConvLayer
andLayerNorm
at the beginning, the default structure isTN+TSTN+TSTN+OutputLayer
TemporalConvLayer
with increasing dilation like in TCN, i.e. 2, 4, 8, 16, etcSpatialConvLayer
does not change the channel size like in author's implementation, i.e.c_in
=c_out
- Extra
METR_LA: 34272 samples, 207 nodes, 5 mins sampling rate
PEMS-BAY: 52116 samples, 325 nodes, 5 mins sampling rate
STGCN paper default parameters: window = 12 (60 mins), horizon = 3, 6, 9 (15, 30, 45 mins), batch_size = 50, epoch = 50, lr = 0.001 with a decay rate of 0.7 after every 5 epochs, opt = RMSProp, temporal convolution kernel size = 3, graph convolution kernel size = 3, channels for the ST-Conv block are 64, 16, 64, dropout = 0.0
Our default parameters for STGCN
: window
= 12 (60 mins), horizon
= 3, 6, 9 (15, 30, 45 mins), batch_size
= 64, epoch
= 50, lr
= 0.001 with a decay rate
of 0.7 after every 5 epochs, opt
= Adam, Kt
= 3, ST-Conv block with the channels
= [64, 16, 64], dropout
= 0.3
STGCN
results on our default parameters (horizon
=3) are:
+------------------------------------------------------------+
| Input |
+------------------------------------------------------------+
| 1D Conv, in_channel = 1, out_channel = 64, dilation = 1 |
+------------------------------------------------------------+
| Graph Conv, in_channel = 64, out_channel = 16 |
+------------------------------------------------------------+
| 1D Conv, in_channel = 16, out_channel = 64, dilation = 1 |
+------------------------------------------------------------+
| Layer Normalization + Dropout |
+------------------------------------------------------------+
| 1D Conv, in_channel = 64, out_channel = 64, dilation = 1 |
+------------------------------------------------------------+
| Graph Conv, in_channel = 64, out_channel = 16 |
+------------------------------------------------------------+
| 1D Conv, in_channel = 16, out_channel = 64, dilation = 1 |
+------------------------------------------------------------+
| Layer Normalization + Dropout |
+------------------------------------------------------------+
| OutputLayer |
+------------------------------------------------------------+
METR-LA: ~ MAE: 4.70 | RMSE: 9.09
PEMS-BAY: Upcoming...
- Masked metrics calculation