A vehicle flow statistics method and related equipment based on YOLOv8 algorithm

By applying the YOLOV8 algorithm and the improved bytetrack tracking algorithm in the traffic statistics, the problem of low statistics in the existing technology in the existing technology in the existing technologies has achieved lower efficiency and accurate traffic statistics.

CN119049305BActive Publication Date: 2025-01-28NANJING INST OF INTELLIGENT TECH INST OF MICROELECTRONICS OF THE CHINESE ACAD OF
View PDF 2 Cites -1 Cited by

Patent Information

Application Number
CN202411525624.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-01-28
Estimated Expiration
2044-10-30

Smart Images

  • Figure CN119049305B_ABST
    Figure CN119049305B_ABST
Patent Text Reader

Abstract

The present application discloses a vehicle flow statistics method based on the YOLOv8 algorithm and related equipment, which relate to the field of traffic control technology. The method comprises: acquiring monitoring video data, wherein the monitoring video data comprises a vehicle to-be-detected area and an area where vehicles must pass through and leave; detecting vehicles in the vehicle to-be-detected area according to the YOLOv8 algorithm to obtain a detection result; calculating the detection result according to an improved ByteTrack tracking algorithm to obtain a tracked trajectory; and obtaining a vehicle flow statistics result in the vehicle to-be-detected area according to the area where vehicles must pass through and leave and the tracked trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of traffic control technology, and in particular to a vehicle flow statistics method based on the YOLOv8 algorithm and related equipment. Background Art

[0002] At present, with the rapid development of intelligent transportation systems (ITS), accurate detection and tracking of vehicles is a key technology for traffic monitoring, flow analysis and safety warning. Currently, the commonly used flow analysis methods include traffic flow statistics based on virtual areas and vehicle tracking. The traffic flow method based on virtual areas is simple to implement and fast, but it is easily affected by external environments such as lighting and has low statistical accuracy. The traffic flow statistics method based on vehicle tracking matches the vehicles in each frame image in the traffic flow video to capture the movement trajectory and state of each vehicle, and counts vehicles based on the differences in vehicle trajectory and state.

[0003] However, in order to simulate the real traffic flow or to analyze the traffic flow at a certain intersection, trunk road or area, it is necessary not only to count the traffic flow on the road, but also to count the traffic flow of lane turns, so as to determine the turning ratio of the traffic flow on the road and obtain the real traffic flow diversion. At present, there is no appropriate method to solve the above problems. Therefore, it is necessary to propose a traffic flow statistics method based on the YOLOv8 algorithm to at least solve some of the above problems. Summary of the invention

[0004] A series of simplified concepts are introduced in the Summary of the Invention section, which will be further described in detail in the Detailed Description of the Invention section. The Summary of the Invention section of this application does not mean to attempt to define the key features and essential technical features of the claimed technical solution, nor does it mean to attempt to determine the scope of protection of the claimed technical solution.

[0005] In a first aspect, an embodiment of the present application provides a vehicle flow statistics method based on the YOLOv8 algorithm, the method comprising:

[0006] Acquire surveillance video data, wherein the surveillance video data includes a vehicle to be detected area and an area that the vehicle must pass through and leave;

[0007] Detecting the vehicle in the vehicle to be detected area according to the YOLOv8 algorithm to obtain a detection result;

[0008] Calculating the detection result according to the improved ByteTrack tracking algorithm to obtain a tracked trajectory;

[0009] The traffic flow statistics result of the vehicle in the area to be detected is obtained according to the area that the vehicle must pass through and the tracked trajectory.

[0010] In one embodiment of the present invention, the step of acquiring surveillance video data includes:

[0011] Obtaining initial surveillance video data;

[0012] Counting the number of lane turns in the initial monitoring video data to obtain a statistical result;

[0013] The statistical results are divided according to lane turns to obtain a vehicle to-be-detected area and a vehicle must-pass-through area.

[0014] In one embodiment of the present invention, the step of calculating the detection result according to the improved ByteTrack tracking algorithm to obtain the tracked trajectory includes:

[0015] Obtain a first frame detection frame and multiple subsequent frame detection frames of the detection result;

[0016] Screening the plurality of subsequent frame detection frames according to a non-maximum suppression algorithm to obtain a detection frame set, wherein the detection frame set includes a high-confidence detection frame set and a low-confidence detection frame set;

[0017] In the case where the subsequent frame detection frame appears in two frames, constructing a tracking trajectory according to the subsequent frame detection frame in which the two frames appear and the first frame detection frame;

[0018] Predicting the tracking trajectory according to a Kalman filter algorithm to obtain a predicted position;

[0019] Matching the predicted position with the set of high-confidence detection frames to obtain a first tracking trajectory and an unmatched trajectory;

[0020] Matching the unmatched track with the low confidence detection frame set to obtain a second tracking track and a missing track;

[0021] Determine whether the missing track is successfully matched within a preset number of frames, and obtain a determination result;

[0022] The tracked trajectory is obtained according to the judgment result.

[0023] In one embodiment of the present invention, the step of screening the plurality of subsequent frame detection frames according to the non-maximum suppression algorithm to obtain a detection frame set includes:

[0024] Calculating a plurality of subsequent frame detection frames to obtain a plurality of intersection-and-union ratios;

[0025] When the plurality of intersection-over-union ratios are all greater than the preset intersection-over-union ratio, comparing the confidences of the plurality of subsequent frame detection frames;

[0026] When the confidence is greater than a preset confidence, obtaining the high confidence detection frame set according to the subsequent frame detection frame;

[0027] When the confidence is less than or equal to a preset confidence, the low confidence detection frame set is obtained according to the subsequent frame detection frame.

[0028] In one embodiment of the present invention, the predicted position is matched with the set of high-confidence detection boxes to obtain a first tracking trajectory and an unmatched trajectory:

[0029] Calculating a first intersection-over-union ratio of the predicted position and the set of high-confidence detection frames;

[0030] Obtain a first relationship loss matrix according to the first intersection-union ratio;

[0031] Matching the predicted position and the set of high-confidence detection boxes according to the first relationship loss matrix and the Hungarian algorithm to obtain a first matching result;

[0032] When the first matching result is a successful match, obtaining a first tracking trajectory according to the predicted position;

[0033] When the first matching result is a matching failure, an unmatched trajectory is obtained according to the tracking trajectory.

[0034] In one embodiment of the present invention, the unmatched track is matched with the low confidence detection box set to obtain a second tracking track and a missing track:

[0035] Calculating a second intersection-over-union ratio of the unmatched trajectory and the low-confidence detection frame set;

[0036] Obtain a second relationship loss matrix according to the second intersection-union ratio;

[0037] Matching the unmatched trajectory and the low-confidence detection box set according to the second relationship loss matrix and the Hungarian algorithm to obtain a second matching result;

[0038] When the second matching result is a successful match, obtaining a second tracking trajectory according to the unmatched trajectory;

[0039] When the second matching result is a matching failure, a missing trajectory is obtained according to the unmatched trajectory.

[0040] In one embodiment of the present invention, the tracked trajectory is obtained according to the judgment result:

[0041] If the judgment result is that the match is not successful, the missing track is deleted to obtain the tracked track;

[0042] When the judgment result is that the match is successful, the missing track is retained to obtain the tracked track.

[0043] In the second aspect, the present application proposes a vehicle flow statistics system based on the YOLOv8 algorithm, the system comprising: a data acquisition module, a calculation module and a statistics module;

[0044] The data acquisition module is configured to: acquire monitoring video data, the monitoring video data including a vehicle to be detected area and an area that the vehicle must pass through and leave;

[0045] The calculation module is configured to: detect the vehicle in the vehicle to be detected area according to the YOLOv8 algorithm to obtain a detection result; calculate the detection result according to the improved ByteTrack tracking algorithm to obtain a tracked trajectory;

[0046] The statistical module is configured to obtain a traffic flow statistical result of the vehicle to be detected area according to the area where the vehicle must leave and the tracked trajectory.

[0047] In a third aspect, an electronic device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is used to implement the steps of a vehicle flow statistics method based on the YOLOv8 algorithm as described in any one of the first aspects above when executing the computer program stored in the memory.

[0048] In a fourth aspect, the present application further proposes a computer-readable storage medium having a computer program stored thereon, and when the above-mentioned computer program is executed by a processor, the steps of a vehicle flow statistics method based on the YOLOv8 algorithm of any one of the first aspects are implemented.

[0049] In summary, a vehicle flow statistics method based on the YOLOv8 algorithm in an embodiment of the present application includes: obtaining monitoring video data, the monitoring video data includes a vehicle to be detected area and a vehicle must leave area; detecting vehicles in the vehicle to be detected area according to the YOLOv8 algorithm to obtain detection results; calculating the detection results according to the improved ByteTrack tracking algorithm to obtain tracked trajectories; obtaining vehicle flow statistics results in the vehicle to be detected area according to the vehicle must leave area and the tracked trajectories. All vehicles in the vehicle to be detected area in the monitoring video data are detected by the YOLOv8 algorithm; the detection results are input into the improved ByteTrack tracking algorithm to reduce the probability of misjudgment and missed detection, and the tracked trajectories are output; in the set vehicle must leave area, the vehicle flow statistics are performed by judging whether the tracking trajectory is in the vehicle must leave area. Not only can the vehicle in the vehicle to be detected area be accurately identified and tracked, but also the robustness of tracking is greatly increased, and the vehicle flow of each lane turn can be accurately and efficiently obtained according to the vehicle flow statistics in the vehicle must leave area.

[0050] The vehicle flow statistics method based on the YOLOv8 algorithm proposed in this application, and other advantages, objectives and features of this application will be partially reflected through the following description, and will also be partially understood by technical personnel in this field through research and practice of this application. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present specification. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0052] Figure 1 A flow chart of a vehicle flow statistics method based on the YOLOv8 algorithm provided in an embodiment of the present application;

[0053] Figure 2 A schematic diagram of the structure of a vehicle flow statistics system based on the YOLOv8 algorithm provided in an embodiment of the present application;

[0054] Figure 3 A schematic diagram of the structure of an electronic device for traffic flow statistics based on the YOLOv8 algorithm provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to better understand the technical solutions provided by the embodiments of this specification, the technical solutions of the embodiments of this specification are described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of this specification and the specific features in the embodiments are detailed descriptions of the technical solutions of the embodiments of this specification, rather than limitations on the technical solutions of this specification. In the absence of conflict, the embodiments of this specification and the technical features in the embodiments can be combined with each other.

[0056] In this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements limited by the statement "comprise one..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. The term "more than two" includes two or more than two situations.

[0057] See also Figure 1 , which is a flow diagram of a vehicle flow statistics method based on the YOLOv8 algorithm provided in an embodiment of the present application, which may specifically include:

[0058] S110, acquiring monitoring video data, wherein the monitoring video data includes a vehicle to be detected area and an area that the vehicle must pass through and leave;

[0059] Exemplarily, surveillance video data of a camera at an intersection is collected, and the surveillance video data includes a vehicle to be detected area and an area that the vehicle must pass through to leave, wherein the area that the vehicle must pass through includes video data of a right turn leaving area, video data of a straight-ahead leaving area, and video data of a left turn leaving area.

[0060] S120, detecting vehicles in the vehicle to-be-detected area according to the YOLOv8 algorithm to obtain a detection result;

[0061] Exemplarily, video frames of surveillance video data are read in a loop to determine vehicle detection areas (including areas divided according to different lane turns) and areas that vehicles must pass through and leave in all video frames, and all vehicles in the vehicle detection areas in each video frame are detected using the YOLOv8 algorithm.

[0062] S130, calculating the detection result according to the improved ByteTrack tracking algorithm to obtain a tracked trajectory;

[0063] Exemplarily, the detection results are used as input to the improved ByteTrack tracking algorithm, and the tracked track and track unique ID are output. The main idea is to first create a tracking track, and then use the tracking track to match the subsequent frame detection frame of each frame, and match the subsequent frame detection frame frame by frame to form a complete track. For the first frame detection frame of the video, tracks will be created for all the first frame detection frames and marked as tracked tracks. The tracking track includes tracked tracks (tracks that were successfully tracked in the previous frame) and missing tracks (tracks that lost tracking in the previous n frames, n<=30).

[0064] S140, obtaining a traffic flow statistics result of the area to be detected of the vehicle according to the area that the vehicle must pass through and the tracked trajectory.

[0065] Exemplarily, based on the vehicle's must-departure area obtained above, traffic flow statistics are performed by determining whether the tracked trajectory obtained above passes through the vehicle's must-departure area; so as to obtain the traffic flow of the right-turn departure area, the straight-ahead departure area and the left-turn departure area of ​​the designated lane to be detected.

[0066] In summary, the vehicle flow statistics method based on the YOLOv8 algorithm proposed in the embodiment of the present application detects all vehicles in the vehicle detection area in the monitoring video data through the YOLOv8 algorithm; the detection results are input into the improved ByteTrack tracking algorithm to reduce the probability of misjudgment and missed detection, and the tracked trajectory is output; in the set vehicle must leave area, the vehicle flow statistics are performed by judging whether the tracking trajectory is in the vehicle must leave area. Not only can the vehicle in the vehicle to be detected area be accurately identified and tracked, but also the robustness of the tracking is greatly increased, and the vehicle flow of each lane turn can be accurately and efficiently obtained according to the vehicle flow statistics in the vehicle must leave area.

[0067] In some examples, the step of obtaining surveillance video data includes:

[0068] Obtaining initial surveillance video data;

[0069] Counting the number of lane turns in the initial monitoring video data to obtain a statistical result;

[0070] The statistical results are divided according to lane turns to obtain a vehicle to-be-detected area and a vehicle must-pass-through area.

[0071] Exemplarily, based on the collected monitoring video data, the number of lane turns on the road to be detected in the monitoring video data is counted to obtain statistical results; the number of lane turns includes vehicle right turns, vehicle straight driving and vehicle left turns; and an equal number of vehicle areas to be detected are divided; then the statistical results are divided according to the lane turns to obtain the vehicle's must-departure area; wherein the vehicle's must-departure area includes the vehicle right turn departure area, the vehicle straight driving departure area and the vehicle left turn departure area, which are used for traffic flow statistics of lane turns.

[0072] In some examples, the step of calculating the detection result according to the improved ByteTrack tracking algorithm to obtain the tracked trajectory includes:

[0073] Obtain a first frame detection frame and multiple subsequent frame detection frames of the detection result;

[0074] Screening the plurality of subsequent frame detection frames according to a non-maximum suppression algorithm to obtain a detection frame set, wherein the detection frame set includes a high-confidence detection frame set and a low-confidence detection frame set;

[0075] In the case where the subsequent frame detection frame appears in two frames, constructing a tracking trajectory according to the subsequent frame detection frame in which the two frames appear and the first frame detection frame;

[0076] Predicting the tracking trajectory according to a Kalman filter algorithm to obtain a predicted position;

[0077] Matching the predicted position with the set of high-confidence detection frames to obtain a first tracking trajectory and an unmatched trajectory;

[0078] Matching the unmatched track with the low confidence detection frame set to obtain a second tracking track and a missing track;

[0079] Determine whether the missing track is successfully matched within a preset number of frames, and obtain a determination result;

[0080] The tracked trajectory is obtained according to the judgment result.

[0081] Exemplarily, the first frame detection frame and multiple subsequent frame detection frames of the detection results and the confidence corresponding to each detection frame are obtained through the detector Det, and the subsequent frame detection frames are screened according to the confidence of the subsequent frame detection frames and the intersection over union (IoU) between the subsequent frame detection frames using a non-maximum suppression algorithm (NMS) to obtain a detection frame set; wherein the detection frame set includes a high-confidence detection frame set and a low-confidence detection frame set; the tracking trajectory is divided into an activated trajectory and an inactivated trajectory, the activated trajectory includes the subsequent frame detection frames that have been tracked for more than two frames and the newly created trajectory of the first frame detection frame; the inactivated trajectory is a new trajectory that appears in the middle of the video and has not yet matched the second point of the trajectory.

[0082] The Kalman Filter algorithm dynamically estimates the state of the next moment in an iterative manner, while taking into account the historical state and observation data. Predictions are made to obtain the possible position of the detection frame of the next frame, which is the predicted position. The predicted position is matched with the set of high-confidence detection frames. After this process, we will get two parts of results: one part is successfully matched, called the first tracking trajectory; the other part is not successfully matched, called the unmatched trajectory. Next, the previously obtained unmatched trajectory is matched again with the set of low-confidence detection frames. After this round of matching, two new results will be generated: the successfully matched tracking trajectory updates the first tracking trajectory and is called the second tracking trajectory. The one that is still not successfully matched is called the missing trajectory. Then, for these missing trajectories, it is judged whether they can be successfully matched within the preset number of frames, and the corresponding judgment results are obtained. Finally, the final tracked trajectory is obtained based on the above judgment results.

[0083] In some examples, the step of screening the plurality of subsequent frame detection frames according to the non-maximum suppression algorithm to obtain a detection frame set includes:

[0084] Calculating a plurality of subsequent frame detection frames to obtain a plurality of intersection-and-union ratios;

[0085] When the plurality of intersection-over-union ratios are all greater than the preset intersection-over-union ratio, comparing the confidences of the plurality of subsequent frame detection frames;

[0086] When the confidence is greater than a preset confidence, obtaining the high confidence detection frame set according to the subsequent frame detection frame;

[0087] When the confidence is less than or equal to a preset confidence, the low confidence detection frame set is obtained according to the subsequent frame detection frame.

[0088] Exemplarily, by calculating the confidence of the subsequent frame detection frame and the intersection over union (IoU) value between the subsequent frame detection frames, if the IoU values ​​of the two subsequent frame detection frames are both greater than the preset IoU value, the confidences of multiple subsequent frame detection frames are compared, and the subsequent frame detection frames with lower confidence are discarded, and the subsequent frame detection frames with higher confidence are retained, thereby obtaining a high-quality detection result. The preset IoU value is 0.95. Traverse the subsequent frame detection frames , based on whether the confidence of the subsequent frame detection box is greater than the preset confidence To filter multiple subsequent frame detection frames, the preset confidence is 0.5 by default. If the confidence of the subsequent frame detection frame is greater than the preset confidence, the subsequent frame detection frame is classified as a high confidence detection frame set. If the confidence of the subsequent frame detection frame is less than or equal to the preset confidence, then the subsequent frame detection frame is classified as a low confidence detection frame set .

[0089] In some examples, the predicted position is matched with the set of high-confidence detection boxes to obtain a first tracking trajectory and an unmatched trajectory:

[0090] Calculating a first intersection-over-union ratio of the predicted position and the set of high-confidence detection frames;

[0091] Obtain a first relationship loss matrix according to the first intersection-union ratio;

[0092] Matching the predicted position and the set of high-confidence detection boxes according to the first relationship loss matrix and the Hungarian algorithm to obtain a first matching result;

[0093] When the first matching result is a successful match, obtaining a first tracking trajectory according to the predicted position;

[0094] When the first matching result is a matching failure, an unmatched trajectory is obtained according to the tracking trajectory.

[0095] For example, the tracking trajectory is calculated Predicted positions and high confidence detection box sets The first intersection-over-union (IoU) value between them is used to obtain a pairwise first relationship loss matrix. The larger the first intersection-over-union (IoU) value, the greater the degree of association, where the maximum value is 1 and the minimum value is 0 (indicating that there is no intersection between the detection frames of subsequent frames). According to the first relationship loss matrix, the detection frame at the predicted position and the set of high-confidence detection frames are matched using the Hungarian algorithm to obtain a first matching result. If the first matching result is a successful match, then the tracking trajectory is updated according to the successfully matched detection frame to obtain the first tracking trajectory. If the first matching result is a failed match, then the unmatched trajectory that was not successfully matched is retained in And the subsequent frame detection boxes that were not successfully matched are in .

[0096] In some examples, the unmatched track is matched with the set of low-confidence detection boxes to obtain a second tracking track and a missing track:

[0097] Calculating a second intersection-over-union ratio of the unmatched trajectory and the low-confidence detection frame set;

[0098] Obtain a second relationship loss matrix according to the second intersection-union ratio;

[0099] Matching the unmatched trajectory and the low-confidence detection box set according to the second relationship loss matrix and the Hungarian algorithm to obtain a second matching result;

[0100] When the second matching result is a successful match, obtaining a second tracking trajectory according to the unmatched trajectory;

[0101] When the second matching result is a matching failure, a missing trajectory is obtained according to the unmatched trajectory.

[0102] For example, for the unmatched track that was not successfully matched in the last matching Perform a second match and calculate the unmatched trajectories With low confidence detection box The second intersection-over-union ratio of can also get a second relation loss matrix, using the Hungarian algorithm for unmatched trajectories. and low confidence detection boxes Perform matching to obtain the second matching result. If the second matching result is a successful match, then update the first tracking trajectory according to the successfully matched detection frame to obtain the second tracking trajectory. The purpose of this matching is to deal with the low-score detection frame that may be caused by occlusion, so as to maintain continuous tracking of the target. If the second matching result is a failed match, the tracking trajectory that has not yet been successfully matched is marked as a lost tracking trajectory.

[0103] In some examples, the tracked trajectory is obtained according to the judgment result:

[0104] If the judgment result is that the match is not successful, the missing track is deleted to obtain the tracked track;

[0105] When the judgment result is that the match is successful, the missing track is retained to obtain the tracked track.

[0106] For example, for the track that is not matched in the above two matches, it is regarded as a temporarily missing track. After a period of time, it is kept and matched again. If it is still not matched successfully after more than 30 frames, it is judged as a failed match and the missing track is deleted from the track set to obtain the final tracked track. Create a new track. Output the tracked track and the unique ID of the tracked track. If the match is successful within 30 seconds, the result is considered a successful match, and the missing track is retained to obtain the final tracked track.

[0107] like Figure 2As shown, this application proposes a vehicle flow statistics system based on the YOLOv8 algorithm, and the system includes: a data acquisition module 21, a calculation module 22 and a statistics module 23;

[0108] The data acquisition module 21 is configured to: acquire monitoring video data, the monitoring video data including the vehicle to be detected area and the vehicle must pass through the area to leave;

[0109] The calculation module 22 is configured to: detect the vehicle in the vehicle to be detected area according to the YOLOv8 algorithm to obtain a detection result; calculate the detection result according to the improved ByteTrack tracking algorithm to obtain a tracked trajectory;

[0110] The statistical module 23 is configured to obtain a traffic flow statistical result of the vehicle to be detected area according to the area where the vehicle must leave and the tracked trajectory.

[0111] The effects of the above-mentioned system when applying the above-mentioned method can be found in the description of the above-mentioned method embodiment, which will not be repeated here.

[0112] like Figure 3 As shown, an embodiment of the present application also provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor. When the processor 320 executes the computer program 311, the steps of any method of vehicle flow statistics based on the YOLOv8 algorithm are implemented.

[0113] Since the electronic device introduced in this embodiment is a device used to implement a vehicle flow statistics device based on the YOLOv8 algorithm in the embodiment of the present application, based on the method introduced in the embodiment of the present application, the technical personnel in this field can understand the specific implementation mode of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of the present application is not described in detail here. As long as the equipment used by the technical personnel in this field to implement the method in the embodiment of the present application is within the scope of protection of this application.

[0114] In the specific implementation process, when the computer program 311 is executed by the processor, it can achieve Figure 1 Any implementation manner in the corresponding embodiments.

[0115] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0116] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-readable program code.

[0117] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, 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 computer, or other programmable data processing device to generate 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 flowchart and / or block diagram. 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.

[0118] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.

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

[0120] An embodiment of the present application also provides a computer program product, which includes computer software instructions. When the computer software instructions are executed on a processing device, the processing device executes the process of the LDPC decoding method of the solid-state hard disk controller.

[0121] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0122] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0123] In the several embodiments provided in the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0124] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0125] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0126] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0127] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

[0128] Although the preferred embodiments of this specification have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of this specification.

[0129] Obviously, those skilled in the art can make various changes and modifications to this specification without departing from the spirit and scope of this specification. Thus, if these modifications and variations of this specification fall within the scope of the claims of this specification and their equivalents, this specification is also intended to include these modifications and variations.

Claims

1. A vehicle flow statistics method based on the YOLOv8 algorithm, characterized in that: The method comprises: Acquire monitoring video data, wherein the monitoring video data includes video data of a vehicle to be detected area and video data of an area that the vehicle must pass through and leave, and the video data of the area that the vehicle must pass through and leave includes video data of a right turn leaving area, video data of a straight driving leaving area, and video data of a left turn leaving area; Detecting vehicles in the video data of the vehicle to be detected area according to the YOLOv8 algorithm to obtain a detection result; The detection results are calculated according to the improved ByteTrack tracking algorithm, and the tracked tracks include: Obtain a first frame detection frame and multiple subsequent frame detection frames of the detection result; The steps of screening the plurality of subsequent frame detection frames according to the non-maximum suppression algorithm to obtain a detection frame set, wherein the detection frame set includes a high-confidence detection frame set and a low-confidence detection frame set include: Calculating a plurality of subsequent frame detection frames to obtain a plurality of intersection-and-union ratios; When the plurality of intersection-over-combination ratios are all greater than the preset intersection-over-combination ratio, comparing the confidences of the plurality of subsequent frame detection frames; When the confidence is greater than a preset confidence, obtaining the high confidence detection frame set according to the subsequent frame detection frame; When the confidence is less than or equal to a preset confidence, obtaining the low confidence detection frame set according to the subsequent frame detection frame; In the case where the subsequent frame detection frame appears in two frames, constructing a tracking trajectory according to the subsequent frame detection frame in which the two frames appear and the first frame detection frame; Predicting the tracking trajectory according to a Kalman filter algorithm to obtain a predicted position; Matching the predicted position with the high confidence detection frame set to obtain a first tracking trajectory and an unmatched trajectory includes: Calculating a first intersection-over-union ratio of the predicted position and the set of high-confidence detection frames; Obtain a first relationship loss matrix according to the first intersection-union ratio; Matching the predicted position and the set of high-confidence detection boxes according to the first relationship loss matrix and the Hungarian algorithm to obtain a first matching result; When the first matching result is a successful match, obtaining a first tracking trajectory according to the predicted position; When the first matching result is a matching failure, obtaining an unmatched trajectory according to the tracking trajectory; The steps of matching the unmatched trajectory with the low confidence detection frame set to obtain a second tracking trajectory and a missing trajectory, wherein the missing trajectory is a trajectory that has lost tracking in the previous n frames, where n is a natural number, include: Calculating a second intersection-over-union ratio of the unmatched trajectory and the low-confidence detection frame set; Obtain a second relationship loss matrix according to the second intersection-union ratio; Matching the unmatched trajectory and the low-confidence detection box set according to the second relationship loss matrix and the Hungarian algorithm to obtain a second matching result; When the second matching result is a successful match, obtaining a second tracking trajectory according to the unmatched trajectory; When the second matching result is a matching failure, obtaining a missing track according to the unmatched track; Determine whether the missing track is successfully matched within a preset number of frames, and obtain a determination result; Obtaining the tracked trajectory according to the judgment result; The traffic flow statistics result of the video data of the vehicle in the area to be detected is obtained according to the video data of the area where the vehicle must leave and the tracked trajectory.

2. According to claim 1, a vehicle flow statistics method based on the YOLOv8 algorithm is characterized in that: The step of obtaining surveillance video data comprises: Obtaining initial surveillance video data; Counting the number of lane turns in the initial monitoring video data to obtain a statistical result; The statistical results are divided according to lane turns to obtain video data of the vehicle to be detected area and video data of the vehicle must pass through the area to leave.

3. The vehicle flow statistics method based on the YOLOv8 algorithm according to claim 1 is characterized in that: The tracked trajectory is obtained according to the judgment result: If the judgment result is that the match is not successful, the missing track is deleted to obtain the tracked track; When the judgment result is that the match is successful, the missing track is retained to obtain the tracked track.

4. A vehicle flow statistics system based on the YOLOv8 algorithm, characterized in that: The system comprises: a data acquisition module, a calculation module and a statistics module; The data acquisition module is configured to: acquire monitoring video data, the monitoring video data including video data of a vehicle to be detected area and video data of an area that the vehicle must pass through and leave, the video data of an area that the vehicle must pass through and leave includes video data of a right turn leaving area, video data of a straight drive leaving area, and video data of a left turn leaving area; The calculation module is configured to: detect vehicles in the video data of the vehicle to be detected area according to the YOLOv8 algorithm to obtain a detection result; calculate the detection result according to the improved ByteTrack tracking algorithm to obtain a tracked trajectory, including: obtaining a first frame detection frame and multiple subsequent frame detection frames of the detection result; screening multiple subsequent frame detection frames according to the non-maximum suppression algorithm to obtain a detection frame set, wherein the detection frame set includes a high-confidence detection frame set and a low-confidence detection frame set, and the steps include: calculating multiple subsequent frame detection frames to obtain multiple intersection-and-union ratios; when the multiple intersection-and-union ratios are all greater than the preset intersection-and-union ratio, In the case of a plurality of subsequent frame detection frames, the confidences are compared; when the confidence is greater than a preset confidence, the high confidence detection frame set is obtained according to the subsequent frame detection frame; when the confidence is less than or equal to the preset confidence, the low confidence detection frame set is obtained according to the subsequent frame detection frame; when the subsequent frame detection frame appears in two frames, a tracking trajectory is constructed according to the subsequent frame detection frame in which the two frames appear and the first frame detection frame; the tracking trajectory is predicted according to the Kalman filter algorithm to obtain a predicted position; the predicted position is matched with the high confidence detection frame set to obtain a first tracking trajectory and an unmatched trajectory, including: calculating a first intersection-and-union ratio of the predicted position and the set of high-confidence detection frames; obtaining a first relation loss matrix according to the first intersection-and-union ratio; matching the predicted position and the set of high-confidence detection frames according to the first relation loss matrix and the Hungarian algorithm to obtain a first matching result; when the first matching result is a successful match, obtaining a first tracking trajectory according to the predicted position; when the first matching result is a failed match, obtaining an unmatched trajectory according to the tracking trajectory; matching the unmatched trajectory with the set of low-confidence detection frames to obtain a second tracking trajectory and a missing trajectory, wherein the missing trajectory is a trajectory that has lost tracking in the previous n frames, where n is The step of obtaining a natural number includes: calculating a second intersection-and-union ratio of the unmatched trajectory and the set of low-confidence detection frames; obtaining a second relationship loss matrix according to the second intersection-and-union ratio; matching the unmatched trajectory and the set of low-confidence detection frames according to the second relationship loss matrix and the Hungarian algorithm to obtain a second matching result; when the second matching result is a successful match, obtaining a second tracking trajectory according to the unmatched trajectory; when the second matching result is a failed match, obtaining a missing trajectory according to the unmatched trajectory; judging whether the missing trajectory is successfully matched within a preset number of frames to obtain a judgment result; and obtaining the tracked trajectory according to the judgment result; The statistical module is configured to obtain a traffic flow statistical result of the video data of the vehicle to be detected area according to the video data of the area where the vehicle must leave and the tracked trajectory.

5. An electronic device comprising: A memory and a processor, wherein the processor is used to implement the steps of a vehicle flow statistics method based on the YOLOv8 algorithm as described in any one of claims 1 to 3 when executing a computer program stored in the memory.

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

Citation Information

Patent Citations

  • Traffic flow statistical method based on road video and license plate detection

    CN109993081A

  • Target tracking method, device and system

    CN116681726A