Traffic flow multi-parameter intelligent identification method and system based on video stream
By using a video stream-based intelligent recognition method, deep learning and tracking algorithms are employed to detect vehicles and license plates. Combined with multi-strategy image enhancement and weighted voting, the problems of unstable license plate recognition and duplicate counting in traffic statistics are solved, achieving high-precision traffic parameter collection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 中铁长江交通设计集团有限公司
- Filing Date
- 2026-04-23
- Publication Date
- 2026-05-26
Smart Images

Figure CN122090397A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent transportation and computer vision technology, specifically to a method and system for intelligent multi-parameter recognition of traffic flow based on video streams. Background Technology
[0002] Currently, traffic parameter collection mainly relies on geomagnetic coils and radar sensors. Geomagnetic coils require excavation and installation, resulting in long construction periods, high maintenance costs, and susceptibility to environmental corrosion and failure. While lidar and millimeter-wave radar offer high detection accuracy, their high cost makes large-scale deployment on ordinary highways or urban road networks difficult. Although current video-based methods offer advantages in terms of flexible deployment and rich information, they still face key technological bottlenecks in complex environments.
[0003] Existing video recognition systems mostly employ single-frame triggered recognition, lacking utilization of vehicle motion temporal information. They exhibit poor detection stability under conditions such as low light at night, rain, fog, and strong backlight. License plate recognition lacks effective error correction mechanisms for obstructed, damaged, or tilted scenes. Traffic flow statistics are easily affected by vehicle lane changes, obstructions, and short-term backtracking, resulting in significant issues with duplicate counting and direction misjudgment. Furthermore, the serial processing architecture and inefficient I / O writing methods make it difficult for the system to support high frame rate real-time processing requirements. Therefore, there is an urgent need for a video intelligent recognition solution that combines environmental adaptability, robust recognition, and real-time processing capabilities. Summary of the Invention
[0004] To address the shortcomings of existing technologies, the present invention aims to provide a multi-parameter intelligent traffic flow recognition method and system based on video streams, solving technical problems such as unstable license plate recognition, repetitive traffic flow statistics, inaccurate direction determination, and high system latency.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] A multi-parameter intelligent recognition method for traffic flow based on video streams includes the following steps:
[0007] S1: Acquire the video stream and extract image frames from the video stream;
[0008] S2: Use a deep learning model to detect vehicles in the image frame, output the vehicle's location information, vehicle type, and confidence level, and locate the license plate area of the vehicle.
[0009] S3: Track the vehicle's movement trajectory. When the vehicle triggers a preset virtual trigger line, identify the license plate area and perform vehicle type analysis.
[0010] S4: Perform multi-strategy image enhancement on the license plate area and perform multi-round OCR recognition. Based on the confidence of each recognition result, perform weighted voting and output the final license plate number.
[0011] S5: Use a tracking algorithm to assign a globally unique identifier to each vehicle, determine the driving direction based on the consistency of the vehicle trajectory points, and include the traffic flow statistics in the corresponding direction when the vehicle has completely crossed the detection area and the direction is stable.
[0012] S6: Store the recognition results and generate multi-dimensional statistical reports including vehicle type, driving direction and time period.
[0013] Furthermore, the multi-strategy image enhancement in S4 includes a combination of at least two strategies among histogram equalization, adaptive contrast enhancement, multi-scale filtering, and edge enhancement.
[0014] Furthermore, step S4 includes the following steps:
[0015] S401: Perform OCR recognition on the same license plate area no more than a preset threshold number of times, using a different combination of image enhancement strategies each time;
[0016] S402: Based on the confidence level of each recognition result, a weighted vote is performed to output the final license plate number. The calculation formula is as follows:
[0017] rfinal=argmaxr∈{r1,r2,…,r n ∑j=lncj·I(rj=r)
[0018] Where cj is the confidence level of the j-th identification, and I(·) is the indicator function;
[0019] S403: When the highest confidence level is lower than the preset confidence threshold, the license plate area boundary expansion and secondary recognition process is triggered.
[0020] Furthermore, S5 includes the following steps:
[0021] S501: Uses a tracking algorithm to generate a globally unique track_id for each vehicle, predicts the position through Kalman filtering, and combines it with appearance features to perform data association;
[0022] S502: Collect vehicle trajectory points {(xi, yi)} for at least 5 consecutive frames, and calculate the coordinate increments between adjacent frames: Δx = x' − x, Δy = y' − y
[0023] S503: When the proportion of the main direction sign exceeds the threshold θ∈[0.8, 0.9], the driving direction is confirmed. The direction determination formula is:
[0024]
[0025] In the formula, D is the preset threshold;
[0026]
[0027] S504: When a vehicle completely traverses the detection area and its direction remains stable, it is included in the traffic flow statistics for the corresponding direction.
[0028] Furthermore, the tracking algorithm employs the DeepSORT algorithm, which combines Kalman filtering with appearance feature matching to assign a globally unique identifier to each vehicle and sets a trajectory retention time to cope with brief occlusions.
[0029] Furthermore, the trajectory tracking algorithm operates within the deep learning detection interval frame and includes the following steps:
[0030] Detect the Nth frame using a deep learning model, output the vehicle position, and create a trajectory list;
[0031] In the subsequent M frames (M<30), only the tracking algorithm is used to predict the vehicle center point, and no deep learning inference is performed;
[0032] Every M frames, the deep learning model is reactivated for detection and matched with the tracking results: if the Euclidean distance of the center point is less than the threshold D, it is associated with the original trajectory; otherwise, a new trajectory is created.
[0033] The number of trajectory lists for different vehicle models represents the traffic statistics for that vehicle model.
[0034] Furthermore, the deep learning model in S2 adopts the YOLO architecture, and its training process includes:
[0035] S201: Randomly initialize model parameters by inputting sample images and label files into the model;
[0036] S202: Divide each image into an S×S grid and calculate the grid in which the center of the bounding box is located;
[0037] S203: Each grid predicts B bounding boxes (including center coordinates x, y, width and height w, h, confidence score) and C class probabilities;
[0038] S204: The total error Eall = Ecoord + EIOU + Eclass is optimized iteratively using gradient descent until the error converges.
[0039] Furthermore, it also includes exception handling and adaptive mechanisms:
[0040] When a vehicle's trajectory changes abruptly, its speed becomes abnormal, or its direction changes abruptly, it is automatically marked as a suspicious trajectory.
[0041] Based on historical recognition accuracy, dynamically adjust the OCR confidence threshold, trajectory matching threshold, or trigger line position;
[0042] Monitor system resource utilization and automatically implement a degradation strategy when it exceeds a preset threshold.
[0043] A traffic flow multi-parameter intelligent recognition system based on video streams, comprising:
[0044] The video capture module is used to acquire video streams;
[0045] The vehicle detection module is configured to use a deep learning model to detect vehicles in video frames and output vehicle location information and vehicle type.
[0046] A license plate location module is configured to locate the license plate area of the vehicle.
[0047] The trajectory tracking and triggering module is configured to track the vehicle's movement trajectory and trigger license plate recognition when the vehicle triggers a preset virtual trigger line;
[0048] The license plate recognition module is configured to perform multi-strategy image enhancement on the license plate area, perform multi-round OCR recognition, perform weighted voting based on the confidence of each recognition result, and output the final license plate number.
[0049] The traffic statistics module is configured to assign a globally unique identifier to each vehicle using a tracking algorithm, determine the driving direction based on the directional consistency of the vehicle trajectory points, and include the traffic statistics for the corresponding direction when the vehicle has completely crossed the detection area and the direction is stable.
[0050] The data storage and output module is configured to store the recognition results and generate multi-dimensional statistical reports.
[0051] Compared with the prior art, the present invention has the following beneficial effects:
[0052] This solution first extracts frames from the video stream and uses a deep learning model to detect vehicle position, model, and license plate area. After a vehicle triggers a preset virtual trigger line, multi-strategy image enhancement and multi-round OCR recognition are performed on the license plate area. A weighted voting mechanism is used to fuse multiple recognition results, effectively overcoming the limitations of a single enhancement strategy in complex environments. Simultaneously, a tracking algorithm assigns a globally unique identifier to each vehicle, and the driving direction is determined based on the directional consistency of trajectory points. Traffic flow statistics are only counted when the direction is stable and the vehicle completely traverses the detection area, avoiding duplicate counting and misjudgment of direction. Finally, the recognition results are stored and multi-dimensional statistical reports are generated. Through multi-strategy enhancement and weighted voting mechanisms, the accuracy of license plate recognition in complex scenarios such as low light, rain, fog, and occlusion is significantly improved. Global trajectory tracking and directional consistency determination achieve high-precision, anti-duplication traffic flow statistics and direction determination. Furthermore, this method only requires ordinary high-definition cameras to complete multi-dimensional traffic parameter collection, eliminating the need for dedicated sensors such as geomagnetic coils or radar, significantly reducing system cost and construction difficulty. Attached Figure Description
[0053] Figure 1 This is a flowchart illustrating the steps of an embodiment of the intelligent traffic flow multi-parameter recognition method based on video streams according to the present invention.
[0054] Figure 2 This is a vehicle classification standard diagram from Embodiment 1 of the intelligent traffic flow multi-parameter recognition method based on video stream of the present invention. Detailed Implementation
[0055] The present invention will be further described in detail below through specific embodiments:
[0056] The specific implementation process is as follows:
[0057] Example 1
[0058] Example 1 is attached. Figure 1 As shown, a multi-parameter intelligent recognition method for traffic flow based on video streams includes the following steps:
[0059] S1: Acquire the video stream and extract image frames from the video stream;
[0060] S2: Use a deep learning model to detect vehicles in the image frame, output the vehicle's location information, vehicle type, and confidence level, and locate the license plate area of the vehicle.
[0061] S3: Track the vehicle's movement trajectory. When the vehicle triggers a preset virtual trigger line, identify the license plate area and perform vehicle type analysis.
[0062] S4: Perform multi-strategy image enhancement on the license plate area and perform multi-round OCR recognition. Based on the confidence of each recognition result, perform weighted voting and output the final license plate number.
[0063] S5: Use a tracking algorithm to assign a globally unique identifier to each vehicle, determine the driving direction based on the consistency of the vehicle trajectory points, and include the traffic flow statistics in the corresponding direction when the vehicle has completely crossed the detection area and the direction is stable.
[0064] S6: Store the recognition results and generate multi-dimensional statistical reports including vehicle type, driving direction and time period.
[0065] By extracting frames from the video stream and using a deep learning model to detect vehicle position, model, and license plate area, multi-strategy image enhancement and multi-round OCR recognition are performed on the license plate area after the vehicle triggers a virtual trigger line. A weighted voting mechanism then fuses the results of multiple recognitions to overcome recognition limitations in complex environments. Simultaneously, a tracking algorithm assigns a globally unique identifier to each vehicle, and the driving direction is determined based on the consistency of trajectory point direction. Traffic statistics are only counted when the direction is stable and the vehicle completely traverses the detection area to avoid duplicate counting and misjudgment of direction. This significantly improves the accuracy of license plate recognition in low-light, rain, fog, and obstructed scenarios, achieving high-precision anti-duplication traffic statistics and direction determination.
[0066] Specifically, the system first acquires the video stream and then extracts image frames from it. In this embodiment, a high-definition camera with a resolution of at least 4 megapixels and a frame rate of at least 20fps is installed beside the road. The camera transmits the real-time video stream to an industrial control computer via the RTSP protocol. The industrial control computer is equipped with an Intel i5-8500 processor, 16GB of memory, and an RTX 2060 graphics card, running the Windows 10 operating system. The system extracts image frames from the video stream at a fixed frame rate. The frame extraction interval can be dynamically adjusted according to the processing load. For example, under normal circumstances, each frame is processed; when the CPU utilization exceeds 80%, the system automatically skips frames to process every two frames to ensure real-time performance.
[0067] Then, a deep learning model is used to detect vehicles in the image frames, outputting vehicle location information, vehicle type, and confidence score, and locating the license plate region of the vehicle. The deep learning model in this embodiment adopts the YOLO architecture, and its training process includes:
[0068] S201: Randomly initialize model parameters by inputting sample images and label files into the model;
[0069] S202: Divide each image into an S×S grid and calculate the grid in which the center of the bounding box is located;
[0070] S203: Each grid predicts B bounding boxes (including center coordinates x, y, width and height w, h, confidence score) and C class probabilities;
[0071] S204: The total error Eall = Ecoord + EIOU + Eclass is optimized iteratively using gradient descent until the error converges.
[0072] Specifically, during model training, a sample set containing over 50,000 labeled images is constructed. Vehicle and wheel positions and categories are labeled, and the sample set is divided into training, validation, and test sets in an 8:1:1 ratio. The model segments the input image into a 19×19 grid, with each grid predicting two bounding boxes and four class probabilities (passenger vehicle, truck, passenger car, and wheel). The loss function consists of coordinate error, intersection-over-union (IoU) error, and classification error, and is iteratively optimized using gradient descent until convergence. The model output includes vehicle category statistics, vehicle category probability distribution P(c), and confidence score s. Based on the vehicle detection results, the system further crops the front area of the vehicle and applies edge detection and morphological processing to accurately locate the license plate position.
[0073] The system then tracks the vehicle's trajectory. When the vehicle triggers a preset virtual trigger line, the license plate area is identified and vehicle type analysis is performed. In this embodiment, a virtual trigger line is set in the video frame, represented by the linear equation ax + by + c = 0, where a² + b² = 1. The trigger line position is adaptively adjusted according to road geometry features: xt = xstart + α·Wroad, yt = ystart + β·Hroad, where xt and yt are the x-coordinate and y-coordinate of the trigger line endpoint, respectively; xstart and ystart are the x-coordinate and y-coordinate of the trigger line start point, respectively; Wroad is the road width; Hroad is the road height; and α and β are scaling factors. In this embodiment, α is 0.6 and β is 0.8. The system tracks the center point (xb, yb) of the vehicle's bottom edge. When the distance from this point to the trigger line d = |a·xb + b·yb + c| < ε (ε is 5 pixels), the subsequent recognition process is triggered. To reduce false triggers, speed filtering is used to confirm a valid trigger only when the vehicle speed v > vmin (vmin is taken as 5 km / h). In the vehicle type analysis of this embodiment, passenger cars are divided into 4 categories according to highway toll standards, and analyzed based on passenger capacity, vehicle length, and appearance. Freight cars are divided into 6 categories according to highway toll standards, and analyzed based on vehicle length, number of axles, and license plate color. The vehicle type classification standards are attached. Figure 2 As shown.
[0074] Then, multi-strategy image enhancement is performed on the license plate area, followed by multiple rounds of OCR recognition. Weighted voting is then conducted based on the confidence levels of each recognition result to output the final license plate number. In this embodiment, multi-strategy image enhancement is performed on the license plate area after triggering. First, the license plate area is expanded at a boundary ratio δ=1.1 to avoid character truncation. Then, a combination of enhancement strategies is applied sequentially: global histogram equalization, CLAHE adaptive contrast enhancement, Gaussian and median filtering for noise reduction, Laplacian sharpening, and Canny edge enhancement. OCR recognition is performed once after each application of one or more enhancement strategies, for a total of 5 recognitions. The recognition result rj and its confidence level cj are recorded. The weighted voting formula is:
[0075] rfinal=argmaxr∈{r1,r2,…,r n ∑j=lncj·I(rj=r)
[0076] Where cj is the confidence level of the j-th recognition, and I(·) is the indicator function. When the highest confidence level is lower than 0.8, the secondary recognition process is triggered, the boundary expansion ratio is adjusted to δ=1+(1-max_confidence) / 2, and multiple rounds of recognition are performed again.
[0077] Then, a tracking algorithm is used to assign a globally unique identifier to each vehicle. The driving direction is determined based on the direction consistency of the vehicle's trajectory points. When the vehicle completely crosses the detection area and the direction is stable, the traffic statistics for the corresponding direction are counted. In this embodiment, the DeepSORT algorithm is used to assign a globally unique track_id to each vehicle. This algorithm combines Kalman filter to predict positions and appearance features for data association, and sets the trajectory retention time to 30 frames to handle short-term occlusions. The vehicle trajectory points \((x_i, y_i)\) of 5 consecutive frames are collected, and the coordinate increments \(\Delta x = x' - x\), \(\Delta y = y' - y\) between adjacent frames are calculated. The direction determination method is as follows: when \(|\Delta y| > D\), the direction is taken as \(\text{sign}(\Delta y)\); when \(|\Delta y| \leq D\), the direction is taken as \(\text{sign}(\Delta x)\), where \(D\) is a preset displacement threshold, and \(D\) is taken as 3 pixels in this embodiment. When the proportion of the main direction signs exceeds 0.85, the driving direction is confirmed. Only when the vehicle's direction is consistent for more than 5 consecutive frames and it completely crosses the detection area, the traffic statistics for the corresponding direction are counted to ensure anti-duplicate counting. The trigger line is represented by the linear equation \(ax + by + c = 0\), where \(a\) and \(b\) need to satisfy \(a^2 + b^2 = 1\) to ensure the unitization of the direction vector. To ensure the effectiveness of the trigger function, the following constraint conditions need to be met: First, the trigger line needs to be perpendicular to the road direction, that is, the direction vector \((a, b)\) and the road centerline direction vector \((dx, dy)\) satisfy \(a*dx + b*dy = 0\); Second, the position of the trigger line needs to satisfy \(c = -a*x_0 - b*y_0\), where \((x_0, y_0)\) is the midpoint coordinate of the road centerline. In addition, an effective width parameter \(w\) of the trigger line is defined. When the center point \((x, y)\) of the vehicle bottom edge satisfies \(|ax + by + c| < w\), it is determined as an effective trigger, and \(w\) is taken as 20 pixels in this embodiment.
[0078] To balance the detection accuracy and computational efficiency, this embodiment adopts a detection and tracking cooperation strategy: use a deep learning model to detect the \(N\)th frame and create a trajectory list; within the subsequent \(M\) frames (\(M = 15\)), only use the DeepSORT tracking algorithm to predict the vehicle center point without performing deep learning inference; every \(M\) frames, re-enable the deep learning model for detection and match the tracking results. If the Euclidean distance of the center points is less than 30 pixels, it is associated with the original trajectory, otherwise a new trajectory is created. The number of trajectory lists for different vehicle models is the traffic statistics result for the corresponding vehicle model.
[0079] The recognition results are then stored, and multi-dimensional statistical reports including vehicle type, driving direction, and time period are generated. This embodiment adopts a four-thread asynchronous architecture: one thread is responsible for reading frames from the video source, two threads perform deep learning inference and tracking in parallel, and one thread is responsible for data writing. Threads exchange data through a bounded buffer queue with a capacity of 200. The Excel writer is optimized based on openpyxl, employing a memory buffer and batch writing strategy, performing a batch write every 100 records accumulated. The final output includes: real-time detection boxes and recognition labels, vehicle type, license plate, passage time, driving direction, and traffic statistics tables summarized by hour, day, vehicle type, and direction. The system also supports exporting in CSV and JSON formats, facilitating integration with traffic management platforms.
[0080] In addition, this embodiment also has an anomaly handling and adaptive mechanism: when the vehicle trajectory changes abruptly, the speed is abnormal, or the direction changes abruptly, it is automatically marked as a suspicious trajectory and highlighted in the visualization interface; the OCR confidence threshold, trajectory matching threshold and trigger line position are dynamically adjusted according to the historical recognition accuracy; the CPU and memory usage are monitored in real time, and when they exceed 90%, the detection frame rate is automatically reduced or some auxiliary functions are turned off to ensure the stable operation of the core recognition process.
[0081] Example 2
[0082] Example 2 is a traffic flow multi-parameter intelligent recognition system based on video streams. This system corresponds to the method examples described above and includes the following modules:
[0083] The video capture module is used to acquire video streams. This module supports RTSP streams, local video files, and USB camera input, and can handle up to eight 1080P video streams in parallel. The video capture module automatically adjusts the camera's exposure time, gain, and white balance parameters, and switches to infrared mode under low-light conditions.
[0084] The vehicle detection module is configured to use a deep learning model to detect vehicles in video frames and output vehicle location information and vehicle type. This module uses the YOLOv5 architecture, with an input image resolution of 640×640, and outputs vehicle bounding box coordinates, vehicle type probability distribution, and confidence score. The vehicle detection module works in conjunction with the trajectory tracking module, performing a complete detection every 15 frames, while the tracking module performs position prediction for the remaining frames.
[0085] The license plate localization module is configured to locate the license plate area of the vehicle. Based on the vehicle detection results, the module crops out the front area of the vehicle, applies an edge detection algorithm to extract candidate regions, connects broken edges through morphological closing operations, and combines the prior aspect ratio of the license plate (3:1 to 5:1) to filter out the final license plate position.
[0086] The trajectory tracking and triggering module is configured to track the movement trajectory of the vehicle and trigger license plate recognition when the vehicle triggers a preset virtual trigger line. This module uses the DeepSORT algorithm to assign a globally unique track_id to each vehicle, and performs data association by combining Kalman filter predicted positions and appearance features. The virtual trigger line is represented by the linear equation ax + by + c = 0, where a and b need to satisfy a² + b² = 1 to ensure the unitization of the direction vector, and it needs to be perpendicular to the road direction, that is, the direction vector (a, b) and the road center line direction vector (dx, dy) satisfy a*dx + b*dy = 0. The trigger line position needs to satisfy c = -a*x0 - b*y0, where (x0, y0) is the midpoint coordinate of the road center line. When the center point (x, y) of the bottom edge of the vehicle satisfies |ax + by + c| < w (w is taken as 20 pixels) and the speed is greater than 5 km / h, the license plate recognition process is triggered.
[0087] The license plate recognition module is configured to perform multi-strategy image enhancement on the license plate area and perform multiple rounds of OCR recognition, and perform weighted voting based on the confidence of each recognition result to output the final license plate number. This module sequentially applies enhancement strategy combinations such as global histogram equalization, CLAHE, Gaussian filtering, and Laplacian sharpening, performs up to 5 OCR recognitions at most, uses a weighted voting mechanism to fuse the recognition results, and automatically triggers boundary expansion and secondary recognition when the highest confidence is lower than 0.8.
[0088] The traffic statistics module is configured to assign a globally unique identifier to each vehicle using a tracking algorithm, judge the driving direction based on the direction consistency of the vehicle trajectory points, and count the traffic statistics in the corresponding direction when the vehicle completely crosses the detection area and the direction is stable. This module collects 5 consecutive frames of trajectory points, calculates Δx and Δy, uses a piecewise function to determine the driving direction, confirms the direction when the proportion of the main direction sign exceeds 0.85, and only updates the count value in the corresponding direction when the vehicle completely crosses the detection area and the direction is stable. The number of trajectory lists of different vehicle models is the traffic statistics result of the corresponding vehicle model.
[0089] The data storage and output module is configured to store the recognition results and generate multi-dimensional statistical reports. This module adopts a four-thread asynchronous architecture, and the threads exchange data through a bounded buffer queue. The Excel writer is optimized based on openpyxl, adopts a memory buffer and batch writing strategy, supports export in CSV, Excel, and JSON formats, and automatically generates traffic statistical tables summarized by hour, day, vehicle model, and direction.
[0090] In addition, the system provides a visual debugging interface, supporting real-time viewing of detection boxes, trajectory lines, and recognition results, facilitating on-site debugging and parameter optimization. The system has built-in anomaly handling and adaptive mechanisms; when a sudden change in trajectory or excessively high resource utilization is detected, the system automatically adjusts its processing strategy to ensure stable operation of core functions.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A multi-parameter intelligent recognition method for traffic flow based on video streams, characterized in that, Including the following steps: S1: Acquire the video stream and extract image frames from the video stream; S2: Use a deep learning model to detect vehicles in the image frame, output the vehicle's location information, vehicle type, and confidence level, and locate the license plate area of the vehicle. S3: Track the vehicle's movement trajectory. When the vehicle triggers a preset virtual trigger line, identify the license plate area and perform vehicle type analysis. The virtual trigger line is represented by the linear equation ax + by + c = 0, where a² + b² = 1. The trigger line position is adaptively adjusted according to the road geometry: xt = xstart + α·Wroad, yt = ystart + β·Hroad; In the formula, xt and yt are the x-coordinate and y-coordinate of the trigger line endpoint, respectively; xstart and ystart are the x-coordinate and y-coordinate of the trigger line start point, respectively; Wroad is the road width; Hroad is the road height; and α and β are proportionality coefficients. S4: Perform multi-strategy image enhancement on the license plate area and perform multi-round OCR recognition. Based on the confidence of each recognition result, perform weighted voting and output the final license plate number. S5: Use a tracking algorithm to assign a globally unique identifier to each vehicle, determine the driving direction based on the consistency of the vehicle trajectory points, and include the traffic flow statistics in the corresponding direction when the vehicle has completely crossed the detection area and the direction is stable. S6: Store the recognition results and generate multi-dimensional statistical reports including vehicle type, driving direction and time period.
2. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 1, characterized in that: The multi-strategy image enhancement in S4 includes a combination of at least two strategies from histogram equalization, adaptive contrast enhancement, multi-scale filtering, and edge enhancement.
3. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 2, characterized in that: S4 includes the following steps: S401: Perform OCR recognition on the same license plate area no more than a preset threshold number of times, using a different combination of image enhancement strategies each time; S402: Based on the confidence level of each recognition result, a weighted vote is performed to output the final license plate number. The calculation formula is as follows: rfinal=argmaxr∈{r1,r2,…,r n } ∑j=lncj·I(rj=r) Where cj is the confidence level of the j-th identification, and I(·) is the indicator function; S403: When the highest confidence level is lower than the preset confidence threshold, the license plate area boundary expansion and secondary recognition process is triggered.
4. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 3, characterized in that: S5 includes the following steps: S501: Uses a tracking algorithm to generate a globally unique track_id for each vehicle, predicts the position through Kalman filtering, and combines it with appearance features to perform data association; S502: Collect vehicle trajectory points {(xi, yi)} for at least 5 consecutive frames, and calculate the coordinate increments between adjacent frames: Δx = x' − x, Δy = y' − y S503: When the proportion of the main direction sign exceeds the threshold θ∈[0.8, 0.9], the driving direction is confirmed. The direction determination formula is: In the formula, D is the preset threshold; S504: When a vehicle completely traverses the detection area and its direction remains stable, it is included in the traffic flow statistics for the corresponding direction.
5. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 4, characterized in that: The tracking algorithm uses the DeepSORT algorithm, which combines Kalman filtering and appearance feature matching to assign a globally unique identifier to each vehicle and sets the trajectory retention time to cope with brief occlusions.
6. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 5, characterized in that: The trajectory tracking algorithm operates between frames in the deep learning detection interval and includes the following steps: Detect the Nth frame using a deep learning model, output the vehicle position, and create a trajectory list; In the subsequent M frames (M < 30), only the tracking algorithm is used to predict the vehicle center point, and no deep learning inference is performed; Every M frames, the deep learning model is reactivated for detection and matched with the tracking results: if the Euclidean distance of the center point is less than the threshold D, it is associated with the original trajectory; otherwise, a new trajectory is created. The number of trajectory lists for different vehicle models represents the traffic statistics for that vehicle model.
7. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 6, characterized in that: The deep learning model in S2 adopts the YOLO architecture, and its training process includes: S201: Randomly initialize model parameters by inputting sample images and label files into the model; S202: Divide each image into an S×S grid and calculate the grid in which the center of the bounding box is located; S203: Each grid predicts B bounding boxes (including center coordinates x, y, width and height w, h, confidence score) and C class probabilities; S204: The total error Eall = Ecoord + EIOU + Eclass is optimized iteratively using gradient descent until the error converges.
8. The intelligent multi-parameter traffic flow recognition method based on video stream according to claim 7, characterized in that: It also includes exception handling and adaptive mechanisms: When a vehicle's trajectory changes abruptly, its speed becomes abnormal, or its direction changes abruptly, it is automatically marked as a suspicious trajectory. Based on historical recognition accuracy, dynamically adjust the OCR confidence threshold, trajectory matching threshold, or trigger line position; Monitor system resource utilization and automatically implement a degradation strategy when it exceeds a preset threshold.
9. A multi-parameter intelligent traffic flow recognition system based on video streams, characterized in that, include: The video capture module is used to acquire video streams; The vehicle detection module is configured to use a deep learning model to detect vehicles in video frames and output vehicle location information and vehicle type. A license plate location module is configured to locate the license plate area of the vehicle. The trajectory tracking and triggering module is configured to track the vehicle's movement trajectory and trigger license plate recognition when the vehicle triggers a preset virtual trigger line; The license plate recognition module is configured to perform multi-strategy image enhancement on the license plate area, perform multi-round OCR recognition, perform weighted voting based on the confidence of each recognition result, and output the final license plate number. The traffic statistics module is configured to assign a globally unique identifier to each vehicle using a tracking algorithm, determine the driving direction based on the directional consistency of the vehicle trajectory points, and include the traffic statistics for the corresponding direction when the vehicle has completely crossed the detection area and the direction is stable. The data storage and output module is configured to store the recognition results and generate multi-dimensional statistical reports.