Traffic flow statistical method and device based on traffic big data analysis, equipment and medium
By cleaning multi-source heterogeneous traffic data using a unified spatiotemporal benchmark, constructing a global sparse tensor and performing traffic flow correction, the problems of double counting and undercounting in multi-scale traffic flow statistics are solved, and the logical consistency and accuracy of traffic flow statistics are improved, providing reliable data support for traffic management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 宫帅
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-01
AI Technical Summary
Existing traffic big data analysis methods suffer from structured errors such as double counting and undercounting in multi-scale traffic flow statistics, resulting in a lack of logical consistency in statistical data and affecting the accuracy of traffic management decisions.
By cleaning and matching multi-source heterogeneous traffic data using a unified spatiotemporal benchmark, a global sparse tensor is constructed to identify recount intensity indicators, and a joint optimization objective function is built to correct traffic flow and eliminate recounting and undercounting phenomena.
It significantly improves the logical consistency and accuracy of traffic flow statistics at different scales, providing reliable data support for traffic management decisions.
Smart Images

Figure CN121963483A_ABST
Abstract
Description
Traffic flow statistics methods, devices, equipment, and media based on traffic big data analysis Technical Field
[0001] This invention belongs to the field of intelligent transportation technology, and in particular relates to a method, device, equipment and medium for traffic flow statistics based on traffic big data analysis. Background Technology
[0002] With the rapid development of intelligent transportation systems and big data collection technologies, the means of acquiring urban traffic data have become increasingly diverse, encompassing multi-source heterogeneous data from fixed-point detectors (such as video surveillance, inductive loops, and radar) and mobile detectors (such as satellite positioning and mobile phone signaling). Traffic flow statistics based on this massive amount of traffic big data have become the foundation for traffic signal control, congestion mitigation, and road network planning. In practical applications, to meet the management needs of different levels, it is often necessary to conduct multi-scale statistical analysis of traffic flow, requiring not only micro-flow at the lane and intersection levels, but also macro-flow at the road segment, corridor, and even regional levels.
[0003] In existing traffic big data analytics technologies, traffic flow statistics methods typically treat data from different scales or sources as relatively independent objects for processing. Traditional methods are mostly based on a single detection section or independent data source for traffic flow calculation. For example, they directly use video recognition algorithms to count the number of vehicles passing through a lane, or estimate sample traffic flow for a road segment based on floating car satellite positioning trajectories. When larger-scale traffic flow statistics are required, current practices usually employ simple aggregation methods, that is, directly summing the traffic flow data of a sub-region or sub-section, or using time series smoothing algorithms to correct for data fluctuations at a single section, thereby obtaining the overall traffic flow statistics for the road network.
[0004] However, the existing statistical methods described above have significant drawbacks. Due to spatial overlap and temporal asynchrony in the collection of multi-source heterogeneous data, and the lack of inherent logical connections between statistical units at different scales, direct aggregation is highly susceptible to the same vehicle being counted repeatedly at different cross-sections or from different data sources, or being missed due to the failure of some detectors. This structural error of "double counting and undercounting" in multi-scale statistics results in a lack of logical consistency between the final statistical data and the macro-level data. For example, the statistical traffic flow of a road segment is often inflated compared to the actual number of vehicles passing through, failing to accurately reflect the true traffic demand and severely impacting the accuracy of traffic management decisions. Summary of the Invention
[0005] Therefore, it is necessary to provide a traffic flow statistics method, device, equipment, and medium based on traffic big data analysis that can solve the structured errors of double counting and undercounting in multi-scale cross-sectional traffic flow statistics, in order to address the above-mentioned technical problems.
[0006] Firstly, this application provides a traffic flow statistics method based on traffic big data analysis, including:
[0007] S1. Based on multi-source heterogeneous traffic data and a preset unified spatiotemporal benchmark, perform data cleaning to obtain cleaned traffic data;
[0008] S2. Perform map matching based on the cleaned traffic data to obtain the original traffic record set; the original traffic record set includes vehicle identifiers, topological edge numbers, and time slice indexes.
[0009] S3. Perform cross-scale mapping based on the physical connectivity of the road network and the original traffic record set to obtain a global sparse tensor; the global sparse tensor is used to reflect the existence state of vehicles in various scale spaces.
[0010] S4. Recounting is performed based on global sparse tensors to obtain a recount intensity index; the recount intensity index is used to characterize and identify recounting and undercounting patterns in multi-scale statistics.
[0011] S5. Based on the global sparse tensor and the recount intensity index, the optimization objective function is constructed to obtain the joint optimization objective function;
[0012] S6. Solve for flow correction based on the joint optimization objective function to obtain the corrected multi-scale flow tensor.
[0013] In one embodiment, S3 includes:
[0014] S11. Define the hierarchical structure based on the physical connection relationship of the road network to generate a multi-scale topological hierarchy; the multi-scale topological hierarchy includes lane level, road segment level, corridor level and region level;
[0015] S12. Based on the original passage record set and the multi-scale topological hierarchy, perform parent node association queries to obtain the set of vehicle association relationships at each scale node.
[0016] S13. Assign values to the tensor of the association set to obtain the global sparse tensor; the global sparse tensor is used to reflect the existence state of the vehicle in space at various scales.
[0017] In one embodiment, S4 includes:
[0018] S21. Perform deduplication and counting based on the global sparse tensor to obtain the unique number of vehicles in the parent node;
[0019] S22. Sum the flow based on the global sparse tensor to obtain the cumulative sum of the flow of the child nodes;
[0020] S23. Based on the unique number of vehicles and the cumulative sum, the recount intensity is calculated to obtain the recount intensity index; the calculation formula for the recount intensity index is:
[0021]
[0022] in, Let be the recount intensity index between parent and child nodes u and v at time t. Let t be the sum of the observed traffic of all child nodes v. The number of unique vehicles in parent node u at time t.
[0023] In one embodiment, S5 includes:
[0024] S31. Based on the original observed flow rate and the flow rate variable to be corrected in the global sparse tensor, the fidelity term is calculated according to the data source reliability weight to obtain the data fidelity term.
[0025] S32. Based on the road network topology, constraints are introduced using the Lagrange multiplier method to generate topology constraint terms.
[0026] S33. Based on the recount intensity index, perform penalty term generation processing to obtain the recount penalty term;
[0027] S34. Perform a weighted summation of the data fidelity term, topology constraint term, and recount penalty term to construct a joint optimization objective function.
[0028] In one embodiment, S6 includes:
[0029] S41. Initialize the tensor of the flow variables to be corrected, the deduplication coefficient matrix, and the iteration termination condition of the joint optimization to obtain the initialization parameter set.
[0030] S42. With the deduplication coefficient matrix fixed, the joint optimization objective function is transformed into a quadratic programming problem in terms of the flow variable tensor. The updated flow variable tensor is obtained by solving the problem using a sparse matrix solver.
[0031] S43. Fix the updated flow variable tensor, adjust the parameters based on the current flow estimate, and obtain the updated deduplication coefficient matrix;
[0032] S44. Repeat the solution calculation and parameter adjustment until the change in the joint optimization objective function meets the iteration termination condition, and obtain the corrected multi-scale flow tensor.
[0033] In one embodiment, S43 includes:
[0034] S431. Calculate the proportion based on the flow variable tensor of the current iteration cycle to obtain the initial contribution ratio;
[0035] S432. Construct a loss function based on the deviation between the initial contribution ratio and the ideal single-count state to obtain a loss function used to penalize the deviation.
[0036] S433. Update the deduplication coefficient matrix of the loss function using gradient descent to obtain the updated deduplication coefficient matrix.
[0037] S434. Normalize the updated deduplication coefficient matrix to obtain the deduplication coefficient matrix for the next iteration.
[0038] In one embodiment, after S6, the following is also included:
[0039] S51. Obtain the latest periodic measured data, and verify the corrected multi-scale flow tensor based on the measured data to obtain the prediction residual;
[0040] S52. Perform feature identification on the distribution characteristics of the prediction residuals in the time and spatial dimensions to obtain the identification results; the identification results are used to indicate the existence of systematic biases or random abnormal fluctuations.
[0041] S53. If there is a systematic deviation, the weight coefficients in the joint optimization objective function are updated by backpropagation using the stochastic gradient descent algorithm to obtain the optimized weight coefficients.
[0042] S54. Based on the latest recount intensity index distribution, update the prior distribution parameters of the deduplication coefficient matrix to obtain model parameters that adapt to changes in traffic patterns and detector states.
[0043] Secondly, this application also provides a traffic flow statistics device based on traffic big data analysis, comprising:
[0044] The multi-source data cleaning module is used to clean multi-source heterogeneous traffic data and a preset unified spatiotemporal benchmark to obtain cleaned traffic data.
[0045] The map matching module is used to perform map matching based on the cleaned traffic data to obtain the original traffic record set; the original traffic record set includes vehicle identifiers, topological edge numbers, and time slice indexes.
[0046] The cross-scale mapping module is used to perform cross-scale mapping based on the physical connectivity of the road network and the original traffic record set to obtain a global sparse tensor; the global sparse tensor is used to reflect the existence state of vehicles in various scale spaces.
[0047] The recounting identification module is used to identify recounts based on global sparse tensors and obtain a recounting intensity index; the recounting intensity index is used to characterize and identify recounting and undercounting patterns in multi-scale statistics.
[0048] An optimization objective function construction module is used to construct the optimization objective function based on the global sparse tensor and the repetition count intensity index, so as to obtain the joint optimization objective function;
[0049] The flow correction solution module is used to solve for flow correction based on the joint optimization objective function, and obtain the corrected multi-scale flow tensor.
[0050] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the traffic flow statistics method based on traffic big data analysis as described in the first aspect.
[0051] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the traffic flow statistics method based on traffic big data analysis as described in the first aspect.
[0052] The aforementioned traffic flow statistics method, device, equipment, and medium based on traffic big data analysis clean and match multi-source heterogeneous traffic data using a unified spatiotemporal benchmark, and perform cross-scale mapping by combining the physical connectivity of the road network. This constructs a global sparse tensor that can uniformly represent the state of vehicles in various spatial scales. Then, based on the global sparse tensor, recount identification is performed to quantify statistical error characteristics, and a joint optimization objective function including a recount intensity index is constructed. Through traffic flow correction calculation, the recount and undercount phenomena caused by spatial overlap or logical disconnection in multi-scale statistics are effectively eliminated, thereby significantly improving the logical consistency and accuracy of traffic flow statistics results at different scale levels. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 is a flowchart illustrating a traffic flow statistics method based on traffic big data analysis provided by the present invention;
[0055] Figure 2 is a flowchart illustrating the method for obtaining the recount intensity index in an optional embodiment of the present invention.
[0056] Figure 3 is a schematic diagram of a traffic flow statistics device based on traffic big data analysis provided by the present invention. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0058] In one embodiment, as shown in Figure 1, a traffic flow statistics method based on traffic big data analysis is provided. This embodiment illustrates the application of this method to a statistics terminal. It is understood that this method can also be applied to a server, and further to a system including both a statistics terminal and a server, and is implemented through the interaction between the statistics terminal and the server. In this embodiment, the method includes the following steps:
[0059] S1. Based on multi-source heterogeneous traffic data and a preset unified spatiotemporal benchmark, perform data cleaning to obtain cleaned traffic data.
[0060] Optionally, Coordinated Universal Time (UTC) is adopted as a unified time reference. Timestamps of different formats in multi-source heterogeneous traffic data are uniformly converted to UTC time, such as frame time of video surveillance, positioning time of satellite positioning, and trigger time of ground loop. Then, the time dimension is standardized according to the preset time slice division rules (such as fixed duration sliding window). The spatial reference adopts China Geodetic Coordinate System 2000 (CGCS2000). The spatial location information of different data sources (such as camera calibration coordinates of video surveillance and WGS84 coordinates of satellite positioning) is uniformly converted to this coordinate system through coordinate transformation algorithms (such as the seven-parameter Bursa model), so as to achieve the unification of spatiotemporal reference. Data cleaning is achieved through three steps: The first step is data denoising, which involves using Gaussian filtering to remove image sensor noise from video data, using the sliding window midpoint method to remove abnormal pulse signals from inductive loop data, and using Kalman filtering to eliminate positioning drift noise from satellite positioning data. The second step is data completion, which involves using linear interpolation to fill in a small amount of missing data within a continuous time period, and using historical data from nearby similar time periods to fill in non-continuous missing data. The third step is data format standardization, which involves converting all valid data from all data sources into a unified JSON (JavaScript Object Notation) format, with fields including vehicle location, timestamp, and data source identifier, thus obtaining the cleaned traffic data.
[0061] S2. Perform map matching based on the cleaned traffic data to obtain the original traffic record set; the original traffic record set includes vehicle identifiers, topological edge numbers, and time slice indexes.
[0062] Optionally, a road network topology map is pre-constructed, which includes attribute information such as the number of topological edges (i.e., road segments), the coordinates of the start and end points (CGCS2000), the road width, and the number of lanes. The topological edge number is identified by a unique string to ensure the uniqueness of different road segments. Map matching is implemented using a Hidden Markov Model (HMM). The specific process is as follows: First, the location coordinates and time information of each vehicle record in the cleaned traffic data are extracted and used as the observation sequence. Then, using the topological edges in the road network topology map as hidden states, the Euclidean distance between the vehicle position and each topological edge in the observation sequence, as well as the probability of consistency between the vehicle's driving direction and the angle of the topological edge direction, are calculated. The weighted sum of the distance and angle probabilities is used as the state transition probability. The Viterbi algorithm is used to solve for the hidden state sequence that maximizes the state transition probability, and the topological edge number corresponding to each vehicle record is determined. Next, according to the preset time slice division rules, the UTC timestamp of each vehicle record is mapped to the corresponding time slice index. The time slice index is a continuous integer that increases in chronological order. Finally, vehicle identifiers are extracted. For video data, the license plate number is obtained through a license plate recognition algorithm as the vehicle identifier. For satellite positioning data, the Vehicle Identification Number (VIN) or the unique identifier of the mobile device (such as the IMEI of a mobile phone) is used. The vehicle identifier (International Mobile Equipment Identity) is used as the vehicle identifier. The vehicle identifier, the matched topological edge number, and the time slice index are combined into a single original passage record. All original passage records are then aggregated to form an original passage record set.
[0063] S3. Perform cross-scale mapping based on the physical connectivity of the road network and the original traffic record set to obtain a global sparse tensor; the global sparse tensor is used to reflect the existence state of vehicles in various scale spaces.
[0064] Optionally, a physical connection table of the road network can be pre-constructed using a road network topology analysis tool. This table clarifies the relationship between topological units at each scale (lane level, intersection level, road segment level, corridor level, and region level) and topological edges. For example, a lane-level topological unit corresponds to a single lane on a single topological edge, a road segment-level topological unit corresponds to multiple consecutive topological edges, and a region-level topological unit corresponds to the set of all topological edges in that region. Each scale of topological unit is identified by a unique code. First, each record in the original traffic record set is traversed, and the topological unit codes of all scales to which the topological edge number belongs are found according to the association table. Then, the dimensions of the global sparse tensor are defined, including the vehicle dimension (using the vehicle identifier as the dimension index), the scale dimension (using the unique code of each scale type as the dimension index), the topological unit dimension (using the unique code of the topological unit under each scale as the dimension index), and the time slice dimension (using the time slice index as the dimension index). Next, for each original traffic record, the positions corresponding to the vehicle identifier, scale code, topological unit code, and time slice index in the global sparse tensor are marked as 1, indicating that the vehicle exists in the topological unit of that scale within that time slice. The remaining unmarked positions are defaulted to 0. Since the distribution of vehicles in the road network is sparse, most tensor positions are 0. Therefore, a sparse storage method is used to store only the position index marked as 1 and the corresponding state value, finally obtaining the global sparse tensor, which fully reflects the existence state of vehicles in each scale space.
[0065] S4. Recounting is performed based on global sparse tensors to obtain a recount intensity index. The recount intensity index is used to characterize and identify recounting and undercounting patterns in multi-scale statistics.
[0066] Optionally, recount recognition rules are predefined, including two core rules: First, the same vehicle appears in multiple non-adjacent topological units of the same scale within the same time slice; second, the same vehicle appears in different topological units of different scales with an inclusion relationship within the same time slice but does not meet the normal driving timing logic, such as appearing first in a regional topological unit and then in a lane-level topological unit, which violates the actual driving path rules. The process iterates through the vehicle and time-slice dimensions of the global sparse tensor, statistically analyzing the non-zero elements of the tensor for each vehicle within each time slice, and extracting the corresponding topological unit codes for each scale. Based on the recounting identification rules, it determines whether duplicate markings exist. For example, if the road segment-level topological unit code for the same vehicle within the same time slice corresponds to two non-adjacent topological edge sets, then recounting is identified. The number of recounted vehicles in each scale topological unit within each time slice is counted, and the ratio of the number of recounted vehicles to the total number of vehicles in that topological unit is calculated as the basic recounting intensity. For missed detection, the continuity of vehicle presence in adjacent time slices for the same topological unit is analyzed. If a vehicle exists in both upstream and downstream units of that topological unit in adjacent time slices but does not appear in the current time slice, it is considered a possible missed detection, and the ratio of the number of missed vehicles to the average number of vehicles in adjacent time slices is calculated as the missed detection intensity. The basic recounting intensity and the missed detection intensity are weighted and summed to obtain a recounting intensity index. The larger the value of this index, the more severe the recounting and missed detection problems of the corresponding scale topological unit within the corresponding time slice.
[0067] S5. Based on the global sparse tensor and the recount intensity index, the optimization objective function is constructed to obtain the joint optimization objective function.
[0068] Optionally, the construction of the joint optimization objective function takes minimizing the flow statistics error caused by recounting and undercounting as the core objective, while ensuring the logical consistency of flow data at all scales. First, based on the global sparse tensor, the initial flow estimate for each scale of topological unit in each time slice is calculated. The initial flow estimate is the number of vehicles marked as 1 at the tensor position corresponding to that topological unit. Then, a recount intensity index is introduced as a penalty term. The penalty term coefficient is set according to the statistical accuracy requirements of each scale of topological unit. The larger the recount intensity index, the higher the weight of the penalty term. The penalty term expression is the product of the penalty term coefficient and the recount intensity index. Next, a logical consistency constraint term is constructed. Based on the road network physical connection table, the flow inclusion relationship of topological units at different scales is clarified. For example, the flow of a road segment-level topological unit should be equal to the sum of the flows of all lane-level topological units it contains, and the flow of a region-level topological unit should be equal to the sum of the flows of all road segment-level topological units it contains. The constraint term expression is the sum of squared deviations between the flow of each scale of topological unit and the sum of the flows of its subordinate topological units. Finally, the sum of squared errors of the initial flow estimate, the penalty term, and the logical consistency constraint term are weighted and summed to obtain the joint optimization objective function, the mathematical expression of which is: ,in Let be the vector of flow values at each scale to be solved. Let be the initial flow estimate for the i-th topology unit. The recount intensity index is the i-th topological unit. This represents the flow rate value of the parent topology unit. for The flow values of subordinate lower-level topology units, , , The weight coefficients for the sum of squared errors, penalty term, and constraint term are respectively used, and the optimal values of each weight coefficient are determined by cross-validation.
[0069] S6. Solve for flow correction based on the joint optimization objective function to obtain the corrected multi-scale flow tensor.
[0070] Optionally, the Alternating Direction Method of Multipliers (ADMM) can be used to solve the joint optimization objective function. This method is applicable to constrained convex optimization problems and can effectively improve the solution efficiency and convergence stability. First, initial values for the optimization variables are set, using the initial flow estimation vector as the initial input. Then, convergence conditions are set: the difference between the objective function values of two adjacent iterations must be less than a preset threshold, set according to statistical accuracy requirements; simultaneously, the logical consistency deviation of the flow at each scale of topological units must also be less than the preset threshold. Next, the ADMM iterative steps are followed, decomposing the joint optimization objective function into multiple sub-problems. Each sub-problem is solved separately, and the optimal solutions are obtained. Lagrange multipliers are used to update and coordinate the optimal solutions of the sub-problems, forming a complete iteration. This iterative process is repeated until both the objective function value and the logical consistency deviation satisfy the convergence conditions. The iteration stops, and the final flow values for each scale of topological units are output. Finally, the output flow values are organized according to scale, topological unit, and time slice dimensions to construct a multi-scale flow tensor. Each tensor element corresponds to the corrected flow value for a specific scale, topological unit, and time slice, thus obtaining the corrected multi-scale flow tensor.
[0071] The aforementioned traffic flow statistics method based on traffic big data analysis first cleans the data by unifying the spatiotemporal reference, then obtains a standardized original traffic record set through map matching. Based on the physical connectivity of the road network, a global sparse tensor is constructed through cross-scale mapping. Recounting and undercounting patterns are accurately identified to obtain a recount intensity index. Finally, a joint optimization objective function is constructed and solved to obtain the corrected multi-scale flow tensor. This method effectively solves the spatiotemporal heterogeneity problem of multi-source heterogeneous data and the problem of missing logical connections in multi-scale statistics, avoiding recounting and undercounting errors, ensuring the logical consistency of flow data at each scale, improving the accuracy of traffic flow statistics, and providing reliable data support for traffic management decisions such as traffic signal control and congestion mitigation.
[0072] In one embodiment, S3 includes:
[0073] S11. Define the hierarchical structure based on the physical connection relationship of the road network to generate a multi-scale topological hierarchical structure; the multi-scale topological hierarchical structure includes lane level, road segment level, corridor level and region level.
[0074] Optionally, basic road network data can be acquired in advance, including road centerline coordinates, lane distribution, intersection connection relationships, administrative boundary and traffic corridor planning documents. Based on this data, a road network physical connection relationship dataset can be constructed. This dataset uses topological edges as the basic unit and records attributes such as the coordinates of the start and end nodes of each topological edge, the number of lanes, the identifiers of adjacent topological edges, and the connection direction. The multi-scale topological hierarchy includes lane-level, segment-level, corridor-level, and region-level. The hierarchy is defined using a bottom-up strategy. First, lane-level topological nodes are defined by splitting a single topological edge according to the actual number of lanes, with each lane corresponding to an independent lane-level node. The node identifier is generated by combining the topological edge identifier and the lane number. Next, segment-level topological nodes are constructed by aggregating all lane-level nodes corresponding to multiple continuously connected topological edges with consistent functional attributes. Connectivity is determined by the adjacency of topological edges, and consistency of functional attributes is determined by road grade, design speed, and direction of travel. Then, corridor-level topological nodes are generated by determining the corridor's scope according to the traffic corridor planning document, aggregating all segment-level nodes within the scope. The scope is defined through spatial overlay analysis of administrative planning coordinates and road network coordinates. Finally, region-level topological nodes are constructed based on the administrative region boundary, aggregating all corridor-level nodes and segment-level nodes not included in the corridor within the boundary. Boundary matching is achieved through a spatial inclusion relationship judgment algorithm. The identifiers of each level node, the set of its subordinate nodes, and the spatial coordinates are organized hierarchically to generate a multi-scale topological hierarchical structure. This structure is stored using a tree data structure, and the parent node and child node are mapped through associated pointers.
[0075] S12. Based on the original traffic record set and the multi-scale topological hierarchy, perform parent node association queries to obtain the set of vehicle association relationships at each scale node.
[0076] Optionally, the original passage record set pre-contains three core fields: vehicle identifier, topology edge number, and time slice index. The vehicle identifier is the unique identification information of the vehicle, the topology edge number corresponds to the topology edge identifier in the road network physical connection relationship dataset, and the time slice index is a continuous integer index divided according to a preset time interval. The parent node association query is based on the tree-like storage feature of the multi-scale topological hierarchy and is implemented using a depth-first search algorithm. First, each record in the original traffic record set is traversed, and the topological edge number is extracted. Starting from the lane-level node corresponding to that topological edge number, the algorithm traverses upwards along the tree pointer of the multi-scale topological hierarchy, sequentially matching the corresponding road segment-level parent node, corridor-level parent node, and region-level parent node. The traversal terminates when the highest-level region-level node is reached. The vehicle identifier and time slice index of each original traffic record are associated and combined with the parent node identifiers obtained at each scale, forming a complete association record containing the vehicle identifier, time slice index, lane-level node identifier, road segment-level node identifier, corridor-level node identifier, and region-level node identifier. All complete association records are summarized to obtain the set of vehicle association relationships at each scale node. This set is stored in a relational data table format to ensure the integrity and queryability of each field's association.
[0077] S13. Assign values to the tensor of the association set to obtain the global sparse tensor; the global sparse tensor is used to reflect the existence state of the vehicle in space at various scales.
[0078] Optionally, a dimensionality system for the global sparse tensor is first defined, which includes four core dimensions: vehicle dimension, scale dimension, node dimension, and time slice dimension. The index of the vehicle dimension is the vehicle identifier of all vehicles in the association set. The index of the scale dimension is the scale code corresponding to lane level, road segment level, corridor level, and region level, respectively. The index of the node dimension is the node identifier of all nodes at each scale. The index of the time slice dimension is the time slice index of all time slices in the association set. Tensor assignment is implemented using a record-by-record mapping method. Each associated record in the association set is traversed, and the vehicle identifier, scale code, node identifier, and time slice index are extracted. The position of the tensor element corresponding to the four dimension indices is located in the global sparse tensor, and the element value at that position is assigned a value of 1, indicating that the corresponding vehicle exists in the corresponding node at the corresponding scale within the corresponding time slice. For dimension index combinations that do not appear in the association set, their corresponding tensor element values are assigned a default value of 0. Since the distribution of vehicles in the road network is naturally sparse, with most tensor element values being 0, a sparse storage format is used to store only dimension index combinations with element values of 1 and their corresponding values, without storing the position information of element values of 0. Finally, a global sparse tensor is obtained, which fully reflects the existence state of vehicles in various scale spaces.
[0079] In the above embodiments, a multi-scale topological hierarchy is defined through the physical connectivity of the road network, clarifying the association logic of nodes at each level. Then, a correspondence between vehicles and nodes at each scale is established through parent node association queries. Finally, a global sparse tensor is generated through tensor assignment. This embodiment standardizes the hierarchical division criteria of multi-scale topology, achieves accurate association between vehicle passage records and multi-scale nodes, and ensures that the global sparse tensor accurately reflects the distribution of vehicles at each scale.
[0080] In an optional embodiment, as shown in FIG2, S4 includes:
[0081] S21. Perform deduplication and counting based on the global sparse tensor to obtain the unique number of vehicles in the parent node.
[0082] Optionally, the global sparse tensor predefines vehicle dimension, scale dimension, node dimension, and time slice dimension. Each dimension index corresponds to the vehicle identifier, scale code, node identifier, and time slice index at time t, respectively. When a tensor element value is 1, it indicates that the corresponding vehicle exists in the corresponding node at the corresponding scale at the corresponding time. The core logic of deduplication statistics is based on the uniqueness of vehicle identifiers. First, the predefined parent-child node mapping relationship in the multi-scale topological hierarchy is loaded to clarify the set of all child nodes corresponding to each parent node u. For each parent node u, the global sparse tensor is traversed along the time slice dimension to locate the time slice index corresponding to time t. Under this time slice index, all tensor elements belonging to parent node u in the global sparse tensor are extracted, and the vehicle dimension index corresponding to these elements is collected, i.e., the vehicle identifier. The collected vehicle identifiers are deduplicated using a hash set data structure. The characteristic of a hash set is that it only stores unique elements and can automatically remove duplicate vehicle identifiers. The number of elements in the hash set after deduplication is counted, and this number is the number of unique vehicles of parent node u at time t. The parent node identifier, time t, and the corresponding number of unique vehicles are stored together to form a dataset of unique vehicle counts of parent nodes.
[0083] S22. Sum the flow based on the global sparse tensor to obtain the cumulative sum of the flow of the child nodes.
[0084] Optionally, the core of traffic summation is to count and accumulate the observed traffic of all child nodes under the same parent node at the corresponding time. The observed traffic of a child node is defined as the number of vehicle identifiers with a value of 1 in the global sparse tensor corresponding to child node v at time t. Based on the parent-child node mapping relationship in the multi-scale topological hierarchy, each parent node u and its corresponding child nodes v are traversed. For each child node v, the global sparse tensor is traversed along the time slice dimension to locate the time slice index corresponding to time t. Under this time slice index, the number of records with a value of 1 belonging to child node v in the global sparse tensor is counted; this number is the observed traffic of child node v at time t. After sequentially completing the observation traffic statistics of all child nodes v under parent node u at time t, an accumulation operation is performed to obtain the accumulated sum of the observed traffic of all child nodes v at time t. The parent node identifier, time t, and the corresponding accumulated sum of observed traffic are stored together to form a child node traffic sum dataset.
[0085] S23. Based on the unique number of vehicles and the cumulative sum, the recount intensity is calculated to obtain the recount intensity index; the calculation formula for the recount intensity index is:
[0086]
[0087] in, Let be the recount intensity index between parent and child nodes u and v at time t. Let t be the sum of the observed traffic of all child nodes v. The number of unique vehicles in parent node u at time t.
[0088] Optionally, the correspondence between parent and child nodes u and v is derived from the multi-scale topological hierarchy, and time t corresponds to the time slice index of the global sparse tensor. The observed traffic sum at time t and for the corresponding child node v is extracted directly from the child node traffic sum dataset. Extract the number of unique vehicles at time t and corresponding parent node u from the unique vehicle count dataset of the parent node. The specific process for calculating the recount intensity is as follows: Establish a parameter association mapping table to associate the vehicles at the same time t with the same pair of parent and child nodes u and v. and Perform association matching; perform division on the matched parameters, that is, through... Divide by get If it appears In the special case of 0, directly set the corresponding value to 0. Mark as invalid value to avoid division operation errors; calculate the result The recount intensity index dataset is stored in association with the corresponding parent and child node identifiers and time t, forming a complete dataset. The larger the recount intensity index value, the more significant the flow deviation caused by recounting between parent and child nodes u and v at time t.
[0089] In the above embodiment, the unique number of vehicles in the parent node is obtained through deduplication statistics, and the cumulative sum of observed traffic flow in the child nodes is obtained through traffic summation. Finally, the recount intensity index is calculated based on a clear formula. This embodiment achieves accurate quantification of the recount intensity between parent and child nodes, clearly characterizes the degree of recount deviation between parent and child nodes at different times, and effectively supports the improvement of the accuracy of multi-scale traffic statistics.
[0090] In one embodiment, S5 includes:
[0091] S31. Based on the original observed flow rate and the flow rate variable to be corrected in the global sparse tensor, the fidelity term is calculated according to the data source reliability weight to obtain the data fidelity term.
[0092] Optionally, the original observed flow rate is extracted from the global sparse tensor, specifically the vehicle identification count results where each scale node has a tensor element value of 1 at the corresponding time. The flow rate variable to be corrected is an unknown variable representing the corrected flow rate at each scale node, represented in vector form, where each element corresponds to the corrected flow rate value at a specific scale node at a specific time. The reliability weight of the data source is pre-determined through data source evaluation indicators, including data sampling frequency, historical data integrity rate, and positioning accuracy. The weight value of each data source is calculated using the analytic hierarchy process (AHP). Data sources with higher sampling frequency, higher historical data integrity rate, and higher positioning accuracy have greater reliability weights. The fidelity term is calculated using a weighted sum of squared residuals. First, the residual between the original observed flow and the flow variable to be corrected is calculated for each scale node, i.e., the original observed flow minus the flow variable to be corrected. The calculated residual is then squared to obtain the squared residual value. The squared residual value is multiplied by the reliability weight of the corresponding data source. Finally, the weighted squared residual values of all scale nodes at each time point are summed to obtain the data fidelity term. This data fidelity term is used to ensure that the deviation between the corrected flow variable and the original observed flow is within a reasonable range, while also taking into account the reliability differences of different data sources.
[0093] S32. Based on the road network topology, constraints are introduced using the Lagrange multiplier method to generate topology constraint terms.
[0094] Optionally, the road network topology pre-includes the parent-child relationships of nodes at each scale, the connection relationships of adjacent nodes, and the direction of flow transmission. Based on this structure, topological constraints are determined. The core constraints include the parent-child node flow inclusion constraint and the adjacent node flow conservation constraint. The parent-child node flow inclusion constraint means that the flow variable to be corrected of the parent node should not be less than the sum of the flow variables to be corrected of all its child nodes. The adjacent node flow conservation constraint means that the flow variable to be corrected of the upstream node should be equal to the sum of the flow variable to be corrected of the downstream node and the stagnant flow variable of that node. The core principle of the Lagrange multiplier method is to transform a constrained optimization problem into an unconstrained optimization problem. First, the topological constraints are transformed into standard equality or inequality constraint expressions. Inequality constraint expressions are constructed for parent-child node flow inclusion constraints, and equality constraint expressions are constructed for adjacent node flow conservation constraints. A corresponding Lagrange multiplier is introduced for each constraint expression. The Lagrange multiplier for equality constraints is an arbitrary real number, and the Lagrange multiplier for inequality constraints is a non-negative real number. The product terms of each constraint expression and the corresponding Lagrange multiplier are accumulated to obtain the topological constraint term. This topological constraint term is used to ensure that the flow variables to be corrected conform to the physical transmission laws of the road network topology.
[0095] S33. Based on the recount intensity index, perform penalty term generation processing to obtain the recount penalty term.
[0096] Optionally, the recount intensity index is pre-stored in a recount intensity index dataset, containing recount intensity values corresponding to different parent-child node pairs at different times. The larger the value, the more significant the recount deviation of the corresponding parent-child node pair. The penalty term is generated using the squared form of the flow variable weighted by the recount intensity. First, the recount intensity index corresponding to each parent-child node pair at each time is extracted from the dataset; the extracted recount intensity index is multiplied by the flow variable to be corrected of the parent node in the corresponding parent-child node pair; the product result is squared to obtain the weighted flow square value; the weighted flow square values of all times and all parent-child node pairs are summed to obtain the recount penalty term. This recount penalty term is used to impose a greater penalty on the flow variable to be corrected of the node with a higher recount intensity, thereby reducing the impact of recounting on the final flow statistics result.
[0097] S34. Perform a weighted summation of the data fidelity term, topology constraint term, and recount penalty term to construct a joint optimization objective function.
[0098] Optionally, the weight coefficients of the data fidelity term, topology constraint term, and recount penalty term are determined in advance using cross-validation. The weight coefficient of the data fidelity term is used to balance the reference value of the original observation data, the weight coefficient of the topology constraint term is used to adjust the strictness of the topology constraints, and the weight coefficient of the recount penalty term is used to control the strength of the recount correction. First, the data fidelity term is multiplied by its corresponding weight coefficient to obtain the weighted data fidelity term; the topology constraint term is multiplied by its corresponding weight coefficient to obtain the weighted topology constraint term; the recount penalty term is multiplied by its corresponding weight coefficient to obtain the weighted count penalty term; the weighted data fidelity term, weighted topology constraint term, and weighted count penalty term are summed to obtain the joint optimization objective function. The optimization direction of this objective function is to minimize the overall objective value. Through this objective function, a balance can be achieved between the flow variable to be corrected in conforming to the original observation data, conforming to the road network topology, and reducing recount bias.
[0099] In the above embodiment, a data fidelity term is constructed by weighting the reliability of the data source to ensure the correlation of the observed data. Then, the Lagrange multiplier method is used to introduce a topological constraint term to conform to the physical laws of the road network. A penalty term is generated based on the recount intensity to suppress recount bias. Finally, a weighted summation is performed to obtain the joint optimization objective function. This embodiment achieves a reasonable integration of multi-objective optimization, ensuring that the corrected flow variables have both data reliability and physical rationality, and effectively improving the accuracy of multi-scale flow statistics.
[0100] In one embodiment, S6 includes:
[0101] S41. Initialize the flow variable tensor to be corrected, the deduplication coefficient matrix, and the iteration termination condition of the joint optimization to obtain the initialization parameter set.
[0102] Optionally, the flow variable tensor to be corrected is a multidimensional tensor representing the corrected flow at each scale node at different times. Its dimensions are consistent with the global sparse tensor, including scale dimension, node dimension, and time slice dimension. The tensor elements are the unknown flow values to be solved. The deduplication coefficient matrix is a square matrix used to quantify the correction strength of different parent-child node pairs. The rows and columns of the matrix correspond to unique identifiers of parent-child node pairs. The larger the element value, the higher the priority of the corresponding parent-child node pair's deduplication correction. The iteration termination conditions for joint optimization include two types: the objective function change threshold and the upper limit of the number of iterations. The objective function change threshold is used to determine whether the iteration has converged, and the upper limit of the number of iterations is used to avoid the iteration from falling into an infinite loop. First, the initial value of the flow variable tensor to be corrected is set to the original observed flow corresponding to the global sparse tensor, so as to achieve a preliminary fit between the initial value and the observed data. Then, the deduplication coefficient matrix is initialized to the identity matrix, and at this time, it is assumed that the deduplication correction strength of each parent-child node pair is consistent. Finally, based on the statistical accuracy requirements, the threshold of the change in the objective function is set, and the upper limit of the number of iterations is set in combination with the computing resource constraints. The initialized flow variable tensor to be corrected, the deduplication coefficient matrix and the iteration termination condition are summarized to obtain the initialization parameter set.
[0103] S42. With the deduplication coefficient matrix fixed, the joint optimization objective function is transformed into a quadratic programming problem in terms of the flow variable tensor. The updated flow variable tensor is obtained by solving the problem using a sparse matrix solver.
[0104] Optionally, the deduplication coefficient matrix is fixed, meaning its element values remain unchanged. In this case, only the flow variable tensor to be corrected in the joint optimization objective function is an unknown variable. Since the joint optimization objective function, after the deduplication coefficient matrix is fixed, satisfies the standard form of a quadratic programming (QP) problem with respect to the flow variable tensor to be corrected, i.e., the objective function is a quadratic function and the constraints are linear constraints. The quadratic, linear, and constant terms of the flow variable tensor to be corrected contained in the joint optimization objective function are extracted and rearranged into the standard objective function form of a quadratic programming problem; simultaneously, the linear constraints in the topology constraint terms are transformed into the constraint expressions of a quadratic programming problem. An interior-point sparse solver is preferred for the sparse matrix solver. Its core principle is to transform the constrained quadratic programming problem into an unconstrained problem by introducing a barrier function, and then solve for the optimal solution using Newton's iteration method. During the calculation, the transformed quadratic programming problem model is input into the sparse matrix solver. The solver optimizes computational efficiency through sparse matrix storage and outputs a solution that satisfies the minimization of the objective function; this solution is the updated flow variable tensor.
[0105] S43. Fix the updated flow variable tensor, adjust the parameters based on the current flow estimate, and obtain the updated deduplication coefficient matrix.
[0106] Optionally, the updated flow variable tensor is fixed by keeping its element values unchanged, and the current flow estimate is the element value of each scale node in the updated flow variable tensor at the corresponding time. The core of parameter adjustment is to dynamically optimize the element values of the deduplication coefficient matrix based on the deviation between the current flow estimate and the recount intensity index, so that the deduplication coefficients accurately match the actual recount situation. First, the deviation between the current flow estimate and the number of unique vehicles of the parent node is calculated. The larger the deviation, the more prominent the recount problem of the corresponding parent-child node pair. Then, the recount intensity index corresponding to each parent-child node pair is extracted, and the deviation and the recount intensity index are multiplied by weight to obtain the correction requirement weight of each parent-child node pair. The element values of the corresponding positions in the deduplication coefficient matrix are adjusted based on the correction requirement weight. The larger the correction requirement weight, the larger the adjustment range of the corresponding element value, so that the adjusted deduplication coefficient matrix can specifically improve the correction intensity of the severely recounted areas, and finally obtain the updated deduplication coefficient matrix.
[0107] S44. Repeat the solution calculation and parameter adjustment until the change in the joint optimization objective function meets the iteration termination condition, and obtain the corrected multi-scale flow tensor.
[0108] Optionally, the solution calculation and parameter adjustment are repeated, i.e., the quadratic programming solution in S42 and the deduplication coefficient matrix adjustment in S43 are performed alternately to form an iterative optimization loop. After each iteration, the difference between the joint optimization objective function value obtained in the current iteration and the objective function value in the previous iteration is calculated, i.e., the change in the objective function; the change in the objective function is compared with the threshold of the change in the objective function in the iteration termination condition, and it is determined whether the current iteration number exceeds the upper limit of the iteration number; if the change in the objective function is less than the threshold, it means that the iteration has converged, the iteration stops, and the currently updated flow variable tensor is used as the corrected multi-scale flow tensor; if the change in the objective function is greater than or equal to the threshold and the upper limit of the iteration number has not been reached, S42 is returned to continue to execute the next round of iteration; if the upper limit of the iteration number has been reached but convergence has not occurred, the currently updated flow variable tensor is output and marked as the approximate optimal solution, i.e., the corrected multi-scale flow tensor.
[0109] In the above embodiments, an iterative foundation is established by initializing parameters, and quadratic programming solutions and deduplication coefficient adjustments are performed alternately to achieve collaborative optimization until the iteration termination condition is met, resulting in a corrected multi-scale flow tensor. This embodiment achieves dynamic adaptation between flow correction and recount coefficient optimization, effectively improving iterative convergence efficiency, ensuring that the corrected multi-scale flow tensor has both data accuracy and road network topology consistency, significantly reducing the impact of recounts and omissions on flow statistics, and providing high-quality flow data support for traffic management decisions.
[0110] In one embodiment, S43 includes:
[0111] S431. Calculate the proportion based on the flow variable tensor of the current iteration cycle to obtain the initial contribution ratio.
[0112] Optionally, the flow variable tensor in the current iteration cycle is the updated flow variable tensor obtained from the previous iteration. Its element values represent the current flow estimate of each scale node at the corresponding time. The dimensions include scale dimension, node dimension, and time slice dimension, and the parent-child relationship of each node is clearly defined. The initial contribution ratio is defined as the proportion of the current flow estimate of each child node under the same parent node to the total flow estimate of that parent node, used to reflect the degree of contribution of each child node's flow to the parent node's flow. First, all parent nodes in the flow variable tensor are traversed, and the total flow estimate of each parent node at the corresponding time is extracted. This total flow estimate is the sum of the flow estimates of all its subordinate child nodes at the same time. Then, the current flow estimate of each child node under each parent node is extracted one by one. The flow estimate of a single child node is divided by the total flow estimate of the corresponding parent node to obtain the initial contribution ratio corresponding to that child node. All initial contribution ratios are organized according to the parent-child node pair and the time slice dimension to form an initial contribution ratio set, ensuring that each parent-child node pair has a unique initial contribution ratio at different times.
[0113] S432. Construct a loss function based on the deviation between the initial contribution ratio and the ideal single-count state to obtain a loss function used to penalize the deviation.
[0114] Optionally, the ideal single-count state refers to the ideal contribution state of each child node to the traffic of the parent node under a scenario with no recounting and no undercounting. Its core characteristic is that the sum of the ideal contribution ratios of all child nodes under the same parent node is 1, and the ideal contribution ratio of each child node matches the actual traffic capacity and road network topology weight of that child node. The ideal contribution ratio is pre-determined based on the road network topology and traffic data during historical congestion-free periods, forming a set of ideal contribution ratios. The deviation is the difference between the initial contribution ratio and the ideal contribution ratio of the same parent and child nodes at the same time. The larger the deviation, the more severe the recounting or undercounting of the current traffic estimate. The loss function is constructed using the mean squared error (MSE) form. It calculates the deviation between the initial contribution ratio and the ideal contribution ratio of each parent-child node pair at the corresponding time. The deviation is squared to obtain the squared deviation value. The squared deviation values of all parent-child node pairs at each time are summed and then divided by the total amount of data to obtain the average sum of squared deviations, which is used as the expression for the loss function. The core objective of this loss function is to minimize the deviation between the initial contribution ratio and the ideal single-count state, thereby achieving precise punishment for double-counting and undercounting deviations.
[0115] S433. Update the deduplication coefficient matrix of the loss function using gradient descent to obtain the updated deduplication coefficient matrix.
[0116] Optionally, the core principle of Gradient Descent (GD) is to calculate the gradient of the loss function with respect to the deduplication coefficient matrix, and iteratively update the elements of the deduplication coefficient matrix along the negative gradient direction, gradually reducing the loss function value until the optimal deduplication coefficient matrix is obtained. First, the learning rate of gradient descent is determined. The learning rate controls the step size of each update, avoiding excessively large step sizes that cause iterative oscillations or excessively small step sizes that lead to slow convergence. Then, the partial derivative of the loss function with respect to each element of the deduplication coefficient matrix is calculated to obtain the gradient matrix of the loss function. The element values of the gradient matrix represent the rate of change of the loss function with respect to the corresponding deduplication coefficient element. Subtracting the product of the learning rate and the corresponding element of the gradient matrix from each element of the current deduplication coefficient matrix yields the initially updated deduplication coefficient matrix. During the update process, the change in the loss function value is monitored in real time to ensure that the loss function value shows a decreasing trend. If an increase occurs, the learning rate is adjusted and recalculated to finally obtain the updated deduplication coefficient matrix.
[0117] S434. Normalize the updated deduplication coefficient matrix to obtain the deduplication coefficient matrix for the next iteration.
[0118] Optionally, the purpose of normalization is to constrain the element values of the updated deduplication coefficient matrix to the range [0,1], avoiding weight imbalance in subsequent iterations due to some element values being too large or too small, while ensuring the consistency of the physical meaning of the deduplication coefficient matrix. This normalization uses the L2 normalization method, which scales the vector elements by calculating the Euclidean norm of the vector. The deduplication coefficient matrix is divided into multiple row vectors, each row vector corresponding to the deduplication coefficients of a set of parent-child node pairs. The L2 norm of each row vector is calculated, which is the square root of the sum of the squares of all elements in the row vector. Each element in each row vector is divided by the L2 norm of the corresponding row vector to obtain the normalized row vector. All normalized row vectors are recombined to form the normalized deduplication coefficient matrix. The sum of the elements in each row of the normalized matrix is verified to meet the preset range, ensuring that the normalized deduplication coefficient matrix can accurately reflect the priority of the duplicate count correction for each parent-child node pair and can be directly used in the next iteration process.
[0119] In the above embodiment, the traffic contribution of child nodes to parent nodes is quantified by calculating the initial contribution ratio. A loss function is constructed based on the deviation from the ideal single-count state. Gradient descent is used to achieve accurate updates of the deduplication coefficient matrix, and normalization is used to ensure the rationality of the coefficients. This embodiment achieves dynamic adaptation between the deduplication coefficient matrix and the traffic estimation deviation, improves the accuracy of the deduplication coefficients, and effectively enhances the accuracy and stability of multi-scale traffic tensor correction.
[0120] In one embodiment, after S6, the following is also included:
[0121] S51. Obtain the latest periodic measured data, and verify the corrected multi-scale flow tensor based on the measured data to obtain the prediction residual.
[0122] Optionally, the latest period's measured data comes from the real-time output of multi-source heterogeneous traffic data acquisition terminals, covering raw data collected from sources such as video surveillance, inductive loop detectors, and satellite positioning. This data must undergo preprocessing consistent with the previous data cleaning process, including unifying the spatiotemporal reference, denoising, completion, and format standardization, to ensure the validity and consistency of the measured data. The corrected multi-scale flow tensor contains the corrected flow values of nodes at each scale at different times, and its dimensions perfectly match the spatiotemporal dimensions of the measured data. The core of the verification calculation is to quantify the deviation between the corrected flow and the measured flow. First, according to the scale dimension, node dimension, and time slice dimension, the flow values of the corresponding time and node in the corrected multi-scale flow tensor are matched with the flow values of the same spatiotemporal dimension in the preprocessed measured data. Then, the deviation value of each matching unit is calculated, i.e., the measured flow value minus the corrected flow value. This deviation value is the prediction residual of a single spatiotemporal unit. All prediction residuals are organized according to the spatiotemporal dimension to form a prediction residual set, ensuring that each corrected flow value has a corresponding prediction residual.
[0123] S52. Perform feature identification on the distribution characteristics of the prediction residuals in the time and space dimensions to obtain the identification results; the identification results are used to indicate the existence of systematic bias or random abnormal fluctuations.
[0124] Optionally, the temporal distribution characteristics mainly focus on the pattern of prediction residual changes over time, while the spatial distribution characteristics focus on the distribution pattern of prediction residuals at different scale nodes and different road network regions. Feature identification is achieved by combining statistical analysis and pattern matching. In the temporal dimension, the autocorrelation, trend, and periodicity indices of the prediction residual sequence are calculated. Autocorrelation is used to determine whether the residuals fluctuate continuously in the same direction, the trend index is used to identify whether the residuals show an increasing or decreasing trend over time, and the periodicity index is used to detect whether the residuals fluctuate with a specific time period. In the spatial dimension, spatial clustering analysis is used to cluster nodes with large prediction residuals according to the road network topology connection relationship to determine whether the deviation is concentrated in a specific road segment, corridor, or region. Based on the above analysis results, pattern matching is performed. If the residuals show a continuous trend in the same direction in time and a clustered feature in space, it is identified as a systematic bias. If the residuals fluctuate irregularly in time and are randomly distributed in space, and the fluctuation amplitude is within a reasonable statistical range, it is identified as random abnormal fluctuation. Finally, the identification results containing the type, distribution range and intensity of the bias are output.
[0125] S53. If there is a systematic deviation, the weight coefficients in the joint optimization objective function are updated by backpropagation using the stochastic gradient descent algorithm to obtain the optimized weight coefficients.
[0126] Optionally, the core advantage of the Stochastic Gradient Descent (SGD) algorithm is that it improves parameter update efficiency by randomly selecting a subset of samples to calculate the gradient, making it suitable for real-time data-driven parameter optimization scenarios. The weight coefficients of the joint optimization objective function include the weights of the data fidelity term, the topological constraint term, and the recount penalty term, and its update objective is to minimize the loss function corresponding to the prediction residual. First, the prediction residuals are used as the loss signal to construct a mean squared error loss function based on the prediction residuals. This loss function is associated with the joint optimization objective function, and changes in the weight coefficients directly affect the value of the loss function. Then, the learning rate and number of iterations of the stochastic gradient descent algorithm are set. The learning rate controls the update step size of the weight coefficients, and the number of iterations is set according to the convergence requirements. In each iteration, a portion of the prediction residual samples are randomly selected, and the partial derivative of the loss function with respect to each weight coefficient is calculated to obtain the gradient vector. Along the negative direction of the gradient vector, the product of the learning rate and the corresponding gradient value is subtracted from each weight coefficient to complete one weight coefficient update. The iteration process is repeated until the loss function value converges to the preset range, resulting in the optimized weight coefficients, ensuring that the joint optimization objective function can better adapt to the characteristics of the current traffic data.
[0127] S54. Based on the latest recount intensity index distribution, update the prior distribution parameters of the deduplication coefficient matrix to obtain model parameters that adapt to changes in traffic patterns and detector states.
[0128] Optionally, the latest recount intensity distribution is recalculated based on the latest periodic measured data and the corrected multi-scale flow tensor. It includes the recount intensity values and distribution patterns of different time periods and different parent-child node pairs, and can reflect changes in current traffic patterns (such as peak hours and off-peak hours) and detector status (such as normal, malfunctioning, and data drift) in real time. The prior distribution parameters of the deduplication coefficient matrix are the basic parameters describing the probability distribution of the elements of the deduplication coefficient matrix, such as the mean and variance of the normal distribution, which determine the initial update direction and magnitude of the deduplication coefficient matrix. First, the statistical features of the latest recount intensity index distribution are extracted, including the mean, variance, extreme values, and cluster centers. These features are used to characterize the core distribution patterns of the current recount problem. Then, based on the Bayesian update principle, the extracted statistical features are used as likelihood information and combined with the prior distribution parameters of the deduplication coefficient matrix to calculate the posterior distribution parameters. The posterior distribution parameters are then used as the updated prior distribution parameters and assigned to the distribution model of the deduplication coefficient matrix. New initial values for the deduplication coefficient matrix are generated by sampling through the distribution model, ensuring that the deduplication coefficient matrix can be specifically adapted to changes in current traffic patterns and detector states, thereby improving the adaptability and accuracy of subsequent iterative optimization.
[0129] In the above embodiments, the prediction residuals are obtained through verification with measured data. The types of deviations are identified by spatiotemporal distribution characteristics. The weight coefficients of the joint optimization objective function are updated in reverse for systematic deviations. The prior distribution parameters of the deduplication coefficient matrix are updated in conjunction with the latest recount intensity index. This embodiment achieves dynamic adaptive optimization of model parameters, effectively adapting to changes in traffic patterns and fluctuations in detector states. It continuously improves the accuracy and stability of multi-scale flow tensor correction, providing dynamic optimization technical support for long-term reliable traffic flow statistics.
[0130] The aforementioned traffic flow statistics methods, devices, equipment, and media based on traffic big data analysis address the issues of spatiotemporal heterogeneity and lack of logical connections between multi-scale statistical units in multi-source heterogeneous traffic data. First, standardized original traffic records are obtained by cleaning the data using a unified spatiotemporal benchmark and completing map matching. Then, a multi-scale topological hierarchy is constructed based on the physical connections of the road network. A global sparse tensor reflecting the multi-scale existence of vehicles is generated through parent node association queries and tensor assignment. Next, a recount intensity index is calculated through deduplication statistics and flow summation. A joint optimization objective function is constructed by combining the original observed flow, road network topology constraints, and recount intensity. The corrected multi-scale flow tensor is obtained by iteratively solving the optimization objective function. Subsequently, model parameters can be dynamically optimized based on measured data to form a complete multi-scale traffic flow statistics optimization closed loop. This technical solution effectively solves the recount and undercount problems caused by directly aggregating multi-source heterogeneous data in existing methods, ensuring the logical consistency of multi-scale flow data, improving the accuracy of traffic flow statistics, and providing reliable data support for traffic management decisions.
[0131] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0132] Based on the same inventive concept, this application also provides an apparatus for implementing the traffic flow statistics method based on traffic big data analysis as described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations of one or more embodiments of the traffic flow statistics apparatus based on traffic big data analysis provided below can be found in the limitations of the traffic flow statistics method based on traffic big data analysis described above, and will not be repeated here.
[0133] In an exemplary embodiment, as shown in FIG3, a traffic flow statistics device 10 based on traffic big data analysis is provided, comprising:
[0134] The multi-source data cleaning module 11 is used to clean the data based on multi-source heterogeneous traffic data and a preset unified spatiotemporal benchmark to obtain cleaned traffic data.
[0135] The map matching module 12 is used to perform map matching based on the cleaned traffic data to obtain the original traffic record set; the original traffic record set includes vehicle identifiers, topological edge numbers, and time slice indexes.
[0136] The cross-scale mapping module 13 is used to perform cross-scale mapping based on the physical connection relationship of the road network and the original traffic record set to obtain a global sparse tensor; the global sparse tensor is used to reflect the existence state of vehicles in various scale spaces.
[0137] The recounting identification module 14 is used to identify recounts based on a global sparse tensor and obtain a recounting intensity index; the recounting intensity index is used to characterize and identify recounting and undercounting patterns in multi-scale statistics.
[0138] The objective function construction module 15 is used to construct the objective function based on the global sparse tensor and the recount intensity index, so as to obtain the joint objective function.
[0139] The flow correction solution module 16 is used to perform flow correction solution based on the joint optimization objective function to obtain the corrected multi-scale flow tensor.
[0140] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of a traffic flow statistics method based on traffic big data analysis as described above.
[0141] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of a traffic flow statistics method based on traffic big data analysis as described above.
[0142] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0143] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.
Claims
1. A traffic flow statistics method based on traffic big data analysis, characterized in that, The method includes: S1, cleaning the data based on multi-source heterogeneous traffic data and a preset unified spatiotemporal benchmark to obtain cleaned traffic data; S2, performing map matching based on the cleaned traffic data to obtain an original traffic record set; the original traffic record set includes vehicle identifiers, topological edge numbers, and time slice indexes; S3, performing cross-scale mapping based on the physical connection relationship of the road network and the original traffic record set to obtain a global sparse tensor; the global sparse tensor is used to reflect the existence state of vehicles in various scale spaces; S4, performing recount identification based on the global sparse tensor to obtain a recount intensity index; the recount intensity index is used to characterize and identify recount and undercount patterns in multi-scale statistics; S5, constructing an optimization objective function based on the global sparse tensor and the recount intensity index to obtain a joint optimization objective function; S6, solving for traffic flow correction based on the joint optimization objective function to obtain a corrected multi-scale traffic flow tensor.
2. The method according to claim 1, characterized in that, S3 includes: S11, defining a hierarchical structure based on the physical connection relationship of the road network to generate a multi-scale topological hierarchical structure; the multi-scale topological hierarchical structure includes lane level, road segment level, corridor level, and region level; S12, performing parent node association queries based on the original traffic record set and the multi-scale topological hierarchical structure to obtain the association relationship set of vehicles at each scale node; S13, assigning tensor values to the association relationship set to obtain the global sparse tensor; the global sparse tensor is used to reflect the existence state of vehicles in each scale space.
3. The method according to claim 1, characterized in that, S4 includes: S21, performing deduplication statistics based on the global sparse tensor to obtain the number of unique vehicles in the parent node; S22, summing the traffic flow based on the global sparse tensor to obtain the cumulative sum of the traffic flow in the child nodes; S23, calculating the recount intensity based on the number of unique vehicles and the cumulative sum to obtain the recount intensity index; the calculation formula for the recount intensity index is: in, Let be the recount intensity index between parent and child nodes u and v at time t. Let be the sum of the observed traffic of all child nodes v at time t. The number of unique vehicles in parent node u at time t.
4. The method according to claim 1, characterized in that, S5 includes: S31, calculating a data fidelity term based on the original observed flow rate and the flow rate variable to be corrected in the global sparse tensor, according to the data source reliability weight; S32, introducing constraints according to the road network topology using the Lagrange multiplier method to generate a topology constraint term; S33, generating a penalty term based on the recount intensity index to obtain a recount penalty term; S34, performing a weighted summation of the data fidelity term, the topology constraint term, and the recount penalty term to construct the joint optimization objective function.
5. The method according to claim 1, characterized in that, S6 includes: S41, initializing the flow variable tensor to be corrected, the deduplication coefficient matrix, and the iteration termination condition of the joint optimization to obtain an initialization parameter set; S42, fixing the deduplication coefficient matrix, transforming the joint optimization objective function into a quadratic programming problem with respect to the flow variable tensor, and solving it using a sparse matrix solver to obtain the updated flow variable tensor; S43, fixing the updated flow variable tensor, adjusting the parameters based on the current flow estimate to obtain the updated deduplication coefficient matrix; S44, repeating the solution calculation and parameter adjustment until the change in the joint optimization objective function satisfies the iteration termination condition to obtain the corrected multi-scale flow tensor.
6. The method according to claim 5, characterized in that, S43 includes: S431, calculating the proportion based on the flow variable tensor of the current iteration cycle to obtain the initial contribution ratio; S432, constructing a loss function based on the deviation between the initial contribution ratio and the ideal single-count state to obtain a loss function used to penalize the deviation; S433, updating the deduplication coefficient matrix of the loss function using gradient descent to obtain the updated deduplication coefficient matrix; S434, normalizing the updated deduplication coefficient matrix to obtain the deduplication coefficient matrix used for the next iteration.
7. The method according to claim 6, characterized in that, Following S6, the method further includes: S51, acquiring the latest periodic measured data, and performing verification calculations on the corrected multi-scale flow tensor based on the measured data to obtain the prediction residual; S52, performing feature identification on the distribution characteristics of the prediction residual in the time and spatial dimensions to obtain the identification result; the identification result is used to indicate the existence of systematic deviations or random abnormal fluctuations; S53, if there are systematic deviations, updating the weight coefficients in the joint optimization objective function through backpropagation using the stochastic gradient descent algorithm to obtain the optimized weight coefficients; S54, updating the prior distribution parameters of the deduplication coefficient matrix based on the latest repetition intensity index distribution to obtain model parameters adapted to changes in traffic patterns and detector states.
8. A traffic flow statistics device based on traffic big data analysis, characterized in that, The device includes: a multi-source data cleaning module for cleaning multi-source heterogeneous traffic data and a preset unified spatiotemporal benchmark to obtain cleaned traffic data; a map matching module for performing map matching based on the cleaned traffic data to obtain an original traffic record set; the original traffic record set includes vehicle identifiers, topological edge numbers, and time slice indices; a cross-scale mapping module for performing cross-scale mapping based on the physical connectivity of the road network and the original traffic record set to obtain a global sparse tensor; the global sparse tensor reflects the existence state of vehicles in various scale spaces; a recounting identification module for recounting based on the global sparse tensor to obtain a recounting intensity index; the recounting intensity index characterizes and identifies recounting and undercounting patterns in multi-scale statistics; an optimization objective function construction module for constructing an optimization objective function based on the global sparse tensor and the recounting intensity index to obtain a joint optimization objective function; and a flow correction solution module for performing flow correction solution based on the joint optimization objective function to obtain a corrected multi-scale flow tensor.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.