A method, device and medium for analyzing highway headway

By combining hierarchical Bayesian models and the NUTS algorithm, the shortcomings of existing headway analysis methods in characterizing multimodal and heavy-tailed phenomena are addressed. This enables high-precision analysis of lane and vehicle heterogeneity, improving the robustness and prediction accuracy of the model.

CN121075114BActive Publication Date: 2026-07-21SHANDONG JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG JIAOTONG UNIV
Filing Date
2025-08-14
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing headway analysis methods are difficult to accurately characterize multimodal distributions and heavy-tailed phenomena, and are prone to getting trapped in local optima, failing to meet the requirements of high-precision modeling.

Method used

A hierarchical Bayesian model is adopted, combined with the NUTS algorithm and bridging sampling method. Video frames are denoised and perspective transformation is corrected by collecting data from UAVs. A hierarchical Bayesian model is constructed and efficient sampling is performed to obtain posterior distribution samples. Weighted summation is then performed to improve the stability and reliability of the model.

Benefits of technology

In scenarios with scarce data, the model's ability to characterize the heterogeneity of different lanes and vehicle types has been improved, enabling accurate quantification of model parameter uncertainty and effective characterization of multimodal and heavy-tailed phenomena, thereby enhancing the stability and reliability of the prediction distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121075114B_ABST
    Figure CN121075114B_ABST
Patent Text Reader

Abstract

The application discloses a highway head time interval analysis method, equipment and medium, the method comprises the following steps: collecting traffic flow data through a unmanned aerial vehicle, denoising and perspective transformation correction are carried out on the traffic flow data, and video images are obtained; time interval detection line is set based on the video image, the change of adjacent frame coordinate symbol is judged to pass through the line event, the linear interpolation is estimated to pass through the line length, then the head time interval is calculated to determine the traffic parameters of the vehicle; according to the lane and the vehicle type combination, a plurality of data groups are obtained; a hierarchical Bayesian model is respectively constructed for the preset probability distribution model and the mixed distribution model, the NUTS algorithm is used to sample to obtain parameter posterior samples, and the posterior predictive distribution is calculated; the model posterior probability is taken as a weight, and the final distribution is obtained by weighted summation of the model posterior predictive distribution. Through the multi-model multi-group method, the stability and reliability of the model for predicting the head time interval distribution are improved, and the limitation of a single model in describing multimodal and heavy tail phenomena is overcome.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of traffic management, and in particular to a method, equipment and medium for analyzing headway distances on highways. Background Technology

[0002] In highway traffic flow analysis, the headway distribution characteristics are the core foundation for traffic control and safety assessment. Existing headway analysis methods are mainly divided into two categories: single-model and hybrid-model, but both have obvious limitations.

[0003] Among them, single-model methods such as the three-parameter Burr distribution and the Bayesian posterior Gaussian distribution use a single peak to analyze the headway distribution in multiple scenarios. However, due to the single distribution model being limited by the single-peak characteristics and fixed tail decay form, it is difficult to analyze the multimodal distribution and heavy-tail phenomenon of headway under complex traffic conditions.

[0004] Mixture models, such as Gaussian mixture models (GMM), analyze the headway distribution in multiple scenarios by mixing components. Although they can distinguish complex traffic states such as saturation and unsaturation, the fixed number of mixing components and lack of hierarchical structure design make them prone to ignoring the heterogeneity caused by differences in lanes and vehicle types. This leads to sensitivity to initial parameters and getting stuck in local optima, making it difficult to quantify uncertainty and meet the requirements of high-precision modeling. Summary of the Invention

[0005] This application provides a method, device, and medium for highway headway analysis, which addresses the problems of existing headway analysis methods being insufficient in characterizing multimodal distributions and prone to getting trapped in local optima.

[0006] The embodiments of this application adopt the following technical solutions:

[0007] On one hand, embodiments of this application provide a method for analyzing the headway of vehicles on highways. This method includes: performing video frame denoising and perspective transformation correction on highway traffic flow data collected by a drone to obtain video images in a geographic coordinate system; setting a headway detection line in the video images; monitoring whether a vehicle has passed the headway detection line by judging the change in the sign of the function value of the geographic coordinate point of the same vehicle relative to the headway detection line in adjacent frames; when passing, determining the vehicle's crossing time through linear interpolation, and determining the headway between adjacent vehicles based on the crossing time of each vehicle; and dividing the headway based on the lane and vehicle type combination to obtain multiple headway data subsets. Hierarchical Bayesian models are constructed for the predefined probability distribution model and mixed distribution model, respectively. The NUTS algorithm is used to sample each hierarchical Bayesian model to obtain the posterior distribution samples of each hierarchical Bayesian model. Based on the posterior distribution samples of each hierarchical Bayesian model and each vehicle headway data subset, the posterior prediction distribution of vehicle headway for each hierarchical Bayesian model for each vehicle headway data subset is calculated. The posterior probability of each hierarchical Bayesian model is determined as the weight of each model. Based on the weight of each model, the posterior prediction distribution of vehicle headway for each hierarchical Bayesian model is weighted and summed to obtain the final posterior prediction distribution of vehicle headway for each vehicle headway data subset.

[0008] In one example, before determining the posterior probability of each hierarchical Bayesian model as the weight corresponding to each model, the method further includes: calculating the marginal likelihood of each hierarchical Bayesian model under the headway data subset using bridging sampling; determining that the prior probability of each hierarchical Bayesian model is uniformly distributed; and calculating the weighted prior probability and marginal likelihood of each hierarchical Bayesian model using Bayes' theorem formula to obtain the posterior probability of each hierarchical Bayesian model.

[0009] In one example, hierarchical Bayesian models are constructed for a predefined probability distribution model and a mixed distribution model, respectively. Specifically, a three-layer Bayesian model consisting of an observation layer, a vehicle parameter layer, and a hyperparameter layer is constructed for the predefined probability distribution model and the mixed distribution model, respectively. The observation layer models the headway time distance samples in the vehicle headway data subset as observations that conform to the corresponding distribution model. The parameters of the vehicle parameter layer are generated by the global distribution of the hyperparameter layer. The hyperparameter layer assigns weakly informative priors to the parameters of the global prior distribution.

[0010] In one example, based on the posterior distribution samples of each hierarchical Bayesian model and each vehicle headway data subset, the posterior prediction distribution of the headway for each hierarchical Bayesian model for each vehicle headway data subset is calculated. Specifically, this includes: based on the posterior distribution samples, performing a prediction distribution integral calculation on the posterior distribution of each hierarchical Bayesian model for the vehicle headway data subset to obtain the posterior prediction distribution of the headway for each hierarchical Bayesian model for each vehicle headway data subset.

[0011] In one example, after dividing the vehicles in front of and behind the time distance detection line according to the lane they are in, and obtaining multiple vehicle headway data subsets, the method further includes: traversing multiple vehicle headway data subsets; if the same vehicle ID appears multiple times within a preset time period, only the parameter record with the earliest timestamp is retained, and the other multiple parameter records within the preset time period are deleted; parameters with vehicle speeds lower than the minimum speed threshold or higher than the maximum speed threshold are deleted.

[0012] In one example, video frame denoising and perspective transformation correction are performed on highway traffic flow data collected by a drone to obtain a video image in a geographic coordinate system. Specifically, this includes: performing Gaussian filtering on the highway traffic flow data collected by the drone to obtain first filtered data; performing median filtering on the first filtered data with a preset window size to obtain second filtered data; determining the homography matrix through a set of ground control points; and mapping the pixel coordinates in the second filtered data to geographic coordinates according to the homogeneous coordinate transformation formula and the homography matrix to obtain a video image in a geographic coordinate system.

[0013] In one example, setting a time-distance detection line in the video image specifically includes: determining two reference points in the video image based on the equation of a straight line; connecting the two reference points to obtain a primary time-distance detection line; determining whether the primary time-distance detection line is perpendicular to the road in the video image; if it is perpendicular, determining the primary time-distance detection line as the time-distance detection line; if it is not perpendicular, re-selecting two reference points in the video image and connecting them until the connecting line is perpendicular to the road in the video image.

[0014] In one example, the method also includes: the drone is installed at a preset vertical height above the median strip of a highway, with the pitch, roll, and yaw angles of the drone all in a vertical attitude directly above.

[0015] On the other hand, embodiments of this application provide a highway headway analysis device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform any of the above-mentioned highway headway analysis methods.

[0016] On the other hand, embodiments of this application provide a non-volatile computer storage medium for highway headway analysis, which stores computer-executable instructions that can execute any of the above-mentioned highway headway analysis methods.

[0017] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:

[0018] This application constructs a hierarchical Bayesian model, building sub-models for different groups under the global hyperparameter layer. This allows vehicle parameters to share global prior information, maintaining robustness of parameter estimation even in data-scarce scenarios and effectively improving the model's ability to characterize heterogeneity across different lanes and vehicle types. The NUTS algorithm's MCMC sampling method efficiently samples each hierarchical Bayesian model, obtaining posterior distribution samples of model parameters. This provides a reliable foundation for calculating the posterior prediction distribution, enabling precise quantification of model parameter uncertainty. By employing the Bayesian model averaging framework and bridging sampling method, the marginal likelihood and posterior probability weights of each hierarchical Bayesian model are calculated. The posterior prediction distributions of multiple distribution models are then weighted and fused, fully utilizing model uncertainty to improve the stability and reliability of the prediction distribution, overcoming the limitations of a single model in characterizing multimodal and heavy-tailed phenomena. Attached Figure Description

[0019] To more clearly illustrate the technical solution of this application, some embodiments of this application will be described in detail below with reference to the accompanying drawings, in which:

[0020] Figure 1 A flowchart illustrating a method for analyzing the headway of a vehicle on a highway, provided as an embodiment of this application;

[0021] Figure 2 A schematic diagram of UAV data acquisition for a method of analyzing the headway of vehicles on a highway, provided in an embodiment of this application;

[0022] Figure 3 A schematic diagram of a lane-crossing event provided for a method for analyzing headway on a highway, as illustrated in an embodiment of this application;

[0023] Figure 4 This is a schematic diagram of a highway headway analysis device provided in an embodiment of this application. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] Some embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0026] Figure 1 This is a flowchart illustrating a method for analyzing headway on highways, provided as an embodiment of this application. This method can be applied to different business domains. Certain input parameters or intermediate results in this process can be manually adjusted to help improve accuracy.

[0027] The analysis method involved in the embodiments of this application can be implemented by a terminal device or a server, and this application does not impose any special limitations on it. For ease of understanding and description, the following embodiments are all described in detail using a controller as an example.

[0028] Based on this Figure 1 The process may include the following steps:

[0029] S101: Perform video frame denoising and perspective transformation correction on the highway traffic flow data collected by the drone to obtain video images in the geographic coordinate system.

[0030] In some embodiments of this application, to analyze and model the headway of vehicles on highways, the first step is to use a drone to collect highway traffic flow data. Specifically, several fixed observation points are selected along the key sections of the highway. The drone hovers at a vertical height of H = 50m above the central divider to ensure full coverage in both directions. The drone maintains an upward attitude with a pitch angle θ = -90°, a roll angle φ = 0°, and a yaw angle ψ = 0°, and begins collecting traffic flow data.

[0031] Furthermore, because the grayscale value I of the collected traffic flow data video frames noisy (u,v), containing Gaussian noise With impulse noise n P Its observation formula is expressed as

[0032] I noisy (u,v)=I true (u,v)+n G +n P ,

[0033] In the formula, (u,v) represents the horizontal and vertical coordinates of a pixel in the image frame, corresponding to the column index u (column) and row index v (row), respectively. noisy (u,v) represents the grayscale value of the observed frame at pixel position (u,v), I true (u,v) represents the true (noise-free) grayscale value at pixel (u,v), n G n represents the Gaussian noise component. p This represents the impulse noise component.

[0034] Therefore, it is necessary to perform Gaussian filtering on the highway traffic flow data collected by the drone to obtain the first filtered data.

[0035] Then, to further suppress noise, a (2m+1)×(2m+1) window is used for median filtering (usually m=1) to obtain the second filtered data. m is the half-length of the median filtering window, which means that m pixels are extended outward from the center pixel (u,v).

[0036] Furthermore, the denoised second-filtered data undergoes perspective transformation correction, specifically through a set of ground control points. Solve for the homography matrix H, and then perform coordinate transformation on the pixels. The perspective transformation formula is as follows:

[0037]

[0038] In the formula, (u i ,v i The x and y coordinates of a pixel in the image pixel coordinate system represent the column index u (column) and row index v (row), respectively. H represents a 3×3 homography matrix, estimated from the correspondence between the image coordinates and the actual geographic coordinates of several pairs of ground control points, used to correct perspective distortion. g ,y g w represents the geographic coordinate components mapped to homogeneous coordinates, where x g y g Here, represents the unnormalized geographic coordinates, w is the scaling factor for homogeneous coordinates, and 1 is the constant component used when constructing the homogeneous coordinate vector. (x, y) represents the normalized... The obtained actual ground plane coordinates are used for subsequent geometric measurements and time distance calculations. After normalization, the first two components are taken as the corresponding geographic coordinates (X). i ,Y i ).

[0039] This application overcomes the limitations of fixed equipment deployment by using UAV dynamic monitoring and video preprocessing methods to achieve comprehensive coverage of different lanes and sections of highways. By combining Gaussian filtering, median filtering for noise reduction, and perspective transformation correction, it provides high-quality geographic coordinate system video images for subsequent vehicle detection and parameter extraction, thereby improving the completeness and accuracy of traffic data collection.

[0040] S102: A time-distance detection line is set in the video image. By judging the change in the sign of the function value of the same vehicle relative to the time-distance detection line at the geographical coordinate point in adjacent frames, the vehicle is monitored to see if it has passed the time-distance detection line. When the same vehicle is on both sides of the time-distance detection line, the function value signs are different.

[0041] In some embodiments of this application, after processing traffic flow data to obtain video images, lane detection lines L need to be defined in a geographic coordinate system to facilitate the calculation of headway and lane numbering. j Used to determine vehicle lane crossing events, specifically, the set time-distance detection line is formed by two points on the ground (X... j1 ,Y j1 ) and (X j2 ,Y j2 Based on the equation of the straight line, two reference points are determined in the video image. These two reference points are then connected to obtain the primary time-distance detection line, whose equation can be written as follows:

[0042] a j X+b j Y+c j =0

[0043] a j =Y j2 -Y j2

[0044] b j =X j1 -X j2

[0045] c j =X j2 Y j1 -X j1 Y j2

[0046] Among them, a j X+b j Y+c j =0 is the linear equation of the j-th lane detection line. An algebraic equation describes the linear relationship of the detection line in the geographic coordinate system. Substituting the vehicle coordinates determines whether the line has been crossed. a j b j c jThese are the coefficients of the straight line equation, calculated from the coordinates of two ground points that determine the detection line.

[0047] Furthermore, determine whether the primary time-distance detection line is perpendicular to the road in the video image. If it is perpendicular, the primary time-distance detection line is determined as the time-distance detection line.

[0048] If the line is not perpendicular, select two reference points in the video image and connect them until the connecting line is perpendicular to the road in the video image.

[0049] Furthermore, when a vehicle is at geographical coordinates (X) in two adjacent frames... k ,Y k ) and (X k+1 ,Y k+1 ) respectively correspond to f j (X k ,Y k ) and f j (X k+1 ,Y k+1 When the signs are opposite, it is determined that the vehicle crossed the detection line between these two frames. j The symbol indicates which side of the inspection line the vehicle is located on.

[0050] S103: When passing through, the crossing time of a vehicle is determined by linear interpolation, and the headway between adjacent vehicles is determined based on the crossing time of each vehicle.

[0051] In some embodiments of this application, after determining that the vehicle has completed the line crossing event, the time of the line crossing event is determined by linear interpolation, and the vehicle's headway and average speed are determined according to the line crossing time and physical speed formulas. The linear interpolation formula is as follows:

[0052]

[0053] Where t cross The moment a vehicle crosses the detection line is a key time point estimated through linear interpolation, used to accurately determine the instant the vehicle crosses the line. k This is the time corresponding to the k-th frame of the vehicle, serving as the base time reference for linear interpolation calculation of the line-crossing time. Δt represents the time interval between two adjacent frames. Its calculation is related to the frame rate f. s Related, f s This is the frame rate of a video or image sequence, i.e., the number of frames per unit time. Δt represents the time length between two frames. |f j (X k ,Y k )|,|f j (X k+1 ,Y k+1)| represent the vehicle's position in frame k and frame (k+1), respectively. j The absolute value of the (X,Y) calculation result is used in the linear interpolation process to determine the proportional weight of the time of crossing the line in the time interval between two adjacent frames.

[0054] Furthermore, at the time t when the vehicle crosses the line... i After extraction, the headway and average speed can be extracted. The formula for calculating the headway is as follows:

[0055] h i =t i -t i-1

[0056] Among them, h i t represents the headway of the i-th vehicle. i and t i-1 Let be the times when the i-th vehicle and the vehicle in front of it cross the lane, respectively. The formula for calculating the average speed is as follows:

[0057]

[0058] The lane to which a vehicle belongs is determined by the detection line number j it crosses, and the adjacent detection line L... j With L j+1 Record the crossing time separately. and And the actual ground distance between the two lines is D. j .

[0059] Finally, a structured record {VehicleID,Class,j,t} is generated for each vehicle. i ,h i ,v i ,l i The traffic parameters of the vehicle are obtained. Where VehicleID is the vehicle ID, Class is the vehicle type, j is the detection lane number, and t... i h is the time when the vehicle crosses the line. i For the headway, v i For average velocity, l i Lane number.

[0060] Furthermore, after the above operations are completed, YOLOv8 and DeepSORT are used to perform target recognition and tracking to extract traffic parameters. First, a vehicle detection image dataset is established, and the YOLOv8 vehicle detection model is trained to realize the recognition of vehicle types in the video. Then, the DeepSORT algorithm is used to realize multi-target tracking and extract data such as the number of vehicles, lane number, vehicle type, and timestamp on the observed road segment in the video.

[0061] S104: Based on the lane and vehicle type, divide the vehicles in front of and behind the time distance detection line to obtain multiple vehicle headway data subsets.

[0062] In some embodiments of this application, to analyze the headway distribution under different vehicle types and lane conditions, all vehicles in the obtained vehicle traffic parameters are grouped according to two conditions: vehicle type and lane. The vehicle types in the traffic parameters include car (C) and truck (T); the lane numbers are L1 and L2, corresponding to the left and right lanes respectively. Therefore, the selected data is divided into the following eight subsets: (CC, L1), (CC, L2), (CT, L1), (CT, L2), (TC, L1), (TC, L2), (TT, L1), and (TT, L2).

[0063] Furthermore, after completing the initial vehicle type and lane screening, it is necessary to further remove outliers and discontinuous records to ensure the accuracy of subsequent headway calculations. First, considering the occasional misjudgments during high-frequency sampling and target recognition, there may be cases where the same vehicle is recorded repeatedly within a very short period of time. Therefore, this study sets the following rules to remove duplicate frames: if the same vehicle number appears multiple times within an interval of less than 20 milliseconds (i.e., less than one frame time, frame rate of 25fps), it is considered a duplicate detection within the same frame, and only the record with the earliest timestamp is retained, while the remaining duplicate data is deleted.

[0064] Simultaneously, the vehicle speed field is checked for reasonableness. For the speed field, if the recorded value is below 1 m / s, it may be due to measurement error when the vehicle is stationary; while a value above 80 m / s clearly exceeds the reasonable range for highway driving. Therefore, this paper considers records with speeds below 1 m / s or above 80 m / s as outliers and removes them.

[0065] S105: Construct hierarchical Bayesian models for the preset probability distribution model and mixed distribution model respectively, and sample each hierarchical Bayesian model using the NUTS algorithm to obtain the posterior distribution samples of each hierarchical Bayesian model.

[0066] In some embodiments of this application, after determining a subset of traffic parameters by grouping, it is necessary to define a probability distribution model and a mixture distribution model. The probability distribution model in this application takes four traditional probability distribution models: Lognormal distribution, Weibull distribution, Gamma distribution, and Exponential distribution, as examples, and the mixture distribution model takes the Gaussian mixture model (GMM) as an example.

[0067] Furthermore, a three-layer Bayesian model, comprising an observation layer, a subset parameter layer, and a hyperparameter layer, is constructed for the pre-defined probability distribution model and the mixed distribution model, respectively. The observation layer models the headway samples within the traffic parameter subset as observations that conform to the corresponding distribution model. The parameters of the subset parameter layer are generated by the global distribution of the hyperparameter layer. The hyperparameter layer assigns weakly informative priors to the parameters of the global prior distribution.

[0068] Taking the Lognormal distribution as an example, the construction of a three-layer Bayesian model specifically consists of a Level 1 observation layer (within each subset):

[0069] For each subset z, the observation y j (Time interval):

[0070]

[0071] The log-time interval logy of each sample follows a normal distribution, and each subset has its own parameter μ. j , σ j .

[0072] Level 2 Subset Parameter Layer (Subset parameters come from global priors):

[0073] The parameters for each subset are further derived from the global distribution, and modeled as follows:

[0074]

[0075] The mean μ of each subset j It fluctuates around a global central value μ0; the variance σ of each subset j There is also a shared prior scope.

[0076] Level 3 hyperparameter layer (prior hyperparameters):

[0077] Weakly informative priors are given for the global parameters μ0, τ, and ξ:

[0078]

[0079] Furthermore, Markov chain Monte Carlo sampling is performed on each hierarchical Bayesian model using the NUTS algorithm to generate posterior distribution samples for each hierarchical Bayesian model.

[0080] S106: Based on the posterior distribution samples of each hierarchical Bayesian model and each vehicle headway time distance subset, calculate the posterior prediction distribution of the vehicle headway time distance for each hierarchical Bayesian model for each vehicle headway time distance subset.

[0081] In some embodiments of this application, after generating the posterior distribution sample for each hierarchical Bayesian model, it is necessary to calculate the predictive distribution integral of the posterior distribution of each hierarchical Bayesian model for the subset of traffic parameters based on the posterior distribution sample, thereby obtaining the posterior predicted distribution of each hierarchical Bayesian model for the subset of traffic parameters. The formula for the predictive distribution integral is:

[0082] p(h * |D g M k )=∫p(h * |θ g M k )p(θ g |D g M k )dθ g

[0083] Among them, M k This represents a hierarchical Bayesian model, h * Indicates the future (unobserved) headway; θ g Model parameters for the g-th subset; p(h * |θ g M k ) is a given parameter θ g Then, the model's predicted distribution for new samples (i.e., the model's likelihood function); p(θ) g |D g M k ) is based on training data D g The posterior distribution of the obtained model parameters is represented by MCMC samples.

[0084] It should be noted that when generating the posterior prediction distribution of vehicle headway time using hierarchical Bayesian models for subsets of vehicle headway time data, this application follows a one-to-one correspondence principle. For example, if there are 5 hierarchical Bayesian models ABCDE and 3 sets of vehicle headway time data subsets ZXC, the first hierarchical Bayesian model is used to calculate the posterior prediction distribution of vehicle headway time with each of the 3 sets of vehicle headway time data subsets, i.e., AZ, AX, AC. Then, the second hierarchical Bayesian model is used to calculate the posterior prediction distribution of vehicle headway time with each of the 3 sets of vehicle headway time data subsets, i.e., BZ, BX, BC, until all hierarchical Bayesian models have completed the calculation for the 3 sets of vehicle headway time data subsets.

[0085] S107: Determine the posterior probability of each hierarchical Bayesian model as the weight corresponding to each model, and according to the weight corresponding to each model, perform a weighted summation of the posterior prediction distribution of the headway of each hierarchical Bayesian model to obtain the final posterior prediction distribution of the headway of each subset of headway data.

[0086] In some embodiments of this application, a large number of representative parameter samples are obtained by performing Markov Chain Monte Carlo (MCMC) sampling on the posterior distribution of the parameters of each hierarchical Bayesian model. Then, the marginal likelihood estimation method using bridging sampling is employed to calculate the model's performance on a given subset of data D. g Marginal likelihood p(D) under the given conditions g |M k ),

[0087] p(D g |M k )=∫p(D g |θ k M k )·p(θ k |M k )dθ k ,

[0088] Where p(θ) k |M k ) is the prior distribution of the model parameters. Then, it is combined with the pre-defined model prior probability p(M) k (Assuming a uniform distribution), calculate the posterior probability of each model using Bayes' theorem, and obtain the weight w of each model. k ,Right now:

[0089]

[0090] This posterior probability serves as a model weighting coefficient, which is used in the subsequent Bayesian Model Averaging (BMA) process to sum the posterior prediction distributions of all hierarchical Bayesian models in a weighted manner, thereby fully considering the impact of model uncertainty on the final prediction results.

[0091] Finally, the posterior prediction results of all hierarchical Bayesian models under different subsets are integrated to fully account for the uncertainty of the model structure. The posterior prediction distribution is expressed as follows:

[0092]

[0093] Wherein, p(M k |D g ) represents model M k The posterior probability, p(h) * |D g M k Model M k The posterior predicted distribution under the given conditions.

[0094] It should be noted that, although the embodiments in this application are based on... Figure 1Steps S101 to S107 will be described sequentially, but this does not mean that steps S101 and S107 must be performed in a strict order. The reason this embodiment follows this order is... Figure 1 The order in which steps S101 to S107 are described is provided to facilitate understanding of the technical solutions of the embodiments of this application by those skilled in the art. In other words, in the embodiments of this application, the order of steps S101 to S107 can be appropriately adjusted according to actual needs.

[0095] pass Figure 1 This application employs a hierarchical Bayesian model, constructing sub-models for different subsets within a global hyperparameter layer. This allows subset parameters to share global prior information, maintaining robustness of parameter estimation even in data-scarce scenarios and effectively enhancing the model's ability to characterize heterogeneity across different lanes and vehicle types. The NUTS algorithm's MCMC sampling method efficiently samples each hierarchical Bayesian model, obtaining posterior distribution samples of model parameters. This provides a reliable foundation for calculating the posterior prediction distribution, enabling precise quantification of model parameter uncertainty. Furthermore, by employing the Bayesian model averaging framework and bridging sampling method, the marginal likelihood and posterior probability weights of each hierarchical Bayesian model are calculated. The posterior prediction distributions of multiple distribution models are then weighted and fused, fully utilizing model uncertainty to improve the stability and reliability of the prediction distribution, overcoming the limitations of single models in characterizing multimodal and heavy-tailed phenomena.

[0096] Figure 2 This is a schematic diagram of UAV data acquisition for a highway headway analysis method provided in an embodiment of this application.

[0097] exist Figure 2 The image shows a diagram illustrating the collection of traffic flow video data by a drone. Specifically, the drone hovers at a vertical height of H=50m above the central divider to ensure full coverage in both directions. The drone maintains an upward attitude with a pitch angle θ=-90°, a roll angle φ=0°, and a yaw angle ψ=0°.

[0098] Figure 3 This is a schematic diagram of a lane-crossing event in a method for analyzing the headway of a vehicle on a highway, provided in an embodiment of this application.

[0099] exist Figure 3 The image shows the line-crossing event of this application, specifically when a vehicle crosses the line at geographical coordinates (X, Y, F, G) between two adjacent frames. k ,Y k ) and (X k+1 ,Y k+1 ) respectively correspond to f j (X k ,Y k ) and f j (Xk+1 ,Y k+1 When the signs are opposite, it is determined that the vehicle crossed the detection line between these two frames. j The symbol indicates which side of the inspection line the vehicle is located on.

[0100] Figure 4 A schematic diagram of a highway headway analysis device provided in this application embodiment includes:

[0101] At least one processor; and,

[0102] A memory that is communicatively connected to at least one processor; wherein,

[0103] A highway headway analysis method is described in which the memory stores instructions that can be executed by at least one processor, such that the at least one processor is able to perform any of the above-mentioned tasks.

[0104] Some embodiments of this application provide a non-volatile computer storage medium for highway headway analysis, which stores computer-executable instructions that can execute any of the above-described highway headway analysis methods.

[0105] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.

[0106] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0107] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0108] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0109] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0110] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0111] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0112] Memory may include non-persistent storage in computer-readable media, random access memory (RAM), and non-volatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0113] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0114] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0115] The above are merely embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the technical principles of this application should fall within the protection scope of this application.

Claims

1. A method for analyzing headway on highways, characterized in that, The method includes: The traffic flow data on highways collected by drones is processed by video frame denoising and perspective transformation correction to obtain video images in geographic coordinate system. A time-distance detection line is set in the video image. By judging the change in the sign of the function value of the same vehicle relative to the time-distance detection line in adjacent frames, it is monitored whether the vehicle has passed the time-distance detection line. When the same vehicle is on both sides of the time-distance detection line, the sign of the function value is different. When a vehicle is at geographical coordinates in two adjacent frames and Corresponding to and When the signs are opposite, it is determined that the vehicle crossed the detection line between these two frames. The symbol indicates which side of the inspection line the vehicle is located on; When passing through, the crossing time of a vehicle is determined by linear interpolation, and the headway between adjacent vehicles is determined based on the crossing time of each vehicle. Based on the vehicle's lane and vehicle type, the vehicles in front of and behind the time distance detection line are divided to obtain multiple vehicle headway data subsets; Hierarchical Bayesian models are constructed for the preset probability distribution model and the mixed distribution model, respectively. The NUTS algorithm is used to sample each hierarchical Bayesian model to obtain the posterior distribution samples of each hierarchical Bayesian model. Based on the posterior distribution samples of each hierarchical Bayesian model and each vehicle headway data subset, calculate the posterior prediction distribution of the vehicle headway for each hierarchical Bayesian model for each vehicle headway data subset. The posterior probability of each hierarchical Bayesian model is determined as the weight of each model. Based on the weight of each model, the posterior prediction distribution of the headway of each hierarchical Bayesian model is weighted and summed to obtain the final posterior prediction distribution of the headway of each subset of headway data.

2. The method according to claim 1, characterized in that, Before determining the posterior probability of each hierarchical Bayesian model as its corresponding weight, the method further includes: The marginal likelihood of each hierarchical Bayesian model under the time-distance data subset at the vehicle head is calculated using the bridging sampling method. The prior probability of each hierarchical Bayesian model is determined to be uniformly distributed; The prior probability and marginal likelihood of each hierarchical Bayesian model are weighted and calculated using Bayes' theorem formula to obtain the posterior probability of each hierarchical Bayesian model.

3. The method according to claim 1, characterized in that, The construction of hierarchical Bayesian models for the preset probability distribution model and the mixed distribution model includes: For the preset probability distribution model and the mixed distribution model, construct a three-layer Bayesian model including the observation layer, the subset parameter layer, and the hyperparameter layer respectively; The observation layer models the headway time distance samples within the subset of headway data as observations that follow the corresponding distribution model; the parameters of the vehicle parameter layer are generated by the global distribution of the hyperparameter layer; and the hyperparameter layer assigns weakly informative priors to the parameters of the global prior distribution.

4. The method according to claim 1, characterized in that, The step of calculating the posterior distribution of the headway for each hierarchical Bayesian model for each headway data subset, based on the posterior distribution samples of each hierarchical Bayesian model and each headway data subset, specifically includes: Based on the posterior distribution samples, the prediction distribution integral of the posterior distribution of each hierarchical Bayesian model for the vehicle headway data subset is calculated to obtain the posterior prediction distribution of the vehicle headway for each hierarchical Bayesian model for each vehicle headway data subset.

5. The method according to claim 1, characterized in that, After dividing adjacent vehicles passing the time-distance detection line according to their lane and vehicle type to obtain multiple vehicle headway data subsets, the method further includes: Traverse the multiple vehicle headway data subsets. If the same vehicle ID appears multiple times within a preset time, only the parameter record with the earliest timestamp is retained, and the other parameter records within the preset time are deleted. Parameters whose vehicle speed is below the minimum speed threshold or above the maximum speed threshold will be deleted.

6. The method according to claim 1, characterized in that, The process of performing video frame denoising and perspective transformation correction on highway traffic flow data collected by the drone to obtain video images in a geographic coordinate system specifically includes: Gaussian filtering is applied to the highway traffic flow data collected by the drone to obtain the first filtered data; The first filtered data is subjected to median filtering with a preset window size to obtain the second filtered data; The homography matrix is ​​determined by the set of ground control points. Based on the homography matrix and the homography transformation formula, the pixel coordinates in the second filtered data are mapped to geographic coordinates to obtain the video image in the geographic coordinate system.

7. The method according to claim 1, characterized in that, Setting a time interval detection line in the video image specifically includes: Based on the equation of the straight line, determine two reference points in the video image; Connect the two reference points to obtain the primary time-distance detection line; Determine whether the primary time-distance detection line is perpendicular to the road in the video image. If it is perpendicular, determine the primary time-distance detection line as the time-distance detection line. If the line is not perpendicular, select two reference points in the video image and connect them until the connecting line is perpendicular to the road in the video image.

8. The method according to claim 1, characterized in that, The method further includes: The drone is installed at a preset vertical height above the median strip of the highway, with its pitch, roll, and yaw angles all pointing directly upwards in a vertical attitude.

9. A highway headway analysis device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform a highway headway analysis method according to any one of claims 1-8.

10. A highway vehicle headway analysis storage medium, storing computer-executable instructions, characterized in that, The computer-executable instructions are capable of executing the highway headway analysis method according to any one of claims 1-8.