Traffic light control method, system, electronic device and medium
Through video recognition technology, the road congestion status is monitored in real time and the traffic light duration is adjusted, which solves the problems of complex equipment installation, high maintenance costs and low detection accuracy in the existing technology, and realizes adaptive adjustment and efficient detection of traffic lights.
Patent Information
- Application Number
- CN202410575710.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-05-10
AI Technical Summary
Among the existing traffic light control technology, magnetic frequency detection equipment is complex in installation and deployment and high maintenance costs, and infrared detection technology is susceptible to environmental temperature to cause low detection accuracy.
Video recognition technology is used to collect road video data in real time through road surveillance cameras, perform pre-processing and video recognition processing, obtain road traffic status parameter information, and judge whether the road is in a congested state based on this information, thereby adjusting the traffic light duration.
Adaptive adjustment of traffic lights is realized, road load is reduced, equipment installation and deployment is simplified, maintenance costs are reduced, and detection accuracy is improved.
Smart Images

Figure CN118314732B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of road traffic management, and in particular relates to a traffic light control method, system, electronic equipment and medium. Background Art
[0002] At present, the traffic light signal control method with a fixed period is generally adopted at the intersections, that is, the traffic lights at each intersection are generally set with a fixed lighting duration, which is determined according to the statistical results of historical traffic flow. In order to realize the duration control of traffic lights under congestion, there are technical solutions in the prior art that use magnetic frequency detection technology and infrared detection technology to detect vehicle congestion on the road, so as to adjust the duration of traffic lights according to the vehicle congestion state. Among them, magnetic frequency detection technology is the most widely used traffic data detection and collection technology in my country. Its working principle is to judge whether there is a vehicle passing by through electromagnetic induction, and can directly collect data such as traffic flow and time occupancy. This technology is quite mature, and a large number of practical applications have also proved that it has strong real-time performance, high accuracy, and is not easily affected by bad weather conditions; infrared detection technology is to emit infrared rays through a detector installed at a high place. If a vehicle passes within the detection range, the infrared rays will be reflected by the vehicle to the detector, so as to judge whether there is a vehicle passing.
[0003] However, in the process of using the prior art, the inventors found that the prior art has at least the following problems:
[0004] The installation and deployment of magnetic frequency detection equipment is relatively complicated in the early stage, and the maintenance cost is high in the later stage. Infrared detection technology is easily affected by the ambient temperature, resulting in low detection accuracy. As a result, the existing technology for traffic light control has the defects of high maintenance cost and low detection accuracy. Summary of the invention
[0005] The present invention aims to solve the above technical problems at least to a certain extent. The present invention provides a traffic light control method, system, electronic device and medium.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a traffic light control method, comprising:
[0008] Acquire road video data collected in real time by a road monitoring camera of a designated road, and preprocess the road video data to obtain preprocessed road video data;
[0009] Performing video recognition processing on the pre-processed road video data to obtain road traffic status parameter information;
[0010] Obtaining a road congestion condition parameter of a current road, and judging whether the current road is in a congested state according to the road traffic state parameter information and the road congestion condition parameter;
[0011] If so, a traffic light control instruction is sent to the control system corresponding to the traffic light at the current road intersection to adjust the duration of the traffic light, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired;
[0012] If not, an instruction to restore the preset control mode is sent to the control system, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired.
[0013] The present invention uses video recognition technology to monitor the road congestion status in real time, and then determines whether the road traffic status is congested, and controls traffic lights according to the road congestion situation, which can realize adaptive adjustment of traffic lights, and can facilitate reducing road load under congested conditions. At the same time, the present invention uses video recognition technology to detect the road congestion status, which has the advantages of simple installation and deployment, low subsequent maintenance cost, and high detection accuracy, and is worthy of promotion and application.
[0014] In a possible design, the road traffic status parameter information includes the number of valid detection targets and the average retention time; correspondingly, the pre-processed road video data is subjected to video recognition processing to obtain the road traffic status parameter information, including:
[0015] Inputting the plurality of preprocessed road video frames of the preprocessed road video data within the preset detection duration into a preset target detection model frame by frame for target recognition, so as to obtain a plurality of target detection results corresponding to the plurality of preprocessed road video frames one by one;
[0016] According to the multiple target detection results, target tracking is performed on the detection targets in the multiple target detection results to obtain target tracking trajectories of all the detection targets in the multiple target detection results;
[0017] According to the target tracking trajectories of all detection targets, the number of valid detection targets in the target tracking trajectories and the retention time of the valid detection targets in the preset detection area are obtained; wherein the valid detection targets are detection targets corresponding to the target tracking trajectories that enter the preset detection area from a specified starting baseline of any preprocessed road video frame of the preprocessed road video data within the preset detection time, and leave the preset detection area from a specified ending baseline of any preprocessed road video frame whose acquisition time is after the preprocessed road video frame;
[0018] According to the retention time of all valid detection targets in the preset detection area during the preset detection time, the average retention time of the valid detection targets is obtained.
[0019] In a possible design, the target detection result includes at least one detected target identified and a target marking frame of each detected target in the at least one detected target; correspondingly, according to the multiple target detection results, target tracking is performed on the detected targets in the multiple target detection results to obtain target tracking trajectories of all detected targets in the multiple target detection results, including:
[0020] The target detection result corresponding to the k-1th preprocessed road video frame among the multiple target detection results is defined as the current target detection result, and the current target marking frame set corresponding to all detected targets in the current target detection result is obtained; wherein k is a natural number greater than 2;
[0021] From the multiple target detection results, obtain a previous target label frame set corresponding to all detected targets in the previous target detection result of the current target detection result;
[0022] Perform target marker frame matching on the current target marker frame set and the previous target marker frame set to obtain a target marker frame matching pair in the current preprocessed road video frame;
[0023] The target detection result corresponding to the kth preprocessed road video frame among the multiple target detection results is redefined as the current target detection result until the target marker box matching pairs in all preprocessed road video frames are obtained;
[0024] According to the matching pairs of target marker boxes in all preprocessed road video frames, target tracking trajectories of all detected targets in multiple target detection results are obtained.
[0025] In a possible design, the target marker frame matching pair in the current preprocessed road video frame includes a first target marker frame matching pair and a second target marker frame matching pair; correspondingly, target marker frame matching is performed on the current target marker frame set and the previous target marker frame set to obtain the target marker frame matching pair in the current preprocessed road video frame, including:
[0026] Using the Kalman filter method, the predicted value of the previous target mark frame set in the preprocessed road video frame corresponding to the current target mark frame set is predicted;
[0027] Performing target marker frame matching on the predicted value and the current target marker frame set to obtain a first target marker frame matching pair in the current preprocessed road video frame, a previous target marker frame set corresponding to the unmatched predicted value, and an unmatched current target marker frame;
[0028] Obtain a cost matrix between the target marked frame in the previous target marked frame set and the target marked frame in the current target marked frame set corresponding to the unmatched prediction value;
[0029] According to the cost matrix of the target labeled frame in the previous target labeled frame set and the current target labeled frame set corresponding to the unmatched prediction value, cascade matching and IOU matching are performed on the previous target labeled frame set and the current target labeled frame set corresponding to the unmatched prediction value to obtain a second target labeled frame matching pair.
[0030] In one possible design, the Kalman filter method is used to predict any target marker frame in the previous target marker frame set. The predicted value in the preprocessed road video frame corresponding to the current target marker frame set includes:
[0031] Use the Kalman filter method to predict any target marker frame in the previous target marker frame set The initial prediction value in the preprocessed road video frame corresponding to the current target mark frame set and the initial prediction value, T is the transposed symbol, wherein the initial prediction value is:
[0032]
[0033] The initial covariance matrix of the initial prediction value is:
[0034]
[0035] Where A is the preset first transformation matrix, B is the preset second transformation matrix, and u k Mark the target box The mean value, P k-1 Mark the target box The initial covariance matrix of , T is the transposed symbol;
[0036] According to the initial prediction value and the initial covariance matrix of the initial prediction value, the initial prediction value is updated to obtain the target marking frame The predicted value in the preprocessed road video frame corresponding to the current target mark frame set; wherein the predicted value is:
[0037]
[0038] Where C is the preset third transformation matrix, K k is the Kalman gain, y k Mark the target box The observation vector.
[0039] In a possible design, the cost matrix between the target marked box i in the previous target marked box set and the target marked box j in the current target marked box set corresponding to the unmatched prediction value is obtained, including:
[0040] Get the cosine distance between the target marking frame i and the target marking frame j; wherein the cosine distance is:
[0041]
[0042] Where cos(i,j) is the cosine similarity between target label box i and target label box j. After normalization, ||i||2=1, ||j||2=1;
[0043] According to the cosine distance, a cost matrix between the target marking frame i and the target marking frame j is obtained; wherein the cost matrix is:
[0044] c i,j =λd (1) (i,j)+(1-λ)d (2) (i,j);
[0045] Where, d (1) (i, j) is the cosine distance, d (2) (i, j) is the Mahalanobis distance, and λ is the preset weight coefficient.
[0046] In a possible design, according to the target tracking trajectories of all detected targets, obtaining the retention time of the effective detected targets in the target tracking trajectories in the preset detection area includes:
[0047] According to the target tracking trajectories of all detection targets, obtaining the entry time of the effective detection target from the specified starting baseline of the preprocessed road video data located in any preprocessed road video frame within the preset detection duration into the preset detection area, and the departure time of the effective detection target from the specified ending baseline of any preprocessed road video frame whose acquisition time is located after the preprocessed road video frame leaves the preset detection area;
[0048] The retention time of the effective detection target in the preset detection area is obtained according to the entry time and the exit time; wherein the retention time=the exit time-the entry time.
[0049] In a second aspect, the present invention provides a traffic light control system for implementing the traffic light control method as described in any one of the above items; the traffic light control system comprises:
[0050] A data acquisition module is used to acquire road video data collected in real time by a road monitoring camera of a designated road, and preprocess the road video data to obtain preprocessed road video data;
[0051] A data recognition module, which is in communication with the data acquisition module and is used to perform video recognition processing on the pre-processed road video data to obtain road traffic status parameter information;
[0052] A traffic light control module, which is in communication with the data identification module, is used to obtain a road congestion condition parameter of a current road, and determine whether the current road is in a congested state according to the road traffic state parameter information and the road congestion condition parameter;
[0053] If so, a traffic light control instruction is sent to the control system corresponding to the traffic light at the current road intersection to adjust the duration of the traffic light, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired;
[0054] If not, an instruction to restore the preset control mode is sent to the control system, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired.
[0055] In a third aspect, the present invention provides an electronic device, comprising:
[0056] a memory for storing computer program instructions; and,
[0057] A processor is used to execute the computer program instructions to complete the operation of the traffic light control method as described in any one of the above items.
[0058] In a fourth aspect, the present invention provides a computer-readable storage medium for storing computer program instructions readable by a computer, wherein the computer program instructions are configured to execute the operations of the traffic light control method as described in any one of the above items when run. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 is a flow chart of a traffic light control method in an embodiment;
[0060] Figure 2 is a module block diagram of a traffic light control system in an embodiment;
[0061] Figure 3 It is a module block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0063] Embodiment 1:
[0064] This embodiment discloses a traffic light control method, which can be executed by, but is not limited to, a computer device or a virtual machine with certain computing resources, such as a personal computer, a smart phone, a personal digital assistant, or a wearable device, or by a virtual machine.
[0065] like Figure 1 As shown, a traffic light control method may include but is not limited to the following steps:
[0066] S1. Obtain road video data collected in real time by a road monitoring camera of a designated road, and preprocess the road video data to obtain preprocessed road video data; specifically, preprocessing the road video data includes but is not limited to removing data noise in the road video data.
[0067] In step S1, when preprocessing the road video data, median filtering is used to remove data noise in the road video data. It should be noted that median filtering can both suppress noise data in the road video data and maintain details. Median filtering takes the pixel values of the current pixel and its surrounding adjacent pixels (a total of an odd number of pixels), sorts these pixel values, and then uses the pixel value in the middle position as the pixel value of the current pixel.
[0068] Specifically, in this embodiment, the road video data is input into OpenCV for preprocessing, and each road video frame in the road video data is processed frame by frame in the form of a moving window, and the center of the moving window is overlapped with a certain pixel position in the road video frame; then the pixel grayscale value corresponding to each pixel under the moving window is read to obtain the grayscale value sequence corresponding to the current moving window; then the grayscale value of the middle pixel in the grayscale value sequence is selected; finally, the middle value in the grayscale value sequence is assigned to the pixel at the center of the moving window. At this time, in OpenCV, the function that implements median filtering is cv2.medianBlur(), and its syntax format is as follows:
[0069] dst=cv2.medianBlur(src,ksize);
[0070] Where dst is the return value, which indicates the result after median filtering; src is the image to be processed, i.e. the source image. It can have any number of channels and process each channel independently. The image depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F; ksize is the size of the filter kernel. The filter kernel size refers to the height and width of its neighborhood image during the filtering process. Note that the kernel size must be an odd number greater than 1, such as 3, 5, 7, etc.
[0071] S2. Perform video recognition processing on the pre-processed road video data to obtain road traffic status parameter information; wherein the road traffic status parameter information includes vehicle flow, vehicle speed, etc.
[0072] In this embodiment, the road traffic status parameter information includes the number of valid detection targets and the average retention time; correspondingly, in step S2, the pre-processed road video data is subjected to video recognition processing to obtain the road traffic status parameter information, including:
[0073] S201. Inputting the plurality of pre-processed road video frames of the pre-processed road video data within the preset detection time into a preset target detection model frame by frame for target recognition, so as to obtain a plurality of target detection results corresponding to the plurality of pre-processed road video frames one by one; wherein the target detection results include at least one detected target identified and target marking frames of each detected target in the at least one detected target;
[0074] In this embodiment, the target detection model adopts the Yolov4 model.
[0075] It should be understood that the target detection model is generated based on the YOLOv4 target detection algorithm and is a pre-trained Yolov4 model. Specifically, in this embodiment, the target detection model includes a backbone network Backbone, a neck network neck and a head network head which are connected in sequence, wherein the backbone network Backbone adopts a CSPDarknet53 (CSP stands for Cross Stage Partial) network, which is used to extract the feature data of the preprocessed road video frame in the preprocessed road video data; the neck network neck is composed of an SPP (Spatial Pyramid Pooling block) network and a PANet (Path Aggregation Network) network, the SPP network is used to increase the receptive field and separate the most important features in the feature data, and the PANet network can ensure that semantic features are received from high-level layers and fine-grained features are received from low-level layers of the horizontal backbone network at the same time; the head network head is based on the anchor frame for detection, and detects three different sizes of feature maps 13*13, 26*26, and 52*52, which are used to detect large to small targets respectively. Here, the feature map with a large size contains richer information, so the feature map with a size of 52x52 is used to detect small targets, and vice versa.
[0076] S202. According to the multiple target detection results, target tracking is performed on the detection targets in the multiple target detection results to obtain target tracking trajectories of all detection targets in the multiple target detection results;
[0077] In this embodiment, the target detection result includes at least one detected target identified and a target marking frame of each detected target in the at least one detected target; correspondingly, according to the multiple target detection results, target tracking is performed on the detected targets in the multiple target detection results to obtain target tracking trajectories of all detected targets in the multiple target detection results, including:
[0078] S2021. define the target detection result corresponding to the k-1th pre-processed road video frame among the multiple target detection results as the current target detection result, and obtain the current target marking frame set detections corresponding to all detected targets in the current target detection result; wherein k is a natural number greater than 2;
[0079] S2022. Obtain, from multiple target detection results, previous target label frame sets tracks corresponding to all detected targets in a previous target detection result of a current target detection result;
[0080] S2023. Perform target marker frame matching on the current target marker frame set detections and the previous target marker frame set tracks to obtain a target marker frame matching pair in the current preprocessed road video frame, an unmatched current target marker frame, and an unmatched previous target marker frame;
[0081] Specifically, the target marker frame matching pair in the current preprocessed road video frame includes a first target marker frame matching pair and a second target marker frame matching pair; correspondingly, target marker frame matching is performed on the current target marker frame set detections and the previous target marker frame set tracks to obtain the target marker frame matching pair in the current preprocessed road video frame, including:
[0082] A1. Use the Kalman filter method to predict the predicted value of the previous target marker frame set tracks in the preprocessed road video frame corresponding to the current target marker frame set detections;
[0083] In this embodiment, the Kalman filter method is used to predict any target marked frame in the previous target marked frame set tracks. The predicted values in the preprocessed road video frame corresponding to the current target marker frame set detections include:
[0084] Use the Kalman filter method to predict any target marker frame in the previous target marker frame set tracks The initial prediction value in the preprocessed road video frame corresponding to the current target marker frame set detections and the initial covariance matrix of the initial prediction value; wherein the initial prediction value is:
[0085]
[0086] The initial covariance matrix of the initial prediction value is:
[0087]
[0088] Where A is the preset first transformation matrix, is the state transfer matrix, B is the preset second transformation matrix, is the control matrix, and u k Mark the target box The mean value, P k-1 Mark the target box The initial covariance matrix of , T is the transposed symbol;
[0089] According to the initial prediction value and the initial covariance matrix of the initial prediction value, the initial prediction value is updated to obtain the target marking frame The predicted value in the preprocessed road video frame corresponding to the current target marker frame set detections; wherein the predicted value is:
[0090]
[0091] In the formula, C is the preset third transformation matrix, is the observation matrix, and K k is the Kalman gain, y k Mark the target box The observation vector.
[0092] Among them, the covariance matrix of the predicted value is: Where I is the preset unit matrix.
[0093] A2. Perform target marker frame matching on the predicted value and the current target marker frame set detections to obtain the first target marker frame matching pair in the current preprocessed road video frame, the previous target marker frame set tracks' corresponding to the unmatched predicted value, and the unmatched current target marker frame detections';
[0094] A3. Obtain the cost matrix between the target marked frame in the previous target marked frame set tracks' and the target marked frame in the current target marked frame set detections' corresponding to the unmatched prediction value;
[0095] In this embodiment, obtaining the cost matrix between the target marked frame i in the previous target marked frame set tracks' and the target marked frame j in the current target marked frame set detections' corresponding to the unmatched prediction value includes:
[0096] Get the cosine distance between the target marking frame i and the target marking frame j; wherein the cosine distance is:
[0097]
[0098] Where cos(i,j) is the cosine similarity between target label box i and target label box j. After normalization, ||i||2=1, ||j||2=1;
[0099] According to the cosine distance, a cost matrix between the target marking frame i and the target marking frame j is obtained; wherein the cost matrix is:
[0100] c i,j =λd (1) (i,j)+(1-λ)d (2) (i,j);
[0101] Where, d(1) (i, j) is the cosine distance, d (2) (i, j) is the Mahalanobis distance, and λ is the preset weight coefficient.
[0102] A4. According to the cost matrix of the target labeled frame in the previous target labeled frame set tracks' and the current target labeled frame set detections' corresponding to the unmatched prediction value, cascade matching and IOU (Intersection over Union) matching are performed on the previous target labeled frame set tracks' and the current target labeled frame set detections' corresponding to the unmatched prediction value to obtain a second target labeled frame matching pair.
[0103] S2024. Redefine the target detection result corresponding to the kth pre-processed road video frame among the multiple target detection results as the current target detection result, that is, return to step S2021 until the target marker frame matching pairs in all pre-processed road video frames are obtained;
[0104] S2025. Obtain target tracking trajectories of all detected targets in multiple target detection results based on target marker frame matching pairs in all pre-processed road video frames.
[0105] S203. According to the target tracking trajectories of all detection targets, the number of valid detection targets in the target tracking trajectories and the retention time of the valid detection targets in the preset detection area are obtained; wherein the valid detection targets are detection targets corresponding to the target tracking trajectories that enter the preset detection area from a specified starting baseline of any preprocessed road video frame of the preprocessed road video data within the preset detection time, and leave the preset detection area from a specified ending baseline of any preprocessed road video frame whose acquisition time is after the preprocessed road video frame;
[0106] In this embodiment, according to the target tracking trajectories of all detected targets, the retention time of the effective detected targets in the target tracking trajectories in the preset detection area is obtained, including:
[0107] According to the target tracking trajectories of all detection targets, obtaining the entry time of the effective detection target from the specified starting baseline of the preprocessed road video data located in any preprocessed road video frame within the preset detection duration into the preset detection area, and the departure time of the effective detection target from the specified ending baseline of any preprocessed road video frame whose acquisition time is located after the preprocessed road video frame leaves the preset detection area;
[0108] The retention time of the effective detection target in the preset detection area is obtained according to the entry time and the exit time; wherein the retention time=the exit time-the entry time.
[0109] S204. Obtain an average retention time of the valid detection targets according to the retention time of all valid detection targets in the preset detection area during the preset detection time.
[0110] The road traffic status parameter information may also include the average moving speed of the effective detection target, so as to determine whether the current road is in a congested state according to the average moving speed of the effective detection target. At this time, after obtaining the retention time of the effective detection target in the preset detection area, the method further includes:
[0111] According to the target tracking trajectories of all detected targets, an effective trajectory distance of an effective detected target in the target tracking trajectories is obtained;
[0112] Obtaining a moving speed of the effective detection target according to the effective trajectory distance and the retention time corresponding to the effective detection target;
[0113] According to the moving speeds of all effective detection targets within the preset detection time, the average moving speed of the effective detection targets is obtained.
[0114] In this embodiment, when the pre-processed road video data is subjected to video recognition processing, the radar-visual fusion technology can also be used to identify the road traffic status of the pre-processed road video data, that is, the target speed is detected by radar, the vehicle is detected by the target detection algorithm, and the detected target is tracked by the Deepsort target tracking algorithm. Specifically, when the radar-visual fusion technology is used, the vehicle density within each road section, such as 120m and 150m, can be calculated to determine whether the current road is in a congested state, and the length of the congestion, such as whether it is 200m or 300m. The duration of the traffic light can be adjusted according to the actual situation, and vehicles within 100m can be released first, etc., or all vehicles can be released according to the road conditions at other intersections.
[0115] S3. Obtain the road congestion condition parameters of the current road, such as the road section level, congestion time, flow rate, etc. of the current road, and determine whether the current road is in a congested state based on the road traffic state parameter information and the road congestion condition parameters;
[0116] If so, a traffic light control instruction is sent to the control system corresponding to the traffic light at the current road intersection, so as to adjust the duration of the traffic light, such as shortening the duration of the red light at the congested side intersection, etc., which is not restricted here, thereby improving traffic efficiency, and then re-obtaining the road video data collected in real time by the road monitoring camera of the designated road;
[0117] If not, that is, when the current road congestion is relieved or released, an instruction to restore the preset control mode is sent to the control system. At this time, the control system automatically restores to the original traffic light control mode, and then re-acquires the road video data collected in real time by the road monitoring camera of the designated road.
[0118] Specifically, in this embodiment, when judging whether the current road is in a congested state based on the road traffic status parameter information and the road congestion condition parameters, based on the road congestion condition parameters of the current road, if, for example, the number of valid detection targets in the road traffic status parameter information is greater than a preset number threshold, and the average residence time of valid detection targets in the road traffic status parameter information exceeds a preset time threshold, it is determined that the current road is in a congested state; otherwise, it is determined that the current road is not in a congested state.
[0119] This embodiment uses video recognition technology to monitor the road congestion status in real time, and then determines whether the road traffic status is congested, and controls traffic lights according to the road congestion situation, which can realize adaptive adjustment of traffic lights, and can reduce road load under congestion conditions. At the same time, this embodiment uses video recognition technology to detect the road congestion status, which has the advantages of simple installation and deployment, low subsequent maintenance cost, and high detection accuracy, and is worthy of promotion and application.
[0120] Embodiment 2:
[0121] This embodiment discloses a traffic light control system for implementing the traffic light control method in Embodiment 1; Figure 2 As shown, the traffic light control system includes:
[0122] A data acquisition module is used to acquire road video data collected in real time by a road monitoring camera of a designated road, and preprocess the road video data to obtain preprocessed road video data;
[0123] A data recognition module, which is in communication with the data acquisition module and is used to perform video recognition processing on the pre-processed road video data to obtain road traffic status parameter information;
[0124] A traffic light control module, which is in communication with the data identification module, is used to obtain a road congestion condition parameter of a current road, and determine whether the current road is in a congested state according to the road traffic state parameter information and the road congestion condition parameter;
[0125] If so, a traffic light control instruction is sent to the control system corresponding to the traffic light at the current road intersection to adjust the duration of the traffic light, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired;
[0126] If not, an instruction to restore the preset control mode is sent to the control system, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired.
[0127] Embodiment 3:
[0128] Based on Embodiment 1 or 2, this embodiment discloses an electronic device, which may be a smart phone, a tablet computer, a laptop computer, or a desktop computer. The electronic device may be referred to as a terminal, a portable terminal, a desktop terminal, etc. Figure 3 As shown, the electronic equipment includes:
[0129] a memory for storing computer program instructions; and,
[0130] A processor is used to execute the computer program instructions to complete the operation of the traffic light control method as described in any one of Embodiment 1.
[0131] Embodiment 4:
[0132] Based on any one of embodiments 1 to 3, this embodiment discloses a computer-readable storage medium for storing computer-readable computer program instructions, wherein the computer program instructions are configured to execute the operations of the traffic light control method as described in embodiment 1 when run.
[0133] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, a person skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A traffic light control method, characterized in that: include: Acquire road video data collected in real time by a road monitoring camera of a designated road, and preprocess the road video data to obtain preprocessed road video data; Performing video recognition processing on the pre-processed road video data to obtain road traffic status parameter information; Obtaining a road congestion condition parameter of a current road, and judging whether the current road is in a congested state according to the road traffic state parameter information and the road congestion condition parameter; If so, a traffic light control instruction is sent to the control system corresponding to the traffic light at the current road intersection to adjust the duration of the traffic light, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired; If not, a command to restore the preset control mode is sent to the control system, and then the road video data collected in real time by the road monitoring camera of the designated road is reacquired; The road traffic status parameter information includes the number of effective detection targets and the average retention time; Correspondingly, the pre-processed road video data is subjected to video recognition processing to obtain road traffic status parameter information, including: Inputting the plurality of preprocessed road video frames of the preprocessed road video data within the preset detection duration into a preset target detection model frame by frame for target recognition, so as to obtain a plurality of target detection results corresponding to the plurality of preprocessed road video frames one by one; According to the multiple target detection results, target tracking is performed on the detection targets in the multiple target detection results to obtain target tracking trajectories of all the detection targets in the multiple target detection results; According to the target tracking trajectories of all detection targets, the number of valid detection targets in the target tracking trajectories and the retention time of the valid detection targets in the preset detection area are obtained; wherein the valid detection targets are detection targets corresponding to the target tracking trajectories that enter the preset detection area from a specified starting baseline of any preprocessed road video frame of the preprocessed road video data within the preset detection time, and leave the preset detection area from a specified ending baseline of any preprocessed road video frame whose acquisition time is after the preprocessed road video frame; According to the retention time of all effective detection targets in the preset detection area during the preset detection time, the average retention time of the effective detection targets is obtained; The target detection result includes at least one detected target identified and a target marking frame of each detected target in the at least one detected target; correspondingly, according to the multiple target detection results, target tracking is performed on the detected targets in the multiple target detection results to obtain target tracking trajectories of all detected targets in the multiple target detection results, including: The corresponding target among multiple target detection results k- The target detection result of the road video frame after 1 frame preprocessing is defined as the current target detection result, and the current target marking frame set corresponding to all detected targets in the current target detection result is obtained; wherein, k is a natural number greater than 2; From the multiple target detection results, obtain a previous target label frame set corresponding to all detected targets in the previous target detection result of the current target detection result; Perform target marker frame matching on the current target marker frame set and the previous target marker frame set to obtain a target marker frame matching pair in the current preprocessed road video frame; The corresponding target among multiple target detection results k The target detection result of the road video frame after frame preprocessing is redefined as the current target detection result until the target marker box matching pairs in all preprocessed road video frames are obtained; According to the target marker box matching pairs in all pre-processed road video frames, the target tracking trajectories of all detected targets in the multiple target detection results are obtained; The target marker frame matching pair in the current preprocessed road video frame includes a first target marker frame matching pair and a second target marker frame matching pair; correspondingly, target marker frame matching is performed on the current target marker frame set and the previous target marker frame set to obtain the target marker frame matching pair in the current preprocessed road video frame, including: Using the Kalman filter method, the predicted value of the previous target mark frame set in the preprocessed road video frame corresponding to the current target mark frame set is predicted; Performing target marker frame matching on the predicted value and the current target marker frame set to obtain a first target marker frame matching pair in the current preprocessed road video frame, a previous target marker frame set corresponding to the unmatched predicted value, and an unmatched current target marker frame; Obtain a cost matrix between the target marked frame in the previous target marked frame set and the target marked frame in the current target marked frame set corresponding to the unmatched prediction value; According to the cost matrix of the target label frame in the previous target label frame set and the current target label frame set corresponding to the unmatched prediction value, cascade matching and IOU matching are performed on the previous target label frame set and the current target label frame set corresponding to the unmatched prediction value to obtain a second target label frame matching pair; Use the Kalman filter method to predict any target marker frame in the previous target marker frame set The predicted value in the preprocessed road video frame corresponding to the current target marker frame set includes: Use the Kalman filter method to predict any target marker frame in the previous target marker frame set The initial prediction value in the preprocessed road video frame corresponding to the current target mark frame set and the initial covariance matrix of the initial prediction value; wherein the initial prediction value is: ; The initial covariance matrix of the initial prediction value is: ; In the formula, is the preset first transformation matrix, is the preset second transformation matrix, Mark the target box The mean of Mark the target box The initial covariance matrix of is the transpose symbol; According to the initial prediction value and the initial covariance matrix of the initial prediction value, the initial prediction value is updated to obtain the target marking frame The predicted value in the preprocessed road video frame corresponding to the current target mark frame set; wherein the predicted value is: ; In the formula, is the preset third transformation matrix, is the Kalman gain, , Mark the target box The observation vector.
2. A traffic light control method according to claim 1, characterized in that: Get the target marked box in the previous target marked box set corresponding to the unmatched prediction value and the target marker frame in the current target marker frame set The cost matrix between includes: Get the target marker box and target marker box The cosine distance between them; wherein the cosine distance is: ; In the formula, Mark the target box and target marker box The cosine similarity between , after normalization , ; According to the cosine distance, the target marking box is obtained and target marker box The cost matrix between ; wherein the cost matrix is: ; In the formula, is the cosine distance, is the Mahalanobis distance, is the preset weight coefficient.
3. A traffic light control method according to claim 1, characterized in that: According to the target tracking trajectories of all detected targets, the retention time of the effective detected targets in the target tracking trajectories in the preset detection area is obtained, including: According to the target tracking trajectories of all detection targets, obtaining the entry time of the effective detection target from the specified starting baseline of the preprocessed road video data located in any preprocessed road video frame within the preset detection duration into the preset detection area, and the departure time of the effective detection target from the specified ending baseline of any preprocessed road video frame whose acquisition time is located after the preprocessed road video frame leaves the preset detection area; The length of time for which the effective detection target stays in the preset detection area is obtained according to the entry time and the exit time; wherein the length of time for which the effective detection target stays=the exit time-the entry time.
4. A traffic light control system, characterized in that: Used to implement the traffic light control method according to any one of claims 1 to 3; the traffic light control system comprises: A data acquisition module is used to acquire road video data collected in real time by a road monitoring camera of a designated road, and preprocess the road video data to obtain preprocessed road video data; A data recognition module, which is in communication with the data acquisition module and is used to perform video recognition processing on the pre-processed road video data to obtain road traffic status parameter information; A traffic light control module, which is in communication with the data identification module, is used to obtain a road congestion condition parameter of a current road, and determine whether the current road is in a congested state according to the road traffic state parameter information and the road congestion condition parameter; If so, a traffic light control instruction is sent to the control system corresponding to the traffic light at the current road intersection to adjust the duration of the traffic light, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired; If not, an instruction to restore the preset control mode is sent to the control system, and then the road video data collected in real time by the road monitoring camera of the designated road is re-acquired.
5. An electronic device, characterized in that: include: a memory for storing computer program instructions; as well as, A processor is used to execute the computer program instructions to complete the operation of the traffic light control method according to any one of claims 1 to 3.
6. A computer-readable storage medium for storing computer program instructions readable by a computer, characterized in that: The computer program instructions are configured to execute the operations of the traffic light control method according to any one of claims 1 to 3 when executed.
Citation Information
Patent Citations
Method for detecting illegal lane change of vehicle based on video detection technique
CN102819952A
Deep learning and intelligent street lamp-based traffic signal lamp intelligent control system
CN107016861A