# Spatio-Temporal Traffic Flow Prediction Based on Coordinated Attention

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- Using Graph Convolutional Network (GCN) and attention mechanism, a traffic flow prediction model applicable to the generalization of global road network is proposed. By coordinating the attention mechanism, the potential correlation properties existing between the temporal and spatial dimensions are considered to quantify the dynamic dependencies of different time segments at different checkpoints; the influence degree of different feature information in different spatial and temporal dimensions is clarified by combining the coordinate method;
- Fully consider the influencing factors of traffic flow and analyze the spatio-temporal characteristics of traffic flow from several features, and select the traffic flow, average speed, and average occupancy as the learning objects of the model. In addition, in order to improve the flexibility and efficiency of the model, on the one hand, the long-term dependencies of the spatio-temporal dimension are learned with the help of convolutional networks, the graph structure information based on the spatial dimension is aggregated using graph convolutional networks, and the long-term dynamic dependencies based on the temporal dimension are aggregated using regular convolution; on the other hand, the hard-swish activation function is introduced into the traffic flow prediction, so that the model the prediction accuracy is further improved;
- The validity of our model is verified on two real datasets, and the excellent prediction performance of the proposed model is demonstrated by comparing other traffic flow prediction models, both in short-time and long-time prediction.

## 2. Related Work

## 3. Methodology

#### 3.1. Problem Analysis and Definition

#### 3.1.1. Spatial and Temporal Characteristics of Traffic Flow

#### 3.1.2. Definition of Road Traffic Flow on the Graph

#### 3.2. Model Overview

#### 3.2.1. Graph Convolutional Network (GCN)

#### 3.2.2. Coordinated Attention

#### 3.2.3. Activation Function

## 4. Experiment

#### 4.1. Datasets

#### 4.2. Description of Evaluation Indicators and Parameter Settings

#### 4.2.1. Evaluation Indicators

#### 4.2.2. Parameter Setting

#### 4.3. Experimental Results and Analysis

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Zhu, J.; Easa, S.; Gao, K. Merging control strategies of connected and autonomous vehicles at freeway on-ramps: A comprehensive review. J. Intell. Connect. Veh.
**2022**, 5, 99–111. [Google Scholar] [CrossRef] - Peled, I.; Lee, K.; Jiang, Y.; Dauwels, J.; Pereira, F.C. On the quality requirements of demand prediction for dynamic public transport. Commun. Transp. Res.
**2021**, 1, 100008. [Google Scholar] [CrossRef] - Yu, B.; Yin, H.; Zhu, Z. Spatio-Temporal Graph Convolutional Networks: A Deep Learning Framework for Traffic Forecasting. arXiv
**2018**. [Google Scholar] [CrossRef] - Guo, S.; Lin, Y.; Feng, N.; Song, C.; Wan, H. Attention based spatial-temporal graph convolutional networks for traffic flow forecasting. In Proceedings of the AAAI Conference on Artificial Intelligence, Honolulu, HI, USA, 27 January–1 February 2019; pp. 922–929. [Google Scholar] [CrossRef] [Green Version]
- An, J.; Guo, L.; Liu, W.; Fu, Z.; Ren, P.; Liu, X.; Tao, L.A. IGAGCN: Information geometry and attention-based spatiotemporal graph convolutional networks for traffic flow prediction. Neural Netw.
**2021**, 143, 355–367. [Google Scholar] [CrossRef] [PubMed] - Cui, Z.; Zhang, J.; Noh, G.; Park, H.J. MFDGCN: Multi-Stage Spatio-Temporal Fusion Diffusion Graph Convolutional Network for Traffic Prediction. Appl. Sci.
**2022**, 12, 2688. [Google Scholar] [CrossRef] - Liu, Y.; Lyu, C.; Zhang, Y.; Liu, Z.; Yu, W.; Qu, X. DeepTSP: Deep traffic state prediction model based on large-scale empirical data. Commun. Transp. Res.
**2021**, 1, 100012. [Google Scholar] [CrossRef] - Ma, T.; Antoniou, C.; Toledo, T. Hybrid machine learning algorithm and statistical time series model for network-wide traffic forecast. Transp. Res. Part C Emerg. Technol.
**2020**, 111, 352–372. [Google Scholar] [CrossRef] - Ahmaed, M.S.; Cook, A.R. Analysis of Freeway Traffic Time-Series Data by Using Box-Jenkins Technique. Transp. Res. Rec.
**1979**, 773, 1–9. [Google Scholar] - Okutani, I.; Stephanedes, Y.J. Dynamic prediction of traffic volume through Kalman filtering theory. Transport. Res. B-Meth.
**1984**, 18, 1–11. [Google Scholar] [CrossRef] - Voort, M.; Dougherty, M.; Watson, S. Combining kohonen maps with arima time series models to forecast traffic flow. Transp. Res. Part C Emerg. Technol.
**1996**, 4, 307–318. [Google Scholar] [CrossRef] [Green Version] - Lee, S.; Fambro, D. Application of Subset Autoregressive Integrated Moving Average Model for Short-Term Freeway Traffic Volume Forecasting. Transp. Res. Record.
**1999**, 1678, 179–188. [Google Scholar] [CrossRef] - Williams, B.M.; Hoel, L.A. Modeling and Forecasting Vehicular Traffic Flow as a Seasonal ARIMA Process: Theoretical Basis and Empirical Results. J. Transp. Eng.
**2003**, 129, 664–672. [Google Scholar] [CrossRef] [Green Version] - Chang, H.; Lee, Y.; Yoon, B.; Baek, S. Dynamic near-term traffic flow prediction: System-oriented approach based on past experiences. IET Intell. Transp. Syst.
**2012**, 6, 292–305. [Google Scholar] [CrossRef] - Hu, W.; Yan, L.; Liu, K.; Wang, H. A Short-term Traffic Flow Forecasting Method Based on the Hybrid PSO-SVR. Neural Process. Lett.
**2016**, 43, 155–172. [Google Scholar] [CrossRef] - Ghanim, M.S.; Muley, D.; Kharbeche, M. ANN-Based traffic volume prediction models in response to COVID-19 imposed measures. Sust. Cities Soc.
**2022**, 81, 103830. [Google Scholar] [CrossRef] - Vythoulkas, P.C. Alternative approaches to short term traffic forecasting for use in driver information systems. In Proceedings of the Transportation and traffic theory proceedings of the 12th International Symposium on the Theory of Traffic Flow and Transportation, Berkeley, CA, USA, 21–23 July 1993; pp. 485–506. [Google Scholar]
- Du, W.; Zhang, Q.; Chen, Y.; Ye, Z. An Urban Short-term Traffic Flow Prediction Model Based on Wavelet Neural Network with Improved Whale Optimization Algorithm. Sust. Cities Soc.
**2021**, 69, 102858. [Google Scholar] [CrossRef] - Peng, Y.; Xiang, W.; Dawson, K.A.; Indekeu, J.O.; Stanley, H.E.; Tsallis, C. Short-term traffic volume prediction using GA-BP based on wavelet denoising and phase space reconstruction. Phys. A
**2020**, 549, 123913. [Google Scholar] [CrossRef] - Zou, Z.; Peng, H.; Liu, L.; Xiong, G.; Du, B.; Bhuiyan, M.Z.A.; Long, Y.; Li, D. Deep Convolutional Mesh RNN for Urban Traffic Passenger Flows Prediction. In Proceedings of the 2018 IEEE SmartWorld, Ubiquitous Intelligence & Computing, Advanced & Trusted Computing, Scalable Computing & Communications, Cloud & Big Data Computing, Internet of People and Smart City Innovation (SmartWorld/SCALCOM/UIC/ATC/CBDCom/IOP/SCI), Guangzhou, China, 8–12 October 2018; pp. 1305–1310. [Google Scholar]
- Zheng, Y.; Dong, C.; Dong, D.; Wang, S. Traffic Volume Prediction: A Fusion Deep Learning Model Considering Spatial–Temporal Correlation. Sustainability
**2021**, 13, 10595. [Google Scholar] [CrossRef] - Zhang, D.; Kabuka, M.R. Combining Weather Condition Data to Predict Traffific Flow: A GRU Based Deep Learning Approach. IET Intell. Transp. Syst.
**2018**, 12, 578–585. [Google Scholar] [CrossRef] - Lu, S.; Zhang, Q.; Chen, G.; Seng, D. A combined method for short-term traffic flow prediction based on recurrent neural network. Alex. Eng. J.
**2021**, 60, 87–94. [Google Scholar] [CrossRef] - Huang, H.; Chen, J.; Sun, R.; Wang, S. Short-term traffic prediction based on time series decomposition. Phys. A
**2022**, 585, 126441. [Google Scholar] [CrossRef] - Narmadha, S.; Vijayakumar, V. Spatio-Temporal vehicle traffic flow prediction using multivariate CNN and LSTM model. Mater. Today Proc.
**2021**, 4, 249. [Google Scholar] [CrossRef] - Zhao, W.; Gao, Y.; Ji, T.; Wan, X.; Ye, F.; Bai, G. Deep Temporal Convolutional Networks for Short-Term Traffic Flow Forecasting. IEEE Access
**2019**, 7, 114496–114507. [Google Scholar] [CrossRef] - Rempe, F.; Franeck, P.; Bogenberger, K. On the estimation of traffic speeds with Deep Convolutional Neural Networks given probe data. Transp. Res. Part C Emerg. Technol.
**2022**, 134, 103448. [Google Scholar] [CrossRef] - Zhang, J.; Zheng, Y.; Sun, J.; Qi, D. Flow Prediction in Spatio-Temporal Networks Based on Multitask Deep Learning. IEEE Trans. Knowl. Data Eng.
**2020**, 32, 468–478. [Google Scholar] [CrossRef] - Zhao, L.; Song, Y.; Zhang, C.; Liu, Y.; Li, H. T-GCN: A Temporal Graph Convolutional Network for Traffic Prediction. IEEE. Trans. Intell. Transp. Syst.
**2020**, 21, 3848–3858. [Google Scholar] [CrossRef] [Green Version] - Xu, Z.; Hou, L.; Zhang, Y.; Zhang, J. Passenger Flow Prediction of Scenic Spot Using a GCN–RNN Model. Sustainability
**2022**, 14, 3295. [Google Scholar] [CrossRef] - Lee, K.; Rhee, W. DDP-GCN: Multi-graph convolutional network for spatiotemporal traffic forecasting. Transp. Res. Part C Emerg. Technol.
**2022**, 134, 103466. [Google Scholar] [CrossRef] - Chen, D.; Yan, X.; Liu, X.; Wang, L.; Li, F.; Li, S. Multi-Task Fusion Deep Learning Model for Short-Term Intersection Operation Performance Forecasting. Remote Sens.
**2021**, 13, 1919. [Google Scholar] [CrossRef] - Deng, H.; Ergu, D.; Liu, F.; Cai, Y.; Ma, B. Text sentiment analysis of fusion model based on attention mechanism. Procedia Comput. Sci.
**2022**, 199, 741–748. [Google Scholar] [CrossRef] - Chen, Q.; Fan, J.; Chen, W. An improved image enhancement framework based on multiple attention mechanism. Displays
**2021**, 70, 102091. [Google Scholar] [CrossRef] - Han, S.; Shao, H.; Huo, Z.; Yang, X.; Cheng, J. End-to-end chiller fault diagnosis using fused attention mechanism and dynamic cross-entropy under imbalanced datasets. Build Environ.
**2022**, 212, 108821. [Google Scholar] [CrossRef] - Xu, M.; Dai, W.; Liu, C.; Gao, X.; Lin, W.; Qi, G.J.; Xiong, H. Spatial-Temporal Transformer Networks for Traffic Flow Forecasting. arXiv
**2020**. [Google Scholar] [CrossRef] - Zheng, C.; Fan, X.; Wang, C.; Qi, J. GMAN: A Graph Multi-Attention Network for Traffic Prediction. arXiv
**2019**. [Google Scholar] [CrossRef] - Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. arXiv
**2017**. [Google Scholar] [CrossRef] - Wu, Z.; Pan, S.; Chen, F.; Long, G.; Zhang, C.; Yu, P.S. A Comprehensive Survey on Graph Neural Networks. IEEE Trans. Neural Netw. Learn. Syst.
**2021**, 32, 4–24. [Google Scholar] [CrossRef] [Green Version] - Defferrard, M.; Bresson, X.; Vandergheynst, P. Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering. arXiv
**2016**. [Google Scholar] [CrossRef] - Hou, Q.; Zhou, D.; Feng, J. Coordinate Attention for Efficient Mobile Network Design. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Nashville, TN, USA, 20–25 June 2021; pp. 13708–13717. [Google Scholar] [CrossRef]
- Jie, H.; Li, S.; Gang, S.; Albanie, S. Squeeze-and-Excitation Networks. arXiv
**2017**. [Google Scholar] [CrossRef] - Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module. arXiv
**2018**. [Google Scholar] [CrossRef] - Ramachandran, P.; Zoph, B.; Le, Q.V. Swish: A Self-Gated Activation Function. arXiv
**2017**. [Google Scholar] [CrossRef] - Howard, A.; Sandler, M.; Chu, G.; Chen, L.C.; Chen, B.; Tan, M.; Wang, W.; Zhu, Y.; Pang, R.; Vasudevan, V.; et al. Searching for MobileNetV3. arXiv
**2019**. [Google Scholar] [CrossRef] - Zhang, C.; Zhou, H.-Y.; Qiu, Q.; Jian, Z.; Zhu, D.; Cheng, C.; He, L.; Liu, G.; Wen, X.; Hu, R. Augmented Multi-Component Recurrent Graph Convolutional Network for Traffic Flow Forecasting. ISPRS Int. J. Geo-Inf.
**2022**, 11, 88. [Google Scholar] [CrossRef]

**Figure 2.**Spatial and temporal characteristics analysis of traffic flow: (

**a**) Daily traffic flow variation diagram; (

**b**) traffic flow variation diagram at different detection points, (

**c**) spatial relationship diagram of average speed; (

**d**) spatial relationship diagram of average occupancy.

**Figure 3.**(

**a**) Representation of the topology of road information involving the temporal dimension; (

**b**) is a CVSTGCN model framework consisting of multiple attentional spatio-temporal modules. The input of the model is the spatio-temporal information of the first T time steps, where $\stackrel{\u2322}{Y}$ is the output result of the model training, which is used to measure the model performance; (

**c**) is the internal structure of a CVSTGCN layer. Temporal Convolution is composed of 1D convolution is used for interaction learning of temporal information.

**Figure 6.**Comparison of model prediction error distributions: (

**a**) MAE values of the prediction models; (

**b**) RMSE values of the prediction models.

**Figure 7.**Plot of predicted versus true values: (

**a**) Prediction results for a prediction time step of 30 min; (

**b**) prediction results for a prediction time step of 60 min.

**Table 1.**Comparison of the prediction performance of different models on the PEME04 datasets (Some of the data results in the table are referenced from the literature [46]).

Pems04 | ||||||
---|---|---|---|---|---|---|

Model | 15 min | 30 min | 60 min | |||

MAE | RMSE | MAE | RMSE | MAE | RMSE | |

HA | 28.88 | 45.40 | 30.40 | 46.96 | 35.59 | 53.20 |

ARIMA | 33.71 | 36.91 | 41.36 | 46.65 | 47.74 | 52.32 |

GRU | 22.86 | 35.07 | 24.73 | 37.23 | 27.10 | 40.08 |

LSTM | 23.31 | 35.75 | 24.17 | 36.53 | 26.96 | 39.86 |

MSTGCN (1d) | 20.78 | 32.25 | 23.45 | 35.80 | 29.50 | 43.48 |

ASTGCN (1d) | 20.26 | 31.98 | 22.12 | 34.75 | 26.70 | 40.93 |

CVSTGCN (k = 3) | 19.53 | 31.02 | 20.99 | 33.28 | 24.61 | 38.5 |

**Table 2.**Comparison of the prediction performance of different models on the PEME08 datasets (Some of the data results in the table are referenced from the literature [46]).

Pems08 | ||||||
---|---|---|---|---|---|---|

Model | 15 min | 30 min | 60 min | |||

MAE | RMSE | MAE | RMSE | MAE | RMSE | |

HA | 23.15 | 40.14 | 24.64 | 41.49 | 29.20 | 46.37 |

ARIMA | 27.77 | 28.96 | 29.59 | 30.38 | 44.25 | 48.33 |

GRU | 19.50 | 28.03 | 20.52 | 29.44 | 22.82 | 32.51 |

LSTM | 19.18 | 27.64 | 20.37 | 29.08 | 22.92 | 32.80 |

MSTGCN (1d) | 16.57 | 25.18 | 18.52 | 28.22 | 22.87 | 34.13 |

ASTGCN (1d) | 16.11 | 25.01 | 18.18 | 28.10 | 22.05 | 33.42 |

CVSTGCN (k = 3) | 15.74 | 24.45 | 17.12 | 26.58 | 19.98 | 30.57 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Li, M.; Li, M.; Liu, B.; Liu, J.; Liu, Z.; Luo, D.
Spatio-Temporal Traffic Flow Prediction Based on Coordinated Attention. *Sustainability* **2022**, *14*, 7394.
https://doi.org/10.3390/su14127394

**AMA Style**

Li M, Li M, Liu B, Liu J, Liu Z, Luo D.
Spatio-Temporal Traffic Flow Prediction Based on Coordinated Attention. *Sustainability*. 2022; 14(12):7394.
https://doi.org/10.3390/su14127394

**Chicago/Turabian Style**

Li, Min, Mengshan Li, Bilong Liu, Jiang Liu, Zhen Liu, and Dijia Luo.
2022. "Spatio-Temporal Traffic Flow Prediction Based on Coordinated Attention" *Sustainability* 14, no. 12: 7394.
https://doi.org/10.3390/su14127394