Traffic light period estimation method based on machine learning

Through machine learning-based method analysis of vehicle GPS trajectory data, identifying stop modes and traffic flow changes, the problem of difficult estimation of traffic light cycles in urban road networks is solved, and accurate detection of traffic light cycles and traffic flow optimization is achieved.

CN119091612AInactive Publication Date: 2024-12-06BEIJING INFORMATION TECH COLLEGE
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411068325.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-12-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Against the backdrop of rapid urbanization, many traffic lights in the huge urban road network are not connected to the network monitoring system, which makes it impossible for traffic management departments to directly obtain operating data. It is difficult for existing technology to accurately estimate traffic light cycles, affecting traffic efficiency and congestion conditions optimization.

Method used

Using a machine learning-based method, the stop mode and signal light state transformation are identified by analyzing vehicle GPS trajectory data, combining data processing, pattern recognition and traffic flow changes, an algorithm is designed to estimate traffic light cycles, and the Fourier transform and CUSUM method are used to detect cycles. change.

Benefits of technology

Accurate estimation and change detection of signal light cycles are realized, the intelligence level of traffic signal control system is improved, and traffic flow and road traffic efficiency are optimized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0004980020650000051
    Figure BDA0004980020650000051
  • Figure BDA0004980020650000052
    Figure BDA0004980020650000052
  • Figure BDA0004980020650000053
    Figure BDA0004980020650000053
Patent Text Reader

Abstract

The invention relates to the technical field of traffic light period estimation, and discloses a traffic light period estimation method based on machine learning, which comprises the following steps: S1, judging whether the red and green period of a signal lamp is fixed or not; s2, estimating the period of the signal lamp according to the data; s3, if the red and green period of the signal lamp is fixed, but the influence of factors such as the sample vehicle proportion, the vehicle flow and the positioning error on the model estimation precision needs to be discussed, and the driving tracks of all vehicles at the irrelevant intersection are obtained, estimating the period of the signal lamp according to the data; and if there is vehicle trajectory data of an irrelevant intersection, trying to calculate a period switching moment and new and old period parameters. According to the traffic light period estimation method based on machine learning, the traffic light period of the signal lamp can be accurately estimated through comprehensive analysis of the vehicle driving track data, and the period change condition is processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of traffic light cycle estimation, and in particular to a method for estimating a traffic light cycle based on machine learning. Background Art

[0002] With the rapid development of urbanization, traffic management and optimization have become one of the key issues in urban operations. Traffic lights are important facilities for regulating vehicle and pedestrian flows, and their operating efficiency directly affects the smoothness of urban traffic. In this context, accurately understanding the red-green cycle of each traffic light has become an important part of improving traffic efficiency, reducing congestion and improving driver experience.

[0003] However, facing the huge urban road network, many traffic lights are not connected to the modern network monitoring system, which makes it impossible for traffic management departments to directly obtain operation data from these lights. In addition, due to technical and cost limitations, it is impossible to arrange manual monitoring at each intersection to read the traffic light cycle information. This problem is particularly prominent for electronic map service providers, because they need to provide accurate route planning services, which directly depends on the understanding of traffic light cycles.

[0004] Existing technology has proposed an innovative solution: using customer driving trajectory data to estimate the red-green cycle of traffic lights. This method can not only reduce dependence on physical infrastructure, but also use existing big data resources to solve the problem at a low cost and high efficiency.

[0005] Specifically, the program plans to identify the vehicle's stop pattern at traffic lights by analyzing the vehicle's GPS trajectory data. For example, when a vehicle stops at a traffic light-controlled intersection and then starts again, this stop-start pattern is likely to indicate that the light changes from red to green. By collecting a large amount of such data, statistical methods and machine learning techniques can be used to estimate the red-green cycle of traffic lights at each intersection.

[0006] The above existing technologies have several key technical challenges that need to be overcome:

[0007] Data collection and processing: Valid trajectory data needs to contain accurate geographic location information and timestamps, but due to the instability of GPS signals, these data may contain errors. Therefore, algorithms need to be developed to clean and correct the data to ensure the accuracy of the analysis results.

[0008] Pattern recognition: Intelligent algorithms need to be designed to recognize different stop-start behavior patterns and associate them with traffic light state changes.

[0009] Traffic flow changes: It is necessary to consider the changes in traffic flow in different time periods (such as morning and evening peak hours and non-peak hours) so that the algorithm can adapt to different traffic conditions and accurately predict the periodic changes of traffic lights.

[0010] In conclusion, estimating traffic light cycles using vehicle trajectories is a cutting-edge and challenging field. It combines big data analysis, machine learning, and traffic engineering techniques, demonstrating the great potential of modern technology in solving traditional problems. In this way, it can not only optimize traffic flow and reduce environmental pollution, but also pave the way for a smarter urban transportation system in the future.

[0011] To this end, we propose a method for traffic light cycle estimation based on machine learning. Summary of the invention

[0012] 1. Technical issues to be solved

[0013] In view of the deficiencies in the prior art, the present invention provides a method for estimating a traffic light cycle based on machine learning.

[0014] (II) Technical solution

[0015] To achieve the above object, the present invention provides the following technical solution: a method for estimating a traffic light cycle based on machine learning, comprising the following steps:

[0016] S1: Determine whether the red-green cycle of the traffic light is fixed;

[0017] S2: If the red-green cycle of the traffic light is fixed and the driving trajectory data of all vehicles at different intersections can be obtained, the cycle of the traffic light is estimated based on these data;

[0018] S3: If the red-green cycle of the traffic light is fixed, but the influence of factors such as sample vehicle ratio, traffic flow, and positioning error on the model estimation accuracy needs to be discussed, and the driving trajectories of all vehicles at unrelated intersections have been obtained, the cycle of the traffic light is estimated based on these data;

[0019] S4: If the red-green cycle of the traffic light may change and there is vehicle trajectory data at unrelated intersections, try to find the cycle switching time and the new and old cycle parameters;

[0020] S5: If the vehicle trajectory data of all directions at a certain intersection has been obtained, try to identify the cycle of the traffic light at the intersection.

[0021] Preferably, the step of estimating the cycle of the traffic light of the signal light by fixing the traffic light cycle is as follows:

[0022] S1.1: Data processing (null values, outliers) and grouping by columns, and performing difference calculations on the data;

[0023] S1.2: Calculate the Euclidean distance and the speed of the vehicle, and set it to be a parking state when the speed is less than 0.5;

[0024] S1.3: Remove invalid values ​​through the peak value, average the effective value to get the red light cycle, extract the vehicle start time point, and then average the effective value to get the entire cycle;

[0025] S1.4: Use the entire cycle and the red cycle to solve for the green cycle.

[0026] Preferably, the step S3 discusses factors such as sample vehicle ratio, vehicle flow, positioning error, etc. to estimate the traffic light cycle:

[0027] Step 1: Perform the same operations as in Step S1.1 and Step S1.2 above;

[0028] Step 2: Analyze steering behavior:

[0029] Calculate the heading angle: Calculate based on continuous coordinates. When calculating, use the inverse tangent function (arctan2) to obtain the angle. This function considers the coordinates of both the horizontal and vertical axes to determine the direction of the angle (clockwise or counterclockwise).

[0030] Calculate the change in relative position:

[0031] Δx=x1-x2

[0032] Δy=y1-y2

[0033] Calculate the heading angle (zero degrees east, positive counterclockwise):

[0034] θ=arctan2(y,x)

[0035] Among them, arctan2 is a function that calculates the azimuth from (0, 0) to (Δx, Δy), and the return value is between [-π, π], which represents radians;

[0036] Combining speed changes and steering behavior:

[0037] Cross-validation: Cross-validate the speed change points and turning events. At intersections, vehicles usually slow down and turn.

[0038] Determine candidate intersection locations: Based on the results of cross-validation, determine possible candidate intersection locations;

[0039] Determine intersection location: Set a threshold or buffer zone to identify when a vehicle is approaching or leaving an intersection;

[0040] Step 3: According to the above step S1.3, improvements are made and the best result is obtained through comparison.

[0041] Preferably, the S4 signal light cycle may change, and the step of estimating the time of cycle switching and the parameters of the old and new cycles is as follows:

[0042] Step 1: Repeat the operations of steps S1.1 and S1.2 above, and then construct the time series;

[0043] Step 2: Periodicity analysis: Use Fourier transform to estimate the traffic light period at each intersection;

[0044] Stability analysis: Analyze the initially obtained periodic data, measure the average value, standard deviation, confidence interval, spectrum analysis and main frequency extraction multiple times, so as to determine a baseline period;

[0045] The formula for Fourier transform is:

[0046]

[0047] In actual calculations, the discrete Fourier transform (DFT) or fast Fourier transform (FFT) is used:

[0048]

[0049] Where N is the signal length, k is the frequency index, and x[n] is the discrete-time signal;

[0050] The mean and standard deviation of multiple measurements:

[0051] Assume we have n measured periodic data T i :

[0052]

[0053] The mean T, standard deviation σ, and z are the standard normal distribution values ​​corresponding to the confidence level;

[0054] Confidence Interval:

[0055]

[0056] z is the standard normal distribution value corresponding to the confidence level;

[0057] Step 3: Use the sliding window technique to continuously update the new cycle estimate, followed by change point detection, using the statistical test CUSUM in the sliding window to detect significant changes in the cycle;

[0058] The signal light cycle change can also be calculated by the CUSUM method. The main steps of this method are as follows:

[0059] a. Prepare data: First, you need to prepare the data for anomaly detection. This data can be time series data or continuous measurements, depending on your application scenario.

[0060] b. Setting parameters: The algorithm needs to set two parameters: threshold h and smoothing parameter k. Threshold h is used to determine when a change is detected, while smoothing parameter k is used to control the sensitivity of the algorithm.

[0061] c. Apply the algorithm: pass the prepared data and parameters into the algorithm function for processing, and the algorithm will return the position of the detected change point;

[0062] d. Interpret the results: Analyze the output of the algorithm, identify the detected change points, and perform further processing and interpretation based on your application scenario and needs.

[0063] Preferably, the step S5 has acquired the vehicle trajectory data in all directions of a certain intersection and estimated the cycle of the traffic light at the intersection:

[0064] Step 1: Repeat the operation process of steps S1.1 and S1.2 above;

[0065] Step 2: Find a time point on each vehicle and add columns. Use the 'arctan2' function in Python to calculate the direction angle (heading angle) between two adjacent points at each time point. 'degrees' converts radians to degrees, and uses %360 to ensure that the angle is between 0 and 360 degrees for subsequent classification. Define the 'categorize_direction' function to classify the direction into eight main directions according to the angle: east, northeast, north, northwest, west, southwest, south, southeast;

[0066] Convert radians to degrees:

[0067]

[0068] Step 3: Use K-Means cluster analysis. Elbow Method and Silhouette Analysis are two commonly used techniques to help determine the optimal number of clusters k.

[0069] The specific steps of the Elbow Method are as follows:

[0070] For different k, run the K-Means algorithm and calculate the clustering error;

[0071] Plot a graph of clustering error as a function of k;

[0072] c. Observe the curve graph and find the point where the clustering error drops sharply and tends to be flat. This point is usually called the elbow point.

[0073] d. The k value corresponding to the elbow point is usually considered to be the optimal number of clusters;

[0074] The specific steps of Silhouette Analysis are as follows:

[0075] For each sample calculate the silhouette coefficient:

[0076] Among them, a(i) is the average distance (closeness) from sample i to other points in the same cluster, and b(i) is the average distance (separation) from sample i to all points in the nearest other clusters;

[0077] Calculate the average silhouette coefficient S(k) of all samples:

[0078] Where n is the number of samples;

[0079] For each k, calculate the average value of S(k) and select the k value with the highest S(k) as the optimal number of clusters;

[0080] Step 4: Use the sliding window technique to continuously update the new cycle estimate, then perform change point detection, and use the statistical test CUSUM in the sliding window to detect significant changes in the cycle, thereby deriving the switching time point and cycle.

[0081] Preferably, the operation of S1.1 includes:

[0082] Use Python’s pandas library for data analysis;

[0083] First, read all the data and use the pandas library to find missing values. It is found that there are no missing values. The specific method is to use the Kolmogorov-Smirnov test to test the normal distribution of the data and use the 3σ principle to determine the outliers. If the data does not conform to the normal distribution, the box plot and IQR method are used to detect outliers. At the same time, check whether the horizontal axis increases monotonically with time. After analysis, it can be found that there are no outliers in the data.

[0084] Kolmogorov-Smirnov (KS) test:

[0085] A. Calculate the empirical distribution function (EDF):

[0086] Assume that the sample data is X1, X2, ..., X n , empirical distribution function F n (x) is defined as:

[0087]

[0088] B. Calculate the theoretical distribution function (TDF): erf is the error function;

[0089] C. Calculate the KS statistic: D = sup | F n (x)-F(x)|;

[0090] D. Calculate the critical value and conduct the test: Given the significance level α, find the critical value Dα of the KS test. If D>Dα, reject the null hypothesis, that is, the data does not conform to the normal distribution; otherwise, fail to reject the null hypothesis;

[0091] Among them, the 3σ principle determines the abnormal value as follows:

[0092] A. Calculate the mean and standard deviation:

[0093] For sample data X1, X2, ..., X n , calculate the mean X and standard deviation s:

[0094]

[0095] B. Determine the outlier judgment interval:

[0096] According to the 3σ principle, the data is within the interval Points outside of can be considered as outliers;

[0097] C. Identify outliers:

[0098] If a data point X i satisfy or Then X i Determined as an outlier.

[0099] Preferably, the operation of step S1.2 includes:

[0100] A. Calculate the Euclidean distance:

[0101] d 2 =(x2-x1) 2 +(y2-y1) 2

[0102] B. Driving speed:

[0103]

[0104] C. Determination of parking status:

[0105] If v(t)<0.5, the vehicle is in a stopped state;

[0106] The step S1.3 first removes invalid values ​​by peak value, then extracts red light cycle data, and calculates the average value of the red light cycle. Then find the start time of the vehicle, extract the cycle data of the entire signal light, and finally calculate the average value of the entire signal light cycle

[0107] Step S1.4 calculates the green light cycle based on the red light cycle and the value of the entire signal light cycle calculated in step S1.3, and uses the difference between the entire signal light cycle and the red light cycle to calculate the green light cycle.

[0108] (III) Beneficial effects

[0109] Compared with the prior art, the present invention provides a method for estimating traffic light cycles based on machine learning, which has the following beneficial effects:

[0110] The traffic light cycle estimation method based on machine learning of the present invention can accurately estimate the traffic light cycle of the traffic light and handle the cycle change by comprehensively analyzing the vehicle driving trajectory data. The method first uses data processing and statistical analysis techniques, such as Euclidean distance, speed calculation and peak removal, to accurately estimate the red light, green light and the entire cycle of the fixed cycle. The estimation accuracy is improved by analyzing the sample vehicle ratio, traffic flow and positioning error. In addition, the method can detect the cycle change of the traffic light, and use Fourier transform and CUSUM method to identify the time of cycle switching and the parameters of the old and new cycles. In practical applications, this method can effectively improve the intelligence level of the traffic signal control system, optimize traffic flow, and improve road traffic efficiency. DETAILED DESCRIPTION

[0111] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0112] Embodiment: A method for estimating a traffic light cycle based on machine learning comprises the following steps:

[0113] S1: Determine whether the red-green cycle of the traffic light is fixed;

[0114] S2: If the red-green cycle of the traffic light is fixed and the driving trajectory data of all vehicles at different intersections can be obtained, the cycle of the traffic light is estimated based on these data;

[0115] S3: If the red-green cycle of the traffic light is fixed, but the influence of factors such as sample vehicle ratio, traffic flow, and positioning error on the model estimation accuracy needs to be discussed, and the driving trajectories of all vehicles at unrelated intersections have been obtained, the cycle of the traffic light is estimated based on these data;

[0116] S4: If the red-green cycle of the traffic light may change and there is vehicle trajectory data at unrelated intersections, try to find the cycle switching time and the new and old cycle parameters;

[0117] S5: If the vehicle trajectory data of all directions at a certain intersection has been obtained, try to identify the cycle of the traffic light at the intersection.

[0118] Furthermore, the step of estimating the cycle of the traffic light of the signal light by assuming that the cycle of the traffic light of the signal light is fixed is as follows:

[0119] S1.1: Data processing (null values, outliers) and grouping by columns, and performing difference calculations on the data;

[0120] S1.2: Calculate the Euclidean distance and the speed of the vehicle, and set it to be a parking state when the speed is less than 0.5;

[0121] S1.3: Remove invalid values ​​through the peak value, average the effective value to get the red light cycle, extract the vehicle start time point, and then average the effective value to get the entire cycle;

[0122] S1.4: Use the entire cycle and the red cycle to solve for the green cycle.

[0123] Furthermore, the step S3 discusses factors such as sample vehicle ratio, traffic flow, positioning error, etc. to estimate the traffic light cycle:

[0124] Step 1: Perform the same operations as in Step S1.1 and Step S1.2 above;

[0125] Step 2: Analyze steering behavior:

[0126] Calculate the heading angle: Calculate based on continuous coordinates. When calculating, use the inverse tangent function (arctan2) to obtain the angle. This function considers the coordinates of both the horizontal and vertical axes to determine the direction of the angle (clockwise or counterclockwise).

[0127] Calculate the change in relative position:

[0128] Δx=x1-x2

[0129] Δy=y1-y2

[0130] Calculate the heading angle (zero degrees east, positive counterclockwise):

[0131] θ=arctan2(y,x)

[0132] Among them, arctan2 is a function that calculates the azimuth from (0, 0) to (Δx, Δy), and the return value is between [-π, π], which represents radians;

[0133] Combining speed changes and steering behavior:

[0134] Cross-validation: Cross-validate the speed change points and turning events. At intersections, vehicles usually slow down and turn.

[0135] Determine candidate intersection locations: Based on the results of cross-validation, determine possible candidate intersection locations;

[0136] Determine intersection location: Set a threshold or buffer zone to identify when a vehicle is approaching or leaving an intersection;

[0137] Step 3: According to the above step S1.3, improvements are made and the best result is obtained through comparison.

[0138] Furthermore, the S4 signal light cycle may change, and the steps of estimating the cycle switching time and the new and old cycle parameters are as follows:

[0139] Step 1: Repeat the operations of steps S1.1 and S1.2 above, and then construct the time series;

[0140] Step 2: Periodicity analysis: Use Fourier transform to estimate the traffic light period at each intersection;

[0141] Stability analysis: Analyze the initially obtained periodic data, measure the average value, standard deviation, confidence interval, spectrum analysis and main frequency extraction multiple times, so as to determine a baseline period;

[0142] The formula for Fourier transform is:

[0143]

[0144] In actual calculations, the discrete Fourier transform (DFT) or fast Fourier transform (FFT) is used:

[0145]

[0146] Where N is the signal length, k is the frequency index, and x[n] is the discrete-time signal;

[0147] The mean and standard deviation of multiple measurements:

[0148] Assume we have n measured periodic data T i :

[0149]

[0150] The mean T, standard deviation σ, and z are the standard normal distribution values ​​corresponding to the confidence level;

[0151] Confidence Interval:

[0152]

[0153] z is the standard normal distribution value corresponding to the confidence level;

[0154] Step 3: Use the sliding window technique to continuously update the new cycle estimate, followed by change point detection, using the statistical test CUSUM in the sliding window to detect significant changes in the cycle;

[0155] The signal light cycle change can also be calculated by the CUSUM method. The main steps of this method are as follows:

[0156] a. Prepare data: First, you need to prepare the data for anomaly detection. This data can be time series data or continuous measurements, depending on your application scenario.

[0157] b. Setting parameters: The algorithm needs to set two parameters: threshold h and smoothing parameter k. Threshold h is used to determine when a change is detected, while smoothing parameter k is used to control the sensitivity of the algorithm.

[0158] c. Apply the algorithm: pass the prepared data and parameters into the algorithm function for processing, and the algorithm will return the position of the detected change point;

[0159] d. Interpret the results: Analyze the output of the algorithm, identify the detected change points, and perform further processing and interpretation based on your application scenario and needs.

[0160] Furthermore, the step S5 has obtained the vehicle trajectory data of all directions at a certain intersection and estimated the cycle of the traffic light at the intersection:

[0161] Step 1: Repeat the operation process of steps S1.1 and S1.2 above;

[0162] Step 2: Find a time point on each vehicle and add columns. Use the 'arctan2' function in Python to calculate the direction angle (heading angle) between two adjacent points at each time point. 'degrees' converts radians to degrees, and uses %360 to ensure that the angle is between 0 and 360 degrees for subsequent classification. Define the 'categorize_direction' function to classify the direction into eight main directions according to the angle: east, northeast, north, northwest, west, southwest, south, southeast;

[0163] Convert radians to degrees:

[0164]

[0165] Step 3: Use K-Means cluster analysis. Elbow Method and Silhouette Analysis are two commonly used techniques to help determine the optimal number of clusters k.

[0166] The specific steps of the Elbow Method are as follows:

[0167] For different k, run the K-Means algorithm and calculate the clustering error;

[0168] Plot a graph of clustering error as a function of k;

[0169] c. Observe the curve graph and find the point where the clustering error drops sharply and tends to be flat. This point is usually called the elbow point.

[0170] d. The k value corresponding to the elbow point is usually considered to be the optimal number of clusters;

[0171] The specific steps of Silhouette Analysis are as follows:

[0172] For each sample calculate the silhouette coefficient:

[0173] Among them, a(i) is the average distance (closeness) from sample i to other points in the same cluster, and b(i) is the average distance (separation) from sample i to all points in the nearest other clusters;

[0174] Calculate the average silhouette coefficient S(k) of all samples:

[0175] Where n is the number of samples;

[0176] For each k, calculate the average value of S(k) and select the k value with the highest S(k) as the optimal number of clusters;

[0177] Step 4: Use the sliding window technique to continuously update the new cycle estimate, then perform change point detection, and use the statistical test CUSUM in the sliding window to detect significant changes in the cycle, thereby deriving the switching time point and cycle.

[0178] Furthermore, the operation of S1.1 includes:

[0179] Use Python’s pandas library for data analysis;

[0180] First, read all the data and use the pandas library to find missing values. It is found that there are no missing values. The specific method is to use the Kolmogorov-Smirnov test to test the normal distribution of the data and use the 3σ principle to determine the outliers. If the data does not conform to the normal distribution, the box plot and IQR method are used to detect outliers. At the same time, check whether the horizontal axis increases monotonically with time. After analysis, it can be found that there are no outliers in the data.

[0181] Kolmogorov-Smirnov (KS) test:

[0182] A. Calculate the empirical distribution function (EDF):

[0183] Assume that the sample data is X1, X2, ..., X n , empirical distribution function F n (x) is defined as:

[0184]

[0185] B. Calculate the theoretical distribution function (TDF): erf is the error function;

[0186] C. Calculate the KS statistic: D = sup | F n (x)-F(x)|;

[0187] D. Calculate the critical value and conduct the test: Given the significance level α, find the critical value Dα of the KS test. If D>Dα, reject the null hypothesis, that is, the data does not conform to the normal distribution; otherwise, fail to reject the null hypothesis;

[0188] Among them, the 3σ principle determines the abnormal value as follows:

[0189] A. Calculate the mean and standard deviation:

[0190] For sample data X1, X2, ..., Xn , calculate the mean X and standard deviation s:

[0191]

[0192] B. Determine the outlier judgment interval:

[0193] According to the 3σ principle, data points outside the interval [X-3s, X+3s] can be considered outliers;

[0194] C. Identify outliers:

[0195] If a data point X i satisfy or Then X i Determined as an outlier.

[0196] Furthermore, the operation of step S1.2 includes:

[0197] A. Calculate the Euclidean distance:

[0198] d 2 =(x2-x1) 2 +(y2-y1) 2

[0199] B. Driving speed:

[0200]

[0201] C. Determination of parking status:

[0202] If v(t)<0.5, the vehicle is in a stopped state;

[0203] The step S1.3 first removes invalid values ​​by peak value, then extracts red light cycle data, and calculates the average value of the red light cycle. Then find the start time of the vehicle, extract the cycle data of the entire signal light, and finally calculate the average value of the entire signal light cycle

[0204] Step S1.4 calculates the green light cycle based on the red light cycle and the value of the entire signal light cycle calculated in step S1.3, and uses the difference between the entire signal light cycle and the red light cycle to calculate the green light cycle.

[0205] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for estimating traffic light cycles based on machine learning, characterized in that: The following steps are involved: S1: Determine whether the red-green cycle of the traffic light is fixed; S2: If the red-green cycle of the traffic light is fixed and the driving trajectory data of all vehicles at different intersections can be obtained, the cycle of the traffic light is estimated based on these data; S3: If the red-green cycle of the traffic light is fixed, but the influence of factors such as sample vehicle ratio, traffic flow, and positioning error on the model estimation accuracy needs to be discussed, and the driving trajectories of all vehicles at unrelated intersections have been obtained, the cycle of the traffic light is estimated based on these data; S4: If the red-green cycle of the traffic light may change and there is vehicle trajectory data at unrelated intersections, try to find the cycle switching time and the new and old cycle parameters; S5: If the vehicle trajectory data of all directions at a certain intersection has been obtained, try to identify the cycle of the traffic light at the intersection.

2. The method for estimating traffic light cycles based on machine learning according to claim 1, characterized in that: S1: The steps of estimating the cycle when the traffic light cycle of the signal light is fixed: S1.1: Data processing (null values, outliers) and grouping by columns, and performing difference calculations on the data; S1.2: Calculate the Euclidean distance and the speed of the vehicle, and set it to be a parking state when the speed is less than 0.5; S1.3: Remove invalid values ​​through the peak value, average the effective value to get the red light cycle, extract the vehicle start time point, and then average the effective value to get the entire cycle; S1.4: Use the entire cycle and the red cycle to solve for the green cycle.

3. The method for estimating traffic light cycles based on machine learning according to claim 2, characterized in that: S3 discusses factors such as sample vehicle ratio, traffic flow, positioning error, etc. to estimate the traffic light cycle: Step 1: Perform the same operations as in Step S1.1 and Step S1.2 above; Step 2: Analyze steering behavior: Calculate the heading angle: Calculate based on continuous coordinates. When calculating, use the inverse tangent function (arctan2) to obtain the angle. This function considers the coordinates of both the horizontal and vertical axes to determine the direction of the angle (clockwise or counterclockwise). Calculate the change in relative position: Δx=x1-x2 Δy=y1-y2 Calculate the heading angle (zero degrees east, positive counterclockwise): θ=arctan2(y,x) Among them, arctan2 is a function that calculates the azimuth from (0, 0) to (Δx, Δy), and the return value is between [-π, π], which represents radians; Combining speed changes and steering behavior: Cross-validation: Cross-validate the speed change points and turning events. At intersections, vehicles usually slow down and turn. Determine candidate intersection locations: Based on the results of cross-validation, determine possible candidate intersection locations; Determine intersection location: Set a threshold or buffer zone to identify when a vehicle is approaching or leaving an intersection; Step 3: According to the above step S1.3, improvements are made and the best result is obtained through comparison.

4. The method for estimating traffic light cycles based on machine learning according to claim 2, characterized in that: The S4 signal light cycle may change. The steps to estimate the cycle switching time and the parameters of the old and new cycles are as follows: Step 1: Repeat the operations of steps S1.1 and S1.2 above, and then construct the time series; Step 2: Periodicity analysis: Use Fourier transform to estimate the traffic light period at each intersection; Stability analysis: Analyze the initially obtained periodic data, measure the average value, standard deviation, confidence interval, spectrum analysis and main frequency extraction multiple times, so as to determine a baseline period; The formula for Fourier transform is: In actual calculations, the discrete Fourier transform (DFT) or fast Fourier transform (FFT) is used: Where N is the signal length, k is the frequency index, and x[n] is the discrete-time signal; The mean and standard deviation of multiple measurements: Assume we have n measured periodic data T i : average value The standard deviation σ and z are the standard normal distribution values ​​corresponding to the confidence level; Confidence Interval: z is the standard normal distribution value corresponding to the confidence level; Step 3: Use the sliding window technique to continuously update the new cycle estimate, followed by change point detection, using the statistical test CUSUM in the sliding window to detect significant changes in the cycle; The signal light cycle change can also be calculated by the CUSUM method. The main steps of this method are as follows: a. Prepare data: First, you need to prepare the data for anomaly detection. This data can be time series data or continuous measurements, depending on your application scenario. b. Setting parameters: The algorithm needs to set two parameters: threshold h and smoothing parameter k. Threshold h is used to determine when a change is detected, while smoothing parameter k is used to control the sensitivity of the algorithm. c. Apply the algorithm: pass the prepared data and parameters into the algorithm function for processing, and the algorithm will return the position of the detected change point; d. Interpret the results: Analyze the output of the algorithm, identify the detected change points, and perform further processing and interpretation based on your application scenario and needs.

5. The method for estimating traffic light cycles based on machine learning according to claim 2, characterized in that: The step S5 has obtained the vehicle trajectory data of all directions at a certain intersection and estimated the cycle of the traffic light at the intersection: Step 1: Repeat the operation process of steps S1.1 and S1.2 above; Step 2: Find a time point on each vehicle and add columns. Use the 'arctan2' function in Python to calculate the direction angle (heading angle) between two adjacent points at each time point. 'degrees' converts radians to degrees, and uses %360 to ensure that the angle is between 0 and 360 degrees for subsequent classification. Define the 'categorize_direction' function to classify the direction into eight main directions according to the angle: east, northeast, north, northwest, west, southwest, south, southeast; Convert radians to degrees: Step 3: Use K-Means cluster analysis. Elbow Method and Silhouette Analysis are two commonly used techniques to help determine the optimal number of clusters k. The specific steps of the Elbow Method are as follows: For different k, run the K-Means algorithm and calculate the clustering error; Plot a graph of clustering error as a function of k; c. Observe the curve graph and find the point where the clustering error drops sharply and tends to be flat. This point is usually called the elbow point. d. The k value corresponding to the elbow point is usually considered to be the optimal number of clusters; The specific steps of Silhouette Analysis are as follows: For each sample calculate the silhouette coefficient: Among them, a(i) is the average distance (closeness) from sample i to other points in the same cluster, and b(i) is the average distance (separation) from sample i to all points in the nearest other clusters; Calculate the average silhouette coefficient S(k) of all samples: Where n is the number of samples; For each k, calculate the average value of S(k) and select the k value with the highest S(k) as the optimal number of clusters; Step 4: Use the sliding window technique to continuously update the new cycle estimate, then perform change point detection, and use the statistical test CUSUM in the sliding window to detect significant changes in the cycle, thereby deriving the switching time point and cycle.

6. The method for estimating traffic light cycles based on machine learning according to claim 2, characterized in that: The operation of S1.1 includes: Use Python’s pandas library for data analysis; First, read all the data and use the pandas library to find missing values. It is found that there are no missing values. The specific method is to use the Kolmogorov-Smirnov test to test the normal distribution of the data and use the 3σ principle to determine the outliers. If the data does not conform to the normal distribution, the box plot and IQR method are used to detect outliers. At the same time, check whether the horizontal axis increases monotonically with time. After analysis, it can be found that there are no outliers in the data. Kolmogorov-Smirnov (KS) test: A. Calculate the empirical distribution function (EDF): Assume that the sample data is X1, X2, ..., X n , empirical distribution function F n (x) is defined as: B. Calculate the theoretical distribution function (TDF): erf is the error function; C. Calculate the KS statistic: D = sup | F n (x)-F(x)|; D. Calculate the critical value and conduct a test: Given a significance level α, find the critical value Dα of the KS test. If D>Dα, reject the null hypothesis, that is, the data does not conform to the normal distribution; otherwise, fail to reject the null hypothesis; Among them, the 3σ principle determines the abnormal value as follows: A. Calculate the mean and standard deviation: For sample data X1, X2, ..., X n , calculate the mean And standard deviation s: B. Determine the outlier judgment interval: According to the 3σ principle, the data is within the interval Points outside of can be considered as outliers; C. Identify outliers: If a data point X i satisfy or Then X i Determined as an outlier.

7. The method for estimating traffic light cycles based on machine learning according to claim 2, characterized in that: The operation of step S1.2 includes: A. Calculate the Euclidean distance: d 2 =(x2-x1) 2 +(y2-y1) 2 B. Driving speed: C. Determination of parking status: If v(t)<0.5, the vehicle is in a stopped state; The step S1.3 first removes invalid values ​​by peak value, then extracts red light cycle data, and calculates the average value of the red light cycle. Then find the start time of the vehicle, extract the cycle data of the entire signal light, and finally calculate the average value of the entire signal light cycle Step S1.4 calculates the green light cycle based on the red light cycle and the value of the entire signal light cycle calculated in step S1.3, and uses the difference between the entire signal light cycle and the red light cycle to calculate the green light cycle.

Citation Information

Cited By

  • Traffic state judgment method and system based on intersection traffic flow and vehicle

    CN120299281A

  • Methods, systems, and vehicles for determining traffic status at intersections

    CN120299281B