Vehicle flow statistics method, system, medium, equipment and product

Through the improved YOLOv8 algorithm and DeepSORT tracking algorithm, the problem of inaccurate traditional traffic flow statistics in complex traffic scenarios is solved, and efficient and accurate traffic flow monitoring is achieved.

CN120340269BActive Publication Date: 2025-10-03QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510811924.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-10-03
Estimated Expiration
2045-06-18

AI Technical Summary

Technical Problem

Traditional traffic flow statistics methods are inaccurate in high-traffic and multi-lane complex traffic scenarios, making it difficult to achieve accurate traffic flow monitoring.

Method used

Combining the improved YOLOv8 algorithm and DeepSORT tracking algorithm, the two-dimensional spatiotemporal signals of vehicles are obtained for preprocessing, the target detection network model is used for vehicle signal detection and tracking trajectory determination, and the Kalman filter and Hungarian algorithm are combined for vehicle matching and state prediction to achieve accurate traffic flow statistics.

Benefits of technology

It improves the efficiency of vehicle signal recognition and calculation, enhances the model's perception of spatial location information, ensures the accuracy and robustness of traffic flow statistics, and reduces the use of computing resources and the number of parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120340269B_ABST
    Figure CN120340269B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of traffic control and provides a method, system, medium, device, and product for counting vehicle flow. The method comprises obtaining and preprocessing the original two-dimensional space-time signal of a vehicle to obtain the two-dimensional space-time signal; detecting the two-dimensional space-time signal using a pretrained target detection network model to obtain a detection frame of the vehicle signal and its confidence; calculating and determining an initial tracking trajectory using the detection frame of the vehicle signal and its confidence; determining a tracked trajectory based on the similarity between the predicted position of the initial tracking trajectory and the detection frame; and determining a vehicle flow detection result based on the tracked trajectory. The present invention improves the YOLOv8 algorithm to reduce the number of parameters in computing resources and improve the detection accuracy of the two-dimensional space-time signal of vehicle flow. By combining Kalman filtering and the Hungarian algorithm, the method enables precise tracking of detected targets, ensuring the accuracy and robustness of vehicle flow statistics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of traffic control, and in particular relates to a vehicle flow statistics method, system, medium, equipment and product. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] Intelligent Transportation Systems (ITS) integrates advanced electronic, information, and sensor technologies into traffic management based on road infrastructure. Vehicle signal recognition is a key component of ITS. Accurate vehicle detection and tracking plays a crucial role in intelligent transportation systems. It not only provides data support for traffic monitoring, traffic situation estimation, and traffic incident analysis, but also offers services such as vehicle tracking, traffic incident analysis, and safe driving behavior prediction. Traditional detection methods can only discretely collect traffic parameters at traffic sections and are unable to collect vehicle information across time and space over long periods of time and distance. With the application of distributed acoustic sensing (DAS) in the transportation sector, this problem has been effectively addressed, achieving the goal of improving traffic safety.

[0004] Accurate vehicle flow statistics are crucial in modern traffic management and urban planning. Traditional methods for counting vehicle flow rely primarily on manual observation, loop detectors, or video surveillance systems, which have numerous limitations in practical application. For example, manual observation is time-consuming and error-prone; loop detectors are expensive to install and maintain, and are destructive to road structures; and while video surveillance systems can provide rich visual information, they are susceptible to factors such as lighting variations and vehicle obstruction in complex traffic scenarios. To overcome these limitations, distributed acoustic sensing (DAS) has emerged as an emerging traffic monitoring technology in recent years. By deploying fiber optic sensors along roads, DAS systems can monitor the acoustic signals generated by passing vehicles in real time, enabling non-invasive monitoring of traffic flow. However, while DAS systems can provide information on vehicle passing events, they struggle to directly count vehicle flow. This is especially true in complex traffic scenarios with high traffic volumes and multiple lanes. Inaccurate vehicle flow statistics can severely impact the implementation and planning of traffic management. Summary of the Invention

[0005] In order to solve the above problems, the present invention proposes a vehicle flow statistics method, system, medium, equipment and product. The present invention combines the improved YOLOv8 algorithm and DeepSORT tracking algorithm to effectively make up for the shortcomings of the DAS system and achieve accurate vehicle flow statistics.

[0006] According to some embodiments, a first solution of the present invention provides a vehicle flow statistics method, which adopts the following technical solutions:

[0007] A vehicle flow statistics method, comprising:

[0008] Obtain the original two-dimensional space-time signal of the vehicle and perform preprocessing to obtain a two-dimensional space-time signal;

[0009] Use the pre-trained target detection network model to detect the two-dimensional spatiotemporal signal and obtain the detection box of the vehicle signal and its confidence level;

[0010] The detection frame of the vehicle signal and its confidence level are used to calculate and determine the initial tracking trajectory. The tracked trajectory is determined based on the similarity between the predicted position of the initial tracking trajectory and the detection frame.

[0011] Determine the traffic flow detection results of the two-dimensional space-time signal based on the tracked trajectory.

[0012] Furthermore, the target detection network model uses the YOLOv8 model as the basic model, wherein,

[0013] According to the flow of data processing, the backbone network includes the first windmill convolution module, the second windmill convolution module, the first APC2fCoord module, the first CBS module, the second APC2fCoord module, the second CBS module, the first C2f module, the third CBS module, the second C2f module and the first DGSSPPF module;

[0014] According to the flow of data processing, the detection head part includes a first upsampling module, a first splicing module, a first VoVGSCSP module, a second upsampling module, a second splicing module, a second VoVGSCSP module, a first group convolution module, a third splicing module, a third VoVGSCSP module, a second group convolution module, a fourth splicing module, a fourth VoVGSCSP module and three connected detection head modules.

[0015] Furthermore, the APC2fCoord module includes a third windmill convolution module, a segmentation module, a first attention bottleneck module, a second attention bottleneck module, a fifth splicing module, a fourth windmill convolution module, a coordinate attention module, and a jump connection module, which are connected in sequence;

[0016] The fifth concatenation module concatenates the output features of the segmentation module, the first attention bottleneck module, and the second attention bottleneck module, and then merges the output features of the first attention bottleneck module with the output features of the first attention bottleneck module and inputs them into the fourth windmill convolution module.

[0017] The skip connection module connects the input features of the APC2fCoord module and the output features of the coordinate attention module to obtain the output features of the APC2fCoord module.

[0018] Furthermore, the DGSSPPF module includes a first depth-separable convolution module, a sixth splicing module, a second depth-separable convolution module, a third grouped convolution module, a seventh splicing module, and a fourth grouped convolution module, which are connected in sequence;

[0019] The first depthwise separable convolutional module is further connected to a first maximum pooling layer and a second maximum pooling layer, respectively, wherein the second maximum pooling layer is further connected to a third maximum pooling layer;

[0020] The sixth splicing module splices the output features of the three maximum pooling layers with the output features of the first depth-wise separable convolution module.

[0021] Furthermore, the detection frame of the vehicle signal and its confidence level are used to calculate and determine the initial tracking trajectory, and the tracked trajectory is determined based on the similarity between the predicted position of the initial tracking trajectory and the detection frame, specifically:

[0022] Based on the detection frame of the vehicle signal and the vehicle's motion information and appearance features, a unique ID is assigned to each target vehicle and an initial tracking trajectory is generated. For detection frames that appear in two consecutive frames, the initial tracking trajectory of the target vehicle is determined by combining the position information of the detection frame in the first frame;

[0023] Use the Kalman filter to predict the state of each initial tracking trajectory to obtain the predicted position of the target in the next frame. Use the Hungarian algorithm to perform IOU matching between the predicted position and the detection box set of all vehicle signals to obtain a matching result. If the match is successful, the initial tracking trajectory of the target vehicle corresponding to the predicted position is updated. If the match fails, the initial tracking trajectory of the target vehicle corresponding to the predicted position is marked as an unmatched trajectory.

[0024] The unmatched track is matched with the set of detection boxes whose confidence is lower than the set threshold by IOU. If the match is successful, the unmatched track is updated. Otherwise, the unmatched track is marked as a missing track. The missing track matching status is continuously tracked within a preset number of frames. If the re-match is successful within the preset number of frames, the missing track is retained. If the match is still not successful within the preset number of frames, the target vehicle corresponding to the missing track is considered lost.

[0025] The tracked trajectory is determined based on the above matching results.

[0026] Furthermore, the vehicle flow detection result of the two-dimensional space-time signal is determined based on the tracked trajectory, specifically:

[0027] Count the unique IDs of all tracked target vehicles in each frame signal;

[0028] By accumulating the number of unique IDs of all tracked target vehicles, the total traffic volume in a certain period of time is obtained;

[0029] The total traffic volume is divided into hours according to the timestamp information of each frame signal;

[0030] For each hour, the total number of unique IDs in all frame signals within that hour is counted to obtain the hourly traffic flow.

[0031] According to some embodiments, a second solution of the present invention provides a vehicle flow statistics system, which adopts the following technical solutions:

[0032] A vehicle flow statistics system, comprising:

[0033] a signal processing module configured to obtain an original two-dimensional space-time signal of the vehicle and perform preprocessing to obtain a two-dimensional space-time signal;

[0034] The signal detection module is configured to detect the two-dimensional spatiotemporal signal using a pre-trained target detection network model to obtain a detection box of the vehicle signal and its confidence level;

[0035] a tracking trajectory determination module configured to calculate and determine an initial tracking trajectory using a detection frame of the vehicle signal and its confidence score, and to determine a tracked trajectory based on a similarity between a predicted position of the initial tracking trajectory and the detection frame;

[0036] The vehicle flow determination module is configured to determine a vehicle flow detection result of the two-dimensional space-time signal based on the tracked trajectory.

[0037] According to some embodiments, a third aspect of the present invention provides a computer-readable storage medium.

[0038] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a vehicle flow statistics method as described in the first solution above.

[0039] According to some embodiments, a fourth aspect of the present invention provides a computer device.

[0040] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of a vehicle flow statistics method as described in the first solution are implemented.

[0041] According to some embodiments, a fifth aspect of the present invention provides a computer program product or computer program.

[0042] The present invention provides a computer program product or computer program, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the vehicle flow counting method described in the first embodiment.

[0043] Compared with the prior art, the present invention has the following beneficial effects:

[0044] The improved YOLOv8 model structure used in the present invention reduces the use of computing resources and the number of parameters by improving the convolution module, C2f module and SPPF module, has better running speed and real-time performance, and improves detection precision and accuracy. This improvement performs relatively well in understanding the characteristics of two-dimensional space-time graphs and identifying vehicle position information, enabling the model to more accurately locate and identify vehicle signals, further improving the efficiency of vehicle signal information recognition and calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0046] Figure 1 This is a flow chart of a vehicle flow statistics method according to an embodiment of the present invention;

[0047] Figure 2 A schematic diagram of the connection relationship of the traffic monitoring signal acquisition system in an embodiment of the present invention;

[0048] Figure 3 1 is a structural diagram of an existing YOLOv8 network described in an embodiment of the present invention;

[0049] Figure 4 : This is a structural diagram of the improved YOLOv8 network described in an embodiment of the present invention;

[0050] Figure 5 : This is a structural diagram of the improved PinwheelConv module described in an embodiment of the present invention;

[0051] Figure 6 2 is a structural diagram of the improved APC2fCoord module according to an embodiment of the present invention;

[0052] Figure 7 This is a structural diagram of the improved DGSSPPF module according to an embodiment of the present invention;

[0053] Figure 8 Schematic diagram of the structure of a vehicle flow statistics system in an embodiment of the present invention. DETAILED DESCRIPTION

[0054] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0055] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.

[0056] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0057] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.

[0058] Example 1

[0059] like Figure 1 and Figure 8 As shown, this embodiment provides a method for counting vehicle flow. This embodiment uses the method applied to a server as an example. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal, a server, and a server, and is implemented through the interaction between the terminal and the server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network servers, cloud communications, middleware services, domain name services, security services CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in this application. In this embodiment, the method includes the following steps:

[0060] Step S1: obtaining the original two-dimensional space-time signal of the vehicle and performing preprocessing to obtain a two-dimensional space-time signal;

[0061] Step S2: Use the pre-trained target detection network model to detect the two-dimensional spatiotemporal signal to obtain the detection box of the vehicle signal and its confidence;

[0062] Step S3: Calculate and determine the initial tracking trajectory using the detection frame of the vehicle signal and its confidence score, and determine the tracked trajectory based on the similarity between the predicted position of the initial tracking trajectory and the detection frame;

[0063] Step S4: Determine the vehicle flow detection result of the two-dimensional space-time signal according to the tracked trajectory.

[0064] In step S1, the original two-dimensional space-time signal of the vehicle is obtained and preprocessed to obtain a two-dimensional space-time signal, which specifically includes:

[0065] Step S101: Using a distributed acoustic sensing system (DAS) and signal acquisition optical fibers to build a traffic monitoring signal acquisition system for collecting original two-dimensional spatiotemporal signals of vehicles;

[0066] like Figure 2 As shown, the traffic monitoring signal acquisition system includes a distributed acoustic wave sensing system based on a phase-sensitive optical time-domain reflectometer and a signal acquisition optical fiber. The distributed acoustic wave sensing system based on the phase-sensitive optical time-domain reflectometer includes a narrow linewidth laser, an acousto-optic modulator, an erbium-doped fiber amplifier, a circulator, a photodetector, a data acquisition card, and a signal processing host. The narrow linewidth laser, the acousto-optic modulator, the erbium-doped fiber amplifier, and the photodetector are all connected in sequence through a sensing optical fiber. The circulator is connected to the optical fiber to be tested. The optical fiber to be tested is laid in the central isolation zone of the highway. The system collects the spatiotemporal two-dimensional vibration signals generated by vehicles passing by. The system can monitor for a long time and a long distance, and sense the phase and amplitude changes of each point on the optical fiber in a distributed manner. The system has the advantages of low laying cost, good environmental adaptability, anti-electromagnetic interference, and high spatial resolution.

[0067] Step S102: The traffic monitoring signal collection system collects and stores the acoustic vibration signal when the vehicle passes through the sensing optical fiber, i.e., the original two-dimensional space-time signal;

[0068] Step S103: performing data noise reduction processing (signal denoising) on ​​the original two-dimensional spatiotemporal signal to obtain a data matrix, then performing a difference method on the data matrix, and normalizing the differenced data matrix blocks to obtain a normalized data matrix;

[0069] Step S104: During the training process, the differenced data matrix blocks need to be labeled separately, and then the labels are stored in a txt format file. The data matrix blocks and their corresponding vehicle labels together constitute a two-dimensional space-time signal dataset. The two-dimensional space-time signal dataset is divided into a training set and a validation set, and the training set is used to train the target detection network model (improved YOLOv8 model).

[0070] In step S2, the target detection network model uses the YOLOv8 model as the basic model, where:

[0071] According to the flow of data processing, the backbone network includes the first windmill convolution module, the second windmill convolution module, the first APC2fCoord module, the first CBS module, the second APC2fCoord module, the second CBS module, the first C2f module, the third CBS module, the second C2f module and the first DGSSPPF module;

[0072] According to the flow of data processing, the detection head part includes a first upsampling module, a first splicing module, a first VoVGSCSP module, a second upsampling module, a second splicing module, a second VoVGSCSP module, a first group convolution module, a third splicing module, a third VoVGSCSP module, a second group convolution module, a fourth splicing module, a fourth VoVGSCSP module and three connected detection head modules.

[0073] like Figure 3 and Figure 4 As shown in the figure, the improved YOLOv8 model of the present invention mainly includes an improved Backbone part (backbone network) and an improved Head part (detection head):

[0074] First, the improved Backbone part mainly includes the first PinwheelConv module (first pinwheel convolution module), the second PinwheelConv module (second pinwheel convolution module), the first APC2fCoord module, the first CBS module, the second APC2fCoord module, the second CBS module, the first C2f module, the third CBS module, the second C2f module and the first DGSSPPF module. The role of the Backbone part is to extract key features from the input data and gradually convert the input data into high-level feature representation, providing a basis for subsequent processing;

[0075] The improved Head part mainly includes the first Upsample module (first upsampling module), the first Concat module (first splicing module), the first VoVGSCSP module, the second Upsample module (second upsampling module), the second Concat module (second splicing module), the second VoVGSCSP module, the first group convolution module (first GSConv module), the third Concat module (third splicing module), the third VoVGSCSP module, the second group convolution module (second GSConv module), the fourth Concat module (fourth splicing module), the fourth VoVGSCSP module and three connected detection head modules. The three detection heads are used to detect large, medium and small objects respectively, to achieve accurate detection of targets of different scales. The role of the Head part is to convert the high-level features of the model into the final prediction results.

[0076] like Figure 5 As shown in the figure, the CoordAttention mechanism and skip connection are added to the PinwheelConv module. First, the input feature map passes through four padded convolution branches. Each padded convolution branch contains a padding layer and a convolution layer. The four different padding layers pad the input feature map in different directions. After the padded feature map passes through the convolution layer, the horizontal and vertical feature maps are processed respectively. Then, the output feature maps of the four padded convolution branches are spliced ​​in the channel dimension using the concat layer (splicing layer). The fused feature map is enhanced on the vehicle signal position information through the CoordAttention mechanism. Finally, the feature map after attention processing is convolved with the input feature map for skip connection (Skip Connection) to obtain the final output feature.

[0077] CoordAttention, a coordinate attention mechanism, embeds position information into the attention mechanism by generating a direction-aware and position-sensitive attention map. This improves the perception of spatial position information, enhances the model's understanding of spatial structure, and enhances the feature representation of different position information. Skip connections directly transmit the original input information to the output, ensuring that the input information is not lost in complex convolution operations. The PinwheelConv module significantly expands the receptive field through efficient convolution kernel design and grouped convolution technology, while introducing only a very small number of additional parameters. This design not only improves the efficiency of feature extraction, but also enhances the model's ability to detect small objects.

[0078] Using the VoVGSCSP module, it can significantly reduce the computational overhead while maintaining accuracy, providing a new solution for fast target recognition of traffic vehicles; it is composed of VoV and GSCSP, which is a one-time aggregation module that replaces the ordinary bottleneck module to speed up processing.

[0079] like Figure 6 As shown, the APC2fCoord module includes a third windmill convolution module, a segmentation module, a first attention bottleneck module, a second attention bottleneck module, a fifth splicing module, a fourth windmill convolution module, a coordinate attention module and a jump connection module connected in sequence;

[0080] The fifth concatenation module concatenates the output features of the segmentation module, the first attention bottleneck module, and the second attention bottleneck module, and then merges the output features of the first attention bottleneck module with the output features of the first attention bottleneck module and inputs them into the fourth windmill convolution module.

[0081] The skip connection module connects the input features of the APC2fCoord module and the output features of the coordinate attention module to obtain the output features of the APC2fCoord module.

[0082] In the backbone network, the APC2f module is replaced with the APBottleneck module (attention bottleneck module) in the original C2f module to construct the APC2f module. By introducing a special padding strategy, multi-branch structure, and group convolution, APC2f makes the model more effective in tasks such as small object detection. The CoordAttention mechanism and skip connection module are added to the APC2f module to form the final APC2fCoord module. This module achieves efficient information extraction and fusion, more comprehensively capturing the directional information of the input feature map, alleviating the gradient vanishing problem, and enhancing the model's expressiveness. The APC2fCoord module efficiently fuses multi-directional and residual features through multi-layer convolution and residual modules. The module offers multiple configuration options, including the use of residual modules, residual connections, APC2fCoord modules, and the number of hidden layer channels, making it suitable for a variety of task scenarios. These advantages make the APC2fCoord module outstanding for complex tasks and significantly improve the performance and robustness of the model.

[0083] like Figure 7 As shown, the DGSSPPF module includes a first depth-separable convolution module, a sixth splicing module, a second depth-separable convolution module, a third grouped convolution module, a seventh splicing module and a fourth grouped convolution module, which are connected in sequence;

[0084] The first depthwise separable convolutional module is further connected to a first maximum pooling layer and a second maximum pooling layer, respectively, wherein the second maximum pooling layer is further connected to a third maximum pooling layer;

[0085] The sixth splicing module splices the output features of the three maximum pooling layers with the output features of the first depth-wise separable convolution module.

[0086] First, two layers of convolution were added to the module, replacing the ordinary 1×1 convolution with lightweight GSConv (grouped convolution) and DWConv (depthwise separable convolution), respectively. Then, a new pooling layer was added after the maximum pooling layer, with different convolution kernel sizes. This improvement can capture features at different scales and improve the generalization ability of the model. The maximum pooling layers in the traditional SPPF module were improved to be used in parallel, which can increase the diversity of features. Finally, all feature maps were spliced ​​in the channel dimension. The advantage of this is that it can enhance multi-scale information fusion while reducing the amount of computation, making it more suitable for identifying vehicle signal information in two-dimensional space-time signals and improving the model inference speed.

[0087] Among them, the loss function Total Loss of the target detection network model is the sum of the bounding box loss (Box Loss), classification loss (Cls Loss), and category loss (DFL Loss), as shown in formula (1);

[0088] Total Loss=w1*Box Loss+w2*Cls Loss+w3*DFL Loss(1);

[0089] Wherein, w1, w2 and w3 are weight parameters. In the present invention, w1 is 7.5, w2 is 0.5, and w3 is 1.5;

[0090] The specific parameter configuration used in the training of this invention is as follows: the initial learning rate is set to 1e-3, the penalty decay is set to 1e-4, the IOU threshold is set to 0.7, the momentum is set to 0.9, the weight decay is set to 0.005, and NMS and warmup are enabled. The number of rounds is 3, and the optimizer used is AdamW;

[0091] In order to verify the classification and positioning effects of the vehicle flow statistics method and system based on the improved YOLOv8 algorithm described in this application, the trained improved YOLOv8 model method was verified using a test set. In order to ensure the fairness of the comparison results, the comparative experiments all adopted the same training data set and training process, and used Precision, Recall, mAP50, mAP50-95 and GFLOPS to evaluate the target detection effect of the target detection network model. Compared with the baseline model YOLOv8 model, the improved YOLOv8 model described in the present invention has an average mAP50 improvement of 5.53%, an average mAP50-95 improvement of 4.24%, an accuracy improvement of 1.33%, and a recall rate improvement of 2.85%, while minimizing the increase in model overhead. In addition, each image only requires 1.8ms of preprocessing time.

[0092] Precision refers to the ratio of the number of samples correctly identified as positive to the total number of samples identified as positive, that is, the ratio of samples predicted by the model to samples that are actually positive; Recall refers to the ratio of the number of samples correctly identified as positive to the total number of samples that are actually positive, which represents the model's ability to identify all positive samples; mAP50 represents the average of the mean average precision over all categories when the recall rate is 50%; mAP50-95 represents the average of the mean average precision over all categories when the recall rate ranges from 0.5 to 0.95; GFLOPS represents the speed of model inference and the computational overhead;

[0093] The specific formula of Precision is expressed as:

[0094] Precision = (2);

[0095] The specific formula of Recall is expressed as:

[0096] Recall = (3);

[0097] mAP 50 The specific formula of average precision is expressed as:

[0098] (4);

[0099] (5);

[0100] mAP 50-95 The specific formula of average precision is expressed as:

[0101] (6);

[0102] in, TP Represents a real example, FP represents a false positive, FN represents a false negative, C represents the total number of categories, AP i Representative i The average precision of a category is calculated based on the precision and recall of all detection results in that category. The AP value is the average precision of all category point sets. R n It is n The recall threshold, P n It is n The precision corresponding to the recall threshold, N is the total number of recall thresholds.

[0103] In step S3, the detection frame of the vehicle signal and its confidence level are used to calculate and determine the initial tracking trajectory, and the tracked trajectory is determined based on the similarity between the predicted position of the initial tracking trajectory and the detection frame, specifically:

[0104] Based on the detection frame of the vehicle signal and the vehicle's motion information and appearance features, a unique ID is assigned to each target vehicle and an initial tracking trajectory is generated. For detection frames that appear in two consecutive frames, the initial tracking trajectory of the target vehicle is determined by combining the position information of the detection frame in the first frame;

[0105] Specifically, the improved YOLOv8 detection algorithm is used to perform target detection on the first frame and multiple subsequent frames of the vehicle signal, obtaining the detection box and confidence level in each signal frame, and converting the detection box from xyxy format to xywh format for subsequent processing.

[0106] The detection box and features are passed to the DeepSORT tracker. The DeepSORT tracker assigns a unique ID to each target vehicle based on the target's motion information and appearance features and generates an initial tracking trajectory. For detection boxes that appear in two consecutive frames, the initial tracking trajectory of the target vehicle is determined by combining the position information of the detection box in the first frame.

[0107] Use the Kalman filter to predict the state of each initial tracking trajectory and obtain the predicted position of the target in the next frame;

[0108] Use the Hungarian algorithm to match the predicted position with the detection box set of all vehicle signals to obtain a matching result. If the match is successful, the initial tracking trajectory of the target vehicle corresponding to the predicted position is updated. If the match fails, the initial tracking trajectory of the target vehicle corresponding to the predicted position is marked as an unmatched trajectory.

[0109] Perform IOU matching on the unmatched track with the set of detection boxes whose confidence is lower than the set threshold. If the match is successful, the unmatched tracking track is updated. Otherwise, the unmatched track is marked as a missing track.

[0110] Specifically, the IOU value between the unmatched track and the detection box set with a confidence level lower than a set threshold is used to determine whether the match is successful. When the IOU value is higher than the set threshold, it means that the match is successful; otherwise, the match fails.

[0111] The missing track matching status is continuously tracked within a preset number of frames. If the matching is successful within the preset number of frames, the missing track is retained. If the matching is still unsuccessful within the preset number of frames, the target vehicle corresponding to the missing track is considered lost.

[0112] The tracked trajectory is determined based on the above matching results.

[0113] Specifically, after the vehicle signal detection is completed, the detection box and confidence information of the target vehicle signal are output. Based on the detected detection box of the target vehicle signal, the DeepSORT tracking algorithm combines Kalman filtering, Hungarian algorithm and cascade matching to achieve continuous tracking of the vehicle signal in the video frame.

[0114] The Kalman filter is used to predict the future position of the target and update the target state in combination with the new detection results. The target state is adjusted by minimizing the error between the predicted position and the actual detection position.

[0115] The Hungarian algorithm is used to solve the target matching problem and solve the problem of how to optimally match the detected target with the existing trajectory. It will establish a cost matrix. The elements in the matrix represent the distance between the detected target and the trajectory. The distance is a combination of the appearance feature distance and the motion distance. By minimizing the total cost of the cost matrix, it ensures that each detected target can be correctly matched to a trajectory.

[0116] The DeepSORT tracking algorithm used in this embodiment can accurately track the detected target by combining Kalman filtering and the Hungarian algorithm, and can maintain tracking continuity even in complex situations, thereby ensuring the accuracy and robustness of traffic flow statistics.

[0117] In step S4, the vehicle flow detection result of the two-dimensional space-time signal is determined based on the tracked trajectory, specifically:

[0118] Count the unique IDs of all tracked target vehicles in each frame signal;

[0119] By accumulating the number of unique IDs of all tracked target vehicles, the total traffic volume in a certain period of time is obtained;

[0120] The total traffic volume is divided into hours according to the timestamp information of each frame signal;

[0121] For each hour, the total number of unique IDs in all frame signals within that hour is counted to obtain the hourly traffic flow.

[0122] In general, by optimizing the parameters and state prediction mechanism of the Kalman filter, the improved DeepSORT algorithm can more accurately predict the position of the target in the next frame, effectively reducing tracking interruptions; in the Hungarian algorithm, by optimizing the intersection-over-union calculation and the construction of the relational loss matrix in the matching process, the matching accuracy and efficiency are improved; combined with the pre-trained Re-ID model, the improved DeepSORT can maintain the continuity of the target identity through feature matching when the target appearance features change. The unique ID assigned to each target ensures the uniqueness and continuity of the target identity, making the traffic flow statistics more accurate. A multi-cascade matching mechanism is set for low-confidence targets. The unmatched trajectory signals can be further matched with the low-confidence target box to ensure the continuity of tracking even when the target detection is inaccurate. Finally, the processing of the missing trajectory signal is set to ensure that the target can resume tracking after a short loss. By dynamically adjusting the preset number of frames, it can better adapt to different application scenarios.

[0123] Example 2

[0124] like Figure 8 As shown, this embodiment provides a vehicle flow statistics system, including:

[0125] a signal processing module configured to obtain an original two-dimensional space-time signal of the vehicle and perform preprocessing to obtain a two-dimensional space-time signal;

[0126] The signal detection module is configured to detect the two-dimensional spatiotemporal signal using a pre-trained target detection network model to obtain a detection box of the vehicle signal and its confidence level;

[0127] a tracking trajectory determination module configured to calculate and determine an initial tracking trajectory using a detection frame of the vehicle signal and its confidence score, and to determine a tracked trajectory based on a similarity between a predicted position of the initial tracking trajectory and the detection frame;

[0128] The vehicle flow determination module is configured to determine a vehicle flow detection result of the two-dimensional space-time signal based on the tracked trajectory.

[0129] The examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiment 1. It should be noted that the above modules as part of the system can be executed in a computer system such as a set of computer executable instructions.

[0130] The description of each embodiment in the above embodiments has different emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0131] The proposed system can be implemented in other ways. For example, the system embodiment described above is merely illustrative. For example, the above module division is only a logical function division. In actual implementation, other division methods may be used. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not implemented.

[0132] Example 3

[0133] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the steps of the vehicle flow statistics method described in the first embodiment are implemented.

[0134] Example 4

[0135] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the vehicle flow statistics method described in the first embodiment are implemented.

[0136] Example 5

[0137] This embodiment provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the vehicle flow counting method described in the first embodiment.

[0138] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage) containing computer-usable program code.

[0139] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0140] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0142] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0143] Although the above describes the specific embodiments of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without any creative work are still within the scope of protection of the present invention.

Claims

1. A vehicle flow statistics method, characterized in that: include: Obtain the original two-dimensional space-time signal of the vehicle and perform preprocessing to obtain a two-dimensional space-time signal; Use the pre-trained target detection network model to detect the two-dimensional spatiotemporal signal and obtain the detection box of the vehicle signal and its confidence level; The target detection network model uses the YOLOv8 model as the basic model, where: According to the flow of data processing, the backbone network includes the first windmill convolution module, the second windmill convolution module, the first APC2fCoord module, the first CBS module, the second APC2fCoord module, the second CBS module, the first C2f module, the third CBS module, the second C2f module and the first DGSSPPF module; The APC2fCoord module includes a third windmill convolution module, a segmentation module, a first attention bottleneck module, a second attention bottleneck module, a fifth splicing module, a fourth windmill convolution module, a coordinate attention module, and a jump connection module connected in sequence; The fifth concatenation module concatenates the output features of the segmentation module, the first attention bottleneck module, and the second attention bottleneck module, and then merges the output features of the first attention bottleneck module with the output features of the first attention bottleneck module and inputs them into the fourth windmill convolution module. The skip connection module connects the input features of the APC2fCoord module and the output features of the coordinate attention module to obtain the output features of the APC2fCoord module; According to the flow of data processing, the detection head part includes a first upsampling module, a first splicing module, a first VoVGSCSP module, a second upsampling module, a second splicing module, a second VoVGSCSP module, a first group convolution module, a third splicing module, a third VoVGSCSP module, a second group convolution module, a fourth splicing module, a fourth VoVGSCSP module and three connected detection head modules; The detection frame of the vehicle signal and its confidence level are used to calculate and determine the initial tracking trajectory. The tracked trajectory is determined based on the similarity between the predicted position of the initial tracking trajectory and the detection frame. Determine the traffic flow detection results of the two-dimensional space-time signal based on the tracked trajectory.

2. A vehicle flow statistics method according to claim 1, characterized in that: The DGSSPPF module includes a first depth-separable convolution module, a sixth splicing module, a second depth-separable convolution module, a third grouped convolution module, a seventh splicing module and a fourth grouped convolution module, which are connected in sequence; The first depthwise separable convolutional module is further connected to a first maximum pooling layer and a second maximum pooling layer, respectively, wherein the second maximum pooling layer is further connected to a third maximum pooling layer; The sixth splicing module splices the output features of the three maximum pooling layers with the output features of the first depth-wise separable convolution module.

3. The vehicle flow statistics method according to claim 1, wherein: The detection frame of the vehicle signal and its confidence level are used to calculate and determine the initial tracking trajectory, and the tracked trajectory is determined based on the similarity between the predicted position of the initial tracking trajectory and the detection frame. Specifically, Based on the detection frame of the vehicle signal and the vehicle's motion information and appearance features, a unique ID is assigned to each target vehicle and an initial tracking trajectory is generated. For detection frames that appear in two consecutive frames, the initial tracking trajectory of the target vehicle is determined by combining the position information of the detection frame in the first frame; Use the Kalman filter to predict the state of each initial tracking trajectory to obtain the predicted position of the target in the next frame. Use the Hungarian algorithm to perform IOU matching between the predicted position and the detection box set of all vehicle signals to obtain a matching result. If the match is successful, the initial tracking trajectory of the target vehicle corresponding to the predicted position is updated. If the match fails, the initial tracking trajectory of the target vehicle corresponding to the predicted position is marked as an unmatched trajectory. The unmatched track is matched with the set of detection boxes whose confidence is lower than the set threshold by IOU. If the match is successful, the unmatched track is updated. Otherwise, the unmatched track is marked as a missing track. The missing track matching status is continuously tracked within a preset number of frames. If the re-match is successful within the preset number of frames, the missing track is retained. If the match is still not successful within the preset number of frames, the target vehicle corresponding to the missing track is considered lost. The tracked trajectory is determined based on the above matching results.

4. A vehicle flow statistics method according to claim 1, characterized in that: The traffic flow detection results of the two-dimensional space-time signal are determined based on the tracked trajectory, specifically: Count the unique IDs of all tracked target vehicles in each frame signal; By accumulating the number of unique IDs of all tracked target vehicles, the total traffic volume in a certain period of time is obtained; The total traffic volume is divided into hours according to the timestamp information of each frame signal; For each hour, the total number of unique IDs in all frame signals within that hour is counted to obtain the hourly traffic flow.

5. A vehicle flow statistics system, characterized in that: include: a signal processing module configured to obtain an original two-dimensional space-time signal of the vehicle and perform preprocessing to obtain a two-dimensional space-time signal; The signal detection module is configured to detect the two-dimensional spatiotemporal signal using a pre-trained target detection network model to obtain a detection box of the vehicle signal and its confidence level; The target detection network model uses the YOLOv8 model as the basic model, where: According to the flow of data processing, the backbone network includes the first windmill convolution module, the second windmill convolution module, the first APC2fCoord module, the first CBS module, the second APC2fCoord module, the second CBS module, the first C2f module, the third CBS module, the second C2f module and the first DGSSPPF module; The APC2fCoord module includes a third windmill convolution module, a segmentation module, a first attention bottleneck module, a second attention bottleneck module, a fifth splicing module, a fourth windmill convolution module, a coordinate attention module, and a jump connection module connected in sequence; The fifth concatenation module concatenates the output features of the segmentation module, the first attention bottleneck module, and the second attention bottleneck module, and then merges the output features of the first attention bottleneck module with the output features of the first attention bottleneck module and inputs them into the fourth windmill convolution module. The skip connection module connects the input features of the APC2fCoord module and the output features of the coordinate attention module to obtain the output features of the APC2fCoord module; According to the flow of data processing, the detection head part includes a first upsampling module, a first splicing module, a first VoVGSCSP module, a second upsampling module, a second splicing module, a second VoVGSCSP module, a first group convolution module, a third splicing module, a third VoVGSCSP module, a second group convolution module, a fourth splicing module, a fourth VoVGSCSP module and three connected detection head modules; a tracking trajectory determination module configured to calculate and determine an initial tracking trajectory using a detection frame of the vehicle signal and its confidence score, and to determine a tracked trajectory based on a similarity between a predicted position of the initial tracking trajectory and the detection frame; The vehicle flow determination module is configured to determine a vehicle flow detection result of the two-dimensional space-time signal based on the tracked trajectory.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the vehicle flow statistics method according to any one of claims 1 to 4 are implemented.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the vehicle flow statistics method according to any one of claims 1 to 4 are implemented.

8. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the steps in the vehicle flow statistics method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Traffic flow statistical method based on YOLOv8 algorithm and related equipment

    CN119049305A