The invention relates to the field of intelligent traffic, in particular to a
traffic flow prediction method fusing external
time information and context space information. The method comprises the following steps: firstly, preprocessing a plurality of similar
traffic flow data sets, and constructing a combined
training set and a
test set with uniform structures; inputting the merged data into a
time sequence feature embedding module, and generating embedded representation of fusion time and
traffic flow information; the embedded representation is input into a
Transformer model containing two
layers of encoders and decoders to be trained, and the model with the best performance on the merging
test set is selected to store
encoder parameters of the model; then, a space-time prediction model ST-SDNet is constructed; performing model optimization on each single
data set through a back propagation and
gradient descent algorithm; and finally, for each traffic flow
data set, performing traffic flow prediction by adopting an optimal model obtained by corresponding training. According to the method, the multi-source
time sequence features are effectively fused, and the accuracy and generalization ability of traffic flow prediction are improved.