This invention discloses a
traffic flow prediction method and
system based on
Transformer, belonging to the fields of intelligent transportation and
deep learning technology. Addressing the technical problems of existing
traffic flow prediction models, such as difficulty in simultaneously considering long-term and short-term dependencies, inability of static road
network topology to characterize dynamic
spatial heterogeneity, and poor modeling performance of spatiotemporal feature
coupling, this invention proposes a multi-timescale adaptive graph attention
Transformer model. This method first reconstructs the original traffic data at low, medium, and high time scales, and then aggregates spatiotemporal features through a temporal convolutional network and a compressed excitation network. Next, an adaptive
data graph generation module learns node embedding vectors to generate an adaptive
adjacency matrix that integrates static topology and dynamic associations. Finally, an
encoder incorporating temporal one-dimensional convolutional multi-head attention and
spatial graph attention, and a decoder integrating causal
convolution and temporally gated
convolution, are constructed to achieve high-precision multi-step prediction of
traffic flow. This invention effectively captures the spatiotemporal dependencies of traffic flow, with prediction accuracy and generalization superior to mainstream models, and can be widely applied to urban intelligent
traffic management, dynamic path planning, and
traffic congestion mitigation scenarios.