Knowledge graph generation based on traffic state, traffic state prediction method and device

By generating a knowledge graph based on traffic conditions and training the traffic state relationships of road segments using an initial mapping matrix and a target loss function, the problem of difficulty in predicting the impact of traffic events in existing technologies is solved, and accurate prediction and management of road segment traffic conditions are achieved.

CN115905551BActive Publication Date: 2026-03-20HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies are insufficient to effectively predict the impact of road traffic events on road capacity, leading to traffic congestion and unpredictable traffic conditions.

Method used

By generating a knowledge graph based on traffic conditions, training the knowledge graph using an initial mapping matrix and a target loss function, the relationships between traffic conditions of road segments are learned, and the traffic conditions of road segments are predicted.

Benefits of technology

It enables effective prediction of road segment traffic conditions, timely identification and prediction of the impact range of traffic incidents, and improves the efficiency and accuracy of traffic management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905551B_ABST
    Figure CN115905551B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a knowledge graph generation method and device based on a traffic state, and a traffic state prediction method and device, relates to the technical field of intelligent transportation, and the knowledge graph generation method comprises the following steps: for each two associated road sections, based on a first initial mapping matrix, a second initial mapping matrix and a third initial mapping matrix of a knowledge graph to be trained, the historical traffic state of the two associated road sections at a historical moment, the road section relationship and the historical moment are mapped respectively, and a corresponding real mapping quadruple is obtained; based on a target loss function, the first initial mapping matrix, the second initial mapping matrix and the third initial mapping matrix are adjusted, and the training is continued until the target loss function reaches a convergence condition, and a first target mapping matrix, a second target mapping matrix and a third target mapping matrix are obtained. Based on the knowledge graph, the traffic state of the road section can be effectively predicted.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent transportation, in particular to a knowledge graph generation based on traffic states and a traffic state prediction method and device. BACKGROUND

[0002] With the continuous popularity of vehicles, more and more users choose to travel by car. In addition, traffic events frequently occur in road traffic, such as traffic accidents, vehicle breakdowns, road maintenance, large-scale activities, and the like. Such traffic events will affect the traffic capacity of the road, and in turn, will affect the traffic of vehicles. SUMMARY

[0003] The purpose of the embodiments of the present application is to provide a knowledge graph generation based on traffic states and a traffic state prediction method and device, which can effectively predict the traffic state of a road section. The specific technical solutions are as follows:

[0004] In a first aspect, in order to achieve the above-mentioned purpose, the present application discloses a knowledge graph generation method based on traffic states, which comprises:

[0005] Obtaining a first initial mapping matrix for traffic states, a second initial mapping matrix for road section relationships, and a third initial mapping matrix for time in a knowledge graph to be trained;

[0006] For each two associated road sections in a target road network, based on the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix, the historical traffic states of the two associated road sections at a historical time, the road section relationships between the two associated road sections, and the historical time are mapped respectively to obtain real mapping quadruples corresponding to the two associated road sections;

[0007] Obtaining broken mapping quadruples corresponding to each real mapping quadruple;

[0008] Based on a target loss function, adjusting the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix for continuous training until the target loss function reaches a convergence condition, obtaining a first target mapping matrix for traffic states, a second target mapping matrix for road section relationships, and a third target mapping matrix for time in the knowledge graph;

[0009] The target loss function is obtained based on the difference between the scoring function corresponding to the real mapping quadruples and the scoring function corresponding to the broken mapping quadruples.

[0010] Optionally, for each two associated road segments in the target road network, based on the first initial mapping matrix, the second initial mapping matrix and the third initial mapping matrix, the historical traffic state of the two associated road segments at a historical time, the road segment relationship between the two associated road segments and the historical time are mapped respectively to obtain a corresponding real mapping quadruple of the two associated road segments, including:

[0011] For each road segment in the target road network, obtain the corresponding original quadruple of the road segment; wherein an original quadruple contains the historical traffic state of the road segment at a historical time, the historical traffic state of another road segment associated with the road segment at the historical time, the road segment relationship between the road segment and the associated another road segment, and the historical time;

[0012] For each original quadruple, the historical traffic state in the original quadruple is mapped according to the first initial mapping matrix to obtain a mapped traffic state; the road segment relationship in the original quadruple is mapped according to the second initial mapping matrix to obtain a mapped road segment relationship; the historical time in the original quadruple is mapped according to the third initial mapping matrix to obtain a mapped historical time, so as to obtain a corresponding candidate mapping quadruple of the original quadruple;

[0013] Based on the first conversion matrix, each candidate mapping quadruple is converted to obtain a linear matrix corresponding to the candidate mapping quadruple;

[0014] Based on the second conversion matrix, each linear matrix is converted to obtain the weight of the candidate mapping quadruple corresponding to the linear matrix;

[0015] Based on the respective weights, the weighted sum of each candidate mapping quadruple corresponding to the road segment is calculated to obtain the embedding vector of the historical traffic state of the road segment;

[0016] For each two associated road segments in the target road network, the historical traffic state of the road segment, the road segment relationship and the historical time in the original quadruple corresponding to the two associated road segments are replaced by the corresponding embedding vector, the mapped road segment relationship and the mapped historical time respectively to obtain the corresponding real mapping quadruple.

[0017] Optionally, the historical traffic state includes at least one of the following: actual traffic flow of the road segment, maximum traffic flow supported by the road segment, vehicle density of the road segment, length of the road segment, road segment type of the road segment and average vehicle travel speed of the road segment.

[0018] Optionally, the road segment relationship between the two associated road segments comprises at least one of: relative positions of the two road segments, whether there is an intersection between the two road segments, whether there is a traffic flow separation between the two road segments, whether there is a traffic flow merging between the two road segments, and a ratio of actual traffic flows of the two road segments.

[0019] In a second aspect, to achieve the above object, an embodiment of the present application discloses a traffic state prediction method, which comprises:

[0020] determining a first road segment in a target road network where a target traffic event occurs, and a second road segment associated with the first road segment;

[0021] obtaining a traffic state of the first road segment at a future time as a first traffic state;

[0022] calculating a traffic state of the second road segment at the future time as a second traffic state according to the first traffic state, a road segment relationship between the first road segment and the second road segment, the future time, and a knowledge graph;

[0023] The knowledge graph is generated based on any one of the above traffic state-based knowledge graph generation methods.

[0024] Optionally, after the calculating a traffic state of the second road segment at the future time as a second traffic state according to the first traffic state, a road segment relationship between the first road segment and the second road segment, and a knowledge graph, the method further comprises:

[0025] determining whether the second road segment is a road segment affected by the target traffic event based on the second traffic state.

[0026] Optionally, the second traffic state comprises a vehicle density of the second road segment.

[0027] The determining whether the second road segment is a road segment affected by the target traffic event based on the second traffic state comprises:

[0028] If the vehicle density of the second road segment is greater than a preset density threshold, it is determined that the second road segment is a road segment affected by the target traffic event.

[0029] Optionally, the calculating a traffic state of the second road segment at the future time as a second traffic state according to the first traffic state, a road segment relationship between the first road segment and the second road segment, the future time, and a knowledge graph comprises:

[0030] map the first traffic state, the road section relationship between the first road section and the second road section, and the future time based on the first target mapping matrix for the traffic state, the second target mapping matrix for the road section relationship, and the third target mapping matrix for the time in the knowledge graph, to obtain a target mapping quadruple of the first road section and the second road section at the future time.

[0031] calculate an optimal solution when a score function corresponding to the target mapping quadruple takes a minimum value, to obtain a second traffic state of the second road section at the future time.

[0032] In a third aspect, to achieve the above object, the present application discloses a knowledge graph generation device based on traffic state, the device comprises:

[0033] An initial mapping matrix acquisition module is configured to acquire a first initial mapping matrix for traffic state, a second initial mapping matrix for road section relationship, and a third initial mapping matrix for time in a knowledge graph to be trained.

[0034] A real mapping quadruple acquisition module is configured to map, for each two associated road sections in a target road network, a historical traffic state of the two associated road sections at a historical time, a road section relationship between the two associated road sections, and the historical time based on the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix, to obtain a real mapping quadruple corresponding to the two associated road sections.

[0035] A broken mapping quadruple acquisition module is configured to acquire a broken mapping quadruple corresponding to each real mapping quadruple.

[0036] A training module is configured to adjust the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix based on a target loss function, continue training, until the target loss function reaches a convergence condition, to obtain a first target mapping matrix for traffic state, a second target mapping matrix for road section relationship, and a third target mapping matrix for time in the knowledge graph.

[0037] The target loss function is obtained based on a difference between a score function corresponding to the real mapping quadruple and a score function corresponding to the broken mapping quadruple.

[0038] Optionally, the real mapping quadruple acquisition module comprises:

[0039] The original quadruple acquisition submodule is used to acquire each original quadruple corresponding to each road segment in the target road network; wherein, an original quadruple includes the historical traffic state of the road segment at a historical time, the historical traffic state of another road segment associated with the road segment at the historical time, the road segment relationship between the road segment and the other associated road segment, and the historical time;

[0040] The candidate mapping quadruple acquisition submodule is used to map the historical traffic states in the original quadruple according to the first initial mapping matrix to obtain the mapped traffic states; to map the road segment relationships in the original quadruple according to the second initial mapping matrix to obtain the mapped road segment relationships; and to map the historical times in the original quadruple according to the third initial mapping matrix to obtain the mapped historical times, so as to obtain the candidate mapping quadruple corresponding to the original quadruple.

[0041] The linear matrix acquisition submodule is used to transform each candidate mapping quadruple based on the first transformation matrix to obtain the linear matrix corresponding to the candidate mapping quadruple.

[0042] The weight acquisition submodule is used to transform each linear matrix based on the second transformation matrix to obtain the weights of the candidate mapping quadruples corresponding to the linear matrix.

[0043] The embedding vector acquisition submodule is used to calculate the weighted sum of each candidate mapping quadruple corresponding to the road segment based on their respective weights, and obtain the embedding vector of the historical traffic state of the road segment.

[0044] The real mapping quad tuple acquisition submodule is used to replace the historical traffic state, road segment relationship and historical time of the original quad tuple corresponding to the two related road segments in the target road network with the corresponding embedding vector, mapped road segment relationship and mapped historical time, respectively, to obtain the corresponding real mapping quad tuple.

[0045] Optionally, the historical traffic conditions include at least one of the following: the actual traffic flow of the road segment, the maximum traffic flow supported by the road segment, the vehicle density of the road segment, the length of the road segment, the road segment type, and the average vehicle speed of the road segment.

[0046] Optionally, the relationship between two associated road segments includes at least one of the following: the relative positions of the two road segments, whether there is an intersection between the two road segments, whether there is traffic flow separation between the two road segments, whether there is traffic flow merging between the two road segments, and the ratio of the actual traffic volume of the two road segments.

[0047] Fourthly, in order to achieve the above objectives, embodiments of this application disclose a traffic state prediction device, the device comprising:

[0048] a link determination module configured to determine a first link in a target road network on which a target traffic event occurs, and a second link associated with the first link;

[0049] a first traffic state acquisition module configured to acquire a traffic state of the first link at a future time as a first traffic state;

[0050] a second traffic state calculation module configured to calculate a traffic state of the second link at the future time as a second traffic state according to the first traffic state, a link relationship between the first link and the second link, the future time, and a knowledge graph;

[0051] The knowledge graph is generated based on any one of the knowledge graph generation methods based on traffic states.

[0052] Optionally, the device further comprises:

[0053] a processing module configured to determine whether the second link is a link affected by the target traffic event based on the second traffic state after calculating the traffic state of the second link at the future time as the second traffic state according to the first traffic state, the link relationship between the first link and the second link, and the knowledge graph.

[0054] Optionally, the second traffic state comprises a vehicle density of the second link.

[0055] The processing module is specifically configured to determine that the second link is the link affected by the target traffic event if the vehicle density of the second link is greater than a preset density threshold.

[0056] Optionally, the second traffic state calculation module comprises:

[0057] a target mapping quadruple acquisition submodule configured to map the first traffic state, the link relationship between the first link and the second link, and the future time based on a first target mapping matrix for traffic states, a second target mapping matrix for link relationships, and a third target mapping matrix for time in the knowledge graph to obtain a target mapping quadruple of the first link and the second link at the future time.

[0058] a second traffic state calculation submodule configured to calculate an optimal solution when a score function corresponding to the target mapping quadruple takes a minimum value to obtain the second traffic state of the second link at the future time.

[0059] In another aspect of the embodiments of the present application, in order to achieve the above object, the embodiments of the present application further disclose an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus.

[0060] The memory is used for storing a computer program.

[0061] The processor is used for executing the program stored on the memory, and realizes the knowledge graph generation method based on traffic states or the traffic state prediction method according to any one of the above.

[0062] In still another aspect of the embodiments of the present application, a computer readable storage medium is further provided, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the knowledge graph generation method based on traffic states or the traffic state prediction method according to any one of the above.

[0063] The embodiments of the present application further provide a computer program product containing instructions, which, when executed on a computer, cause the computer to perform the knowledge graph generation method based on traffic states or the traffic state prediction method according to any one of the above.

[0064] The embodiments of the present application have the following beneficial effects:

[0065] The knowledge graph generation method based on traffic states provided by the embodiments of the present application can obtain a first initial mapping matrix for traffic states, a second initial mapping matrix for road segment relationships and a third initial mapping matrix for time in a knowledge graph to be trained; for each two associated road segments in a target road network, the historical traffic states of the two associated road segments at a historical time, the road segment relationships between the two associated road segments and the historical time are mapped based on the first initial mapping matrix, the second initial mapping matrix and the third initial mapping matrix, to obtain real mapping quadruples corresponding to the two associated road segments; the smashed mapping quadruples corresponding to each real mapping quadruple are obtained; the first initial mapping matrix, the second initial mapping matrix and the third initial mapping matrix are adjusted based on a target loss function, and the training is continued until the target loss function reaches a convergence condition, to obtain a first target mapping matrix for traffic states, a second target mapping matrix for road segment relationships and a third target mapping matrix for time in the knowledge graph; wherein the target loss function is obtained based on a difference between a scoring function corresponding to the real mapping quadruples and a scoring function corresponding to the smashed mapping quadruples.

[0066] Based on the above processing, the knowledge graph obtained by training contains the first target mapping matrix, the second target mapping matrix and the third target mapping matrix. The knowledge graph can learn the relationship between the traffic states of the road segments. Therefore, based on the existing traffic states of the road segments, the traffic states of other road segments can be predicted, that is, the traffic states of the road segments can be effectively predicted.

[0067] Of course, implementing any of the products or methods of the present application does not necessarily require achieving all the advantages described above at the same time. BRIEF DESCRIPTION OF DRAWINGS

[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other embodiments can also be obtained by those skilled in the art based on these drawings.

[0069] Figure 1 A flowchart of a knowledge graph generation method based on traffic states provided by an embodiment of the present application;

[0070] Figure 2 A flowchart of another knowledge graph generation method based on traffic states provided by an embodiment of the present application;

[0071] Figure 3A A schematic diagram of dividing a road network provided by an embodiment of the present application;

[0072] Figure 3B Another schematic diagram of dividing a road network provided by an embodiment of the present application;

[0073] Figure 3C Another schematic diagram of dividing a road network provided by an embodiment of the present application;

[0074] Figure 4 A flowchart of a traffic state prediction method provided by an embodiment of the present application;

[0075] Figure 5 A flowchart of another traffic state prediction method provided by an embodiment of the present application;

[0076] Figure 6 A flowchart of another traffic state prediction method provided by an embodiment of the present application;

[0077] Figure 7 A schematic diagram of a traffic state prediction provided by an embodiment of the present application;

[0078] Figure 8 A structural diagram of a knowledge graph generation device based on traffic states provided by an embodiment of the present application;

[0079] Figure 9 A structural diagram of a traffic state prediction device provided by an embodiment of the present application is provided.

[0080] Figure 10 A structural diagram of an electronic device provided by an embodiment of the present application is provided. DETAILED DESCRIPTION

[0081] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present application.

[0082] The embodiments of the present application provide a knowledge graph generation method based on a traffic state. The method can be applied to an electronic device. The electronic device can obtain historical traffic states of road segments in a road network and road segment relationships between the road segments. Based on the knowledge graph generation method based on a traffic state provided by the embodiments of the present application, a knowledge graph is generated. In addition, the electronic device can also predict traffic states of road segments based on the generated knowledge graph.

[0083] For example, the traffic state of a road segment can be detected by a detection device installed on a road side. The electronic device can communicate with the detection device. Accordingly, the electronic device can obtain the traffic state of the road segment from the detection device and process the traffic state based on the method provided by the embodiments of the present application.

[0084] For another example, the electronic device can also be a detection device installed on a road side. Accordingly, the electronic device can directly detect the traffic state of a road segment and process the traffic state based on the method provided by the embodiments of the present application.

[0085] Referring to Figure 1 , Figure 1 A flowchart of a knowledge graph generation method based on a traffic state provided by an embodiment of the present application is provided. The method can include the following steps.

[0086] S101: Obtain a first initial mapping matrix for a traffic state, a second initial mapping matrix for a road segment relationship, and a third initial mapping matrix for a time in a knowledge graph to be trained.

[0087] S102: For each two associated road segments in the target road network, based on the first initial mapping matrix, the second initial mapping matrix and the third initial mapping matrix, the historical traffic state of the two associated road segments at the historical moment, the road segment relationship between the two associated road segments, and the historical moment are mapped respectively to obtain a real mapping quadruple corresponding to the two associated road segments.

[0088] S103: Obtain a broken mapping quadruple corresponding to each real mapping quadruple.

[0089] S104: Based on the target loss function, adjust the first initial mapping matrix, the second initial mapping matrix and the third initial mapping matrix, continue training until the target loss function reaches the convergence condition, and obtain the first target mapping matrix for the traffic state, the second target mapping matrix for the road segment relationship and the third target mapping matrix for the time in the knowledge graph.

[0090] The target loss function is obtained based on the difference between the score function corresponding to the real mapping quadruple and the score function corresponding to the broken mapping quadruple.

[0091] Based on the knowledge graph generation method provided in the embodiments of the present application, the knowledge graph obtained by training includes the first target mapping matrix, the second target mapping matrix and the third target mapping matrix. The knowledge graph can learn the relationship between the traffic states of each road segment. Therefore, based on the existing traffic states of the road segments, the traffic states of other road segments can be predicted, that is, the traffic states of the road segments can be effectively predicted.

[0092] Because there is an association relationship between each road segment in the target road network, the road segments will affect each other, that is, the traffic states of each road segment are associated with each other. The knowledge graph constructed based on the historical traffic states can effectively reflect the association relationship between the traffic states of each road segment, and then the traffic states of the road segments can be predicted based on the knowledge graph. For example, if a road segment has a traffic accident, it will cause the road segment to prohibit vehicle traffic. Then, it can be determined that according to the vehicle flow direction, the downstream road segment of the road segment is not affected by the target traffic event, and because there is no vehicle entering the upstream road segment, the actual traffic flow and vehicle density of the road segment decrease over time. The actual flow and vehicle density of the upstream road segment increase continuously until congestion due to the blocked vehicle flow.

[0093] The knowledge graph can be represented by "instance-relation-instance". In the embodiments of the present application, one instance represents one road segment, and the relationship between two instances represents the road segment relationship between the corresponding two road segments.

[0094] Two associated road segments, which can be two directly adjacent road segments in the target road network, or two indirectly adjacent road segments. Therefore, the road segment associated with a road segment can be one or more.

[0095] The traffic state of a road segment, the road segment relationship between road segments, and the time are in different vector spaces respectively. In order to facilitate calculation, the above information can be projected into the same hyperplane respectively to obtain the corresponding embedding vectors respectively. Each embedding vector constitutes a real mapping quadruple.

[0096] In an implementation manner, after obtaining each real mapping quadruple, elements in each real mapping quadruple can be randomly combined. Each quadruple obtained by combination can be referred to as a broken mapping quadruple. It can be understood that the broken mapping quadruple can be used as an incorrect sample to train the knowledge graph, and the real mapping quadruple can be used as a correct sample to train the knowledge graph.

[0097] In an implementation manner, for two associated road segments, the traffic state of one road segment is represented by h, the traffic state of the other road segment is represented by τ, the road segment relationship between the two road segments is represented by r, and the corresponding time is represented by t.

[0098] For a quadruple (h, r, τ, t) composed of the above information, when it is established, h+r+t≈τ can be considered (that is, through the time t, the head instance h, and the road segment relationship r, the tail instance τ can be determined). Therefore, the purpose of training the knowledge graph is to constantly adjust h, r, and t, so that (h+r+t) is equal to τ. In addition, the degree of h+r+t≈τ can be measured by a scoring function, such as formula (1):

[0099] f(h, r, τ, t) = d(h+r+t, τ) (1)

[0100] Where f(h, r, τ, t) represents the scoring function corresponding to the quadruple. For example, d(h+r+t, τ) =‖e h +e r +e t -e τ ‖, ‖·‖ can be L1 norm, or L2 norm. e h ,e r ,e t ,e τ are embedding representations of h, r, τ, and t respectively, that is, the corresponding embedding vectors.

[0101] The target loss function can be seen in formula (2).

[0102]

[0103] wherein L represents a target loss function, S represents a set of real mapping quadruples, S' represents a set of broken mapping quadruples. (h,r,τ,t) + + + wherein γ>0 represents a preset hyper-parameter.

[0104] For h, r, t and τ in the above formula (2), each can be replaced by a corresponding embedding vector. Gradient descent and other heuristic search algorithms can be used for training.

[0105] Exemplarily, each embedding vector can be obtained based on formula (3).

[0106] h h r r τ h t t (3)

[0107] wherein M h represents a first initial mapping matrix, M r represents a second initial mapping matrix, and M t represents a third initial mapping matrix; correspondingly, e h represents a result of mapping traffic state h, e τ represents a result of mapping traffic state τ, e r represents a result of mapping road section relationship r, and e t represents a result of mapping time t.

[0108] In one implementation, the above mapping results can be used as corresponding embedding vectors, and a quadruple composed of each embedding vector is an alternative mapping quadruple in the following.

[0109] In one embodiment, the alternative mapping quadruple can be directly used as a corresponding real mapping quadruple.

[0110] In another embodiment, referring to Figure 2 the above step S102 can include the following steps.

[0111] S1021: For each road section in a target road network, obtain each original quadruple corresponding to the road section.

[0112] ​​​​​​​​​​​wherein one original quadruple contains a historical traffic state of the road segment at a historical time, a historical traffic state of another road segment associated with the road segment at the historical time, a road segment relationship between the road segment and the associated another road segment, and the historical time.

[0113] S1022: For each original quadruple, the historical traffic state in the original quadruple is mapped according to a first initial mapping matrix to obtain a mapped traffic state; the road segment relationship in the original quadruple is mapped according to a second initial mapping matrix to obtain a mapped road segment relationship; and the historical time in the original quadruple is mapped according to a third initial mapping matrix to obtain a mapped historical time, so as to obtain a candidate mapped quadruple corresponding to the original quadruple.

[0114] S1023: Each candidate mapped quadruple is converted based on a first conversion matrix to obtain a linear matrix corresponding to the candidate mapped quadruple.

[0115] S1024: Each linear matrix is converted based on a second conversion matrix to obtain a weight of the candidate mapped quadruple corresponding to the linear matrix.

[0116] S1025: Based on the respective weights, a weighted sum of each candidate mapped quadruple corresponding to the road segment is calculated to obtain an embedding vector of the historical traffic state of the road segment.

[0117] S1026: For each two associated road segments in the target road network, the historical traffic state of the road segment, the road segment relationship and the historical time in the original quadruple corresponding to the two associated road segments are respectively replaced by the corresponding embedding vector, the mapped road segment relationship and the mapped historical time to obtain a corresponding real mapped quadruple.

[0118] In one embodiment, the original quadruple corresponding to the road segment i and the road segment j is represented as (h i ,r k ,h j ,t p ), h i represents the historical traffic state of the road segment i, h j represents the historical traffic state of the road segment j, r k represents the road segment relationship between the road segment i and the road segment j, and t p represents the corresponding historical time.

[0119] The candidate mapped quadruple corresponding to the original quadruple can be represented as The corresponding linear matrix can be represented by formula (4):

[0120]

[0121] wherein c ijkpdenotes a corresponding linear matrix, W1 denotes a first conversion matrix, denotes preset processing on four elements in an alternative mapping quadruple, for example, can denote calculating a product of the four elements, or also can denote calculating a weighted sum of the four elements.

[0122] Further, based on formula (5), the weight of the alternative mapping quadruple corresponding to the linear matrix can be obtained.

[0123] b ijkp = W2c ijkp (5)

[0124] wherein b ijkp denotes the weight of the alternative mapping quadruple corresponding to the linear matrix, and W2 denotes a second conversion matrix.

[0125] In an embodiment, the weight of the alternative mapping quadruple can also be normalized to obtain a normalized weight, and further, based on the normalized weight, a weighted sum of each alternative mapping quadruple corresponding to the road segment is calculated to obtain the embedding vector of the historical traffic state of the road segment.

[0126] For example, based on formula (6), the weight of the alternative mapping quadruple can be normalized.

[0127]

[0128] N i denotes a set of road segments associated with the road segment i, R in denotes a set of road segment relationships between the road segment i and the associated road segments, T i denotes a set of historical time points.

[0129] Further, based on formula (7), the embedding vector of the historical traffic state of the road segment i can be calculated.

[0130]

[0131] wherein, denotes the embedding vector of the historical traffic state of the road segment i, R ij denotes a set of road segment relationships between the road segment i and the road segment j, and σ denotes a preset activation function, for example, can be a Sigmoid function, or also can be a Relu (The Rectified Linear Unit) function.

[0132] Further, the embedding vector of the traffic state h can be used to replace h in formula (2), and the embedding vector of the traffic state r can be used to replace r in formula (2), to obtain a target loss function containing weights.

[0133] The road segment relationship between two road segments can be determined according to the relative positions of the two road segments in the target road network. See Figure 3A , Figure 3A A schematic diagram for dividing a road network is provided in an embodiment of the present application.

[0134] Figure 3A In the above, the arrow indicates the direction of the vehicle flow. For a road in a vehicle flow direction, according to the direction of the vehicle flow, i represents the ith road segment, i+1 represents the i+1th road segment, and Figure 3A In the above, the ith road segment and the i+1th road segment are both mixed road segments, and the mixed road segment represents a road segment without divided lanes.

[0135] See Figure 3B , Figure 3B Another schematic diagram for dividing a road network is provided in an embodiment of the present application.

[0136] Figure 3B In the above, the arrow indicates the direction of the vehicle flow. For a road in a vehicle flow direction, according to the direction of the vehicle flow, i represents the ith road segment, i+1 represents the i+1th road segment, and Figure 3B In the above, the ith road segment is a mixed road segment, and the i+1th road segment is a channelized road segment, that is, the channelized road segment represents a road segment divided into multiple lanes.

[0137] See Figure 3C , Figure 3C Another schematic diagram for dividing a road network is provided in an embodiment of the present application.

[0138] Figure 3C In the above, the arrow indicates the direction of the vehicle flow. For a road in a vehicle flow direction, according to the direction of the vehicle flow, i represents the ith road segment, i-1 represents the i-1th road segment, and Figure 3C In the above, the ith road segment is a mixed road segment, and the i-1th road segment is a channelized road segment, that is, the i-1th road segment is divided into multiple lanes.

[0139] In an embodiment, the road segment relationship between two associated road segments includes at least one of the following: the relative positions of the two road segments, whether there is an intersection between the two road segments, whether there is a vehicle flow separation between the two road segments, whether there is a vehicle flow merging between the two road segments, and the ratio of the actual vehicle flow of the two road segments.

[0140] In an embodiment of the present application, the road segment relationship between two road segments can be determined according to the directions of vehicles in the two road segments. See Figure 3A , Figure 3A In the above, there is no intersection between the ith road segment and the i+1th road segment. See Figure 3C , Figure 3C In the above, there is an intersection between the i-1th road segment and the ith road segment. See Figure 3BFigure 3B In the embodiment, there is traffic separation between the ith road segment and the i+1th road segment, i.e., from the ith road segment to the i+1th road segment, the road changes from a mixed road to a channelized road. See Figure 3C Figure 3C In the embodiment, there is traffic merging between the i-1th road segment and the ith road segment, i.e., from the i-1th road segment to the ith road segment, the road changes from a channelized road to a mixed road.

[0141] In an embodiment, the historical traffic state includes at least one of the following: an actual traffic volume of the road segment, a maximum traffic volume supported by the road segment, a vehicle density of the road segment, a length of the road segment, a road segment type of the road segment, and an average vehicle travel speed of the road segment.

[0142] In the embodiments of the present application, the traffic state of a road segment represents the traffic condition of the road segment within a certain time length.

[0143] For example, the actual traffic volume of a road segment at the current time can represent the total number of vehicles passing through the road segment within a preset time length before the current time.

[0144] The maximum traffic volume supported by a road segment can represent the maximum number of vehicles allowed to pass through the road segment within a preset time length before the current time.

[0145] The vehicle density of a road segment can represent the ratio of the total number of vehicles in the road segment at the current time to the length of the road segment.

[0146] The road segment type of a road segment can be a mixed road or a channelized road.

[0147] For each vehicle passing through the road segment within a preset time length before the current time, the time length required for the vehicle to travel through the road segment can be calculated, and then the ratio of the length of the road segment to the time length is calculated as the travel speed of the vehicle. Then, the average of the travel speeds of the vehicles is calculated as the average travel speed of the vehicles in the road segment.

[0148] Based on the same inventive concept, the embodiments of the present application also provide a traffic state prediction method, see Figure 4 Figure 4 A flowchart of a traffic state prediction method provided by the embodiments of the present application, which can include the following steps:

[0149] S401: Determine a first road segment in which a target traffic event occurs in a target road network, and a second road segment associated with the first road segment.

[0150] S402: Obtain a traffic state of the first road segment at a future time as a first traffic state.

[0151] ​​​S403: According to the first traffic state, the road section relationship between the first road section and the second road section, the future time, and the knowledge graph, the traffic state of the second road section at the future time is calculated as the second traffic state.

[0152] The knowledge graph is generated based on any of the knowledge graph generation methods.

[0153] The traffic state prediction method provided in the embodiments of the present application can learn the relationship between the traffic states of the road sections through the knowledge graph containing the first target mapping matrix, the second target mapping matrix, and the third target mapping matrix. Therefore, the traffic state of other road sections can be predicted based on the traffic state of the existing road sections, that is, the traffic state of the road section can be effectively predicted.

[0154] For step S401, the first road section can be any road section in the target road network, and a target traffic event occurs in the first road section. The target traffic event can be a traffic accident, a vehicle breakdown, road maintenance, a large-scale event, etc.

[0155] For step S402, if the target traffic event occurs in the first road section, the first traffic state of the first road section can be determined based on the target traffic event. For example, if the target traffic event is a traffic accident, it can be determined that the first road section is prohibited from passing through vehicles, and accordingly, the first traffic state of the first road section conforms to the jam state, for example, the traffic capacity of the first road section at the future time is 0, and the average driving speed of the vehicle is 0.

[0156] In one embodiment, the above step S403 can include the following steps:

[0157] Step one: based on the first target mapping matrix for the traffic state, the second target mapping matrix for the road section relationship, and the third target mapping matrix for the time in the knowledge graph, the first traffic state, the road section relationship between the first road section and the second road section, and the future time are mapped respectively to obtain the target mapping four-tuple of the first road section and the second road section at the future time.

[0158] Step two: the optimal solution when the score function corresponding to the target mapping four-tuple takes the minimum value is calculated to obtain the second traffic state of the second road section at the future time.

[0159] In the embodiments of the present application, after the first traffic state, the road section relationship between the first road section and the second road section, and the future time are obtained, the embedding vectors of the first target mapping matrix, the second target mapping matrix, and the third target mapping matrix can be calculated respectively.

[0160] Further, based on the obtained embedding vectors, a mapping four tuple of the first road segment and the second road segment at a future time can be determined, wherein the embedding vector corresponding to the second traffic state in the mapping four tuple is an unknown quantity. Then, an optimal solution when a score function corresponding to the mapping four tuple takes a minimum value can be calculated, and thus the embedding vector corresponding to the second traffic state can be obtained. Further, the second traffic state can be obtained based on the above formulas (4) to (7).

[0161] In the embodiments of the present application, the knowledge graph can be periodically trained and updated, and historical data does not need to be accumulated all the time, that is, a large database does not need to be maintained all the time, and thus the efficiency of traffic state prediction can be improved.

[0162] In one embodiment, referring to Figure 5 , the method can further include the following steps after the step S403: Figure 4

[0163] S404: Based on the second traffic state, determining whether the second road segment is a road segment affected by the target traffic event.

[0164] In the embodiments of the present application, after the second traffic state is determined, whether the second road segment is affected by the target traffic event in the first road segment can be determined based on the second traffic state. Correspondingly, if the second road segment is affected by the target traffic event, the user can be reminded to perform traffic control on the second road segment to avoid traffic congestion of the second road segment.

[0165] In one embodiment, the second traffic state includes a vehicle density of the second road segment. Correspondingly, referring to Figure 6 , the step S404 can include the following steps based on Figure 5

[0166] S4041: If the vehicle density of the second road segment is greater than a preset density threshold, it is determined that the second road segment is a road segment affected by the target traffic event.

[0167] In the embodiments of the present application, if the predicted vehicle density of the second road segment is greater than the preset density threshold, it indicates that the influence of the target traffic event occurring in the first road segment on the second road segment is large, which can cause congestion of the second road segment. Therefore, it can be determined that the second road segment is affected by the target traffic event. Based on the above processing, the influence range of the target traffic event can be determined.

[0168] Referring to Figure 7 , Figure 7 is a schematic diagram of a traffic state prediction provided in the embodiments of the present application.

[0169] ​​The road network is divided in advance to obtain a plurality of road segments, and then, based on historical traffic states of the road segments and road segment relationships between the road segments, a knowledge graph can be constructed.

[0170] When a traffic event causes a change in the traffic state of a road segment (i.e., a first road segment), the traffic state of an upstream or downstream road segment (i.e., a second traffic state of a second road segment) can be inferred based on the traffic state of the first road segment through the knowledge graph.

[0171] Further, the influence range of the traffic event can be predicted, i.e., based on the second traffic state, the second road segment affected by the traffic event is determined.

[0172] Based on the same inventive concept, the embodiments of the present application also provide a knowledge graph generation device based on traffic states, which is described with reference to Figure 8 , Figure 8 The structure diagram of the knowledge graph generation device based on traffic states provided by the embodiments of the present application can include:

[0173] An initial mapping matrix acquisition module 801 is configured to acquire a first initial mapping matrix for traffic states, a second initial mapping matrix for road segment relationships, and a third initial mapping matrix for time in a knowledge graph to be trained.

[0174] A real mapping quadruple acquisition module 802 is configured to, for each two associated road segments in a target road network, map the historical traffic states of the two associated road segments at a historical time, the road segment relationship between the two associated road segments, and the historical time based on the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix, respectively, to obtain a real mapping quadruple corresponding to the two associated road segments.

[0175] A smashed mapping quadruple acquisition module 803 is configured to acquire a smashed mapping quadruple corresponding to each real mapping quadruple.

[0176] A training module 804 is configured to adjust the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix based on a target loss function, continue training, until the target loss function reaches a convergence condition, and obtain a first target mapping matrix for traffic states, a second target mapping matrix for road segment relationships, and a third target mapping matrix for time in the knowledge graph.

[0177] The target loss function is obtained based on a difference between a scoring function corresponding to the real mapping quadruple and a scoring function corresponding to the smashed mapping quadruple.

[0178] Optionally, the real mapping quadruple acquisition module 802 includes:

[0179] An original quadruple obtaining submodule is configured to obtain, for each road segment in the target road network, an original quadruple corresponding to the road segment, wherein one original quadruple comprises a historical traffic state of the road segment at a historical time, a historical traffic state of another road segment associated with the road segment at the historical time, a road segment relationship between the road segment and the associated another road segment, and the historical time.

[0180] An alternative mapping quadruple obtaining submodule is configured to, for each original quadruple, map the historical traffic state in the original quadruple according to the first initial mapping matrix to obtain a mapped traffic state, map the road segment relationship in the original quadruple according to the second initial mapping matrix to obtain a mapped road segment relationship, and map the historical time in the original quadruple according to the third initial mapping matrix to obtain a mapped historical time, so as to obtain an alternative mapping quadruple corresponding to the original quadruple.

[0181] A linear matrix obtaining submodule is configured to convert each alternative mapping quadruple based on a first conversion matrix to obtain a linear matrix corresponding to the alternative mapping quadruple.

[0182] A weight obtaining submodule is configured to convert each linear matrix based on a second conversion matrix to obtain a weight of an alternative mapping quadruple corresponding to the linear matrix.

[0183] An embedding vector obtaining submodule is configured to calculate a weighted sum of each alternative mapping quadruple corresponding to the road segment based on the respective weight to obtain an embedding vector of the historical traffic state of the road segment.

[0184] A real mapping quadruple obtaining submodule is configured to, for each two associated road segments in the target road network, replace the historical traffic state of the road segment, the road segment relationship, and the historical time in the original quadruple corresponding to the two associated road segments with the corresponding embedding vector, the mapped road segment relationship, and the mapped historical time, respectively, to obtain a corresponding real mapping quadruple.

[0185] Optionally, the historical traffic state comprises at least one of the following: an actual traffic flow of the road segment, a maximum traffic flow supported by the road segment, a vehicle density of the road segment, a length of the road segment, a road segment type of the road segment, and an average vehicle travel speed of the road segment.

[0186] Optionally, the road segment relationship between the two associated road segments comprises at least one of the following: a relative position of the two road segments, whether there is an intersection between the two road segments, whether there is a vehicle flow separation between the two road segments, whether there is a vehicle flow merging between the two road segments, and a ratio of the actual traffic flows of the two road segments.

[0187] Based on the same inventive concept, the embodiments of the present application also provide a traffic state prediction device, which is described with reference to Figure 9 ,Figure 9 A structural diagram of a traffic state prediction device provided in this application embodiment is shown. The device may include:

[0188] The road segment determination module 901 is used to determine the first road segment in the target road network where the target traffic event occurs, and the second road segment associated with the first road segment;

[0189] The first traffic state acquisition module 902 is used to acquire the traffic state of the first road segment at a future time, as the first traffic state;

[0190] The second traffic state calculation module 903 is used to calculate the traffic state of the second road segment at a future time based on the first traffic state, the road segment relationship between the first road segment and the second road segment, the future time, and the knowledge graph, and use it as the second traffic state.

[0191] The knowledge graph is generated based on any of the traffic state-based knowledge graph generation methods described above.

[0192] Optionally, the device further includes:

[0193] The processing module is used to calculate the traffic state of the second road segment at a future time based on the first traffic state, the road segment relationship between the first road segment and the second road segment, and the knowledge graph, and then determine whether the second road segment is a road segment affected by the target traffic event based on the second traffic state.

[0194] Optionally, the second traffic condition includes: the vehicle density of the second road segment;

[0195] The processing module is specifically used to determine that the second road segment is affected by the target traffic event if the vehicle density of the second road segment is greater than a preset density threshold.

[0196] Optionally, the second traffic state calculation module 903 includes:

[0197] The target mapping quadruple acquisition submodule is used to map the first traffic state, the road segment relationship between the first road segment and the second road segment, and the future time based on the first target mapping matrix for traffic state, the second target mapping matrix for road segment relationship, and the third target mapping matrix for time in the knowledge graph, respectively, to obtain the target mapping quadruple of the first road segment and the second road segment at the future time.

[0198] The second traffic state calculation submodule is used to calculate the optimal solution when the scoring function corresponding to the target mapping quadruple takes the minimum value, so as to obtain the second traffic state of the second road segment at a future time.

[0199] The embodiments of the present application also provide an electronic device, such as Figure 10 As shown in the figure, the electronic device comprises a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete mutual communication through the communication bus 1004,

[0200] The memory 1003 is used for storing a computer program.

[0201] The processor 1001 is used for executing the program stored in the memory 1003, so as to realize any one of the above-mentioned knowledge graph generation method based on traffic state or the traffic state prediction method.

[0202] The communication bus mentioned in the above-mentioned electronic device can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0203] The communication interface is used for communication between the above-mentioned electronic device and other devices.

[0204] The memory can comprise a random access memory (RAM) and can also comprise a non-volatile memory (NVM), for example at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0205] The processor mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0206] In a further embodiment provided in the present application, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of any of the above traffic state based knowledge graph generation method or traffic state prediction method.

[0207] In a further embodiment provided in the present application, a computer program product containing instructions, which, when executed on a computer, cause the computer to perform any of the above traffic state based knowledge graph generation method or traffic state prediction method.

[0208] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (for example, floppy disk, hard disk, magnetic tape), optical media (for example, DVD), or semiconductor media (for example, solid state disk (SSD)) and the like.

[0209] It should be noted that, in this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.

[0210] Each of the embodiments in the specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

[0211] The above only describes the preferred embodiments of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating a knowledge graph based on traffic conditions, characterized in that, The method includes: Obtain the first initial mapping matrix for traffic state, the second initial mapping matrix for road segment relationship, and the third initial mapping matrix for time from the knowledge graph to be trained; For each pair of related road segments in the target road network, based on the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix, the historical traffic state of the two related road segments at a historical time, the road segment relationship between the two related road segments, and the historical time are mapped respectively to obtain the real mapping quadruple corresponding to the two related road segments. Obtain the broken mapping quadruples corresponding to each real mapping quadruple; wherein, the broken mapping quadruples are quadruples obtained by randomly combining the elements in each real mapping quadruple. Based on the target loss function, the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix are adjusted, and training continues until the target loss function reaches the convergence condition, thus obtaining the first target mapping matrix for traffic state, the second target mapping matrix for road segment relationship, and the third target mapping matrix for time in the knowledge graph. The target loss function is obtained by the difference between the scoring function corresponding to the true mapping quadruple and the scoring function corresponding to the broken mapping quadruple.

2. The method according to claim 1, characterized in that, For each pair of associated road segments in the target road network, based on the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix, the historical traffic state of the two associated road segments at a historical time, the road segment relationship between the two associated road segments, and the historical time are mapped respectively to obtain the true mapping quadruple corresponding to the two associated road segments, including: For each road segment in the target road network, obtain the original quadruples corresponding to that road segment; wherein, an original quadruple includes the historical traffic state of the road segment at a historical time, the historical traffic state of another road segment associated with the road segment at the historical time, the road segment relationship between the road segment and the other associated road segment, and the historical time; For each original quadruple, the historical traffic state in the original quadruple is mapped according to the first initial mapping matrix to obtain the mapped traffic state; the road segment relationship in the original quadruple is mapped according to the second initial mapping matrix to obtain the mapped road segment relationship; and the historical time in the original quadruple is mapped according to the third initial mapping matrix to obtain the mapped historical time, so as to obtain the candidate mapped quadruple corresponding to the original quadruple. Based on the first transformation matrix, each candidate mapping quadruple is transformed to obtain the linear matrix corresponding to the candidate mapping quadruple; Based on the second transformation matrix, each linear matrix is ​​transformed to obtain the weights of the candidate mapping quadruples corresponding to that linear matrix. Based on their respective weights, the weighted sum of each candidate mapping quadruple corresponding to the road segment is calculated to obtain the embedding vector of the historical traffic state of the road segment. For every two associated road segments in the target road network, the historical traffic state, road segment relationship, and historical time of the original quadruple corresponding to the two associated road segments are replaced with the corresponding embedding vector, mapped road segment relationship, and mapped historical time, respectively, to obtain the corresponding real mapped quadruple.

3. The method according to claim 1, characterized in that, The historical traffic conditions include at least one of the following: actual traffic flow of the road segment, maximum traffic flow supported by the road segment, vehicle density of the road segment, length of the road segment, road segment type, and average vehicle speed of the road segment.

4. The method according to claim 1, characterized in that, The relationship between two related road segments includes at least one of the following: the relative positions of the two road segments, whether there is an intersection between the two road segments, whether there is traffic flow separation between the two road segments, whether there is traffic flow merging between the two road segments, and the ratio of the actual traffic volume of the two road segments.

5. A traffic condition prediction method, characterized in that, The method includes: Identify the first road segment in the target road network where the target traffic event occurred, and the second road segment associated with the first road segment; Obtain the traffic state of the first road segment at a future time, and use it as the first traffic state; Based on the first traffic state, the road segment relationship between the first road segment and the second road segment, the future time, and the knowledge graph, calculate the traffic state of the second road segment at the future time, and use it as the second traffic state; The knowledge graph is generated based on the method described in any one of claims 1-4.

6. The method according to claim 5, characterized in that, After calculating the traffic state of the second road segment at a future time based on the first traffic state, the road segment relationship between the first road segment and the second road segment, and the knowledge graph, and using this as the second traffic state, the method further includes: Based on the second traffic state, determine whether the second road segment is a road segment affected by the target traffic event.

7. The method according to claim 6, characterized in that, The second traffic condition includes: the vehicle density of the second road segment; The step of determining whether the second road segment is affected by the target traffic event based on the second traffic state includes: If the vehicle density of the second road segment is greater than a preset density threshold, the second road segment is determined to be the road segment affected by the target traffic event.

8. The method according to claim 5, characterized in that, The step of calculating the traffic state of the second road segment at a future time, based on the first traffic state, the road segment relationship between the first road segment and the second road segment, the future time, and the knowledge graph, as the second traffic state, includes: Based on the first target mapping matrix for traffic state, the second target mapping matrix for road segment relationship, and the third target mapping matrix for time in the knowledge graph, the first traffic state, the road segment relationship between the first road segment and the second road segment, and the future time are mapped respectively to obtain the target mapping quadruple of the first road segment and the second road segment at the future time. The optimal solution is calculated when the scoring function corresponding to the target mapping quadruple is minimized, and the second traffic state of the second road segment at a future time is obtained.

9. A knowledge graph generation device based on traffic conditions, characterized in that, The device includes: The initial mapping matrix acquisition module is used to acquire the first initial mapping matrix for traffic state, the second initial mapping matrix for road segment relationship, and the third initial mapping matrix for time in the knowledge graph to be trained. The real mapping quadruple acquisition module is used to map the historical traffic state of the two related road segments at a historical time, the road segment relationship between the two related road segments, and the historical time for each two related road segments in the target road network based on the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix, respectively, to obtain the real mapping quadruple corresponding to the two related road segments. The broken mapping quadruple acquisition module is used to acquire the broken mapping quadruple corresponding to each real mapping quadruple; wherein, the broken mapping quadruple is a quadruple obtained by randomly combining the elements in each real mapping quadruple. The training module is used to adjust the first initial mapping matrix, the second initial mapping matrix, and the third initial mapping matrix based on the target loss function, and continue training until the target loss function reaches the convergence condition, thereby obtaining the first target mapping matrix for traffic state, the second target mapping matrix for road segment relationship, and the third target mapping matrix for time in the knowledge graph. The target loss function is obtained by the difference between the scoring function corresponding to the true mapping quadruple and the scoring function corresponding to the broken mapping quadruple.

10. The apparatus according to claim 9, characterized in that, The module for obtaining the true mapping quadruple includes: The original quadruple acquisition submodule is used to acquire each original quadruple corresponding to each road segment in the target road network; wherein, an original quadruple includes the historical traffic state of the road segment at a historical time, the historical traffic state of another road segment associated with the road segment at the historical time, the road segment relationship between the road segment and the other associated road segment, and the historical time; The candidate mapping quadruple acquisition submodule is used to map the historical traffic states in the original quadruple according to the first initial mapping matrix to obtain the mapped traffic states; to map the road segment relationships in the original quadruple according to the second initial mapping matrix to obtain the mapped road segment relationships; and to map the historical times in the original quadruple according to the third initial mapping matrix to obtain the mapped historical times, so as to obtain the candidate mapping quadruple corresponding to the original quadruple. The linear matrix acquisition submodule is used to transform each candidate mapping quadruple based on the first transformation matrix to obtain the linear matrix corresponding to the candidate mapping quadruple. The weight acquisition submodule is used to transform each linear matrix based on the second transformation matrix to obtain the weights of the candidate mapping quadruples corresponding to the linear matrix. The embedding vector acquisition submodule is used to calculate the weighted sum of each candidate mapping quadruple corresponding to the road segment based on their respective weights, and obtain the embedding vector of the historical traffic state of the road segment. The real mapping quad tuple acquisition submodule is used to replace the historical traffic state, road segment relationship and historical time of the original quad tuple corresponding to the two related road segments in the target road network with the corresponding embedding vector, mapped road segment relationship and mapped historical time, respectively, to obtain the corresponding real mapping quad tuple.

11. A traffic condition prediction device, characterized in that, The device includes: The road segment determination module is used to determine the first road segment in the target road network where the target traffic event occurs, and the second road segment associated with the first road segment; The first traffic state acquisition module is used to acquire the traffic state of the first road segment at a future time, as the first traffic state; The second traffic state calculation module is used to calculate the traffic state of the second road segment at a future time based on the first traffic state, the road segment relationship between the first road segment and the second road segment, the future time, and the knowledge graph, and use it as the second traffic state. The knowledge graph is generated based on the method described in any one of claims 1-4.

12. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method according to any one of claims 1-4 or 5-8.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-4 or 5-8.

Citation Information

Patent Citations

  • Temporal knowledge graph representation method based on historical relation and double-graph convolutional network

    CN111159425A

  • Prediction method and device based on knowledge graph embedded representation and computer equipment

    CN112800237A