Code for paper Decoupled Dynamic Spatial-Temporal Graph Neural Network for Traffic Forecasting

Overview

Decoupled Spatial-Temporal Graph Neural Networks

Code for our paper: Decoupled Dynamic Spatial-Temporal Graph Neural Network for Traffic Forecasting.

Traffic forecasting is an indispensable part of building intelligent transportation systems and has remained an enduring research topic in academia and industry. Recently, spatial-temporal (ST) graph neural networks have been proposed to model complex temporal and spatial dependencies in traffic data, and have made significant progress. However, existing models simply connect the spatial and temporal models in series, which ignores the special characteristics of spatial and temporal information. Moreover, the serial connection structure may cause error accumulation, leading to worse model performance.

To address the problem, we propose a novel spatial-temporal framework consisting of a unique spatial gate and a residual decomposition mechanism, which is capable of facilitating the sufficient learning process of downstream modules via decoupling spatial and temporal signals. With the decoupled ST framework, we also propose Decoupled Dynamic Spatial-Temporal Graph Neural Network (D$^2$STGNN in short), which aptly captures spatial-temporal dependencies and is enhanced by a dynamic graph learning module, for learning the dynamic characteristics of traffic networks. Extensive experiments on four real-world traffic datasets demonstrate the effectiveness of the proposed method.

1. Run the model and reproduce the result?

1.1 Data Preparation

For convenience, we package these datasets used in our model in Google Drive or BaiduYun.

They should be downloaded to the code root dir and replace the raw_data and sensor_graph folder in the datasets folder by:

cd /path/to/project
unzip raw_data.zip -d ./datasets/
unzip sensor_graph.zip -d ./datasets/
rm {sensor_graph.zip,raw_data.zip}
mkdir log output

Alterbatively, the datasets can be found as follows:

  • METR-LA and PEMS-BAY: These datasets were released by DCRNN[1]. Data can be found in its GitHub repository, where the sensor graphs are also provided.

  • PEMS03 and PEMS04: These datasets were released by ASTGCN[2] and ASTGNN[3]. Data can also be found in its GitHub repository.

1.2 Data Process

python datasets/raw_data/$DATASET_NAME/generate_training_data.py

Replace $DATASET_NAME with one of METR-LA, PEMS-BAY, PEMS04, PEMS08.

The processed data is placed in datasets/$DATASET_NAME.

1.3 Training the Model

python main.py --dataset=$DATASET_NAME

E.g., python main.py --dataset=METR-LA.

1.4 Load a Pretrained Model

Check the config files of the dataset in configs/$DATASET_NAME, and set the startup args to test mode.

Download the pre-trained model files into the output folder and run the command line in 1.3.

1.5 Results and Visualization

TheTable

Visualization

2. More QA?

Any issues are welcome.

3. To Do

  • Add results and visualization in this readme.
  • Add BaiduYun links.
  • Add pretrained model.
  • 添加中文README

References

[1] Atwood J, Towsley D. Diffusion-convolutional neural networks[J]. Advances in neural information processing systems, 2016, 29: 1993-2001.

[2] Guo S, Lin Y, Feng N, et al. Attention based spatial-temporal graph convolutional networks for traffic flow forecasting[C]//Proceedings of the AAAI Conference on Artificial Intelligence. 2019, 33(01): 922-929.

[3] Guo S, Lin Y, Wan H, et al. Learning dynamics and heterogeneity of spatial-temporal graph data for traffic forecasting[J]. IEEE Transactions on Knowledge and Data Engineering, 2021.

You might also like...
Temporal Dynamic Convolutional Neural Network for Text-Independent Speaker Verification and Phonemetic Analysis
Temporal Dynamic Convolutional Neural Network for Text-Independent Speaker Verification and Phonemetic Analysis

TDY-CNN for Text-Independent Speaker Verification Official implementation of Temporal Dynamic Convolutional Neural Network for Text-Independent Speake

Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch
Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch

disclaimer: this code is modified from pytorch-tutorial Image classification with synthetic gradient in Pytorch I implement the Decoupled Neural Inter

An implementation for the loss function proposed in Decoupled Contrastive Loss paper.

Decoupled-Contrastive-Learning This repository is an implementation for the loss function proposed in Decoupled Contrastive Loss paper. Requirements P

The project is an official implementation of our paper
The project is an official implementation of our paper "3D Human Pose Estimation with Spatial and Temporal Transformers".

3D Human Pose Estimation with Spatial and Temporal Transformers This repo is the official implementation for 3D Human Pose Estimation with Spatial and

DeepSTD: Mining Spatio-temporal Disturbances of Multiple Context Factors for Citywide Traffic Flow Prediction
DeepSTD: Mining Spatio-temporal Disturbances of Multiple Context Factors for Citywide Traffic Flow Prediction

DeepSTD: Mining Spatio-temporal Disturbances of Multiple Context Factors for Citywide Traffic Flow Prediction This is the implementation of DeepSTD in

Event-forecasting - Event Forecasting Algorithms With Python

event-forecasting Event Forecasting Algorithms Theory Correlating events in comp

Forecasting for knowable future events using Bayesian informative priors (forecasting with judgmental-adjustment).
Forecasting for knowable future events using Bayesian informative priors (forecasting with judgmental-adjustment).

What is judgyprophet? judgyprophet is a Bayesian forecasting algorithm based on Prophet, that enables forecasting while using information known by the

CVPR2021: Temporal Context Aggregation Network for Temporal Action Proposal Refinement
CVPR2021: Temporal Context Aggregation Network for Temporal Action Proposal Refinement

Temporal Context Aggregation Network - Pytorch This repo holds the pytorch-version codes of paper: "Temporal Context Aggregation Network for Temporal

The source code and data of the paper "Instance-wise Graph-based Framework for Multivariate Time Series Forecasting".

IGMTF The source code and data of the paper "Instance-wise Graph-based Framework for Multivariate Time Series Forecasting". Requirements The framework

Comments
  • How does

    How does "time_in_day_feat = self.T_i_D_emb[history_data[:, :, :, num_feat] * 288] " work?

    Dear Shao,

    I tried to reproduce your result with my own dataset, one thing bothered me is that the dimension of history_data of METR-LA is (batch_size,12,207,3),and the dimension of self.T_i_D_emb is (288,10). How does the code in my question work where the input data can be transferred to (batch_size,12,207,10)? I created random tensors in the console but failed to obtain the same result. Could you please give me some insight in it? Here is the reproduction code:

    import torch
    import torch.nn as nn
    
    history = torch.randn((16,12,207,3))
    T_i_D_emb = nn.Parameter(torch.empty(288,10))
    nn.init.xavier_uniform_(T_i_D_emb)
    T_i_D_emb[(history[:, :, :, 1] * 288).type(torch.LongTensor)]
    time_in_day_feat = T_i_D_emb[(history[:, :, :, 1] * 288).type(torch.LongTensor)] 
    

    error info: Traceback (most recent call last): File "/home/trp-mrta/anaconda3/envs/step_env/lib/python3.9/code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in IndexError: index 368 is out of bounds for dimension 0 with size 288

    The code wrote by you runs smoothly without any problem,but the version above failed.

    opened by addicter2017 4
  • The link to paper

    The link to paper

    Hi, We can notice that your D2STGNN obtains better performance from the Tables in Readme file. But, we did not find the paper link of D2STDNN. Can you share it with us?

    Best.

    opened by Lucky-Maximize 2
Owner
S22
实事求是
S22
Multivariate Time Series Forecasting with efficient Transformers. Code for the paper "Long-Range Transformers for Dynamic Spatiotemporal Forecasting."

Spacetimeformer Multivariate Forecasting This repository contains the code for the paper, "Long-Range Transformers for Dynamic Spatiotemporal Forecast

QData 440 Jan 2, 2023
Implementation of the paper NAST: Non-Autoregressive Spatial-Temporal Transformer for Time Series Forecasting.

Non-AR Spatial-Temporal Transformer Introduction Implementation of the paper NAST: Non-Autoregressive Spatial-Temporal Transformer for Time Series For

Chen Kai 66 Nov 28, 2022
Spectral Temporal Graph Neural Network (StemGNN in short) for Multivariate Time-series Forecasting

Spectral Temporal Graph Neural Network for Multivariate Time-series Forecasting This repository is the official implementation of Spectral Temporal Gr

Microsoft 306 Dec 29, 2022
The official implementation of the CVPR2021 paper: Decoupled Dynamic Filter Networks

Decoupled Dynamic Filter Networks This repo is the official implementation of CVPR2021 paper: "Decoupled Dynamic Filter Networks". Introduction DDF is

F.S.Fire 180 Dec 30, 2022
Cascaded Deep Video Deblurring Using Temporal Sharpness Prior and Non-local Spatial-Temporal Similarity

This repository is the official PyTorch implementation of Cascaded Deep Video Deblurring Using Temporal Sharpness Prior and Non-local Spatial-Temporal Similarity

hippopmonkey 4 Dec 11, 2022
Graph Self-Attention Network for Learning Spatial-Temporal Interaction Representation in Autonomous Driving

GSAN Introduction Code for paper GSAN: Graph Self-Attention Network for Learning Spatial-Temporal Interaction Representation in Autonomous Driving, wh

YE Luyao 6 Oct 27, 2022
This is the official Pytorch implementation of the paper "Diverse Motion Stylization for Multiple Style Domains via Spatial-Temporal Graph-Based Generative Model"

Diverse Motion Stylization (Official) This is the official Pytorch implementation of this paper. Diverse Motion Stylization for Multiple Style Domains

Soomin Park 28 Dec 16, 2022
Fake-user-agent-traffic-geneator - Python CLI Tool to generate fake traffic against URLs with configurable user-agents

Fake traffic generator for Gartner Demo Generate fake traffic to URLs with custo

New Relic Experimental 3 Oct 31, 2022
data/code repository of "C2F-FWN: Coarse-to-Fine Flow Warping Network for Spatial-Temporal Consistent Motion Transfer"

C2F-FWN data/code repository of "C2F-FWN: Coarse-to-Fine Flow Warping Network for Spatial-Temporal Consistent Motion Transfer" (https://arxiv.org/abs/

EKILI 46 Dec 14, 2022
Spatial Temporal Graph Convolutional Networks (ST-GCN) for Skeleton-Based Action Recognition in PyTorch

Reminder ST-GCN has transferred to MMSkeleton, and keep on developing as an flexible open source toolbox for skeleton-based human understanding. You a

sijie yan 1.1k Dec 25, 2022