A trunk green wave control method and system based on KCF algorithm
By using the KCF algorithm to detect and track traffic flow in real time and dynamically adjust the green light duration and cycle, the problem of traditional green wave control methods being unable to adapt to changes in traffic flow is solved, enabling more refined green wave control on main roads and improving road capacity.
Patent Information
- Application Number
- CN202310619873.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-25
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-05-25
AI Technical Summary
Traditional green wave control methods cannot adapt to changes in traffic flow and complex road conditions, making it difficult to alleviate traffic congestion.
The KCF algorithm is used to detect and track traffic flow in real time. Combined with traffic flow prediction and road congestion analysis, the green light duration and cycle are dynamically adjusted to generate a refined green light sequence and realize green wave control on trunk lines.
It enables adaptive control of traffic flow changes and road conditions, improving road capacity and alleviating traffic congestion.
Smart Images

Figure CN116721559B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic control technology, specifically to a trunk green wave control method and system based on the KCF algorithm. Background Technology
[0002] Traffic congestion has become a common problem in urban development, and how to effectively alleviate traffic congestion and improve urban traffic efficiency has become a focus of attention. Green wave control is a commonly used traffic control method that can effectively alleviate traffic congestion and improve road capacity.
[0003] Traditional green wave control methods are mainly based on timed or sensor-based control, which cannot be dynamically adjusted according to real-time traffic conditions and are difficult to adapt to changes in traffic flow and complex road conditions. These problems urgently need to be solved. To this end, a trunk green wave control method based on the KCF algorithm is proposed. Summary of the Invention
[0004] The technical problem to be solved by this invention is: how to solve the problem that traditional green wave control methods cannot adapt to changes in traffic flow and complex road conditions, and provides a trunk green wave control method based on the KCF algorithm.
[0005] The present invention solves the above-mentioned technical problems through the following technical solution, and the present invention includes the following steps:
[0006] S1: Traffic Flow Detection and Tracking
[0007] The KCF algorithm is used to detect and track traffic flow in real time and obtain traffic flow information.
[0008] S2: Green Wave Control
[0009] Based on traffic flow information and road conditions, the optimal green light duration and cycle are calculated and adjusted in real time to obtain the signal control strategy.
[0010] S3: Signal Control
[0011] Based on traffic flow information and signal control strategies, corresponding green light sequences are generated, and traffic signals are controlled to achieve green wave control on main roads.
[0012] Furthermore, in step S1, road traffic image information is captured by a video surveillance camera, and the image information is input into the KCF algorithm to extract the vehicle's position, speed, and traffic flow information in real time. The traffic flow information includes the vehicle's position, speed, and traffic flow information.
[0013] Furthermore, the KCF algorithm specifically includes the following steps:
[0014] S101: Select the vehicle's color and shape appearance features, and track the vehicle using its initial position;
[0015] S102: In the next frame image, a filter is used for target detection, and the position of the target vehicle in the current frame image is determined by comparing the previous frame and the current frame.
[0016] S103: Update the state of the target vehicle using the detected target location and filter.
[0017] Furthermore, in step S1, the specific process is as follows:
[0018] S111: Initialize target position
[0019] In the acquired image, the initial position of the target vehicle is selected, and the filter of the KCF algorithm is initialized based on the initial position;
[0020] S112: Target Detection and Tracking
[0021] In each frame of the image, the position of the target vehicle is predicted using a filter based on the KCF algorithm; in addition, a deep learning-based vehicle detection model is used to detect vehicles in the entire scene.
[0022] S113: Fusion of target location information
[0023] The position of the target vehicle predicted by the KCF algorithm is fused with the position of the target vehicle obtained by the vehicle detection algorithm.
[0024] S114: Update filter
[0025] Update the KCF algorithm's filter based on the fused target location;
[0026] S115: Obtain traffic flow information
[0027] Based on the updated target vehicle status, analyze traffic flow, vehicle speed, and congestion to obtain traffic information.
[0028] S116: Repeat the above process.
[0029] For each frame of image, repeat steps S112-S115 to track the target vehicle and obtain traffic flow information in real time.
[0030] Furthermore, in step S2, the calculation of green light duration and cycle is based on traffic flow prediction and road congestion analysis. By processing and analyzing traffic flow information, the trend of traffic flow changes in the future is predicted, and then the optimal green light duration and cycle are calculated.
[0031] Furthermore, in step S2, the specific process of obtaining the signal control strategy is as follows:
[0032] S21: Traffic Flow Forecast
[0033] Based on the traffic flow information tracked by the KCF algorithm, combined with historical data, time series analysis, machine learning or deep learning methods are used to predict traffic flow in the future.
[0034] S22: Road Congestion Analysis
[0035] Based on the forecast of traffic flow over a future period, the degree of road congestion is estimated, and the road congestion situation over a future period is obtained.
[0036] S23: Calculate green light duration and cycle
[0037] Based on traffic flow prediction and road congestion analysis, the optimal green light duration and cycle are calculated using a saturation-based cycle optimization method, thus obtaining the signal control strategy.
[0038] Furthermore, in step S3, the specific process for implementing trunk line green wave control is as follows:
[0039] S31: Allocating Green Light Time
[0040] Based on traffic flow information, road priority, congestion status, and the green light duration and cycle calculated in step S2, green light time is allocated to each direction.
[0041] S32: Determine the green light sequence
[0042] The sequence of green lights should be determined based on actual road conditions and traffic flow distribution.
[0043] S33: Generate green light timing sequence
[0044] Based on the allocated green light time and green light sequence, a green light sequence is generated, and traffic signals are controlled to achieve green wave control on main roads.
[0045] Furthermore, in step S31, the green light time is calculated using the following formula:
[0046] G i =C*(flow) I (Total flow)
[0047] Among them, G i Let C represent the green light duration for the i-th direction, and let C represent the cycle length and traffic flow. I Let represent the flow in the i-th direction, and let represent the total flow as the sum of the flows in all directions.
[0048] Furthermore, in step S33, the green light timing includes the on and off times of the green light for each direction, as well as the corresponding red and yellow light times.
[0049] This invention also provides a trunk green wave control system based on the KCF algorithm, used to implement trunk green wave control using the above-mentioned method, including:
[0050] The traffic flow detection and tracking module is used to detect and track traffic flow in real time using the KCF algorithm to obtain traffic flow information;
[0051] The green wave control module is used to calculate the optimal green light duration and cycle based on traffic flow information and road conditions, and adjust the green light duration and cycle in real time to obtain the signal control strategy.
[0052] The signal control module is used to generate corresponding green light sequences based on traffic flow information and signal control strategies, and control traffic signals to achieve green wave control on trunk lines.
[0053] Compared with the prior art, the present invention has the following advantages: the trunk green wave control method based on the KCF algorithm uses the KCF algorithm to realize real-time detection and tracking of traffic flow, which can provide more accurate and real-time traffic flow information, thereby realizing more refined trunk green wave control, further improving road capacity and alleviating traffic congestion; at the same time, it can adapt to changes in traffic flow and road conditions, and has better adaptability and practicality. Attached Figure Description
[0054] Figure 1 This is a flowchart illustrating the trunk green wave control method based on the KCF algorithm in Embodiment 1 of the present invention.
[0055] Figure 2 This is an example of the original input image in Embodiment 1 of the present invention;
[0056] Figure 3 This is the result image after processing by the KCF algorithm and YOLOv5 in Embodiment 1 of the present invention;
[0057] Figure 4 This is a schematic diagram of the entire process of processing tracking images using the KCF algorithm in Embodiment 2 of the present invention. Detailed Implementation
[0058] The embodiments of the present invention are described in detail below. These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes. However, the scope of protection of the present invention is not limited to the following embodiments.
[0059] Example 1
[0060] like Figure 1As shown, this embodiment provides a technical solution: a trunk green wave control method based on the KCF algorithm, comprising the following steps:
[0061] S1: Traffic Flow Detection and Tracking
[0062] The KCF algorithm is used to detect and track traffic flow in real time and obtain traffic flow information.
[0063] S2: Green Wave Control
[0064] Based on traffic flow information and road conditions, the optimal green light duration and cycle are calculated, and the green light duration and cycle are adjusted in real time to obtain the signal control strategy.
[0065] S3: Signal Control
[0066] Based on traffic flow information and signal control strategies, corresponding green light sequences are generated, and traffic signals are controlled to achieve green wave control on main roads.
[0067] In step S1, road traffic image information is captured by a video surveillance camera and input into the KCF algorithm to extract vehicle location, speed, traffic flow, and other information in real time. The KCF algorithm has high real-time performance and accuracy, and can effectively monitor and track traffic flow.
[0068] In step S1, the traffic flow information includes information such as vehicle location, speed, and flow rate.
[0069] In step S1, the KCF algorithm specifically includes the following steps:
[0070] S101: Select the vehicle's color and shape appearance features, and track the vehicle using its initial position;
[0071] S102: In the next frame image, a filter is used for target detection, and the position of the target vehicle in the current frame image is determined by comparing the previous frame and the current frame.
[0072] S103: Update the state of the target vehicle using the detected target location and filter.
[0073] More specifically, in this embodiment, in step S101, the selected vehicle appearance features include color and shape; color and shape are among the most obvious appearance features of a vehicle, which can help us quickly distinguish and identify the vehicle. The KCF algorithm mainly tracks using HOG, so color and shape appearance features are selected.
[0074] More specifically, in this embodiment, the process in step S1 is as follows:
[0075] S111, Initialize target position
[0076] First, the initial position of the target vehicle is automatically selected from the video stream or the image acquired by the monitoring device; then, the filter of the KCF algorithm is initialized based on the initial position.
[0077] S112, Target Detection and Tracking
[0078] In each frame of the image, the position of the target vehicle is predicted using the filter of the KCF algorithm; in addition, vehicle detection algorithms (such as deep learning-based vehicle detection models) can be used to detect vehicles in the entire scene, which can help correct the target position if the KCF algorithm fails to track.
[0079] S113, Fusion of target location information
[0080] The location predicted by KCF is fused with the location obtained by the vehicle detection algorithm; this can be achieved through simple weighted averaging or more complex data association techniques; the fused location information can improve the accuracy of target tracking.
[0081] S114, Update Filter
[0082] The KCF algorithm's filters are updated based on the fused target positions. This is achieved by updating the correlation matrix of the KCF algorithm's filters online, and a learning rate parameter is introduced during filter updates to ensure the filters maintain a certain level of stability when learning new target positions.
[0083] S115: Obtain traffic flow information
[0084] Based on the updated target vehicle status, traffic flow, vehicle speed, and congestion are analyzed to obtain traffic information.
[0085] S116: Repeat the above process.
[0086] For each frame of image, repeat steps S112-S115 to track the target vehicle and obtain traffic flow information in real time.
[0087] In this embodiment, in step S2, the calculation of the green light duration and cycle is mainly based on traffic flow prediction and road congestion analysis. By processing and analyzing traffic flow information, the changing trend of traffic flow in the future is predicted, and then the optimal green light duration and cycle are calculated. In actual control, the green light duration and cycle are adjusted in real time as traffic flow and road congestion change to ensure the effectiveness of green wave control on main roads.
[0088] In this embodiment, the specific process in step S2 is as follows:
[0089] S21: Traffic Flow Forecast
[0090] Based on vehicle location and speed information obtained from KCF tracking, combined with historical data, time series analysis, machine learning, or deep learning methods are used to predict traffic flow in the future; the prediction results will be used to calculate the green light duration and cycle.
[0091] S22: Road Congestion Analysis
[0092] Based on the forecast of traffic flow over a future period, the degree of road congestion can be estimated to obtain the road congestion situation in the future. Commonly used indicators include vehicle density and average speed. By combining real-time monitoring data and traffic flow forecast results, the road congestion situation in the future can be analyzed.
[0093] S23: Calculate green light duration and cycle
[0094] Based on traffic flow forecasts and road congestion analysis, the optimal green light duration and cycle are calculated to obtain the signal control strategy. A saturation-based cycle optimization method (such as the Kimber Cycle Formula) is used for calculation. During the calculation, factors such as traffic flow direction, intersection structure, and priority need to be considered. Appropriate green light durations and cycles are allocated according to the traffic flow and congestion conditions in each direction to achieve green wave control on main roads.
[0095] In this embodiment, the specific process of implementing trunk line green wave control in step S3 is as follows:
[0096] S31: Allocating green light time:
[0097] Based on the green light duration and cycle calculated in step S2, green light time is allocated to each direction. Factors such as traffic flow, road priority, and congestion conditions typically need to be considered. The green light time is calculated using the following formula:
[0098] G i =C*(flow) I (Total flow)
[0099] Among them, G i Let C represent the green light duration for the i-th direction, and let C represent the cycle length and traffic flow. I Let represent the flow in the i-th direction, and let represent the total flow as the sum of the flows in all directions.
[0100] S32: Determine the green light sequence:
[0101] To ensure smooth traffic flow, the sequence of green light activation needs to be determined based on actual road conditions and traffic flow distribution. For example, at an intersection, green lights can be allocated first for straight-ahead traffic, followed by green lights for left-turn traffic. The specific sequence depends on road priority and traffic flow distribution (traffic demand).
[0102] S33: Generate green light timing sequence:
[0103] The green light sequence is generated based on the allocated green light times and green light order. The green light sequence includes the on and off times of the green light for each direction, as well as the corresponding red and yellow light times. For example, let Ti represent the green light on time for the i-th direction, and Gi represent the green light duration for the i-th direction; then the green light off time for the i-th direction is Ti + Gi. Simultaneously, the red and yellow light times need to be considered to ensure traffic safety.
[0104] It should be noted that the corresponding green light sequence is generated to control the traffic signals and achieve green wave control on the main road. In actual control, the traffic signals are usually controlled by a countdown method, which is used to switch traffic signals.
[0105] This embodiment also provides a trunk green wave control system based on the KCF algorithm, used to implement trunk green wave control using the above-mentioned method, including:
[0106] The traffic flow detection and tracking module is used to detect and track traffic flow in real time using the KCF algorithm to obtain traffic flow information;
[0107] The green wave control module is used to calculate the optimal green light duration and cycle based on traffic flow information and road conditions, and adjust the green light duration and cycle in real time.
[0108] The signal control module generates the corresponding green light sequence based on traffic flow information and control strategies, and controls traffic signals to achieve green wave control on main roads.
[0109] This embodiment also provides a trunk line green wave control device for implementing the above-mentioned trunk line green wave control system. In practical applications, the trunk line green wave control device can be installed in the control box of the traffic light. The traffic flow detection and tracking components can be implemented using devices such as video surveillance cameras, which can be installed on traffic light poles or other suitable locations. The green wave control components and signal control components can be implemented using embedded systems or computers, which can be placed in the control box of the traffic light or other safe locations.
[0110] Example 2
[0111] This example illustrates the KCF algorithm:
[0112] The KCF (Kernelized Correlation Filters) algorithm is a target tracking algorithm primarily used for target tracking in video. Below is a detailed explanation of the KCF algorithm:
[0113] The KCF algorithm consists of the following three main parts:
[0114] I. Feature Extraction
[0115] The KCF algorithm uses HOG (Histogram of Oriented Gradients) features, which can capture the local gradient direction and magnitude of the target object, thereby extracting the feature information of the target object.
[0116] II. Correlation Filter Training
[0117] The KCF algorithm employs a kernel-based correlation filter, which transforms the target template in the training set into a vector in the kernel feature space, thereby enabling rapid calculation of the similarity between the template and candidate regions. Specifically, the correlation filter training process includes the following steps:
[0118] 1. Select a region of interest for the target object as the training set;
[0119] 2. Perform HOG feature extraction on each frame of the training set to obtain a feature vector;
[0120] 3. Perform a Fourier transform on the eigenvectors to obtain their representations in the kernel feature space;
[0121] 4. Calculate the weights of the correlation filter using the kernel method to obtain a kernel response function.
[0122] III. Target Tracking
[0123] The target tracking process is as follows: For each frame of image, HOG features are first extracted from candidate regions, then the similarity between them and the target template is calculated using correlation filters, and finally, the candidate region with the highest similarity is selected as the location of the target, the target template is updated, and the target tracking continues.
[0124] IV. Explanation of KCF Filter Tracking Formula
[0125] Assuming the input image is I, the target position can be represented as (x, y); assuming the filter is h, the filter response r can be represented as:
[0126] r = h*I(x,y)
[0127] In the KCF algorithm, both the filter H(f) and the input image I(f) are transformed to the frequency domain using Fourier transform:
[0128] H(f) = F{(x,y)}
[0129] I(f) = F{(x,y)}
[0130] Where {F} denotes the Fourier transform operation;
[0131] Therefore, the frequency domain expression of the filter response can be obtained:
[0132] R(f)=H(f)·I(f)*
[0133] Where * denotes the conjugate complex number;
[0134] The kernel function used in the KCF algorithm is the Gaussian kernel function, which is defined as follows:
[0135]
[0136] Where σ is the standard deviation of the Gaussian kernel function.
[0137] The descriptors used in KCF are HOG features, which are defined as follows:
[0138] f(x,y)=[f1(x,y),f2(x,y),…,f n (x,y)]
[0139] Among them, f i (x,y) represents the gradient histogram in the i-th direction;
[0140] By performing a dot product operation on the descriptor f and the Gaussian kernel function k, the response map G can be obtained:
[0141] G(f)=k(f,f′)
[0142] Here, f′ is the descriptor of the history frame.
[0143] By performing an inverse Fourier transform on the response map G and the filter response R, a new filter h can be obtained:
[0144] h = F -1 {G·R}
[0145] Among them, F -1 This indicates the inverse Fourier transform operation.
[0146] In this way, the KCF algorithm can achieve kernel-trick-based target tracking, exhibiting good performance and robustness. See the detailed process below. Figure 4 .
[0147] In summary, the trunk green wave control method based on the KCF algorithm in the above embodiments uses the KCF algorithm to realize real-time detection and tracking of traffic flow, which can provide more accurate and real-time traffic flow information, thereby achieving more refined trunk green wave control, further improving road capacity and alleviating traffic congestion; at the same time, it can adapt to changes in traffic flow and road conditions, and has better adaptability and practicality.
[0148] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A trunk line green wave control method based on the KCF algorithm, characterized in that, Includes the following steps: S1: Traffic Flow Detection and Tracking The KCF algorithm is used to detect and track traffic flow in real time and obtain traffic flow information. S2: Green Wave Control Based on traffic flow information and road conditions, the optimal green light duration and cycle are calculated and adjusted in real time to obtain the signal control strategy. S3: Signal Control Based on traffic flow information and signal control strategies, generate corresponding green light sequences and control traffic signals to achieve green wave control on trunk lines. In step S1, the specific process is as follows: S111: Initialize target position In the acquired image, the initial position of the target vehicle is selected, and the filter of the KCF algorithm is initialized based on the initial position; S112: Target Detection and Tracking In each frame of the image, the position of the target vehicle is predicted using a filter based on the KCF algorithm; in addition, a deep learning-based vehicle detection model is used to detect vehicles in the entire scene. S113: Fusion of target location information The position of the target vehicle predicted by the KCF algorithm is fused with the position of the target vehicle obtained by the vehicle detection algorithm. S114: Update filter Update the KCF algorithm's filter based on the fused target location; S115: Obtain traffic flow information Based on the updated target vehicle status, analyze traffic flow, vehicle speed, and congestion to obtain traffic information. S116: Repeat the above process. For each frame of image, repeat steps S112-S115 to track the target vehicle and obtain traffic flow information in real time. In step S2, the calculation of green light duration and cycle is based on traffic flow prediction and road congestion analysis. By processing and analyzing traffic flow information, the trend of traffic flow changes in the future is predicted, and then the optimal green light duration and cycle are calculated. In step S2, the specific process of obtaining the signal control strategy is as follows: S21: Traffic Flow Forecast Based on the traffic flow information tracked by the KCF algorithm, combined with historical data, time series analysis, machine learning or deep learning methods are used to predict traffic flow in the future. S22: Road Congestion Analysis Based on the forecast of traffic flow over a future period, the degree of road congestion is estimated, and the road congestion situation over a future period is obtained. S23: Calculate green light duration and cycle Based on traffic flow prediction results and road congestion analysis results, the optimal green light duration and cycle are calculated using a saturation-based cycle optimization method, thus obtaining the signal control strategy. In step S3, the specific process for implementing trunk line green wave control is as follows: S31: Allocating Green Light Time Based on traffic flow information, road priority, congestion status, and the green light duration and cycle calculated in step S2, green light time is allocated to each direction. S32: Determine the green light sequence The sequence of green lights should be determined based on actual road conditions and traffic flow distribution. S33: Generate green light timing sequence Based on the allocated green light time and green light sequence, a green light sequence is generated, and traffic signals are controlled to achieve green wave control on main roads.
2. The trunk green wave control method based on the KCF algorithm according to claim 1, characterized in that: In step S1, road traffic image information is captured by a video surveillance camera, and the image information is input into the KCF algorithm to extract the vehicle's position, speed, and traffic flow information in real time. The traffic flow information includes the vehicle's position, speed, and traffic flow information.
3. The trunk green wave control method based on the KCF algorithm according to claim 2, characterized in that: The KCF algorithm specifically includes the following steps: S101: Select the vehicle's color and shape appearance features, and track the vehicle using its initial position; S102: In the next frame image, a filter is used for target detection, and the position of the target vehicle in the current frame image is determined by comparing the previous frame and the current frame. S103: Update the state of the target vehicle using the detected target location and filter.
4. The trunk green wave control method based on the KCF algorithm according to claim 3, characterized in that: In step S31, the green light time is calculated using the following formula: G i =C*(flow) I (Total flow) Among them, G i Let C represent the green light duration for the i-th direction, and let C represent the cycle length and traffic flow. I Let represent the flow in the i-th direction, and let represent the total flow as the sum of the flows in all directions.
5. The trunk green wave control method based on the KCF algorithm according to claim 4, characterized in that: In step S33, the green light timing includes the on and off times of the green light for each direction, as well as the corresponding red and yellow light times.
6. A trunk green wave control system based on the KCF algorithm, characterized in that, For implementing trunk line green wave control using the method described in any one of claims 1 to 5, comprising: The traffic flow detection and tracking module is used to detect and track traffic flow in real time using the KCF algorithm to obtain traffic flow information; The green wave control module is used to calculate the optimal green light duration and cycle based on traffic flow information and road conditions, and adjust the green light duration and cycle in real time to obtain the signal control strategy. The signal control module is used to generate corresponding green light sequences based on traffic flow information and signal control strategies, and control traffic signals to achieve green wave control on trunk lines.
Citation Information
Patent Citations
Traffic control method and device of self-adaptive intersection traffic signal lights
CN106960584A
Method and device for designing traffic signal phase by using travel time
CN107204120A
Traffic flow parameter real-time detection method based on traffic monitoring video
CN110033479A
Shared traffic control method based on cloud platform data
CN111341107A