Bayesian linear model-based highway traffic flow anomaly detection method and system

By combining Bayesian linear models and wavelet transforms with ETC transaction data from highway toll systems, the problem of high cost of single traffic flow detection is solved, enabling rapid and low-cost detection of traffic flow anomalies.

CN116311929BActive Publication Date: 2025-11-11FUJIAN UNIV OF TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310242737.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-14
Publication Date
2025-11-11
Estimated Expiration
2043-03-14

Smart Images

  • Figure CN116311929B_ABST
    Figure CN116311929B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of traffic flow detection technology, specifically relating to a method and system for detecting abnormal highway traffic flow based on a Bayesian linear model. The method includes the following steps: preprocessing historical vehicle arrival data; performing distribution fitting processing on the preprocessed data; learning the distribution-fitted data using a Bayesian linear model to obtain periodic parameters of vehicle arrival distribution parameter changes; preprocessing vehicle arrival data collected in real time within the corresponding time period, and performing distribution fitting processing on the preprocessed data; processing the distribution-fitted data using a Bayesian linear model to extract vehicle arrival distribution parameters in real time; calculating the difference between the periodic parameters and the parameters in real time to obtain the residual of vehicle arrival distribution parameters in real time; processing the residual using wavelet transform to calculate wavelet energy, and detecting abnormal traffic flow based on the peak value of the wavelet energy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traffic flow detection technology, specifically relating to a method and system for detecting anomalies in highway traffic flow based on a Bayesian linear model. Background Technology

[0002] Traffic flow data, containing the spatiotemporal distribution characteristics of traffic flow, is a crucial basis for analyzing road capacity, traffic management, traffic flow prediction, and traffic accident detection. Traffic flow anomalies typically originate from changes in traffic conditions. When the traffic density on highways reaches a certain level, minor disturbances in the traffic system are amplified, ultimately leading to anomalies in traffic flow. Accurate detection of traffic flow anomalies is beneficial for identifying traffic congestion and accidents, and based on this, selecting appropriate countermeasures to improve highway efficiency.

[0003] Currently, most methods for traffic flow anomaly detection rely on macroscopic baseline maps and highway density and vehicle speed to determine whether the current traffic flow is abnormal. For highways, density and speed detection methods are costly, while traffic flow data based on highway toll system transactions is easier to statistically analyze. Secondly, existing methods cannot detect anomalies solely based on traffic flow; they require floating car data or other data to assess traffic conditions and then correlate them with traffic flow to detect abnormal traffic flow. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for detecting anomalies in highway traffic flow based on a Bayesian linear model. First, historical vehicle arrival data is processed by distribution fitting, and a Bayesian linear model is used to learn the historical vehicle arrival data after distribution fitting, thereby obtaining periodic parameters of the changes in vehicle arrival distribution parameters in the historical data. Second, real-time vehicle arrival data is processed by distribution fitting, and a Bayesian linear model is used to process the real-time data after distribution fitting to obtain vehicle distribution parameters in the real-time state. Then, the difference between the periodic parameters and the vehicle arrival distribution parameters in the real-time state is calculated to obtain the residual of the vehicle arrival distribution parameters in the real-time state. Finally, wavelet transform is used to process the residual to calculate the wavelet energy. The peak value of the wavelet energy indicates that the current traffic flow is in an abnormal state.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] The first aspect of this invention provides a method for detecting anomalies in highway traffic flow based on a Bayesian linear model, comprising the following steps:

[0007] S1. Preprocess historical vehicle arrival data;

[0008] S2. Perform distribution fitting processing on the preprocessed vehicle arrival history data;

[0009] S3. Use a Bayesian linear model to learn the historical vehicle arrival data after distribution fitting to obtain the periodic parameters of the vehicle arrival distribution parameters in the historical data.

[0010] S4. Preprocess the real-time vehicle arrival data collected in real time within the corresponding time period, perform distribution fitting on the preprocessed real-time vehicle arrival data, and use a Bayesian linear model to process the distribution-fitted real-time vehicle arrival data in order to extract the vehicle arrival distribution parameters in real time.

[0011] S5. Calculate the difference between the periodic parameter and the vehicle arrival distribution parameter in real time to obtain the residual of the vehicle arrival distribution parameter in real time.

[0012] S6. Wavelet transform is used to process the residuals to calculate the wavelet energy, and the peak value of the wavelet energy is used to detect abnormal traffic flow on highways.

[0013] As a preferred approach, the historical and real-time vehicle arrival data are preprocessed, including deleting duplicate and abnormal data and filling in missing data.

[0014] As a preferred embodiment, the distribution fitting process described in steps S2 and S4 includes the following steps:

[0015] The Kolmogorov-Smirnow test was used to evaluate the distribution fit results. If the evaluation passed, the subsequent steps were performed. If the evaluation failed, the distribution was refitted.

[0016] As a preferred option, historical vehicle arrival data and real-time vehicle arrival data are obtained from ETC transaction data in the highway toll system.

[0017] As a preferred option, the Bayesian linear model consists of observation equations and system equations;

[0018] The observation equation is:

[0019] P lt =F t Θ t +v t v t ~N(0,V) t ),

[0020] Among them, P lt Let F represent the observation vector of the l-th ETC gantry at time t. tΘ represents the regression matrix at time t. t The system equations at time t, v t This indicates that the mean is 0 and the variance is V. t The observation error, V t The random variable noise represents the observation error at time t, and N represents the number of observations;

[0021] The system equations are:

[0022] Θ t =G t Θ t-1 +w t w t ~N(0,W t ),

[0023] Among them, G t Θ represents the transfer matrix at time t. t-1 The system equations at time t-1, w t It has a mean of 0 and a variance of W. t The systematic error, W t The random variable noise represents the systematic error at time t;

[0024] The variable representation expression of the Bayesian linear model is:

[0025] {F,G,V,W} t ={F t G t V t W t},

[0026] Where F, G, V, and W represent F respectively t G t V t W t The set corresponding to these four variables.

[0027] As a preferred approach, maximum likelihood estimation is used to solve for the parameters of the Bayesian linear model. The calculation formula is as follows:

[0028]

[0029] Among them, P l P represents lt The set, p(Θ,P l |F,G,V,W)p(Θ t |Θ t-1 ), p(P lt |Θ t All of these are conditional probability equations.

[0030] As a preferred option, in step S6, the use of wavelet transform must meet the following two conditions.

[0031] Condition one:

[0032] Condition two:

[0033] Where E represents wavelet energy and ψ(t) represents wavelet basis function.

[0034] As a preferred option, the wavelet transform formula is:

[0035]

[0036] Where a represents the scaling parameter controlling the wavelet's scaling, b represents the translation parameter controlling the wavelet's movement along the time dimension, w(a) is the weighting function, and x(t) represents the residual of the vehicle arrival distribution parameters at time t. This represents the wavelet function after translation and scaling of the wavelet basis function.

[0037] As a preferred option, the formula for calculating wavelet energy is:

[0038]

[0039] The second aspect of the present invention provides a highway traffic flow anomaly detection system based on a Bayesian linear model, and a highway traffic flow anomaly detection method based on a Bayesian linear model as described in the first aspect of the present invention, comprising a data preprocessing module, a distribution fitting processing module, a distribution parameter extraction module, a distribution parameter residual calculation module, and a wavelet energy calculation module connected in sequence.

[0040] The data preprocessing module is used to preprocess historical and real-time vehicle arrival data.

[0041] The distribution fitting processing module is used to perform distribution fitting processing on the preprocessed historical and real-time vehicle arrival data.

[0042] The distribution parameter extraction module is used to learn from the historical vehicle arrival data after distribution fitting to obtain the periodic parameters of the vehicle arrival distribution parameter changes in the historical data. It is also used to process the real-time vehicle arrival data after distribution fitting to extract the vehicle arrival distribution parameters in the real-time state.

[0043] The distributed parameter residual calculation module is used to calculate the difference between the periodic parameter and the vehicle arrival distribution parameter in real time, so as to obtain the residual of the vehicle arrival distribution parameter in real time.

[0044] The wavelet energy calculation module is used to process the residuals using wavelet transform to calculate the wavelet energy, and to detect abnormal traffic flow on highways based on the peak value of the wavelet energy.

[0045] The beneficial effects of this invention are:

[0046] 1. This invention learns the periodicity of traffic flow changes in historical data using a Bayesian linear model. It calculates the difference between the periodic parameters and the vehicle arrival distribution parameters in real-time to obtain the residual of the real-time vehicle arrival distribution parameters. Wavelet transform is then used to process the residual to calculate wavelet energy. The peak value of the wavelet energy indicates that the current traffic flow is in an abnormal state. Existing technologies require floating car data or other data to determine the traffic state and then correlate it with traffic flow to detect abnormal traffic flow. However, the method described in this invention enables anomaly detection using only traffic flow data, making the detection of abnormal traffic flow states more convenient and cost-effective.

[0047] 2. After calculating the wavelet energy, the peak value of the wavelet energy indicates that the traffic flow is in an abnormal state. The judgment of the abnormal state of traffic flow is faster and simpler, which can facilitate managers to make subsequent adjustments as soon as possible after discovering the abnormal situation.

[0048] 3. This invention obtains traffic flow based on transactions in the highway toll system, making traffic flow statistics easier. Only preprocessing of the acquired data is required for subsequent analysis. Data acquisition is simple, fast, and inexpensive. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a flowchart of the method described in this invention.

[0051] Figure 2 This is a diagram illustrating the selection of data from the current moment and the previous 59 minutes under actual conditions. Detailed Implementation

[0052] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0053] Example 1:

[0054] Reference Figure 1 A method for detecting anomalies in highway traffic flow based on a Bayesian linear model includes the following steps:

[0055] S1. Preprocess historical vehicle arrival data;

[0056] S2. Perform distribution fitting processing on the preprocessed vehicle arrival history data;

[0057] S3. Use a Bayesian linear model to learn the historical vehicle arrival data after distribution fitting to obtain the periodic parameters of the vehicle arrival distribution parameters in the historical data.

[0058] S4. Preprocess the real-time vehicle arrival data collected in real time within the corresponding time period, perform distribution fitting on the preprocessed real-time vehicle arrival data, and use a Bayesian linear model to process the distribution-fitted real-time vehicle arrival data in order to extract the vehicle arrival distribution parameters in real time.

[0059] S5. Calculate the difference between the periodic parameter and the vehicle arrival distribution parameter in real time to obtain the residual of the vehicle arrival distribution parameter in real time.

[0060] S6. Wavelet transform is used to process the residuals to calculate the wavelet energy, and the peak value of the wavelet energy is used to detect abnormal traffic flow on highways.

[0061] Furthermore, historical and real-time vehicle arrival data are obtained from ETC transaction data in the highway toll system. Currently, most methods for detecting traffic flow anomalies rely on macroscopic basic maps, highway density, and vehicle speed to determine whether the current traffic flow is abnormal. For highways, density and speed detection methods are costly, while traffic flow is easier to statistically analyze based on ETC transaction data in the highway toll system.

[0062] Furthermore, the historical and real-time vehicle arrival data are preprocessed, including deleting duplicate and abnormal data, filling in missing data, and counting the number of vehicles arriving per minute.

[0063] Specifically:

[0064] Because ETC data collection, transmission, and storage are affected by equipment failures, wireless signal interference, and severe weather, ETC transaction data presents the following three main problems:

[0065] Duplicate data refers to data that has been recorded twice or more, but was collected at the same time.

[0066] Missing data: Due to equipment failure and other reasons, data cannot be uploaded and stored when a vehicle passes through the ETC gantry.

[0067] Abnormal data, similar to duplicate data, occurs when a vehicle passes through an ETC gantry and, due to equipment and other factors, the gantry detects the vehicle in the opposite direction and uploads and stores the data.

[0068] In this embodiment, during data preprocessing, duplicate data is first removed, including data repeatedly detected by the ETC gantry within a 10-second acquisition time. For missing and abnormal data, several adjacent ETC gantries are connected to extract vehicle trajectories, then missing data is filled in, and abnormal data is detected and removed. Using the preprocessed data for subsequent analysis can improve the accuracy of detecting abnormal traffic flow conditions.

[0069] Furthermore, the distribution fitting process described in steps S2 and S4 includes the following steps:

[0070] The Kolmogorov-Smirnow test was used to evaluate the distribution fit results. If the evaluation passed, the subsequent steps were performed. If the evaluation failed, the distribution was refitted.

[0071] Specifically, refer to Figure 2 In this embodiment, the distribution fitting process for real-time data specifically involves extracting the data from the previous 59 minutes at each time point and performing distribution fitting.

[0072] Furthermore, the Bayesian linear model consists of observation equations and system equations;

[0073] The observation equation is:

[0074] P lt =F t Θ t +v t v t ~N(0,V) t),

[0075] Among them, P lt Let F represent the observation vector of the l-th ETC gantry at time t. t Θ represents the regression matrix at time t. t The system equations at time t, v t This indicates that the mean is 0 and the variance is V. t The observation error, V t The random variable noise represents the observation error at time t, and N represents the number of observations;

[0076] The system equations are:

[0077] Θ t =G t Θ t-1 +w t w t ~N(0,W t ),

[0078] Among them, G t Θ represents the transfer matrix at time t. t-1 The system equations at time t-1, w t It has a mean of 0 and a variance of W. t The systematic error, W t The random variable noise represents the systematic error at time t;

[0079] The variable representation expression of the Bayesian linear model is:

[0080] {F,G,V,W} t ={F t G t V t W t},

[0081] Where F, G, V, and W represent F respectively t G t V t W t The set corresponding to these four variables.

[0082] Furthermore, the parameters of the Bayesian linear model are solved using maximum likelihood estimation, and the calculation formula is as follows:

[0083]

[0084] Among them, P l P represents lt The set, p(Θ,P l |F,G,V,W)p(Θ t |Θt-1 ), p(P lt |Θ t All of these are conditional probability equations.

[0085] Furthermore, in step S6, the wavelet transform must meet the following two conditions:

[0086] Condition one:

[0087] Condition two:

[0088] Where E represents wavelet energy, ψ(t) represents wavelet basis function, condition one indicates that E must be finite, and condition two indicates that the mean of the wavelet must be 0.

[0089] Furthermore, the wavelet transform formula is:

[0090]

[0091] Where 'a' represents the scaling parameter controlling wavelet expansion and contraction, 'b' represents the translation parameter controlling wavelet movement along the time dimension, 'w(a)' is the weighting function, and 'x(t)' represents the residual of the vehicle arrival distribution parameters at the current time. This represents the wavelet function after translation and scaling of the wavelet basis functions;

[0092] When a = 1 and b = 0 The wavelet basis function is calculated using the following formula:

[0093]

[0094] Furthermore, the formula for calculating wavelet energy is:

[0095]

[0096] In this embodiment, firstly, the historical vehicle arrival data is subjected to distribution fitting processing, and a Bayesian linear model is used to learn the historical vehicle arrival data after distribution fitting processing, thereby obtaining the periodic parameters of the changes in vehicle arrival distribution parameters in the historical data; secondly, the real-time vehicle arrival data is subjected to distribution fitting processing, and a Bayesian linear model is used to process the real-time data after distribution fitting processing to obtain the vehicle distribution parameters in the real-time state; then, the difference between the periodic parameters and the vehicle arrival distribution parameters in the real-time state is calculated to obtain the residual of the vehicle arrival distribution parameters in the real-time state; finally, wavelet transform is used to process the residual to calculate the wavelet energy, and the peak value of the wavelet energy indicates that the current traffic flow is in an abnormal state.

[0097] Using the above method, anomaly detection can be achieved through a single traffic flow, making the detection of abnormal traffic flow conditions more convenient and less costly.

[0098] Example 2:

[0099] A highway traffic flow anomaly detection system based on a Bayesian linear model, based on the highway traffic flow anomaly detection method based on a Bayesian linear model described in Embodiment 1 of the present invention, includes a data preprocessing module, a distribution fitting processing module, a distribution parameter extraction module, a distribution parameter residual calculation module, and a wavelet energy calculation module connected in sequence.

[0100] The data preprocessing module is used to preprocess historical and real-time vehicle arrival data.

[0101] The distribution fitting processing module is used to perform distribution fitting processing on the preprocessed historical and real-time vehicle arrival data.

[0102] The distribution parameter extraction module is used to learn from the historical vehicle arrival data after distribution fitting to obtain the periodic parameters of the vehicle arrival distribution parameter changes in the historical data. It is also used to process the real-time vehicle arrival data after distribution fitting to extract the vehicle arrival distribution parameters in the real-time state.

[0103] The distributed parameter residual calculation module is used to calculate the difference between the periodic parameter and the vehicle arrival distribution parameter in real time, so as to obtain the residual of the vehicle arrival distribution parameter in real time.

[0104] The wavelet energy calculation module is used to process the residuals using wavelet transform to calculate the wavelet energy, and to detect abnormal traffic flow on highways based on the peak value of the wavelet energy.

[0105] It should be noted that the highway traffic flow anomaly detection system based on the Bayesian linear model provided in this embodiment is similar to that in Embodiment 1, and will not be described in detail here.

[0106] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope of the present invention.

Claims

1. A method for detecting anomalies in highway traffic flow based on a Bayesian linear model, characterized in that, Includes the following steps: S1. Preprocess historical vehicle arrival data; S2. Perform distribution fitting processing on the preprocessed vehicle arrival history data; S3. Use a Bayesian linear model to learn the historical vehicle arrival data after distribution fitting to obtain the periodic parameters of the vehicle arrival distribution parameters in the historical data. S4. Preprocess the real-time vehicle arrival data collected in real time within the corresponding time period, perform distribution fitting on the preprocessed real-time vehicle arrival data, and use a Bayesian linear model to process the distribution-fitted real-time vehicle arrival data in order to extract the vehicle arrival distribution parameters in real time. S5. Calculate the difference between the periodic parameter and the vehicle arrival distribution parameter in real time to obtain the residual of the vehicle arrival distribution parameter in real time. S6. Wavelet transform is used to process the residuals to calculate the wavelet energy, and the peak value of the wavelet energy is used to detect abnormal traffic flow on highways. A Bayesian linear model consists of observation equations and system equations; The observation equation is: P lt =F t Θ t +v t ,v t ~N(0,V t ), Among them, P lt Let F represent the observation vector of the l-th ETC gantry at time t. t Θ represents the regression matrix at time t. t The system equations at time t, v t This indicates that the mean is 0 and the variance is V. t The observation error, V t The random variable noise represents the observation error at time t, and N represents the number of observations; The system equations are: I t =G t I t-1 +w t ,w t ~N(0,W t ), Among them, G t Θ represents the transfer matrix at time t. t-1 The system equations at time t-1, w t It has a mean of 0 and a variance of W. t The systematic error, W t The random variable noise represents the systematic error at time t; The variable representation expression of the Bayesian linear model is: {F,G,V,W} t ={F t ,G t ,V t ,W t }, Where F, G, V, and W represent F respectively t G t V t W t The set corresponding to these four variables.

2. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 1, characterized in that, Preprocessing of historical and real-time vehicle arrival data includes deleting duplicate and abnormal data and filling in missing data.

3. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 1, characterized in that, The distribution fitting process described in steps S2 and S4 includes the following steps: The Kolmogorov-Smirnow test was used to evaluate the distribution fit results. If the evaluation passed, the subsequent steps were performed. If the evaluation failed, the distribution was refitted.

4. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 3, characterized in that, Historical vehicle arrival data and real-time vehicle arrival data are obtained from ETC transaction data in the highway toll system.

5. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 1, characterized in that, The parameters of the Bayesian linear model are solved using maximum likelihood estimation, and the calculation formula is as follows: Among them, P l P represents lt The set of L(F,G,V,W|Θ,P) l ), p(Θ,P l |F,G,V,W)p(Θ t |Θ t-1 ), p(P lt |Θ t All of these are conditional probability equations.

6. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 5, characterized in that, In step S6, the wavelet transform must meet the following two conditions: Condition 1: Condition 2: Where E represents wavelet energy and ψ(t) represents wavelet basis function.

7. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 6, characterized in that, The wavelet transform formula is: Where a represents the scaling parameter controlling the wavelet's scaling, b represents the translation parameter controlling the wavelet's movement along the time dimension, w(a) is the weighting function, and x(t) represents the residual of the vehicle arrival distribution parameters at time t. This represents the wavelet function after translation and scaling of the wavelet basis function.

8. The method for detecting highway traffic flow anomalies based on a Bayesian linear model according to claim 7, characterized in that, The formula for calculating wavelet energy is:

9. A highway traffic flow anomaly detection system based on a Bayesian linear model, comprising the highway traffic flow anomaly detection method based on a Bayesian linear model as described in any one of claims 1-8, characterized in that, It includes a data preprocessing module, a distribution fitting processing module, a distribution parameter extraction module, a distribution parameter residual calculation module, and a wavelet energy calculation module, which are connected in sequence. The data preprocessing module is used to preprocess historical and real-time vehicle arrival data. The distribution fitting processing module is used to perform distribution fitting processing on the preprocessed historical and real-time vehicle arrival data. The distribution parameter extraction module is used to learn from the historical vehicle arrival data after distribution fitting to obtain the periodic parameters of the vehicle arrival distribution parameter changes in the historical data. It is also used to process the real-time vehicle arrival data after distribution fitting to extract the vehicle arrival distribution parameters in the real-time state. The distributed parameter residual calculation module is used to calculate the difference between the periodic parameter and the vehicle arrival distribution parameter in real time, so as to obtain the residual of the vehicle arrival distribution parameter in real time. The wavelet energy calculation module is used to process the residuals using wavelet transform to calculate the wavelet energy, and to detect abnormal traffic flow on highways based on the peak value of the wavelet energy.

Citation Information

Patent Citations

  • Automatic detection method of traffic incident on highway

    CN102436740A

  • Time-phased multi-parameter short-term traffic flow prediction method based on time-space characteristics

    CN105513350A

  • Traffic flow prediction method and system for urban road network

    CN112183862A