Coal logistics park traffic flow statistical system and method based on YOLOv8 and OpenCV

By applying the YOLOv8 object detection algorithm and the vehicle flow statistics system of the OpenCV image processing library in the coal logistics park, the accuracy and real-time problems of vehicle flow statistics in complex scenarios are solved, efficient and accurate vehicle identification and statistics are achieved, and traffic management efficiency is improved.

CN119580506APending Publication Date: 2025-03-07INNER MONGOLIA RONGTONG DIGITAL CHAIN COAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411653488.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing vehicle flow statistics methods lack detection accuracy and real-time performance in complex scenarios, making it difficult to meet the high accuracy and stability requirements of coal logistics parks.

Method used

It adopts a high-precision statistical system based on YOLOv8 object detection algorithm and OpenCV image processing library. By deploying high-definition monitoring equipment, video data is obtained in real time, object detection and tracking is carried out, vehicle counting is realized, and statistical and analysis functions are provided for information such as vehicle type and vehicle speed.

Benefits of technology

It realizes efficient and accurate identification and tracking of vehicles at the intersections within the coal logistics park, solves the problems of missed inspections and missed inspections, provides real-time and accurate vehicle flow statistics, and improves traffic management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119580506A_ABST
    Figure CN119580506A_ABST
Patent Text Reader

Abstract

The invention provides a coal logistics park traffic flow statistical system and method based on YOLOv8 and OpenCV, and the method comprises the following steps: S101, deploying high-definition monitoring equipment at a key intersection in a coal logistics park, and configuring equipment parameters; s102, variables are initialized, a model is loaded, and a data loader is configured; s103, acquiring camera video data in real time through the rtsp video stream; s104, traversing the data frame, and carrying out object detection and tracking; s105, processing a detection result to realize vehicle counting; and S106, deploying the model to a management end to display a result. According to the method, targeted training is carried out on the YOLOv8 model for the special environment of the coal logistics park, the OpenCV and the vehicle tracking algorithm are combined, efficient and accurate recognition, tracking and statistics of the vehicles are achieved, the detection problem caused by shielding, light change and other factors is solved, and a basis is provided for park traffic management. In addition, the system is flexible and expandable, a user can configure the system according to needs, the system can be conveniently expanded to other logistics parks or traffic scenes, and large-range vehicle monitoring is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent traffic monitoring technology, and in particular to vehicle flow statistics at internal intersections in a coal logistics park. A high-precision statistics system and method based on a YOLOv8 target detection algorithm and an OpenCV image processing library are proposed. Background Art

[0002] Traditional vehicle flow counting methods, such as geomagnetic induction coils and infrared sensors, have problems such as high installation cost, complex maintenance, and poor environmental adaptability. Computer vision-based methods, such as background difference method and optical flow method, have the advantages of low cost and easy installation, but the detection accuracy and real-time performance in complex scenes still need to be improved. As a heavy industrial area, the coal logistics park has a complex traffic environment, diverse vehicle types, and a large amount of dust and light changes, which puts higher requirements on the accuracy and stability of the vehicle flow counting system. Therefore, it is particularly important to develop an efficient, accurate, and cost-effective vehicle flow counting system. Summary of the invention

[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention aims to provide a high-precision statistical system and method based on the YOLOv8 target detection algorithm and the OpenCV image processing library, which is particularly suitable for vehicle number statistics in coal logistics parks, and realizes real-time and accurate statistics of vehicle flow, so as to improve the traffic management efficiency of the park.

[0004] In order to achieve the above purpose, the following technical scheme is adopted: The present invention provides a coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV, comprising the following steps:

[0005] S101, deploy high-definition surveillance equipment at key intersections within the coal logistics park to ensure that passing vehicles can be clearly captured, and configure the parameters of the video surveillance equipment, such as resolution and frame rate, to meet the needs of subsequent image processing;

[0006] S102, initialize variables, load models, configure data loaders, and select data processing parameters;

[0007] S103, obtaining camera video data in real time through rtsp video stream and transferring it to data loader;

[0008] S104, traversing the data frame to perform object detection and tracking;

[0009] S105, processing the detection results, realizing vehicle counting, and printing the results for display;

[0010] S106, deploy this model to the management end to display the results.

[0011] Furthermore, in step S101, the special environment of the coal logistics park is taken into consideration, and the selected intersection is an intersection with heavy traffic in the park and prone to traffic jams, and the video surveillance equipment is configured with a resolution of 1920×1080 and a frame rate of 24fps to ensure that vehicles can still be clearly captured under dust and light changes.

[0012] Furthermore, in step S102, the counter for the number of vehicles tracked and identified is initialized to 0, the object list for storing the ID of each tracked vehicle is initialized to be empty, the AutoBackend class is used to load the YOLOv8 model, the stride, category name and model type of the model are obtained, the LoadStreams class is used to create a data loader, and the image size is verified and adjusted to match the stride of the model. In addition, considering the variety of vehicle types in the coal logistics park, the YOLOv8 model is trained specifically to improve the recognition accuracy of specific types of vehicles such as coal transport vehicles.

[0013] Furthermore, in step S103, the rtsp video stream is obtained through the camera platform, read and transmitted to the data loader for subsequent object detection and tracking processing.

[0014] Furthermore, in step S104, each frame of data in the video is traversed, the YOLOv8 model is applied to the current frame to perform object detection, the detection result (including bounding box, category, confidence, etc.) is obtained, and the non-maximum suppression (NMS) algorithm is applied to remove duplicate detection frames to reduce false detection and missed detection.

[0015] Furthermore, in step S105, the detection results of each image are traversed, counters, ID lists, etc. are updated, bounding boxes, labels, confidence levels, etc. are drawn according to the detection results, and the detection results are passed to the tracker, the tracker state is updated, the detection results are passed to the tracker, the tracker state is updated, and the counting is realized by using the over-line counting method according to the tracking results, and the counter count and the object ID list obj_id_list are updated. In addition, considering the special needs of the coal logistics park, the present invention also provides statistical and analysis functions for information such as vehicle type and speed.

[0016] Furthermore, in step S106, according to the result of S105, the traffic flow statistics are displayed on the management end page to provide timely and accurate data support for the traffic management of the park.

[0017] The beneficial effects of the present invention are:

[0018] (1) Aiming at the diversity of vehicle types and special environment in the coal logistics park, the present invention conducts targeted training on the YOLOv8 model, combines the OpenCV image processing library and the vehicle tracking algorithm, realizes efficient and accurate identification of vehicles at intersections within the coal logistics park, and tracks the identified vehicles between consecutive frames, effectively solving the problems of missed detection or false detection caused by factors such as vehicle occlusion and light changes. By using dynamic counting logic, the number of vehicles at the current intersection can be counted in real time, providing timely and accurate data support for traffic management at intersections within the park. The present invention also provides statistical and analysis functions for information such as vehicle type and speed;

[0019] (2) The system provided by the present invention is highly flexible and extensible. Users can configure parameters and expand the system according to actual needs, such as model weight file path, confidence threshold, maximum number of detections, etc., to meet application requirements in different scenarios. In addition, the system can also be easily expanded to other internal intersections or traffic scenes in logistics parks to achieve a wider range of vehicle monitoring and statistics. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The present invention is a schematic diagram of the overall structure of a coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV.

[0021] Explanation of the symbols in the schematic diagram:

[0022] S101, deploy high-definition surveillance equipment at key intersections within the coal logistics park to ensure that passing vehicles can be clearly captured, and configure the parameters of the video surveillance equipment, such as resolution and frame rate, to meet the needs of subsequent image processing;

[0023] S102, initialize variables, load models, configure data loaders, and select data processing parameters;

[0024] S103, obtaining camera video data in real time through rtsp video stream and transferring it to data loader;

[0025] S104, traversing the data frame to perform object detection and tracking;

[0026] S105, processing the detection results, realizing vehicle counting, and printing the results for display;

[0027] S106, deploy this model to the management end to display the results. DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0029] Unless otherwise defined, all professional and scientific terms used herein have the same meanings as those familiar to those skilled in the art. In addition, any methods and materials similar or equivalent to those described herein may be applied to the present invention. The preferred implementation methods and materials described herein are for demonstration purposes only and are not intended to limit the content of this application.

[0030] The experimental methods in the following examples are conventional methods unless otherwise specified, and the experimental materials used in the following examples are purchased from commercial channels unless otherwise specified.

[0031] Example 1

[0032] A coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV

[0033] The system and method include the following steps:

[0034] S101, deploy high-definition surveillance equipment at key intersections within the coal logistics park to ensure that passing vehicles can be clearly captured, and configure the parameters of the video surveillance equipment, such as resolution and frame rate, to meet the needs of subsequent image processing;

[0035] S102, initialize variables, load models, configure data loaders, and select data processing parameters;

[0036] S103, obtaining camera video data in real time through rtsp video stream and transferring it to data loader;

[0037] S104, traversing the data frame to perform object detection and tracking;

[0038] S105, processing the detection results, realizing vehicle counting, and printing the results for display;

[0039] S106, deploy this model to the management end to display the results.

[0040] In step S101, the special environment of the coal logistics park is taken into consideration, and the selected intersection is a crossroads with heavy traffic in the park and prone to traffic jams. The video surveillance equipment is configured with a resolution of 1920×1080 and a frame rate of 24fps to ensure that vehicles can still be clearly captured under dust and light changes.

[0041] In step S102, the counter for the number of vehicles tracked and identified is initialized to 0, the object list for storing the ID of each tracked vehicle is initialized to be empty, the YOLOv8 model is loaded using the AutoBackend class, the stride, category name and model type of the model are obtained, the data loader is created using the LoadStreams class, and the image size is verified and adjusted to match the stride of the model. In addition, considering the variety of vehicle types in the coal logistics park, the YOLOv8 model is trained specifically to improve the recognition accuracy of specific types of vehicles such as coal transport vehicles.

[0042] In step S103, the rtsp video stream is obtained through the camera platform, read and transmitted to the data loader for subsequent object detection and tracking processing.

[0043] In step S104, each frame of data in the video is traversed, and the YOLOv8 model is applied to the current frame to perform object detection, and the detection result (including bounding box, category, confidence, etc.) is obtained. The non-maximum suppression (NMS) algorithm is applied to remove duplicate detection frames to reduce false detection and missed detection.

[0044] In the step S105, the detection results of each image are traversed, counters, ID lists, etc. are updated, bounding boxes, labels, confidence levels, etc. are drawn according to the detection results, and the detection results are passed to the tracker, the tracker state is updated, the detection results are passed to the tracker, the tracker state is updated, and the counting is realized by using the line counting method according to the tracking results, and the counter count and the object ID list obj_id_list are updated. In addition, considering the special needs of the coal logistics park, the present invention also provides statistical and analysis functions for information such as vehicle type and speed.

[0045] In step S106, according to the result of S105, the traffic flow statistics data is displayed on the management end page to provide timely and accurate data support for the traffic management of the park.

Claims

1. A coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV, characterized in that: The steps include: S101, deploy high-definition surveillance equipment at key intersections within the coal logistics park to ensure that passing vehicles can be clearly captured, and configure the parameters of the video surveillance equipment, such as resolution and frame rate, to meet the needs of subsequent image processing; S102, initialize variables, load models, configure data loaders, and select data processing parameters; S103, obtaining camera video data in real time through rtsp video stream and transferring it to data loader; S104, traversing the data frame to perform object detection and tracking; S105, processing the detection results, realizing vehicle counting, and printing the results for display; S106, deploy this model to the management end to display the results.

2. According to claim 1, a coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV is characterized in that: In step S101, the special environment of the coal logistics park is taken into consideration, and the selected intersection is a crossroads with heavy traffic in the park and prone to traffic jams. The video surveillance equipment is configured with a resolution of 1920×1080 and a frame rate of 24fps to ensure that vehicles can still be clearly captured under dust and light changes.

3. According to claim 1, a coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV is characterized in that: In step S102, the counter for the number of vehicles tracked and identified is initialized to 0, the object list for storing the ID of each tracked vehicle is initialized to be empty, the YOLOv8 model is loaded using the AutoBackend class, the stride, category name and model type of the model are obtained, the data loader is created using the LoadStreams class, and the image size is verified and adjusted to match the stride of the model. In addition, considering the variety of vehicle types in the coal logistics park, the YOLOv8 model is trained specifically to improve the recognition accuracy of specific types of vehicles such as coal transport vehicles.

4. According to a coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV according to claim 1, it is characterized in that: In step S103, the rtsp video stream is obtained through the camera platform, read and transmitted to the data loader for subsequent object detection and tracking processing.

5. According to a coal logistics park vehicle flow statistics system and method based on YOLOv8 and OpenCV according to claim 1, it is characterized in that: In step S104, each frame of data in the video is traversed, and the YOLOv8 model is applied to the current frame to perform object detection, and the detection result (including bounding box, category, confidence, etc.) is obtained. The non-maximum suppression (NMS) algorithm is applied to remove duplicate detection frames to reduce false detection and missed detection.

6. The vehicle flow statistics system and method for a coal logistics park based on YOLOv8 and OpenCV according to claim 1, characterized in that: In the step S105, the detection results of each image are traversed, counters, ID lists, etc. are updated, bounding boxes, labels, confidence levels, etc. are drawn according to the detection results, and the detection results are passed to the tracker, the tracker state is updated, the detection results are passed to the tracker, the tracker state is updated, and the counting is realized by using the line counting method according to the tracking results, and the counter count and the object ID list obj_id_list are updated. In addition, considering the special needs of the coal logistics park, the present invention also provides statistical and analysis functions for information such as vehicle type and speed.

7. The vehicle flow statistics system and method for a coal logistics park based on YOLOv8 and OpenCV according to claim 1, characterized in that: In step S106, according to the result of S105, the traffic flow statistics data is displayed on the management end page to provide timely and accurate data support for the traffic management of the park.