Road network traffic state unified representation learning method

By combining graph neural networks and fully connected networks, positive and negative sample pairs are constructed and the contrastive loss function is minimized, thus realizing a unified semantic representation of traffic states. This addresses the shortcomings of existing traffic state modeling methods in terms of global dependency and multi-source data fusion, improving the efficiency and interpretability of traffic state modeling. It is suitable for applications such as traffic prediction and data completion.

CN121503536APending Publication Date: 2026-02-10BEIJING JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511609836.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing traffic state modeling methods are insufficient in capturing global dependencies between road networks and hierarchical relationships in traffic semantics, and lack the ability to fuse multi-source heterogeneous data for modeling, making it difficult to achieve efficient, end-to-end optimized traffic state semantic modeling.

Method used

A traffic network encoder is designed using a graph neural network and a traffic environment encoder is designed using a fully connected neural network. By constructing positive and negative sample pairs and minimizing the contrast loss function, a unified semantic representation of traffic states is achieved. The decoder is used to restore the original traffic state data, and a reconstruction loss function is constructed to freeze the encoder and train the decoder, thus achieving end-to-end traffic state reconstruction.

Benefits of technology

It achieves efficient fusion of multi-source heterogeneous data, improves the consistency of traffic state space and semantic interpretability, and is suitable for intelligent transportation application scenarios such as traffic prediction, congestion management and data completion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121503536A_ABST
    Figure CN121503536A_ABST
Patent Text Reader

Abstract

The invention discloses a road network traffic state unified representation learning method. Comprising the following steps: acquiring multi-source traffic state data of a target area from a traffic perception system, and constructing a graph structure containing road nodes and traffic state attributes; designing a traffic network encoder based on the graph neural network, and extracting a semantic representation vector of each road node; designing a traffic environment encoder based on the full-connection neural network, and extracting a representation vector of each traffic environment combination; and constructing a positive sample pair and a negative sample pair according to a structural relationship between roads and traffic state similarity, defining and minimizing a comparison loss function, and performing comparison training on a traffic network encoder and a traffic environment encoder to obtain a unified traffic state semantic representation space. The method has remarkable advantages in the aspects of multi-source heterogeneous data fusion, traffic state space consistency modeling and semantic interpretability, and is widely applied to intelligent traffic application scenes such as traffic prediction, congestion management and data completion.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of traffic information processing, and particularly relates to a road network traffic state unified representation learning method. BACKGROUND

[0002] In an intelligent transportation system, accurately modeling the traffic states of different roads in a city road network is an important prerequisite for realizing traffic prediction, management and optimization. Existing methods mainly include traffic state modeling methods based on statistical models, machine learning models and deep learning models. These methods are still acceptable when processing static or local segment traffic state data, but they have significant shortcomings in capturing global dependencies between road networks and traffic semantic hierarchical relationships. In addition, traffic state data has obvious multi-source heterogeneous characteristics, such as speed, flow, density, weather and other information collected by different sensors, and its fusion modeling puts higher requirements on the model capability.

[0003] In recent years, contrastive learning has been widely used in representation learning, which realizes the supervised optimization of sample distribution in the semantic space by constructing positive and negative sample pairs. Introducing contrastive learning into traffic modeling is expected to learn a low-dimensional unified representation of road network traffic states with semantic interpretability under unsupervised or weakly supervised conditions.

[0004] However, existing traffic state modeling methods have not fully utilized the advantages of deep neural networks and contrastive learning in feature fusion capability, spatial consistency modeling and contrast mechanism design, and there is an urgent need for an efficient, end-to-end optimized traffic state semantic modeling method. SUMMARY

[0005] In view of the problems in the background art, the application provides a road network traffic state unified representation learning method, which aims to fuse traffic road network structure information and traffic environment factors, realize semantic space alignment using a contrastive loss, and restore the original state through a decoder. The technical scheme comprises the following steps:

[0006] Step S1: Obtain multi-source traffic state data of a target area from a traffic perception system, and construct a graph structure containing road nodes and traffic state attributes;

[0007] Step S2: Design a traffic road network encoder based on a graph neural network to extract a semantic representation vector of each road node;

[0008] Step S3: Design a traffic environment encoder based on a fully connected neural network to extract a representation vector of each traffic environment combination;

[0009] Step S4: According to the structural relationship between roads and traffic state similarity, construct positive sample pairs and negative sample pairs, define and minimize the contrast loss function, conduct contrast training on the traffic road network encoder and the traffic environment encoder, and obtain a unified traffic state semantic representation space;

[0010] Step S5: Use the traffic semantic decoder in a symmetric relationship with the traffic road network encoder to restore the semantic representation output by the encoder to the original traffic state data, and define a reconstruction loss;

[0011] Step S6: Construct a reconstruction loss function, freeze the traffic road network encoder, train the traffic semantic decoder with the representation of the traffic road network encoder, and obtain a model for recovering traffic states from the traffic semantic representation space.

[0012] Multi-source traffic state data includes traffic speed, traffic flow, traffic density, occupancy rate, and weather information.

[0013] Road network graph structure representing traffic wherein, is a set of nodes representing basic objects in the graph; is a set of edges representing the connection relationship between vertices; is a traffic state attribute matrix related to each node. represents the number of nodes, represents the number of traffic state attributes, represents a pair of nodes in has a directed connection to ; the neighbor nodes of vertex are a set of all nodes adjacent to , denoted by ; the adjacency matrix is a topological representation of , wherein indicates that nodes and are connected by an edge, and indicates that nodes and are not connected.

[0014] Traffic road network encoder calculation formula:

[0015] , (1)

[0016] , (2)

[0017] , (3)

[0018] , (4)

[0019] where, denotes the attention weight between nodes and , is the feature of node , denotes the neighborhood of node , represents the activation function, and W denotes the weight matrix; denotes the hidden layer feature of the l-th layer, denotes the representation of the traffic road network; represents the activation function, and W and b denote the weight and bias matrices, respectively.

[0020] The structure of the decoder is in a symmetrical relationship with the structure of the traffic road network encoder, which satisfies:

[0021] (8)

[0022] (9)

[0023] (10)

[0024] where, denotes the matrix converting to the feature of node , denotes the input layer feature of the graph multi-head attention layer; , and denote the activation function, the weight, and the bias, respectively.

[0025] The positive sample pair is a combination of road nodes from the same time period or spatial proximity, and the negative sample pair is a combination of road nodes from a significant state difference or spatial distance;

[0026] The contrastive loss function is the InfoNCE loss function, as shown in equation (7):

[0027] (7)

[0028] where, α i and are the representations of the traffic road network and the traffic environment in the traffic semantic space, respectively; sim calculates the similarity between the two representation codes; is a temperature scaling hyperparameter;

[0029] The goal of training the two encoders by contrastive learning is to align the representations, so the average contrastive error is selected as the evaluation index of the model.

[0030] The semantic decoder adopts a structure combining a graph neural network and a full-connection attribute assignment layer, and is used for reconstructing the traffic state value.

[0031] The traffic semantic decoder decodes the semantic code into a real traffic network state.

[0032] When training the traffic semantic decoder, the traffic network encoder parameters are frozen,

[0033] (11)

[0034] wherein, is a parameter of the traffic semantic decoder, is a traffic network related to the traffic state T.

[0035] After step S6, the following is performed:

[0036] Step S7, verifying the effect of the model method in traffic prediction and data completion: after the training is completed, the learned traffic state semantic representation is used for downstream tasks such as traffic prediction, anomaly detection or data completion.

[0037] The TraEnvNet model is adopted to realize traffic speed estimation based on traffic environmental factors.

[0038] The present application has the following beneficial effects:

[0039] 1. The present application has significant advantages in multi-source heterogeneous data fusion, traffic state space consistency modeling and semantic interpretability, and is widely applicable to intelligent traffic application scenarios such as traffic prediction, congestion management, data completion, etc.

[0040] 2. A road network graph structure with multi-source traffic state attributes is constructed; a graph neural network encoder is designed to extract the traffic semantic representation of the road node; a positive and negative contrast sample pair is constructed, and the encoder is optimized based on the contrast loss to enhance the discriminability of the representation; a semantic decoder is introduced to restore the encoding result, and the interpretability of the semantic expression is improved based on the reconstruction loss; and a unified traffic state representation model is trained through a joint optimization strategy. BRIEF DESCRIPTION OF DRAWINGS

[0041] Figure 1 The figure is a flowchart of an embodiment of a road network traffic state unified representation learning method of the present application.

[0042] Figure 2 The conversion relationship between the real road network and the traffic network graph in the embodiment of the present application.

[0043] Figure 3 The multi-task schematic diagram based on traffic semantic information representation learning in the embodiment of the present application.

[0044] Figure 4 The embedding representation of the traffic semantic space in the embodiment of the application.

[0045] Figure 5 The traffic road network encoder structure in the embodiment of the application.

[0046] Figure 6 The traffic environment encoder structure in the embodiment of the application.

[0047] Figure 7 The traffic semantic representation alignment framework based on contrastive learning in the embodiment of the application.

[0048] Figure 8 The structure of the traffic semantic decoder in the embodiment of the application.

[0049] Figure 9 The distance matrix of different environmental factors in the traffic semantic space and the actual traffic data in the embodiment of the application.

[0050] Figure 10 The traffic semantic encoding visualization of different weeks in the embodiment of the application.

[0051] Figure 11 The traffic congestion state estimation result on January 15, 2020 based on environmental factors in the embodiment of the application.

[0052] Figure 12 The data completion result under different mask rates in the embodiment of the application.

[0053] Figure 13 The flowchart of the framework for traffic semantic information representation learning in the embodiment of the application. DETAILED DESCRIPTION

[0054] The application will be further described in detail below with reference to the accompanying drawings.

[0055] As shown in the embodiment of the application shown in Figures 1-8 and Figure 13 , comprising:

[0056] Step S1: acquiring multi-source traffic state data of a target area from a traffic perception system, and constructing a graph structure containing road nodes and traffic state attributes; the multi-source traffic state data includes but is not limited to traffic speed, traffic flow, traffic density, occupancy rate and weather information;

[0057] The road network graph structure representing traffic , wherein, is a node set, representing the basic objects in the graph; is an edge set, representing the connection relationship between vertices; is a traffic state attribute matrix related to each node. denotes the number of nodes, denotes the number of traffic state attributes (in this study, ). In addition, is a directed graph, denotes the existence of a directed connection between node pairs to ; the neighbor nodes of vertex are all nodes adjacent to , denoted by ; the adjacency matrix is a topological representation of the graph , where denotes that nodes and are connected by an edge, and denotes that nodes and are not connected.

[0058] In this embodiment, taking the central urban area of Beijing as an example, 42 days of historical traffic speed, spatial structure data, combined with weather, time stamp and other information, are collected to construct a traffic state graph structure. Each node in the graph corresponds to a road segment, and the edge represents a physical or logical connection. An example of the data is shown in Table 1 below:

[0059] Table 1: Example of Beijing traffic data set

[0060]

[0061] Step S2: Design a traffic road network encoder based on a graph neural network to extract a semantic representation vector for each road node;

[0062] The traffic road network encoder is a residual graph attention network (GAT) and a fully connected neural network. The input of the traffic road network encoder is a road network with traffic state attributes (e.g., road speed), and the output is a representation encoding vector that captures the semantic features of the road network. In the design of the encoder, a combination structure of a multi-head graph attention layer and a global readout function is introduced to model and extract the multi-level dependency relationship between roads. The graph attention layer assigns adaptive attention weights to each road (node), effectively modeling the heterogeneous association between adjacent roads. The multi-head attention mechanism allows the model to model multiple spatial correlations in different attention "perspectives" in parallel, thereby improving the representation ability of complex road network structures. Specifically, the number of attention heads determines the relationship dimension that the model can perceive, and the stacking depth of the attention layer determines the receptive field of the model, which in turn affects its ability to capture high-order adjacency relationships. The more layers there are, the wider the range of information that the model can aggregate, and the more topological dependency features between distant nodes can be effectively captured. After completing the multi-layer graph attention aggregation, the global readout function in this embodiment is used to integrate node-level features and generate a graph-level semantic representation. First, the high-dimensional features of all nodes are flattened and concatenated, and then input into a two-layer feedforward neural network for nonlinear transformation and compression. Finally, a fixed-dimensional traffic road network semantic representation vector is obtained; the traffic road network encoder calculation formula is as follows:

[0063] (1)

[0064] (2)

[0065] (3)

[0066] (4)

[0067] wherein, represents the attention weight between nodes and , is the feature of node , represents the neighborhood of node , represents an activation function, and W represents a weight matrix; represents the hidden layer feature of the lth layer, represents the representation of the traffic road network; represents an activation function, and W and b represent a weight matrix and a bias matrix, respectively.

[0068] In this embodiment, the traffic road network encoder adopts two layers of ResGAT, sets the number of multi-heads to 4, and sets the hidden layer dimension to 64.

[0069] The environmental encoder takes as input vectors processed by one-hot encoding, including weather (4 categories), time periods (288 categories), and holiday markers (2 categories). The inputs for traffic environmental factors are shown in Table 2 below. After fusion by a two-layer fully connected network, a 64-dimensional semantic vector is output.

[0070] Table 2 Traffic Environmental Factors

[0071]

[0072] Step S3: Design a traffic environment encoder based on a fully connected neural network and extract the representation vector for each traffic environment combination;

[0073] Step S4: Based on the structural relationships and traffic state similarities between roads, construct positive and negative sample pairs, define and minimize the contrastive loss function, and conduct comparative training on the traffic network encoder and the traffic environment encoder to obtain a unified traffic state semantic representation space.

[0074] Among them, positive sample pairs are combinations of road nodes from the same time period or spatially adjacent, and negative sample pairs are combinations of road nodes from significantly different states or spatially distant.

[0075] The contrast loss function is the InfoNCE loss function, as shown in equation (7):

[0076] (7)

[0077] Where, α i and These represent the traffic network and traffic environment in the traffic semantic space, respectively. sim calculates the similarity between the two representation codes; It is a temperature scaling hyperparameter, usually set to 0.2 or 0.07.

[0078] In this embodiment, positive and negative sample pairs are constructed based on traffic state Euclidean distance and road topological adjacency; two encoders (path network encoder and traffic environment encoder) are trained using the InfoNCE loss function to ensure that the semantic representation has state consistency in space.

[0079] In this embodiment, the goal of training the two encoders through contrastive learning is to align representations. Therefore, in this embodiment, the Mean Contrastive Error (MCE) is chosen as the evaluation metric for the model, as shown in the following formula:

[0080] (3-20)

[0081] in, The distance between the two encoded representations is represented by y, where y is the label indicating whether the sample pair matches. A pair of representative samples that match is considered a positive sample. A mismatch between sample pairs is considered a negative sample, where m is a preset distance threshold and N is the total number of all sample pairs. The threshold m defines a radius in the traffic semantic space where only two encoded pairs whose distance is less than this radius contribute to the error; the smaller the MCE, the better the model performance. In this invention, m is set to 2.

[0082] Two encoders map the traffic network and traffic environment into the semantic space, respectively, and use contrastive learning to align data from the two different modalities in the semantic space. Therefore, a spatial distance calculation method is used to study the consistency between the traffic semantic space and the actual traffic state distribution.

[0083] This invention calculates the maximum-minimum normalized Euclidean distance of the encoded data in the semantic space, as well as the Pearson correlation coefficient (PCC) of traffic flow. To compare the normalized Euclidean distance with the PCC, this embodiment converts the PCC to... As shown in formula (3-24). The range of values ​​for both distances is [0,1], and the smaller the value, the higher the correlation.

[0084] (3-24)

[0085] Where X and Y represent two traffic flow sequences, and Let be the mean of these two sequences. and Let be the variance of the two sequences. Let represent the absolute value function.

[0086] Traffic speed data and semantic codes were categorized based on environmental factors. Then, the correlation between three factors—weekday, weather, and time—was calculated, and graphs were plotted as follows: Figure 9 The distance matrix shown. The first column contains traffic flow data. The second column represents the normalized Euclidean distance encoded in the semantic space, and the third column represents the differences between them. The figure shows that the similarity measurements of the same environmental factors in the two spaces are similar, reflecting the consistency between the semantic space and the actual traffic state data distribution. Regarding the correlation of weekday factors in the traffic semantic space, Tuesday, Wednesday, and Thursday are more correlated than Monday and Friday, indicating a significant difference between weekdays and weekends. These situations are consistent with the actual road network traffic conditions. Monday and Friday are the first and last workdays of the week, respectively, and travel is more affected by adjacent rest days, while the commuting patterns of Tuesday, Wednesday, and Thursday, which are the middle workdays, are stable and similar. Weekend traffic is mainly non-commuting and more complex than commuting travel.

[0087] Regarding the correlation of weather factors, the correlation between sunny and cloudy days is higher than that of other weather conditions in the traffic semantic space, indicating that other weather conditions have an independent impact on traffic conditions. Regarding the correlation of time factors, the semantic codes between adjacent time periods show high similarity, while significant abrupt changes occur during periods of drastic traffic changes, such as between 6:00 and 18:00. The distribution of these codes is consistent with the distribution of actual traffic conditions.

[0088] Furthermore, the semantic space further widens the distance between dissimilar traffic states, making their distinguishing features more significant. For example, in temporal correlation, the distance between midnight and noon is much greater in the semantic space than the distance in actual traffic conditions.

[0089] Figure 10 This visualization presents the semantic coding results of the traffic network encoder over four weeks. The horizontal axis shows the time variation, from 0:00 to 24:00, representing 288 codes per day. The vertical axis describes the 64 dimensions of the codes. Colors indicate the magnitude of the values. The graph shows that codes on the same workday are similar, exhibiting a cyclical pattern every seven days, corresponding to the weekly cycle of traffic conditions.

[0090] Step S5: Using a traffic semantic decoder that is symmetrical to the traffic network encoder, the semantic representation output by the encoder is restored to the original traffic state data, and the reconstruction loss is defined;

[0091] The semantic decoder employs a structure combining a graph neural network and a fully connected attribute assignment layer to reconstruct traffic state values.

[0092] The structure of the decoder is symmetrical to that of the traffic network encoder. In the decoder, the structure of the attribute assignment function is symmetrical to the structure of the global readout function in the traffic network encoder; both are fully connected neural networks. The assignment function represents the semantic meaning. Convert to graph node features The data is then input into the residual map multi-head attention layer for feature fusion and transformation, finally obtaining the traffic status of each road segment on the road network. The above process is shown below.

[0093] (8)

[0094] (9)

[0095] (10)

[0096] in, Indicates will Convert to node Feature matrix, This represents the input layer features of the multi-head attention layer in the graph. , and These represent the activation function, weights, and biases, respectively.

[0097] Step S6: Construct the reconstruction loss function, freeze the traffic network encoder, train the traffic semantic decoder using the representation of the traffic network encoder, and obtain a model that recovers the traffic state from the traffic semantic representation space.

[0098] The role of the traffic semantic decoder is to decode semantic codes into realistic traffic network states; the semantic representation of the traffic network encoder is used during decoder training. (Traffic network) The attributes in the model are the targets for reconstructing traffic states. Since the model's output is a reconstruction of the input, the entire framework can be viewed as a structure similar to an autoencoder.

[0099] The training process is shown in formula (11). When training the traffic semantic decoder, the parameters of the traffic network encoder have been successfully pre-trained, so the parameters of the traffic network encoder are frozen at this stage.

[0100] (11)

[0101] in, These are the parameters for the traffic semantic decoder. For traffic network related to traffic state T.

[0102] The two encoders proposed in this invention map the traffic network and traffic environment into the semantic space, respectively, and use contrastive learning to align data from two different modalities in the semantic space. Therefore, a spatial distance calculation method is used to study the consistency between the traffic semantic space and the actual traffic state distribution.

[0103] The traffic semantic decoder consists of two layers of Gaussian Atlas (GAT) and one layer of Multilingual Processing (MLP) to reconstruct traffic speed values ​​from the semantic space. During training, encoder parameters are frozen, and the decoder's reconstruction error is optimized separately. The final trained semantic representation is used for traffic speed prediction and data completion tasks.

[0104] Step S7, verify the effectiveness of the model method in traffic prediction and data completion:

[0105] After training, the learned traffic state semantic representations are used for downstream tasks such as traffic prediction, anomaly detection, or data completion.

[0106] The traffic network encoder and traffic semantic decoder work together to realize the autoencoder architecture of the traffic network to solve the data completion problem; the traffic environment encoder and traffic semantic decoder work together to realize traffic state estimation under any environmental factors.

[0107] In the road network state reconstruction experiment, the speed of each road in the traffic network was reconstructed. The evaluation criteria included root mean squared error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE).

[0108] (3-21)

[0109] (3-22)

[0110] (3-23)

[0111] in, Represents the true value on the road network. This represents the predicted value.

[0112] (1) Velocity prediction task

[0113] Traffic speeds are closely related to traffic environment factors, so we can estimate traffic speeds using only these environmental factors. A traffic environment encoder encodes these environmental factors in a semantic space, which is then decoded by a traffic semantic decoder to obtain the corresponding traffic speed. Through these steps, this section implements traffic speed estimation under arbitrary environmental factors. The model proposed in this embodiment is named TraEnvNet (an abbreviation for Traffic Environment Network). Table 3 describes the traffic speed prediction task.

[0114] Table 3 Traffic Speed ​​Prediction Task

[0115]

[0116] In this embodiment, different time periods of the day were selected to draw the speed color map to represent the traffic status of each road segment, such as... Figure 11As shown, the upper part displays the actual traffic conditions, while the lower part displays the traffic conditions estimated by TraEnvNet. Overall, TraEnvNet effectively reconstructs traffic conditions from traffic environment factors and accurately estimates congested road segments. For example, during the early morning hours, TraEnvNet accurately estimates the congestion on the two lanes of Nanda Hongmen North Road (the blue dashed ellipse in the figure). During morning and evening rush hours, TraEnvNet can estimate common tidal phenomena in the road network, where one direction is congested while the other is smooth (the blue solid ellipse in the figure). During off-peak hours, TraEnvNet can reflect congested road segments concentrated in the central and eastern areas (the blue dashed rectangle in the figure). These two areas are Beijing's central business district, experiencing high traffic volume during the day.

[0117] (2) Data completion task

[0118] As a type of spatiotemporal data, traffic data exhibits both temporal and spatial dependencies. In practical applications, traffic data often faces the problem of missing data. These missing values ​​can be temporal, meaning data is missing from a specific road segment within a particular time period; or spatial, meaning data is missing from multiple road segments at a certain moment. This section aims to address the problem of spatial data missing values.

[0119] In the traffic semantic representation model, the traffic network encoder captures the spatial dependencies of the road network. In the experiment, a portion of road segments are randomly masked, and then these masked road segments are reconstructed using the traffic network encoder and the traffic semantic decoder. The encoder represents the masked traffic network into a semantic space, and then these representations are decoded into the true road network state. This model utilizes only spatial dependencies for data completion and does not use environmental factors.

[0120] In the data completion experiment, to adapt the model to the data completion task, this embodiment fine-tunes the pre-trained road network encoder and semantic decoder. During the fine-tuning process, the masked data is used as input, and the model outputs the recovered data, thereby enabling the encoder and decoder to have the ability to complete data.

[0121] In traffic data completion, environmental factors are readily available. To improve completion accuracy when the mask ratio is high, this embodiment fuses the traffic environment representation with the traffic network representation. To control training costs, a direct fusion method is designed, which uses a gating mechanism to control the weights of the environment and network representations. The calculation formula is shown below:

[0122] (3-25)

[0123] Here, code represents the result after fusion in the traffic semantic space. For the representation of the transportation network, This represents the traffic environment. w is the gating threshold, with a value range of [0,1].

[0124] Table 4 describes the traffic data completion task, and Table 5 shows the experimental results of traffic data completion under different masking rates.

[0125] Table 4 Traffic Data Completion Task

[0126]

[0127] Table 5. Experimental results of traffic data completion under different mask rates

[0128]

[0129] TNER performs best across all masking rates, particularly when the masking rate exceeds 50%. This is because it limits the model's completion search space to the semantic space, preventing the model from generating extreme outliers. The w value of TNER in Table 1 is 0.6, indicating that the fusion of traffic environment representation and traffic network representation improves the accuracy of traffic data completion, especially when the masking rate exceeds 40%. Figure 12 The results are shown with a mask ratio of 0.6. From top to bottom, the figure lists the actual network data, missing data from local road networks, and the data completion results. The mask ratios from left to right are 10%, 30%, 50%, and 70%. The gray edges in the figure represent road segments with missing data, and the other colored edges represent the speeds of each road segment.

[0130] This invention selects two representative tasks to verify the joint representation learning capability of traffic environment factors and traffic network features. The traffic state feature representation model integrates multi-source information from the traffic environment and traffic network into a semantic space. Then, speed estimation and data completion tasks based on the semantic space both achieved good results.

[0131] The TraEnvNet model proposed in this invention can estimate traffic speed based solely on traffic environmental factors, which is of great significance for future traffic management. Managers can provide various environmental factors, and the model can accurately estimate future traffic speeds. In practical applications, the traffic environment representation contains deep semantic information from the road network, and the semantic space establishes the relationship between traffic environmental factors and traffic states. Management departments often need to predict traffic speeds for the next few days, weeks, or even months. In this situation, future traffic environmental factors are readily available, but obtaining traffic speeds over a future period is challenging. The TraEnvNet model effectively solves the speed estimation problem in this context.

[0132] In traffic data completion tasks, the traffic semantic space demonstrates excellent performance under various missing conditions, indicating that it captures the inherent semantic features of traffic states in the road network. Even with significant data loss, the model can still map the road network to a well-defined semantic space. The model with the traffic semantic space outperforms the baseline model under different missing rates and time periods, demonstrating excellent generalization ability in diverse traffic environments and temporal variations. The model in this embodiment consistently exhibits accurate and reliable performance across various scenarios, indicating that its ability to extract traffic semantic information is suitable for practical data completion applications.

Claims

1. A method for learning a unified representation of road network traffic states, characterized in that, include: Step S1: Obtain multi-source traffic state data of the target area from the traffic perception system and construct a graph structure containing road nodes and traffic state attributes; Step S2: Design a traffic network encoder based on graph neural networks to extract the semantic representation vector of each road node; Step S3: Design a traffic environment encoder based on a fully connected neural network and extract the representation vector for each traffic environment combination; Step S4: Based on the structural relationships and traffic state similarities between roads, construct positive and negative sample pairs, define and minimize the contrastive loss function, and conduct comparative training on the traffic network encoder and the traffic environment encoder to obtain a unified traffic state semantic representation space. Step S5: Using a traffic semantic decoder that is symmetrical to the traffic network encoder, the semantic representation output by the encoder is restored to the original traffic state data, and the reconstruction loss is defined; Step S6: Construct the reconstruction loss function, freeze the traffic network encoder, train the traffic semantic decoder using the representation of the traffic network encoder, and obtain a model that recovers the traffic state from the traffic semantic representation space.

2. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, Multi-source traffic status data includes: traffic speed, traffic flow, traffic density, occupancy rate, and weather information.

3. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, Road network diagram structure representing traffic ,in, It is a set of nodes, representing the basic objects in the graph; It is a set of edges, representing the connections between vertices; It is a traffic state attribute matrix associated with each node; Indicates the number of nodes. Indicates the number of traffic status attributes. express Middle node pair There are arrive Directed connection; vertex The neighboring nodes are all nodes that are related to The set of adjacent nodes, using Representation; Adjacency matrix As The topological representation of which, Represents a node and Connected by an edge This indicates a node. and Not connected.

4. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, The calculation formula for the traffic network encoder is as follows: ,(1) ,(2) ,(3) ,(4) in, Represents a node and Attention weights between them It is a node Features Represents a node The neighborhood, represents the activation function, and W represents the weight matrix; Represents the hidden layer features of layer l. Representation of the transportation network; represents the activation function, and W and b represent the weight and bias matrices, respectively.

5. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, The structure of the decoder is symmetrical to that of the traffic network encoder, conforming to the following: (8) (9) (10) in, Indicates will Convert to node Feature matrix, This represents the input layer features of the multi-head attention layer in the graph; , and These represent the activation function, weights, and biases, respectively.

6. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, Positive sample pairs are combinations of road nodes from the same time period or spatially adjacent, while negative sample pairs are combinations of road nodes from significantly different states or spatially distant. The contrast loss function is the InfoNCE loss function, as shown in equation (7): (7) Where, α i and These are the representations of the traffic network and traffic environment in the traffic semantic space, respectively; sim calculates the similarity between the two representation codes; It is a temperature scaling hyperparameter; The goal of contrastive learning in training two encoders is to align representations, so the average contrastive error is chosen as the evaluation metric for the model.

7. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, The semantic decoder employs a structure combining a graph neural network and a fully connected attribute assignment layer to reconstruct traffic state values.

8. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, The traffic semantic decoder decodes semantic codes into the actual traffic network status; When training the traffic semantic decoder, the parameters of the traffic network encoder are frozen. (11) in, These are the parameters for the traffic semantic decoder. For the traffic network related to traffic state T.

9. The method for learning a unified representation of road network traffic states according to claim 1, characterized in that, After step S6, proceed as follows: Step S7, verify the effectiveness of the model method in traffic prediction and data completion: After training, the learned traffic state semantic representation is used for downstream tasks such as traffic prediction, anomaly detection or data completion.

10. The method for learning a unified representation of road network traffic states according to claim 9, characterized in that, Traffic speed estimation is achieved using the TraEnvNet model based on traffic environmental factors.