Traffic prediction method based on memory enhancement and lightweight adaptive coding

CN122548113APending Publication Date: 2026-08-11HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-13
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0006]1.多数模型采用静态或仅基于实时数据的动态图构建方法,无法利用历史经验中的相似情景,导致在突发事件时图结构估计不准确

Benefits of technology

[0051]1、本发明提出的基于记忆增强的动态图构建方法。通过引入可学习的结构化记忆库显式存储历史典型交通模式,并利用软注意力机制根据当前节点状态动态检索最相似的历史情景,将检索到的历史模式信息与当前特征进行自适应融合,再基于融合后的增强特征生成动态邻接矩阵。该方法使得图结构不仅能够反映当前时刻的交通相似性,更具备了利用历史经验进行“情景回忆”的能力,有效缓解了传统动态图方法仅依赖当前时间窗口、在突发事件或模式漂移时图结构估计不准确的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122548113A_ABST
    Figure CN122548113A_ABST
Patent Text Reader

Abstract

This invention discloses a traffic prediction method based on memory enhancement and lightweight adaptive coding. It preprocesses multi-source traffic data and semantic information to construct a multi-feature spatiotemporal graph tensor; it constructs a memory-enhanced dynamic graph generator, including a learnable memory bank, and dynamically generates adjacency matrices between nodes based on memory bank retrieval results; it employs a lightweight spatiotemporal joint encoder to extract spatiotemporal features, introduces elastic weights to consolidate regularization terms, and uses the Fisher information matrix to measure the importance of parameters to historical tasks. An adaptive controller based on a long short-term memory network is designed, receiving historical validation errors and novelty indices as state inputs and outputting the regularization coefficients for elastic weight consolidation; the spatiotemporal features output by the lightweight spatiotemporal joint encoder are input to the output layer to predict traffic states at multiple future time steps. Compared with existing technologies, this invention achieves high-precision, high-efficiency, and online continuously learnable traffic prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent transportation systems technology, specifically relating to a traffic prediction method based on memory enhancement and lightweight adaptive coding. Background Technology

[0002] As urbanization continues to deepen, the complexity of transportation systems is increasing dramatically. Achieving high-precision prediction of traffic state parameters (such as flow, speed, and density) has become a core challenge for improving the operational efficiency of intelligent transportation systems and alleviating traffic congestion.

[0003] Mainstream methods for traffic flow prediction are largely based on spatiotemporal graph neural network frameworks. These methods typically rely on statically predefined graph structures to represent the spatial relationships of the road network, where nodes correspond to traffic sensors and edges are constructed based on road connectivity or geographical distance. The models capture spatial dependencies through graph convolution operations and combine them with temporal models such as recurrent neural networks or temporal convolutional networks to handle dynamic changes. In recent years, some research has begun to employ dynamic graph construction methods, generating adjacency matrices for each time step based on real-time traffic flow similarity, enabling the graph structure to adapt to changes in traffic conditions. However, these dynamic graph methods only calculate similarity based on real-time data within the current time window, failing to utilize similar scenarios from historical experience, leading to inaccurate graph structure estimation during sudden events or abrupt pattern changes.

[0004] Furthermore, existing models have their parameters fixed after training, making them unable to continuously adapt to new changes, and they are prone to catastrophically forgetting old knowledge when adapting to new data. Some studies have attempted to use continuous learning techniques such as elastic weight consolidation, but they lack the ability to perceive the "novelty" of the data and cannot adaptively adjust the regularization strength.

[0005] In summary, the existing technology has the following main drawbacks:

[0006] 1. Most models use static or dynamic graph construction methods based solely on real-time data, which cannot utilize similar scenarios from historical experience, resulting in inaccurate graph structure estimation during sudden events.

[0007] 2. The model faces serious performance degradation issues during long-term deployment. Traffic patterns will continue to evolve due to factors such as seasonal changes, road construction, and policy adjustments. Existing models cannot continuously adapt to new changes without forgetting old knowledge.

[0008] 3. Many deep learning models have a large number of parameters and are computationally complex, making them difficult to deploy on resource-constrained edge devices. Online learning scenarios require models to be able to infer and update quickly, and the latency and storage overhead of large models cannot meet real-time requirements.

[0009] 4. Existing methods lack the ability to perceive the "novelty" of data. When the model encounters inputs that differ significantly from the training distribution, it cannot adaptively adjust the prediction strategy or trigger model updates, resulting in a decrease in prediction reliability. Summary of the Invention

[0010] Purpose of the invention: To address the shortcomings of existing technologies, this invention proposes a traffic prediction method based on memory enhancement and lightweight adaptive coding, which achieves high-precision, high-efficiency, and continuously learnable online traffic prediction, providing more comprehensive information support for traffic management decisions.

[0011] Technical Solution: This invention proposes a traffic prediction method based on memory enhancement and lightweight adaptive coding, including:

[0012] Preprocessing of multi-source traffic data and semantic information to construct a multi-feature spatiotemporal graph tensor;

[0013] Construct a memory-enhanced dynamic graph generator, including a learnable memory bank, and dynamically generate an adjacency matrix between nodes based on real-time multi-feature spatiotemporal graph tensors and memory bank retrieval results;

[0014] A lightweight spatiotemporal co-encoder is used to extract spatiotemporal features, and an elastic weight consolidation regularization term is introduced. The Fisher information matrix is ​​used to measure the importance of parameters to historical tasks, and the change magnitude of important parameters is constrained when the model is updated. An adaptive controller based on a long short-term memory network is designed to receive the model's historical verification error and novelty index as state inputs and output the regularization coefficient of the elastic weight consolidation.

[0015] The spatiotemporal features output by the lightweight spatiotemporal co-encoder are input into the output layer to predict traffic conditions at multiple future time steps.

[0016] Furthermore, the multi-source traffic data and semantic information include minute-level traffic flow and speed, regional congestion index, road event information, weather type, and weekday labels; the data is aggregated in fixed time windows, the average traffic flow and speed within each window are calculated, and the percentage of zero-speed vehicles in each time window is added as a node feature; the road event information is generated based on historical records or simulations and used as a binary label; periodic features are extracted, including time periods of day and days of the week, and the weather type and weekday label are encoded as semantic vectors; the extracted features are organized into a multi-feature spatiotemporal graph tensor.

[0017] Furthermore, the memory-enhanced dynamic graph generator specifically operates as follows:

[0018] First, the historical sequence of each node is compressed into a vector representation by a time aggregator and stacked along the node dimension to obtain a node representation matrix, where each node represents a traffic monitoring point.

[0019] The memory bank includes A key-value pair, key matrix Sum matrix All of these are learnable parameters. The similarity between the node representation and the memory key is calculated, and F represents the feature dimension of each node in each time step.

[0020] Memory-enhanced features are obtained based on similarity retrieval, and then the original representation and retrieval features are fused together.

[0021] Calculate the dynamic adjacency matrix based on the enhanced node features.

[0022] Furthermore, the similarity between the node representation and the mnemonic key is calculated, and the dynamic adjacency matrix is ​​determined, specifically as follows:

[0023] ;

[0024] Memory enhancement features are Integrating original representations and retrieval features: H represents the original representation feature;

[0025] For each pair of nodes (i,j), the enhanced features of the two nodes are concatenated and input into two layers of multilayer perceptron, and the edge weights are output:

[0026] ;

[0027] Obtain the dynamic adjacency matrix And set the diagonal elements to zero to prevent self-loops. Let B represent the enhanced feature vector of node i in all samples, B be the batch size, and N be the number of nodes in the traffic network.

[0028] Furthermore, the novelty calculation is as follows:

[0029] For each sample, the mean of the Euclidean distances between the node's enhanced features and the most similar keys in the memory is calculated, which is the novelty:

[0030] ;

[0031] in, Let F be the k-th key vector in the memory, and let F represent the feature dimension of each node in each time step. When the novelty exceeds the threshold of the historical distribution, the enhanced features of the current batch are written into the memory, and a first-in-first-out strategy is adopted. If the memory is full, the earliest stored sample is replaced.

[0032] Furthermore, the lightweight spatiotemporal joint encoder is composed of L layers of stacked joint blocks. Each joint block adopts a "segmentation-processing-shuffling" strategy, namely: the input features are segmented into four parts along the channel dimension, and identity mapping, pure temporal attention, pure spatial attention, and spatiotemporal attention are performed respectively; the processed features are concatenated along the channels, and channel shuffling is performed; at the same time, the lightweight spatiotemporal joint encoder introduces a graph convolutional network (GCN) branch in parallel, performs graph convolution operation on the same input, and adds the output of the GCN branch and the output of the joint block through residual connections.

[0033] Furthermore, the specific process by which the adaptive controller based on a long short-term memory network determines the regularization coefficients for elastic weight consolidation is as follows:

[0034] The adaptive controller based on Long Short-Term Memory (LSTM) networks uses an LSTM network as its core and takes a state vector as input. , The state vector includes the following components: mean absolute error over the last 5 periods, rate of change of mean absolute error, root mean square error over the last 5 periods, rate of change of root mean square error, novelty score over the last 5 periods, memory retrieval frequency, and average change in edge weight of the dynamic adjacency matrix. The LSTM processes a state sequence of length 5 and outputs the hidden state at the last time step. The regularization coefficients are obtained after passing through a fully connected layer and Sigmoid activation:

[0035] ;

[0036] The scaling factor is obtained through linear transformation and Sigmoid:

[0037] ;

[0038] in, and These are the weight matrix and bias of the fully connected layer, which output regularization coefficients, respectively. and These are the weight matrix and bias of the fully connected layer, respectively, for output scaling factor;

[0039] Based on scaling factor Correct Fisher Information Matrix: , Given the Fisher information matrix, and based on the corrected Fisher information matrix and regularization coefficients... Substitute the regularization loss term for the elastic weight consolidation.

[0040] Furthermore, the total loss function for model training is:

[0041] ;

[0042] in, The loss is due to the new task, which refers to the task of predicting traffic conditions for multiple future time steps based on traffic data from the most recent T historical time steps. Let i be the i-th trainable parameter in the model. This is the value of the i-th parameter of the model saved after the most recent cycle of evolutionary fine-tuning. This is the regularization intensity coefficient;

[0043] Fisher's information estimate is:

[0044] ;

[0045] in, To partition the current validation set from the real-time data buffer, Let x represent a sample pair in the validation set, where x is the input multi-feature spatiotemporal graph tensor and y is the corresponding true future traffic state. This is the average absolute error loss function.

[0046] Furthermore, it also includes: constructing an online update engine containing a real-time calibrator and a periodic evolver. The real-time calibrator is executed after each inference batch, using the prediction error of the current batch as the loss, and only performing 1 to 3 steps of gradient updates on the final convolutional layers of the model; the periodic evolver is triggered daily or when a continuous increase in validation error is detected, sampling recent data and historical typical data from the data buffer and memory respectively to form a mixed training set, and fine-tuning the complete model for multiple cycles under the constraint of the elastic weight consolidation regularization term.

[0047] Furthermore, the cyclic evolutionary process fine-tunes the complete model over multiple cyclic periods on a mixed training set, with the optimization objective being:

[0048] ;

[0049] Among them, the mixed training set , This indicates the most recent data sampled in the data buffer. Historical typical data sampled from the memory bank; This is the corrected Fisher information matrix. Regularization intensity coefficient, Let the mean absolute error loss function be . y represents the model's predicted value, and y represents the actual value. Let i be the i-th trainable parameter in the model. This is the value of the i-th parameter of the model saved after the most recent periodic evolutionary fine-tuning; after fine-tuning, the Fisher information matrix is ​​recalculated based on the current validation set, and the state of the fine-tuned model is used as the new parameter. Reset the elastic weights to reinforce the anchor points of regularization.

[0050] Compared with the prior art, the present invention has the following beneficial effects:

[0051] 1. This invention proposes a dynamic graph construction method based on memory enhancement. By introducing a learnable structured memory to explicitly store typical historical traffic patterns, and utilizing a soft attention mechanism to dynamically retrieve the most similar historical scenarios based on the current node state, the retrieved historical pattern information is adaptively fused with current features. A dynamic adjacency matrix is ​​then generated based on the enhanced features from the fused process. This method enables the graph structure to not only reflect the traffic similarity at the current moment but also possess the ability to "recall scenarios" using historical experience, effectively alleviating the problem of traditional dynamic graph methods relying solely on the current time window and inaccurate graph structure estimation during sudden events or pattern drift.

[0052] 2. This invention proposes a lightweight spatiotemporal joint encoder. By segmenting input features along the channel dimension into multiple subgroups, and performing identity mapping, pure temporal attention, pure spatial attention, and spatiotemporal joint attention processing in parallel, a channel shuffling process is then applied to promote cross-channel information fusion. This method significantly reduces the number of model parameters and computational complexity while maintaining or even enhancing the expressive power of spatiotemporal features. It effectively alleviates the problem of large parameter counts and difficulty in deploying on edge devices associated with traditional serial or alternating stacked spatiotemporal coding structures, providing a feasible solution for the online rapid updating of traffic prediction models and their deployment in resource-constrained scenarios.

[0053] 3. This invention introduces an adaptive regularization mechanism based on meta-learning. Elastic Weight Consolidation (EWC) regularization is used, quantifying the importance of parameters to historical tasks through the Fisher information matrix to mitigate catastrophic forgetting. Based on this, an adaptive controller (meta-controller) based on a Long Short-Term Memory (LSTM) network is designed. This controller takes the model's historical validation error and novelty index as input states, and automatically outputs a regularization coefficient λ and a scaling factor s to dynamically adjust the strength of EWC regularization and fine-grained scaling of parameter importance. This mechanism eliminates the need for manual parameter tuning in setting the regularization strength; instead, it is adaptively determined by the model based on its own state and data characteristics, thus adapting to the evolution of different urban traffic patterns.

[0054] 4. This invention constructs a dual-timescale online update engine. The real-time calibrator responds rapidly to sudden events within milliseconds, while the periodic evolver accumulates knowledge at the daily / weekly level. This two-stage strategy balances agile response with long-term stability, enabling the model to maintain high predictive accuracy throughout deployments lasting several months. Attached Figure Description

[0055] Figure 1This is a diagram of the overall system architecture of the present invention;

[0056] Figure 2 A schematic diagram of the structure of a memory-enhanced dynamic graph generator;

[0057] Figure 3 This is a schematic diagram of a lightweight spatiotemporal co-encoder structure.

[0058] Figure 4 A flowchart for online engine updates;

[0059] Figure 5 Performance comparison chart for different models;

[0060] Figure 6 A visual comparison chart of dynamic adjacency matrices under different semantics. Detailed Implementation

[0061] The following section uses "traffic flow prediction for urban expressways" as an example, and elaborates on the specific implementation process in conjunction with the technical solution of this invention.

[0062] This embodiment uses the widely used benchmark datasets PEMS04 and PEMS08 for validation. The data has undergone a rigorous quality control process, including removing permanent fault detectors and imputing short-term missing values. These datasets are recognized benchmark datasets in the field of traffic prediction, ensuring their authenticity and reliability. This study selects two key indicators, flow rate and speed, as node features.

[0063] 001 Data Acquisition Section:

[0064] This embodiment selects data from 170 detectors in the publicly available benchmark datasets PEMS08 and PEMS04. To simulate the fusion of multi-source information, minute-level traffic flow and speed data from each detector in the datasets are directly used. Based on the traffic flow and speed of the detectors, a simulated regional congestion index is generated for each detector using a specific algorithm. The index ranges from 0 to 10 and is calculated by normalization based on the average speed of all detectors within a certain radius centered on that detector. Road event information is generated based on historical records or simulations and used as binary labels (0 / 1). Weather data is matched with records of corresponding time and location from publicly available meteorological datasets and categorized into four types: sunny, rainy, snowy, and foggy, using unique thermal encoding. Weekday information is directly extracted from timestamps and labeled as binary variables, with 1 representing a weekday and 0 representing a non-weekday.

[0065] Data is aggregated in 5-minute windows, and the average traffic flow and speed are calculated within each window. In addition to the original features, the percentage of vehicles traveling at zero speed in each time window is added as a node feature, calculated as the number of sampling points with a speed of 0 divided by the total number of sampling points. Simultaneously, periodic features are extracted, including time periods of day and days of the week. Weather type and weekday labels will be processed separately and encoded into semantic vectors in subsequent steps.

[0066] 002 Construct a multi-feature spatiotemporal graph tensor, organizing the extracted features into a multi-feature spatiotemporal graph tensor. Where N=170 represents the number of nodes in the traffic network, with each node representing a traffic monitoring point; T=12 represents the number of historical time steps, with each time step corresponding to a 5-minute window (i.e., 1 hour of historical data); F=3 represents the feature dimensions of each node in each time step (average traffic flow, average vehicle speed, and percentage of zero-speed vehicles); and B is the batch size. Time period features and external semantic features will be processed separately by the subsequent encoder.

[0067] Before inputting the data into the model, the multi-feature spatiotemporal graph data needs to be standardized to eliminate the influence of dimensions. The calculation formula is as follows:

[0068]

[0069] in and These are the mean and standard deviation of the features of each node in the training set, respectively.

[0070] 003 Construct a memory-enhanced dynamic graph generator. First, the historical sequence of each node is compressed into a vector representation using a temporal aggregator, employing temporal average pooling:

[0071]

[0072] in For input tensors The matrix formed by all batch samples and all features after fixing node i and time τ. (This is followed by a series of seemingly unrelated characters and symbols, which are not translated as they are not part of the main text.) Stacking along the node dimensions yields the node representation matrix. .

[0073] 004. Retrieval of Feature Memory and Feature Enhancement. The feature memory contains... A key-value pair, key matrix Sum matrix All are learnable parameters. The similarity between the node representation and the mnemonic key is calculated:

[0074]

[0075] The retrieved memory enhancement features are Integrating original representations and retrieval features: .

[0076] 005. Calculate the dynamic adjacency matrix based on the enhanced node features. For each pair of nodes (i,j), concatenate their enhanced features and input them into a two-layer multilayer perceptron, outputting the edge weights:

[0077]

[0078] Obtain the dynamic adjacency matrix And set the diagonal elements to zero to prevent self-loops. This represents the enhanced feature vector of node i in all samples.

[0079] 006 Novelty Calculation and Memory Update. For each sample, calculate the mean (novelty value) of the Euclidean distance between its node-enhanced features and the most similar key in the memory:

[0080]

[0081] in This represents the k-th key vector in the memory. When the novelty exceeds the 75th percentile of the historical distribution, the enhanced features of the current batch are written into the memory. A first-in, first-out (FIFO) strategy is used; if the memory is full, the earliest stored sample is replaced.

[0082] 007 This embodiment employs a lightweight spatiotemporal co-encoder to extract spatiotemporal features. The encoder depth L=5, the number of channels is [3,32,32,32,32,32], the number of multi-head attention heads is 4, and the number of channel segments (groups=4) is 4. The encoder's main input is the normalized 𝒳 from step 004. norm Obtained through dimensional rearrangement X is divided into four parts along the channel dimension, with each part having C / 4 channels.

[0083] Each part is processed separately: the first part undergoes an identity mapping; the second part is reshaped into... The first part is input into a multi-head self-attention module, and the output is reshaped back to its original form. The second part swaps the spatial and temporal dimensions before inputting into the attention module and then swapping back to its original form. The third part directly inputs into the attention module to process the temporal dimension. The outputs of the four parts are concatenated along the channels and then subjected to channel shuffling. The joint convolution module uses the same segmentation strategy, applying 1×3 spatial convolution, 3×1 temporal convolution, and 3×3 spatiotemporal convolution respectively. Simultaneously, the lightweight spatiotemporal joint encoder also introduces a graph convolutional network (GCN) branch in parallel, performing graph convolution operations on the same input X, and adding the GCN branch output to the output of the joint block above through residual connections. Residual connections are added after each joint block.

[0084] 008 introduces elastic weights to reinforce regularization. After each periodic evolutionary fine-tuning, the current validation set is partitioned from the real-time data buffer. The Fisher information matrix is ​​calculated based on this validation set. For the parameters... Its Fisher information estimate is:

[0085]

[0086] in Let be the mean absolute error loss function. In subsequent training, the total loss function is:

[0087]

[0088] in, For the losses in the new mission, These are the model parameter values ​​saved after the most recent cycle of evolutionary fine-tuning. This is the regularization intensity coefficient. The i-th trainable parameter in the model of this invention includes the convolutional layer weights in the lightweight spatiotemporal joint encoder, the projection matrix of the attention mechanism, the weights of the fully connected layer, and the memory bank key matrix M in the memory-enhanced dynamic graph generator. key AND-value matrix M val And the weights of the output layer.

[0089] 009 Design an adaptive controller based on a Long Short-Term Memory (LSTM) network. The adaptive controller uses an LSTM network as its core and takes a state vector as its input. ,in The state vector contains the following components: mean absolute error over the last 5 periods, rate of change of mean absolute error, root mean square error over the last 5 periods, rate of change of root mean square error, novelty score over the last 5 periods, memory retrieval frequency, and average change in edge weight of the dynamic adjacency matrix. The LSTM processes a state sequence of length 5 and outputs the hidden state at the last time step. The regularization coefficients are obtained after a fully connected layer and sigmoid activation:

[0090]

[0091] The scaling factor is obtained through linear transformation and Sigmoid:

[0092]

[0093] 010 Build an online update engine. The online update engine consists of two modules: a real-time calibrator and a periodic evolver.

[0094] Real-time calibrator: Executed after each inference batch, using the prediction error of the current batch as the loss, updating parameters only on the final convolutional layers of the model, with the following update rules:

[0095]

[0096] Among them, learning rate The update process takes 1 to 3 steps. This process does not modify the backbone network parameters, and a single update takes less than 1 millisecond. The mean absolute error loss function is:

[0097]

[0098] in, y represents the model's predicted value, y represents the actual value, and M represents the total number of elements in dimensions such as prediction time steps and number of nodes.

[0099] Periodic Evolver: Triggered every 24 hours of accumulated new data or when the verification error increases for three consecutive periods. The execution flow is as follows:

[0100] (1) Sample data from the last 24 hours from the data buffer and an equal amount of historical typical data from the memory bank to form a hybrid training set. .

[0101] (2) Load the regularization coefficients of the adaptive controller output. and scaling factor Correct Fisher's information matrix: .

[0102] (3) Fine-tune the full model for 10 epochs on the mixed training set, with the optimization objective being:

[0103]

[0104] Learning rate set to .

[0105] (4) After fine-tuning, the Fisher information matrix is ​​recalculated based on the current validation set.

[0106] (5) Use the fine-tuned model's state as the new Reset the elastic weights to reinforce the anchor points of regularization.

[0107] 011 inputs the processed spatiotemporal features into the output layer to predict traffic conditions at multiple future time steps. The output layer is a fully connected layer that converts the temporal features output by the encoder into traffic flow predictions for future time steps.

[0108] In this embodiment, the future prediction time step is 12, corresponding to 60 minutes, with 5 minutes per step.

[0109] During training, the loss function is the mean absolute error, the AdamW optimizer is used, the learning rate η = 0.001, and the weight decay is 10⁻⁻⁶. 4 The training batch size is 1024, and the training epochs are 120. Cosine annealing learning rate scheduling and early stopping are used. The dataset is divided into training, validation, and test sets in a ratio of 6:2:2.

[0110] To verify the performance of this invention, a comparative experiment was conducted on the PEMS08 dataset, and the results are as follows: Figure 5 As shown in Table 1.

[0111] Table 1 Performance Comparison for Different Forecast Periods

[0112]

[0113] As shown in Table 1, the present invention outperforms the comparative methods in all prediction durations and all evaluation metrics. Taking a 60-minute prediction as an example, the MAE of the present invention is 25.34, RMSE is 39.51, and MAPE is 15.94%, which are reduced by approximately 16.5%, 12.5%, and 34.4% respectively compared to the best baseline model STGNN. It can be clearly observed that the model of the present invention achieves optimal performance in all metrics and all prediction durations, and its performance advantage becomes more obvious as the prediction duration increases.

[0114] Figure 6 This is a comparison chart of the traffic flow prediction and actual values ​​of the present invention. As can be seen from the chart, the present invention can achieve accurate prediction of traffic flow, proving the robustness of the model in long-term prediction.

[0115] The above embodiments are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. All equivalent transformations or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.

Claims

1. A traffic prediction method based on memory enhancement and lightweight adaptive coding, characterized in that, include: Preprocessing of multi-source traffic data and semantic information to construct a multi-feature spatiotemporal graph tensor; Construct a memory-enhanced dynamic graph generator, including a learnable memory bank, and dynamically generate an adjacency matrix between nodes based on real-time multi-feature spatiotemporal graph tensors and memory bank retrieval results; A lightweight spatiotemporal co-encoder is used to extract spatiotemporal features, and an elastic weight consolidation regularization term is introduced. The Fisher information matrix is ​​used to measure the importance of parameters to historical tasks, and the change magnitude of important parameters is constrained when the model is updated. An adaptive controller based on a long short-term memory network is designed to receive the model's historical verification error and novelty index as state inputs and output the regularization coefficient of the elastic weight consolidation. The spatiotemporal features output by the lightweight spatiotemporal co-encoder are input into the output layer to predict traffic conditions at multiple future time steps.

2. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 1, characterized in that, The multi-source traffic data and semantic information include minute-level traffic flow and speed, regional congestion index, road event information, weather type, and weekday label; the data is aggregated in fixed time windows, the average traffic flow and speed within each window are calculated, and the proportion of zero-speed vehicles in each time window is added as a node feature. Road event information is generated based on historical records or simulations and used as binary labels; Extract periodic features, including time of day and day of week, weather type and weekday label, and encode them into semantic vectors; organize the extracted features into a multi-feature spatiotemporal graph tensor.

3. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 1, characterized in that, The specific operation of the memory-enhanced dynamic graph generator is as follows: First, the historical sequence of each node is compressed into a vector representation by a time aggregator and stacked along the node dimension to obtain a node representation matrix, where each node represents a traffic monitoring point. The memory bank includes A key-value pair, key matrix Sum matrix All of these are learnable parameters. The similarity between the node representation and the memory key is calculated, and F represents the feature dimension of each node in each time step. Memory-enhanced features are obtained based on similarity retrieval, and then the original representation and retrieval features are fused together. Calculate the dynamic adjacency matrix based on the enhanced node features.

4. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 3, characterized in that, The similarity between node representations and memory keys is calculated, and the dynamic adjacency matrix is ​​determined, specifically as follows: ; Memory enhancement features are Integrating original representations and retrieval features: H represents the original representation feature; For each pair of nodes (i,j), the enhanced features of the two nodes are concatenated and input into two layers of multilayer perceptron, and the edge weights are output: ; Obtain the dynamic adjacency matrix And set the diagonal elements to zero to prevent self-loops. Let B represent the enhanced feature vector of node i in all samples, B be the batch size, and N be the number of nodes in the traffic network.

5. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 1, characterized in that, The novelty calculation is as follows: For each sample, the mean of the Euclidean distances between the node's enhanced features and the most similar keys in the memory is calculated, which is the novelty: ; in, Let F be the k-th key vector in the memory, and let F represent the feature dimension of each node in each time step. When the novelty exceeds the threshold of the historical distribution, the enhanced features of the current batch are written into the memory, and a first-in-first-out strategy is adopted. If the memory is full, the earliest stored sample is replaced.

6. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 1, characterized in that, The lightweight spatiotemporal joint encoder is composed of L layers of joint blocks stacked together. Each joint block adopts a "segmentation-processing-shuffling" strategy, that is, the input features are divided into four parts along the channel dimension and processed by identity mapping, pure temporal attention, pure spatial attention and spatiotemporal attention respectively. The processed features are concatenated along the channels and a channel shuffling operation is performed. At the same time, a lightweight spatiotemporal joint encoder introduces a graph convolutional network (GCN) branch in parallel to perform graph convolution operations on the same input, and adds the output of the GCN branch and the output of the joint block through residual connections.

7. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 1, characterized in that, The specific process for determining the regularization coefficients of elastic weight consolidation in an adaptive controller based on a long short-term memory network is as follows: The adaptive controller based on Long Short-Term Memory (LSTM) networks uses an LSTM network as its core and takes a state vector as input. , The state vector includes the following components: mean absolute error over the last 5 periods, rate of change of mean absolute error, root mean square error over the last 5 periods, rate of change of root mean square error, novelty score over the last 5 periods, memory retrieval frequency, and average change in edge weight of the dynamic adjacency matrix. The LSTM processes a state sequence of length 5 and outputs the hidden state at the last time step. The regularization coefficients are obtained after passing through a fully connected layer and Sigmoid activation: ; The scaling factor is obtained through linear transformation and Sigmoid: ; in, and These are the weight matrix and bias of the fully connected layer, which output regularization coefficients, respectively. and These are the weight matrix and bias of the fully connected layer, respectively, for output scaling factor; Based on scaling factor Correct Fisher Information Matrix: , Given the Fisher information matrix, and based on the corrected Fisher information matrix and regularization coefficients... Substitute the regularization loss term for the elastic weight consolidation.

8. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 7, characterized in that, The total loss function for model training is: ; in, The loss is due to the new task, which refers to the task of predicting traffic conditions for multiple future time steps based on traffic data from the most recent T historical time steps. Let i be the i-th trainable parameter in the model. This is the value of the i-th parameter of the model saved after the most recent cycle of evolutionary fine-tuning. This is the regularization intensity coefficient; Fisher's information estimate is: ; in, To partition the current validation set from the real-time data buffer, Let x represent a sample pair in the validation set, where x is the input multi-feature spatiotemporal graph tensor and y is the corresponding true future traffic state. This is the average absolute error loss function.

9. The traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 1, characterized in that, Also includes: An online update engine is constructed, which includes a real-time calibrator and a periodic evolutionary engine. The real-time calibrator is executed after each inference batch, using the prediction error of the current batch as the loss, and only performs 1 to 3 steps of gradient update on the last convolutional layer of the model. The periodic evolutionary engine is triggered daily or when a continuous increase in validation error is detected. It samples recent data and historical typical data from the data buffer and memory respectively to form a mixed training set, and performs fine-tuning of the complete model for multiple cycles under the constraint of the elastic weight consolidation regularization term.

10. A traffic prediction method based on memory enhancement and lightweight adaptive coding according to claim 9, characterized in that, The cyclic evolutionary process fine-tunes the full model over multiple cyclic periods on a mixed training set, with the optimization objective being: ; Among them, the mixed training set , This indicates the most recent data sampled in the data buffer. Historical typical data sampled from the memory bank; This is the corrected Fisher information matrix. Regularization intensity coefficient, Let the mean absolute error loss function be . y represents the model's predicted value, and y represents the actual value. Let i be the i-th trainable parameter in the model. This is the value of the i-th parameter of the model saved after the most recent periodic evolutionary fine-tuning; after fine-tuning, the Fisher information matrix is ​​recalculated based on the current validation set, and the state of the fine-tuned model is used as the new parameter. Reset the elastic weights to reinforce the anchor points of regularization.