Traffic pattern recognition method and system based on global and local spatio-temporal feature fusion

By using a traffic pattern recognition method that integrates global and local spatiotemporal features, and utilizing GPS trajectory data, a spatiotemporal feature extraction block consisting of a bidirectional gated recurrent unit and a densely connected network is designed. Combined with a temporal convolutional network and an attention mechanism, this method solves the problems of feature selection relying on manual intervention and insufficient integration of spatiotemporal features in existing methods, and achieves fine-grained recognition and high-precision differentiation of traffic patterns.

CN116595410BActive Publication Date: 2026-06-05ZHEJIANG UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV OF TECH
Filing Date
2023-04-20
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing traffic pattern recognition methods rely on manual feature selection, cannot automatically locate important features, and fail to fully integrate global and local spatiotemporal features, resulting in poor performance in recognizing similar traffic patterns.

Method used

A traffic pattern recognition method based on the fusion of global and local spatiotemporal features is adopted. Using GPS trajectory data, a spatiotemporal feature extraction block with bidirectional gated recurrent units and densely connected networks is designed. Combined with temporal convolutional networks and attention mechanisms, global and local spatiotemporal features are automatically extracted and fused.

Benefits of technology

It achieves fine-grained recognition of traffic modes, improves recognition accuracy and robustness, and can effectively distinguish similar traffic modes, such as cars and taxis, trains and subways.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116595410B_ABST
    Figure CN116595410B_ABST
Patent Text Reader

Abstract

The traffic mode recognition method based on fusion of global and local spatiotemporal features comprises the following steps: (1) segmenting the original GPS trajectory data; (2) calculating seven kinematic features of each GPS trajectory point; (3) pre-processing the segmented GPS trajectory data; (4) constructing a traffic mode recognition model; the model comprises a spatiotemporal feature extraction block, a time domain convolution network and an attention mechanism, wherein the spatiotemporal feature extraction block can extract local spatiotemporal features, the time domain convolution network can extract global spatiotemporal features, and the attention mechanism can realize fusion and feature reconstruction of the global and local spatiotemporal features; (5) splitting the data obtained in step (3) to generate a training data set and a test data set, and training the traffic mode recognition model; (6) calculating various evaluation indexes according to the recognition result of step (5); (7) visually displaying the recognition result and the evaluation indexes of the model. The application also comprises a system for implementing the traffic mode recognition method based on fusion of global and local spatiotemporal features. The application improves the traffic model recognition precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a traffic pattern recognition method and system for intelligent transportation, which can identify a user's traffic patterns based on their GPS trajectory. The traffic pattern recognition method of this invention can be used in traffic planning, user movement characteristic analysis, traffic demand forecasting, and management decision-making. Background Technology

[0002] Traffic pattern recognition is a crucial component of intelligent transportation systems. Determining user travel patterns can solve problems in various transportation-related fields, including traffic congestion, traffic demand analysis, vehicle owner analysis, and traffic emissions analysis. For example, when users travel, numerous reasonable travel suggestions and plans can be provided based on urban road traffic patterns. Shared bicycle systems and taxis play a key role in transportation, and understanding their travel patterns is essential for traffic demand analysis and sustainable transportation planning. Currently, many scholars have proposed inferring user traffic patterns based on various sensors, such as mobile phone accelerometers, gyroscopes, and magnetometers. However, mining user traffic patterns from GPS data is a more effective method. It not only contains rich spatiotemporal information about human activity but can also be easily collected via smartphones without relying on other sensors.

[0003] There are three main categories of methods for user traffic pattern recognition based on GPS trajectories. The first category is based on classic machine learning methods, such as decision trees, random forests, and support vector machines. These methods rely on human experience and cannot handle the complexities of real-world traffic environments. Furthermore, these methods are suitable for small datasets, but become time-consuming and produce poor fits on large datasets. The second category is based on statistical methods, such as ensemble classifiers and Markov models. These methods can lead to some models relying on the location coordinates of specific locations, such as bus stops and parking lots, making them unsuitable for general use. The third category is based on deep learning methods, primarily convolutional neural networks (CNNs) and recurrent neural networks (RNNs). CNNs can extract spatial features, while RNNs can extract temporal features. They do not rely on domain-specific knowledge and can automatically extract relevant features from the data for learning. These methods are suitable for large datasets and have good fits. However, they also present several challenges in traffic pattern recognition applications. Some neural network models cannot achieve refined recognition of similar traffic patterns, such as taxis and cars, or trains and subways, whose traffic behaviors are similar and difficult to distinguish. Meanwhile, most neural network models do not make full use of the spatiotemporal features of trajectory data, only considering temporal or spatial features. Although a few models extract both features at the same time, they only involve global or local spatiotemporal features and do not consider both global and local spatiotemporal features at the same time, resulting in limited recognition performance.

[0004] Currently, existing traffic pattern recognition methods have the following main problems: 1) Most methods rely on manual feature selection, which cannot input all available features into the model so that the model can automatically locate important features; 2) Some methods only consider temporal or spatial features, or only consider global or local spatiotemporal features, without fully integrating the global and local aspects of spatiotemporal features; 3) Most methods do not identify traffic patterns in a fine-grained manner and cannot effectively identify traffic patterns with similar traffic behaviors. Summary of the Invention

[0005] The present invention aims to overcome the above-mentioned shortcomings of the prior art and provides a traffic pattern recognition method and system based on the fusion of global and local spatiotemporal features. By collecting user trajectory data through GPS devices and inputting it into the model of the present invention, the user's traffic patterns can be identified in a fine-grained manner, and it has good universality and robustness.

[0006] This invention, based on GPS trajectory data, designs a spatiotemporal feature extraction block composed of a bidirectional gated recurrent unit and a densely connected network. The model, consisting of the spatiotemporal feature extraction block, a temporal convolutional network, and an attention mechanism, realizes the entire traffic pattern recognition system. The model extracts seven kinematic features from the original GPS trajectory, and uses the temporal convolutional network and the spatiotemporal feature extraction block to extract global and local spatiotemporal features from these seven kinematic features. Furthermore, an attention mechanism is employed to fuse and reconstruct the global and local spatiotemporal features, thereby achieving fine-grained recognition of traffic patterns. Applying the method described in this invention, automated recognition of seven traffic modes—walking, cycling, bus, car, taxi, subway, and train—can be achieved based on GPS trajectory data. This invention integrates global and local spatiotemporal features, not only improving the accuracy of traffic pattern recognition but also enabling fine-grained recognition of similar traffic patterns. It is unaffected by environmental conditions and possesses good universality and robustness.

[0007] This invention achieves the above objectives through the following technical solution: a traffic pattern recognition method based on the fusion of global and local spatiotemporal features, the specific implementation steps of which are as follows:

[0008] (1) Trajectory segmentation. The original GPS trajectory data consists of a series of GPS trajectory points. Trajectory segmentation is to divide all GPS trajectory points into multiple GPS segments. Each segment has only one traffic model and the segment length is fixed.

[0009] (2) Feature Calculation. Seven kinematic features of each GPS trajectory point are calculated, including relative distance, time interval, velocity, relative velocity, acceleration, jerk, and azimuth change angle. The specific calculation method is as follows:

[0010]

[0011]

[0012]

[0013]

[0014]

[0015]

[0016]

[0017] Where x1 = (lat1, lon1, t1) and x2 = (lat2, lon2, t2) are two adjacent GPS track points, including latitude, longitude, and timestamp. The Vincenty formula, based on an ellipsoidal Earth model, is used to calculate the relative distance RD between each GPS track point. x Δt x It is a time interval. V x It's about speed. RV x It is relative velocity. Acc x It's acceleration. J x It's accelerator. x It is the azimuth change angle. x It is the azimuth angle, and its calculation method is as follows:

[0018] y= sin(x2[lon2]-x1[lon1])*cos(x2[lat2]) (8)

[0019] x= cos(x1[lat1])*sin(x2(lat2))-sin(x1[lat1])*cos(x2[lat2])*cos(x2[lon2]-x1[lon1]) (9)

[0020]

[0021] Where arctan(.) is the arctangent trigonometric function, π is the mathematical constant pi, and mod is the remainder operation. Through the calculations from (1) to (10), the GPS trajectory points can be represented as:

[0022] x i [RD i ,Δt i V i RV i Acc i J i ,BR i (11)

[0023] (3) Data preprocessing. The segmented GPS trajectory data is preprocessed. Thresholding method is used to design velocity and acceleration thresholds to remove abnormal GPS trajectory points; segments with few GPS trajectory points are deleted; segments with small sums of relative distances are deleted; segments with small sums of time intervals are deleted; for GPS segments with insufficient length, zero-value padding is used to make each GPS segment the same length; the Min-Max method is used to normalize the seven kinematic features of all GPS trajectory points so that the feature range is mapped to between 0 and 1.

[0024] (4) Constructing a traffic pattern recognition model. The traffic pattern recognition model consists of a spatiotemporal feature extraction block, a temporal convolutional network, and an attention mechanism. The spatiotemporal feature extraction block is composed of two parts: a bidirectional gated recurrent unit and a densely connected network, used to acquire local spatiotemporal features. The bidirectional gated recurrent unit can capture temporal features, and the densely connected network can capture spatial features. The temporal convolutional network is composed of three parts: causal convolution, dilated convolution, and residual connections, used to capture global spatiotemporal features. The attention mechanism includes two attention blocks, which realize the fusion and feature reconstruction of global and local spatiotemporal features at the channel level and the spatial level, respectively.

[0025] The input-output change process of the gated loop unit is as follows:

[0026]

[0027]

[0028]

[0029]

[0030] in, These are the kinematic characteristics of the GPS trajectory points at time t after normalization. and It is the coefficient matrix, R t , is the output of the reset gate and update gate, h is the number of hidden neurons, σ(·) represents the sigmoid activation function, tanh(·) is the hyperbolic tangent activation function, and ⊙ represents the matrix element-wise multiplication operation. It is a candidate hidden state, used to generate the true hidden state, H. t-1 and These are the outputs of the previous and current hidden states, respectively.

[0031] The input-output change process of the bidirectional gated loop unit is as follows:

[0032]

[0033]

[0034]

[0035] H = [H1,H2,…,H] n (19)

[0036] in, This represents the hidden unit outputs of the time steps preceding and following time step t, which are concatenated after passing through a gated recurrent unit. yes and The hidden state at time t after connection It is all H t The splicing result is given by n, where n is the length of the segment, i.e., the number of GPS points.

[0037] The input-output change process of a densely connected network is as follows:

[0038]

[0039]

[0040]

[0041]

[0042]

[0043] LF=u9 (25)

[0044] in, This is the result of the convolution operation, where u is the growth rate, representing how much information the current layer adds to the next layer in a dense network. This is the output connection of the previous layer. [u0,u1,u2,u3] is the connection body between u0, u1, u2, and u3. This represents the local spatial features captured after passing through a dense network layer. s It's a convolution operation. and These are convolutional kernels of sizes 7, 3, and 1, respectively. ReLU(.) is the activation function, BN(.) is the batch normalization operation, E(·) is the mean, σ is the standard deviation, ε is a very small real number used to prevent numerical instability, and γ and These are the learning parameters, j∈[1,4]. It is the output of the transition layer. This is the output connection of the previous layer. [u5,u6,u7,u8] is the connection body between u5, u6, u7, and u8. This is the output feature of the second dense connection, where AP(·) is average pooling. This represents the final captured local spatiotemporal features.

[0045] The input-output transformation process of a temporal convolutional network is as follows:

[0046]

[0047]

[0048]

[0049]

[0050] in, This represents the normalized kinematic characteristics of GPS. These are convolutional kernels of sizes 2 and 1. d Let represent dilated convolution, d represent the dilation coefficient, and DP represent random deactivation. This indicates the output of the first block, where l represents the number of output channels. This represents the result of the residual connection. This is the output of the second block. This represents the global spatiotemporal features captured by the temporal convolutional network.

[0051] The input-output change process of the attention mechanism is as follows:

[0052] F = [GF, LF] (30)

[0053] F1=σ(W1(W0(GAP(F)))+W1(W0(GMP(F)))) (31)

[0054] F2=F*F1 (32)

[0055]

[0056] F4 = F2 * F3 (34)

[0057] in, It integrates global and local spatiotemporal features, where c is the number of channels fused, GMP(.) is global max pooling, and GAP(.) is global average pooling. and This is the coefficient matrix of the multilayer perceptron, where r is the dimensionality reduction rate. It is a channel weight coefficient that has undergone the channel attention mechanism. It is the result of the channel weight coefficient F1 acting on F. It is a convolutional kernel of size 7, and MP(.) is max pooling. These are spatial weight coefficients processed through a spatial attention mechanism. This is the result of the spatial weight coefficient F3 applied to F2. First, the fused spatiotemporal features F are processed through GAP and GMP, then summed using two MLPs, and finally the sigmoid function is used to obtain the normalized channel attention weight value F1. F1 is applied to the spatiotemporal features F to form F2. Next, F2 is fused with channel information through MP and AP, then superimposed, followed by convolution. The sigmoid function is used to obtain the normalized spatial attention weight value F3, which is applied to F2 to form F4 as the output of the attention mechanism. Finally, F4 is passed through a fully connected layer (FC) to output the final result.

[0058] The traffic pattern recognition model is trained using the Adam optimizer and updates parameters using the gradient descent algorithm. The model's loss function is the cross-entropy loss function, as follows:

[0059]

[0060] in, This is the final recognition result of the model; class represents the category of the real traffic pattern. It is the model's recognition value for the current class. It is the cumulative value of the model's identification values ​​for all traffic mode categories.

[0061] (5) Generate datasets and train models. Split the data obtained in step (3) to generate training and testing datasets, and train the traffic pattern recognition model.

[0062] (6) Calculate evaluation indicators. Based on the traffic pattern recognition results in step (5), calculate the corresponding evaluation indicators such as precision, recall, accuracy and F1 score to measure the recognition effect and performance of the model.

[0063] (7) Display the results. Visualize the traffic pattern recognition results obtained in step (5) and the evaluation index results obtained in step (6) using line charts, bar charts, etc.

[0064] Preferably, in step (4), the number of hidden neurons h = 32 and the dimensionality reduction rate r = 16.

[0065] Preferably, in step (5), the dataset is split in an 8:2 ratio to generate a training dataset and a test dataset.

[0066] A system implementing the traffic pattern recognition method based on global and local spatiotemporal feature fusion of the present invention includes, in sequence, a trajectory segmentation module, a feature calculation module, a data preprocessing module, a traffic pattern recognition model module, a dataset generation and model training module, an evaluation index calculation module, and a result display module.

[0067] The trajectory segmentation module segments the original GPS trajectory data, dividing all GPS trajectory points into multiple GPS segments. Each segment has only one traffic model, and the segment length is fixed.

[0068] The feature calculation module calculates seven kinematic features for each GPS track point, including relative distance, time interval, velocity, relative velocity, acceleration, jerk, and azimuth change angle.

[0069] The data preprocessing module performs data preprocessing on the segmented GPS trajectory data, including abnormal trajectory point deletion, abnormal segment deletion, zero value filling, and normalization.

[0070] The traffic pattern recognition model module consists of a spatiotemporal feature extraction block, a temporal convolutional network, and an attention mechanism. The spatiotemporal feature extraction block is composed of two parts: a bidirectional gated recurrent unit and a densely connected network, used to acquire local spatiotemporal features. The bidirectional gated recurrent unit can capture temporal features, and the densely connected network can capture spatial features. The temporal convolutional network is composed of three parts: causal convolution, dilated convolution, and residual connections, used to capture global spatiotemporal features. The attention mechanism includes two attention blocks, which realize the fusion and feature reconstruction of global and local spatiotemporal features at the channel level and the spatial level, respectively.

[0071] The dataset generation and model training module splits the data obtained from the data preprocessing module to generate training and test datasets, and trains the traffic pattern recognition model.

[0072] The evaluation metric calculation module calculates corresponding evaluation metrics such as precision, recall, accuracy, and F1 score based on the recognition results of the dataset generation and model training modules, in order to measure the recognition effect and performance of the model.

[0073] The results display module visualizes the traffic pattern recognition results obtained by the dataset generation and model training modules and the evaluation index results obtained by the evaluation index calculation module through line charts, bar charts, and other methods.

[0074] The beneficial effects of the present invention are as follows: (1) The present invention not only considers temporal and spatial features, but also global and local features, and adopts the method of integrating global spatiotemporal features and local spatiotemporal features to improve the recognition effect of traffic patterns; (2) The present invention eliminates the manual feature selection method, inputs all kinematic features related to the trajectory into the neural network, and realizes the automatic selection of key features through the attention mechanism; (3) The present invention has a good recognition effect on similar traffic patterns, such as cars and taxis, trains and subways. Attached Figure Description

[0075] Figure 1 This is a structural diagram of the traffic pattern recognition model of the present invention.

[0076] Figure 2 This is a diagram of the temporal convolutional network structure of the present invention.

[0077] Figure 3 This is a structural diagram of the spatiotemporal feature extraction block of the present invention.

[0078] Figure 4 This is a structural diagram of the attention mechanism of the present invention.

[0079] Figure 5 This is a system functional block diagram of the present invention. Detailed Implementation

[0080] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0081] The traffic pattern recognition method based on the fusion of global and local spatiotemporal features of the present invention has the following specific implementation steps:

[0082] (1) Trajectory segmentation. The original GPS trajectory data consists of a series of GPS trajectory points. Trajectory segmentation is to divide all GPS trajectory points into multiple GPS segments. Each segment has only one traffic model and the segment length is fixed.

[0083] (2) Feature Calculation. Seven kinematic features of each GPS trajectory point are calculated, including relative distance, time interval, velocity, relative velocity, acceleration, jerk, and azimuth change angle. The specific calculation method is as follows:

[0084]

[0085]

[0086]

[0087]

[0088]

[0089]

[0090]

[0091] Where x1 = (lat1, lon1, t1) and x2 = (lat2, lon2, t2) are two adjacent GPS track points, including latitude, longitude, and timestamp. The Vincenty formula, based on an ellipsoidal Earth model, is used to calculate the relative distance RD between each GPS track point. x Δt x It is a time interval. V x It's about speed. RV x It is relative velocity. Acc x It's acceleration. J x It's accelerator. x It is the azimuth change angle. x It is the azimuth angle, and its calculation method is as follows:

[0092] y=sin(x2[lon2]-x1[lon1])*cos(x2[lat2]) (8)

[0093] x=cos(x1[lat1])*sin(x2(lat2))-sin(x1[lat1])*cos(x2[lat2])*cos(x2[lon2]-x1[lon1])(9)

[0094]

[0095] Where arctan(.) is the arctangent trigonometric function, π is the mathematical constant pi, and mod is the remainder operation. Through the calculations from (1) to (10), the GPS trajectory points can be represented as:

[0096] x i [RD i ,Δt i V i RV i Acc i J i ,BR i (11)

[0097] (3) Data preprocessing. The segmented GPS trajectory data is preprocessed. Thresholding method is used to design velocity and acceleration thresholds to remove abnormal GPS trajectory points; segments with few GPS trajectory points are deleted; segments with small sums of relative distances are deleted; segments with small sums of time intervals are deleted; for GPS segments with insufficient length, zero-value padding is used to make each GPS segment the same length; the Min-Max method is used to normalize the seven kinematic features of all GPS trajectory points so that the feature range is mapped to between 0 and 1.

[0098] (4) Constructing a traffic pattern recognition model. The traffic pattern recognition model consists of a spatiotemporal feature extraction block, a temporal convolutional network, and an attention mechanism. The spatiotemporal feature extraction block is composed of two parts: a bidirectional gated recurrent unit and a densely connected network, used to acquire local spatiotemporal features. The bidirectional gated recurrent unit can capture temporal features, and the densely connected network can capture spatial features. The temporal convolutional network is composed of three parts: causal convolution, dilated convolution, and residual connections, used to capture global spatiotemporal features. The attention mechanism includes two attention blocks, which realize the fusion and feature reconstruction of global and local spatiotemporal features at the channel level and the spatial level, respectively.

[0099] The input-output change process of the gated loop unit is as follows:

[0100]

[0101]

[0102]

[0103]

[0104] in, These are the kinematic characteristics of the GPS trajectory points at time t after normalization. and It is the coefficient matrix, R t , is the output of the reset gate and update gate, h is the number of hidden neurons (generally h = 32), σ(·) represents the sigmoid activation function, tanh(·) is the hyperbolic tangent activation function, and ⊙ represents the matrix element-wise multiplication operation. It is a candidate hidden state, used to generate the true hidden state, H. t-1 and These are the outputs of the previous and current hidden states, respectively.

[0105] The input-output change process of the bidirectional gated loop unit is as follows:

[0106]

[0107]

[0108]

[0109] H = [H1,H2,…,H] n (19)

[0110] in, This represents the hidden unit outputs of the time steps preceding and following time step t, which are concatenated after passing through a gated recurrent unit. yes and The hidden state at time t after connection It is all H t The splicing result is given by n, where n is the length of the segment, i.e., the number of GPS points.

[0111] The input-output change process of a densely connected network is as follows:

[0112]

[0113]

[0114]

[0115]

[0116]

[0117] LF=u9 (25)

[0118] in, This is the result of the convolution operation, where u is the growth rate, representing how much information the current layer adds to the next layer in a dense network. This is the output connection of the previous layer. [u0,u1,u2,u3] is the connection body between u0, u1, u2, and u3. This represents the local spatial features captured after passing through a dense network layer. s It's a convolution operation. and These are convolutional kernels of sizes 7, 3, and 1, respectively. ReLU(.) is the activation function, BN(.) is the batch normalization operation, E(·) is the mean, σ is the standard deviation, ε is a very small real number used to prevent numerical instability, and γ and These are the learning parameters, j∈[1,4]. It is the output of the transition layer. This is the output connection of the previous layer. [u5,u6,u7,u8] is the connection body between u5, u6, u7, and u8. This is the output feature of the second dense connection, where AP(·) is average pooling. This represents the final captured local spatiotemporal features.

[0119] The input-output transformation process of a temporal convolutional network is as follows:

[0120]

[0121]

[0122]

[0123]

[0124] in, This represents the normalized kinematic characteristics of GPS. These are convolutional kernels of sizes 2 and 1. d Let represent dilated convolution, d represent the dilation coefficient, and DP represent random deactivation. This indicates the output of the first block, where l represents the number of output channels. This represents the result of the residual connection. This is the output of the second block. This represents the global spatiotemporal features captured by the temporal convolutional network.

[0125] The input-output change process of the attention mechanism is as follows:

[0126] F = [GF, LF] (30)

[0127] F1=σ(W1(W0(GAP(F)))+W1(W0(GMP(F)))) (31)

[0128] F2=F*F1 (32)

[0129]

[0130] F4 = F2 * F3 (34)

[0131] in, It integrates global and local spatiotemporal features, where c is the number of channels fused, GMP(.) is global max pooling, and GAP(.) is global average pooling. and This is the coefficient matrix of the multilayer perceptron, where r is the dimensionality reduction rate, typically r = 16. It is a channel weight coefficient that has undergone the channel attention mechanism. It is the result of the channel weight coefficient F1 acting on F. It is a convolutional kernel of size 7, and MP(.) is max pooling. These are spatial weight coefficients processed through a spatial attention mechanism. This is the result of the spatial weight coefficient F3 applied to F2. First, the fused spatiotemporal features F are processed through GAP and GMP, then summed using two MLPs, and finally the sigmoid function is used to obtain the normalized channel attention weight value F1. F1 is applied to the spatiotemporal features F to form F2. Next, F2 is fused with channel information through MP and AP, then superimposed, followed by convolution. The sigmoid function is used to obtain the normalized spatial attention weight value F3, which is applied to F2 to form F4 as the output of the attention mechanism. Finally, F4 is passed through a fully connected layer (FC) to output the final result.

[0132] The traffic pattern recognition model is trained using the Adam optimizer and updates parameters using the gradient descent algorithm. The model's loss function is the cross-entropy loss function, as follows:

[0133]

[0134] in, This is the final recognition result of the model; class represents the category of the real traffic pattern. It is the model's recognition value for the current class. It is the cumulative value of the model's identification values ​​for all traffic mode categories.

[0135] (5) Generate dataset and train model. Based on the data obtained in step (3), split it in an 8:2 ratio to generate training dataset and test dataset, and train traffic pattern recognition model.

[0136] (6) Calculate evaluation indicators. Based on the traffic pattern recognition results in step (5), calculate the corresponding evaluation indicators such as precision, recall, accuracy and F1 score to measure the recognition effect and performance of the model.

[0137] (7) Display the results. Visualize the traffic pattern recognition results obtained in step (5) and the evaluation index results obtained in step (6) using line charts, bar charts, etc.

[0138] As attached Figure 1 The present invention provides a structural diagram of the traffic pattern recognition model. The model consists of two parts. The first part is data processing, which divides the original GPS trajectory data into GPS segments and extracts the corresponding kinematic features. The second part is feature mining, which fuses the kinematic features using a temporal convolutional network and spatiotemporal feature extraction blocks, and finally uses an attention mechanism to finely identify traffic patterns.

[0139] As attached Figure 2The present invention presents a temporal convolutional network structure diagram. The temporal convolutional network (TCN) includes causal convolution, dilated convolution, and residual connections. Causal convolution and dilated convolution operations work together in blocks 1 and 2. A temporal convolutional network is a convolutional network that processes time series data, capturing global spatiotemporal features. The length of its output sequence is equal to the length of its input sequence. Causal convolution is a convolutional method for handling sequence problems; it does not consider future information, and the GPS point at a given time relies only on previously identified GPS sequences. Its fitting effect decreases with increasing network depth. Dilated convolution can obtain a larger receptive field, enhancing the model's ability to perceive historical information and compensating for the shortcomings of causal convolution. Residual connections can avoid the gradient vanishing problem during training and add convolutional features to the output features, improving the generalization ability of shallow network features and making it suitable for deeper networks.

[0140] As attached Figure 3 The spatiotemporal feature extraction block structure of this invention is shown in the diagram. The spatiotemporal feature extraction block includes a bidirectional gated recurrent unit and a densely connected network, wherein the densely connected network includes two densely connected layers and a transition layer. The spatiotemporal feature extraction block first captures the temporal features of GPS segments through the bidirectional gated recurrent unit, then captures spatial features through the densely connected network, ultimately obtaining local spatiotemporal features.

[0141] As attached Figure 4 The attention mechanism of this invention is shown in the structural diagram. The attention mechanism includes two layers of attention blocks, namely channel attention block and spatial attention block. The fused spatiotemporal features are located and selected through channel attention and spatial attention, respectively, and finally, traffic patterns are identified through a fully connected layer.

[0142] As attached Figure 5 The system functional module diagram of this invention is shown below. The system includes functional modules such as trajectory segmentation, feature calculation, data preprocessing, traffic pattern recognition model, dataset generation and model training, evaluation index calculation, and result display. The trajectory segmentation module segments the original GPS trajectory data; the feature calculation module calculates various kinematic features of all GPS trajectory points; the data preprocessing module performs data preprocessing on the segmented GPS trajectory data, including thresholding, zero-value filling, and data normalization; the traffic pattern recognition model module establishes a neural network-based traffic pattern recognition model, including spatiotemporal feature extraction blocks, temporal convolutional networks, and attention mechanisms; the dataset generation and model training module splits the training dataset and test dataset and trains the traffic pattern recognition model; the evaluation index calculation module compares and analyzes the model's classification results and recognition capabilities; and the result display module visualizes the recognition results.

[0143] A system for implementing the traffic pattern recognition method based on global and local spatiotemporal feature fusion of the present invention includes a trajectory segmentation module, a feature calculation module, a data preprocessing module, a traffic pattern recognition model module, a dataset generation and model training module, an evaluation index calculation module, and a result display module connected in sequence. The trajectory segmentation module, feature calculation module, data preprocessing module, traffic pattern recognition model module, dataset generation and model training module, evaluation index calculation module, and result display module each contain the technical content of steps (1) to (7) of the method of the present invention.

[0144] The embodiments described in this specification are merely examples of implementations of the inventive concept. The scope of protection of this invention should not be considered as limited to the specific forms stated in the embodiments. The scope of protection of this invention also extends to equivalent technical means that can be conceived by those skilled in the art based on the inventive concept.

Claims

1. A traffic pattern recognition method based on the fusion of global and local spatiotemporal features, comprising the following steps: (1) Trajectory segmentation: Divide all GPS trajectory points into multiple GPS segments, each segment having only one traffic model and a fixed segment length; (2) Feature calculation; calculate seven kinematic features for each GPS trajectory point, including relative distance, time interval, velocity, relative velocity, acceleration, jerk and azimuth change angle; (3) Data preprocessing; perform data preprocessing on the segmented GPS trajectory data; A threshold method was used to design velocity and acceleration thresholds to remove abnormal GPS trajectory points; segments with fewer GPS trajectory points were deleted; segments with small sums of relative distances were deleted; segments with small sums of time intervals were deleted; for GPS segments with insufficient length, zero-value padding was used to make each GPS segment the same length; the Min-Max method was used to normalize the seven kinematic features of all GPS trajectory points so that the feature range was mapped to between 0 and 1. (4) Constructing a traffic pattern recognition model; the traffic pattern recognition model consists of a spatiotemporal feature extraction block, a temporal convolutional network, and an attention mechanism; the spatiotemporal feature extraction block consists of two parts: a bidirectional gated recurrent unit and a densely connected network, used to acquire local spatiotemporal features, wherein the bidirectional gated recurrent unit can capture temporal features, and the densely connected network captures spatial features; the temporal convolutional network consists of three parts: causal convolution, dilated convolution, and residual connections, used to capture global spatiotemporal features; the attention mechanism includes two attention blocks, which realize the fusion and feature reconstruction of global and local spatiotemporal features at the channel level and the spatial level, respectively; the input-output change process of the gated recurrent unit is as follows: in, It is after normalization. Kinematic characteristics of GPS trajectory points at any given time and It is a coefficient matrix. , This is the output for resetting and updating the door. It is the number of hidden neurons. This represents the Sigmoid activation function. It is the hyperbolic tangent activation function. This represents the matrix element-wise multiplication operation. These are candidate hidden states, used to generate the true hidden states. and These are the outputs of the previous and current hidden states, respectively. (5) Generate dataset and training model; split the data obtained in step (3) to generate training dataset and test dataset, and train traffic pattern recognition model; (6) Calculate evaluation indicators; Based on the traffic pattern recognition results in step (5), calculate the corresponding evaluation indicators such as precision, recall, accuracy and F1 score to measure the recognition effect and performance of the model. (7) Display the results; visualize the traffic pattern recognition results obtained in step (5) and the evaluation index results obtained in step (6) using line charts, bar charts, etc.

2. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 1, characterized in that: In step (4), the input-output change process of the bidirectional gated loop unit is as follows: in, , express The hidden unit outputs from the previous and next time steps are concatenated after passing through a gated loop unit. yes and After connection Hide your status at all times. It is all The splicing result, It is the length of the segment, i.e., the number of GPS points.

3. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 2, characterized in that: In step (4), the input-output changes of the densely connected network are as follows: in, It is the result of the convolution operation. It is the growth rate, which indicates how much information is added from the current layer to the next layer in a dense network. , , It is the output connection of the previous layer. yes , , and The connector, This represents the local spatial features captured after passing through a dense network layer. It's a convolution operation. , , and The kernels are of sizes 7, 3, and 1. It is an activation function. It is a batch normalization operation of data. It is the mean. It is the standard deviation. It is a very small real number, used to prevent instability in numerical calculations. and These are learning parameters. , It is the output of the transition layer. , , It is the output connection of the previous layer. yes , , and The connector, It is the output feature of the second dense connection. It is average pooling. This represents the final captured local spatiotemporal features.

4. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 3, characterized in that: In step (4), the input and output changes of the temporal convolutional network are as follows: in, This represents the normalized kinematic characteristics of GPS. , , , , , These are convolutional kernels of sizes 2 and 1. This represents dilated convolution. Indicates the coefficient of thermal expansion. Indicates random inactivation. This indicates the output of the first block. Indicates the number of output channels. This represents the result of the residual connection. This is the output of the second block. This represents the global spatiotemporal features captured by the temporal convolutional network.

5. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 4, characterized in that: In step (4), the input-output change process of the attention mechanism is as follows: in, It integrates global and local spatiotemporal features. It is the number of channels to be merged. It is global max pooling. It is global average pooling. and It is the coefficient matrix of the multilayer perceptron. It's the dimensionality reduction rate. It is a channel weight coefficient that has undergone the channel attention mechanism. Channel weight coefficient Effect on The result above, It is a convolution kernel of size 7. It is max pooling. These are spatial weight coefficients processed through a spatial attention mechanism. Spatial weight coefficient Effect on The results above; firstly, the spatiotemporal characteristics of the fusion. After GAP and GMP, the channel attention weights are obtained by summing the two MLPs and then passing them through the Sigmoid function. ,Will Acting on spatiotemporal features upper formation Next, After the MP and AP channel information is fused and superimposed, a convolution operation is performed, and the normalized spatial attention weights are obtained using the Sigmoid function. ,Will Acting on upper formation As the output of the attention mechanism; finally. The final result is output through a fully connected layer (FC).

6. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 5, characterized in that: In step (4), the traffic pattern recognition model is trained using the Adam optimizer and updated using the gradient descent algorithm; the model's loss function is the cross-entropy loss function, as follows: in, It is the final recognition result of the model. It is a category of real-world transportation modes. The model is for the current The identification value, It is the cumulative value of the model's identification values ​​for all traffic mode categories.

7. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 6, characterized in that: In step (4), the number of hidden neurons dimensionality reduction .

8. The traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 1, characterized in that: In step (5), the dataset is split in an 8:2 ratio to generate the training dataset and the test dataset.

9. A system for implementing the traffic pattern recognition method based on the fusion of global and local spatiotemporal features as described in claim 1, characterized in that: It includes, in sequence, a trajectory segmentation module, a feature calculation module, a data preprocessing module, a traffic pattern recognition model module, a dataset generation and model training module, an evaluation index calculation module, and a results display module; among them, The trajectory segmentation module segments the original GPS trajectory data, dividing all GPS trajectory points into multiple GPS segments. Each segment has only one traffic model, and the segment length is fixed. The feature calculation module calculates seven kinematic features for each GPS track point, including relative distance, time interval, velocity, relative velocity, acceleration, jerk, and azimuth change angle. The data preprocessing module performs data preprocessing on the segmented GPS trajectory data, including deleting abnormal trajectory points, deleting abnormal segments, zero-value filling, and normalization. The traffic pattern recognition model module consists of a spatiotemporal feature extraction block, a temporal convolutional network, and an attention mechanism. The spatiotemporal feature extraction block comprises a bidirectional gated recurrent unit (GRU) and a densely connected network, used to acquire local spatiotemporal features. The GRU captures temporal features, while the densely connected network captures spatial features. The temporal convolutional network consists of causal convolutions, dilated convolutions, and residual connections, used to capture global spatiotemporal features. The attention mechanism includes two attention blocks, which achieve the fusion and feature reconstruction of global and local spatiotemporal features at the channel level and spatial level, respectively. The input-output transformation process of the GRU is as follows: in, It is after normalization. Kinematic characteristics of GPS trajectory points at any given time and It is a coefficient matrix. , This is the output for resetting and updating the door. It is the number of hidden neurons. This represents the Sigmoid activation function. It is the hyperbolic tangent activation function. This represents the matrix element-wise multiplication operation. These are candidate hidden states, used to generate the true hidden states. and These are the outputs of the previous and current hidden states, respectively. The dataset generation and model training module splits the data obtained from the data preprocessing module to generate training and test datasets, and trains the traffic pattern recognition model. The evaluation metric calculation module calculates corresponding evaluation metrics such as precision, recall, accuracy, and F1 score based on the recognition results of the dataset generation and model training modules, in order to measure the recognition effect and performance of the model. The results display module uses line charts, bar charts, and other methods to visualize the traffic pattern recognition results obtained by the dataset generation and model training modules, as well as the evaluation index results obtained by the evaluation index calculation module.