A road monitoring system based on multi-target detection and tracking and a method thereof
By combining a lightweight YOLOv8n model with the DeepSORT algorithm, multi-target detection and tracking in urban road monitoring systems were achieved, solving the problems of high cost and low intelligence in existing systems and providing accurate traffic data support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TIANJIN ZHIXIN COSLIGHT TECHNOLOGY CO LTD
- Filing Date
- 2026-03-09
- Publication Date
- 2026-06-16
AI Technical Summary
Existing urban road monitoring systems suffer from high hardware costs, data silos, low levels of intelligence, and poor adaptability to complex scenarios, making it difficult to meet the needs of comprehensive management.
A lightweight YOLOv8n model is used for multi-target detection, combined with the DeepSORT algorithm for target tracking, to achieve continuous tracking across frames. The pixel domain data is converted into physical domain data through a velocity calculation formula to construct a multi-dimensional traffic data system.
It has improved the intelligence and precision of the road monitoring system, realized full-process perception and quantitative analysis, adapted to complex scenarios, and provided accurate traffic data support.
Smart Images

Figure CN122223635A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation technology, specifically to a road monitoring system and method based on multi-target detection and tracking. Background Technology
[0002] As a core infrastructure of urban road traffic management, road monitoring systems can collect key information such as road traffic status, vehicle trajectory, and pedestrian activity in real time. This provides important data support for traffic command and dispatch, accident tracing and evidence collection, investigation and handling of violations, and public safety prevention. Its technical performance directly affects the efficiency and quality of road traffic management.
[0003] Currently, the technical solutions adopted in the field of urban road monitoring are mainly divided into two categories: stand-alone smart camera monitoring solutions and integrated smart monitoring system solutions. Stand-alone smart camera solutions achieve localized area monitoring coverage by deploying smart cameras at key road nodes. While this solution can achieve basic single-point monitoring functions, it has several inherent drawbacks: Firstly, the hardware manufacturing, installation, debugging, and maintenance costs of smart cameras are high. To achieve comprehensive coverage of urban roads, large-scale equipment deployment is required, leading to high overall construction costs. Secondly, each smart camera operates independently, with data storage and processing completed locally. The lack of a unified data interaction interface and integrated management platform creates data silos, hindering cross-regional and cross-road segment data analysis and collaborative monitoring, and failing to meet the needs of comprehensive urban road traffic management.
[0004] Therefore, integrated intelligent monitoring systems are gradually becoming the mainstream choice for urban road monitoring. By building a unified monitoring and management platform, the system integrates various dispersed monitoring devices, enabling centralized data collection, transmission, storage, and preliminary processing. Compared to standalone intelligent camera solutions, it has significant advantages in cost control and data integration, achieving broader road monitoring coverage at a lower overall cost.
[0005] However, the current level of intelligence in intelligent monitoring systems is generally low, mainly reflected in the following aspects: First, the data processing capability is limited, and it mainly relies on manual analysis of monitoring data, which is inefficient and prone to errors; second, there is a lack of intelligent decision support, making it difficult to effectively regulate based on real-time traffic data; and third, the adaptability to complex scenarios is poor, and the performance drops significantly in severe weather or complex road conditions. Summary of the Invention
[0006] In view of the shortcomings of existing technologies, the present invention aims to provide a road monitoring system and method based on multi-target detection and tracking. The purpose is to improve the intelligence and accuracy of road monitoring through the integrated application of multi-target detection and tracking technologies, realize the full-process perception and quantitative analysis of traffic targets, and thus adapt to the full-scenario needs of modern urban road traffic management.
[0007] This invention provides a road monitoring method based on multi-target detection and tracking, characterized by the following steps:
[0008] The data acquisition process involves collecting real-time video data of the road and constructing a training dataset. The target information acquisition step involves inputting the video data into the YOLOv8n model to obtain the target information detected in the image. The target information includes the target category, target location, and confidence level. The YOLOv8n model is used to parse and process the raw data. This model has lightweight characteristics, high target recognition accuracy, and accurate bounding box positioning. The target motion trajectory acquisition step involves transmitting the target information to the DeepSORT algorithm framework. The DeepSORT algorithm framework assigns a corresponding and unique tracking ID to each target and continuously tracks the target through the tracking ID to obtain the target motion trajectory. This step enables continuous tracking of multiple targets across frames and constructs the complete motion trajectory of the target. The target speed calculation step involves obtaining the displacement change between consecutive frames of the same target from the target's motion trajectory, and calculating the target speed based on the displacement change. This step transforms structured target information into speed parameters that are meaningful for traffic management, meeting the needs of speeding detection or traffic flow speed analysis.
[0009] Furthermore, the target information acquisition step is configured with a target location identification strategy, specifically: The YOLOv8n model detects each frame of video image in the video data and represents the position of the target in the image in the form of a two-dimensional bounding box, obtaining the bounding box (x1, y1, x2, y2) of each target, where (x1, y1) is the pixel coordinate of the upper left corner of the bounding box and (x2, y2) is the pixel coordinate of the lower right corner of the bounding box.
[0010] Standardizing computer vision target localization by defining bounding boxes ensures the universality and computability of location data.
[0011] Furthermore, the target categories include vehicles and pedestrians. Clearly defining the priority of the system's detection objects simplifies model computation, improves detection speed, avoids non-core targets consuming system resources, and provides a basis for subsequent data classification and storage, traffic statistics, and violation determination.
[0012] Furthermore, the specific details of the target velocity calculation step are as follows: In each frame of the video image, the center position (center_x, center_y) of the target is calculated. The calculation formula is: center_x=x1+x22, center_y=y1+y22; To obtain the pixel position change of the same target between adjacent frames in consecutive frames, where the center position of the target in the previous frame is (center_x1, center_y1) and the center position in the current frame is (center_x2, center_y2), the pixel position change between adjacent frames can be obtained as follows: distance=center_x2 cneter_x12+center_y2 center_y12; The target velocity is obtained by converting the change in pixel position using the following formula: speed=distance×scale×3.6×fps; Where scale is the conversion ratio from pixel to actual distance; fps is the frame rate of the video data.
[0013] The purpose of obtaining the center position is to simplify the calculation and accurately represent the core position of the target. Compared with the displacement calculation based on any vertex of the bounding box, the error is smaller. The pixel displacement change takes into account the bidirectional displacement of the X and Y axes, which is closer to the actual movement trajectory of the target. Furthermore, the conversion from the pixel domain to the physical domain is achieved through the velocity conversion formula.
[0014] Furthermore, the data acquisition step is configured with a data preprocessing strategy, specifically including: The video frame extraction operation is completed by using the equal-time frame extraction method or the motion detection-based frame extraction method. Perform blur removal and low-quality image removal operations on each frame of video data that has undergone frame extraction processing; The remaining video frames are augmented through rotation, translation, and misplacement to obtain preprocessed video data.
[0015] Data preprocessing strategies are used to optimize raw video data, improve data quality, adapt to model input requirements, and reduce the impact of noise and low-quality data on detection accuracy.
[0016] This invention also provides a system for a road monitoring method based on multi-target detection and tracking, which is applicable to the above-mentioned monitoring method. The system includes: The data acquisition module is a camera that collects video data of the road in real time. The data processing module has a built-in data preprocessing strategy to preprocess the acquired video data. The target detection module has a built-in YOLOv8n model for target detection on preprocessed video data. The target tracking module has a built-in DeepSORT algorithm framework, which assigns a corresponding tracking ID to each detected target and tracks it continuously. A speed calculation and flow detection module is used to calculate the target speed and obtain the target flow.
[0017] Furthermore, the system also includes a data storage module, which is used to classify and store data, specifically according to target category, target movement trajectory, target quantity, and target violation statistics category.
[0018] Furthermore, the system also includes a front-end display module, which constructs a front-end interface and displays the processed monitoring images and various traffic statistics in real time through the front-end interface, marks the targets of violations, and presents the traffic monitoring data intuitively in the form of charts.
[0019] The beneficial effects of this invention are: This invention achieves rapid and accurate detection of multiple targets, including vehicles and pedestrians, using a lightweight YOLOv8n model. It combines confidence-based filtering of valid detection results to reduce false positives and false negatives. Furthermore, it employs the DeepSORT algorithm framework to assign unique tracking IDs to targets, achieving continuous tracking across frames through deep feature matching and Kalman filtering. This effectively addresses tracking interruptions or target confusion in scenarios involving target occlusion, rapid movement, and lane changes. Overall, this solution significantly improves the robustness of multi-target detection and tracking in complex traffic scenarios, resolving the issues of low intelligence and poor tracking performance in existing monitoring systems.
[0020] The speed calculation formula designed in this invention completes the conversion from the pixel domain to the physical domain and unit standardization, enabling accurate calculation of the instantaneous speed of the target. Compared with traditional single-point or section speed measurement, this invention can simultaneously perform non-contact speed measurement on multiple targets, and the data is more consistent with the actual driving state of the target. Furthermore, by tracking the ID to construct the complete motion trajectory of the target, combined with speed data and traffic statistics functions, a multi-dimensional traffic data system of trajectory, speed, and traffic flow is formed, providing accurate and comprehensive quantitative data for speeding enforcement, traffic flow analysis, and congestion prediction. This solves the problem that existing systems can only achieve basic detection and cannot complete accurate quantitative analysis. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of a road monitoring system based on multi-target detection and tracking according to the present invention.
[0022] Figure 2 This is a flowchart illustrating a road monitoring method based on multi-target detection and tracking according to the present invention.
[0023] Figure 3 This is a schematic diagram of the target detection and tracking structure in a road monitoring method based on multi-target detection and tracking according to the present invention.
[0024] Figure 4 This is the precision-recall curve after YOLOv8n training in a road monitoring method based on multi-target detection and tracking according to the present invention. Figure 5 This is a schematic diagram of the DeepSORT training convergence process in a road monitoring method based on multi-target detection and tracking according to the present invention. Figure 6 This is a schematic diagram of the front-end display module displaying real-time monitoring images in a road monitoring system based on multi-target detection and tracking according to the present invention.
[0025] Figure 7 This is a schematic diagram illustrating the statistics of speeding vehicles in a road monitoring system based on multi-target detection and tracking according to the present invention.
[0026] Figure 8 This is a schematic diagram illustrating vehicle and pedestrian traffic statistics in a road monitoring system based on multi-target detection and tracking, as described in this invention. Detailed Implementation
[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] It should be noted that when a component is described as "fixed to" another component, it can be directly on the other component or may have a component in between. When a component is considered "connected to" another component, it can be directly connected to the other component or may have a component in between. When a component is considered "set on" another component, it can be directly set on the other component or may have a component in between. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0030] This invention discloses a road monitoring system based on multi-target detection and tracking. The system's overall architecture employs a front-end / back-end separation design. The back-end, built using the FastAPI framework, is primarily responsible for processing video stream data and loading and running the YOLOv8n target detection model and the DeepSORT target tracking model to perform real-time analysis and processing of the video stream. The front-end, implemented using the Vue.js framework, establishes a persistent connection with the back-end via the WebSocket protocol, thereby receiving detection results from the back-end in real time and updating the displayed content on the page, including real-time display of the video stream, display of target speed information, and annotation of speeding targets, for example... Figure 7 Displaying statistical images of speeding vehicles over a certain time period and Figure 8 Displaying a screen showing statistics on vehicle and pedestrian traffic.
[0031] like Figure 1 As shown, the system includes: The data acquisition module is a camera. This camera needs to have high resolution and high frame rate, and the installation position should be appropriate and the shooting angle should be adjusted to ensure that clear and complete road video data is captured for real-time acquisition of road video data. The data processing module has a built-in data preprocessing strategy to preprocess the acquired video data. This module is used to improve the quality of the input data and reduce the interference of noise and invalid information on subsequent model processing. The object detection module has a built-in YOLOv8n model for object detection on preprocessed video data. The target tracking module has a built-in DeepSORT algorithm framework, which assigns a corresponding tracking ID to each detected target and tracks it continuously. The speed calculation and flow detection module is used to calculate the target speed and obtain the target flow. The system also includes a data storage module, which is used to classify and store data. Specifically, it stores data of corresponding types according to target category, target movement trajectory, target quantity, and target violation statistics. Among them, the target category data table stores information such as target ID, category code, and category name. The target ID is consistent with the tracking ID to ensure data association. The target movement trajectory stores information such as the timestamp, center point coordinates, bounding box coordinates, and confidence level of each frame of the tracking ID, which is used to support the retrospective tracking of the target movement trajectory. The target quantity stores summary data such as traffic flow, pedestrian flow, and average speed in the statistical area during the statistical time period. The target violation statistics store information such as the violation type, violation time, violation location, and speed data of the tracking ID.
[0032] The system also includes a front-end display module, which is built on the Vue.js framework and features a responsive user interface. This module displays the processed monitoring footage and various traffic statistics in real time, marks the violations, and presents the traffic monitoring data in a visually intuitive chart format to facilitate traffic management personnel in quickly viewing and processing the violations.
[0033] like Figure 2 As shown, the present invention also provides a monitoring method adapted to the above-mentioned monitoring system, the specific content of which is as follows: The first step is data acquisition, which uses high-resolution and high-frame-rate cameras. The cameras need to be pre-installed at appropriate locations and angles on the road to ensure that clear and complete road video data can be captured. The acquired data set is then used to build a training dataset. The acquired video data undergoes preprocessing in the data processing module using a preprocessing strategy. The specific processing steps are as follows: Video frame extraction is performed on video data using either the equal-time frame extraction method or the motion detection-based frame extraction method to obtain keyframe images. It should be noted that the equal-time frame extraction method extracts image frames from the video stream at fixed time intervals, such as one frame every 0.1 seconds, which is suitable for regular road conditions with stable traffic flow. The motion detection-based frame extraction method detects whether there is target motion in the video frames. If there is, the frame extraction frequency is increased; if not, the frame extraction frequency is decreased. For example, one frame is extracted every 0.05 seconds when vehicle or pedestrian motion is detected, and one frame is extracted every 0.5 seconds when there is no motion. This method is suitable for scenarios with large fluctuations in traffic flow. Then, each frame of video image after frame extraction is subjected to blur removal and low-quality image removal operations. Specifically, the image sharpness evaluation algorithm is used to determine whether the image is blurry. For example, the Laplacian variance of the image is calculated. When the variance value is lower than a preset threshold, which can be set to 30, the image can be identified as blurry and removed. At the same time, low-quality images caused by excessively dark or bright light or occlusion also need to be removed. Finally, data augmentation operations are performed on the remaining video frames using rotation, translation, and misplacement to obtain preprocessed video data. Rotation involves rotating the image by preset angles such as 90, 180, or 270 degrees; translation involves moving the image horizontally or vertically by preset pixel values, such as 10 pixels; and misplacement involves stretching or compressing portions of the image by preset proportions, such as 10%. These preprocessing operations improve data quality to better suit model input requirements and reduce the impact of noise and low-quality data on detection accuracy.
[0034] The preprocessed image data is input into the YOLOv8n model of the object detection module to obtain the target information detected in the image. The target information includes the target category, target location, and confidence level. The YOLOv8n model is a lightweight version of the YOLO series of object detection algorithms, which balances detection speed and accuracy. It can parse and process the raw data, complete the detection of each frame of video image, identify vehicle and pedestrian targets in the image, and represent the position of the target in the image in the form of a two-dimensional bounding box. By defining the bounding box, the standardization of computer vision target localization is completed, ensuring the universality and computability of the position data. The bounding box (x1, y1, x2, y2) for each target can be obtained, where (x1, y1) are the pixel coordinates of the upper left corner of the bounding box, and (x2, y2) are the pixel coordinates of the lower right corner of the bounding box. At the same time, the model also outputs the category ID and confidence score of the target information. The category ID is a numerical code used to distinguish between vehicles and pedestrians, for example, the vehicle category is encoded as 0 and the pedestrian category is encoded as 1. The confidence score is a value between 0 and 1, used to characterize the reliability of the model's detection results. The closer the value is to 1, the more reliable the detection result is.
[0035] The detected target information is then passed to the target tracking module, specifically to the DeepSORT algorithm framework built into the target tracking module. The DeepSORT algorithm framework includes a ReID model for extracting appearance features, a Kalman filter algorithm, and a data association algorithm to realize a multi-target tracking model. It associates targets through appearance features and motion models. Appearance features refer to the visual characteristics of the target image, such as the color and shape of a vehicle; the height and clothing of a pedestrian, etc. The motion model is a model that predicts the current motion state based on the target's historical motion state. This model assigns a unique tracking ID to each target and continuously updates the target's state, thereby achieving stable tracking of multiple targets on the time axis and effectively solving the problems of tracking interruption or target confusion in scenarios such as target occlusion, rapid movement, and lane changes.
[0036] like Figure 3The diagram illustrates the target detection and tracking process. First, based on the target trajectory already established in the system, which includes the target's position in historical frames and historical motion information such as calculated speed and direction, the Kalman filter algorithm is used to predict the motion state of each trajectory in the next frame. The predicted bounding box position of the trajectory in the next frame is output, and each trajectory is marked as either confirmed or unconfirmed. The purpose is to lock the approximate position of the target in the new frame in advance, reduce the matching range of the subsequently detected bounding boxes and trajectories, and improve matching efficiency. Furthermore, for a new frame of video image, the YOLOv8n model is first used to perform object detection, outputting the detection boxes of all objects, including bounding box coordinates, vehicle or pedestrian categories, and confidence scores. Then, based on the bounding box coordinates of the objects, the region of each candidate object is cropped from the image, and feature extraction is performed on the cropped object image. Specifically, the target feature vector of each object is extracted, that is, the identity features of the object, such as the appearance, color, and model features of vehicles, and the clothing and body features of pedestrians, so as to assign a unique identifier to different objects. The process then proceeds to cascaded matching, which involves two main steps to filter the trajectory and detection box. The first step is to filter candidate pairs for motion state matching by calculating the Mahalanobis distance. Based on the trajectory prediction state output by the Kalman filter and the actual position of the detection box, the Mahalanobis distance between the detection box and the trajectory prediction box is calculated. The Mahalanobis distance is an indicator that measures the similarity of two objects in motion state. The smaller the distance, the closer the actual position of the detection box is to the predicted position of the trajectory, and the more matched their motion states are. By setting a Mahalanobis distance threshold, candidate trajectory-detection pairs with matching motion features are initially selected, while invalid matches with excessively large differences in motion state are excluded. The second step is to filter the final pairs of identity feature matching by calculating cosine similarity. For the trajectory-detection candidate pairs selected in the first step, the cosine similarity between the feature vector of the detection box and the mean of the feature vectors in the trajectory feature library is further calculated. The trajectory feature library stores the target feature vectors of all past frames of the trajectory, and the mean is taken as the core identity feature of the trajectory. The cosine similarity value ranges from 0 to 1. The closer the value is to 1, the more similar the identity features of the detection box target and the trajectory target are, and the higher the probability that they are the same target. By setting a cosine similarity threshold, the trajectory-detection pairs that match both motion state and identity features are finally selected, completing the core target association. For trajectories and detection boxes that still do not match after cascade matching, further supplementary association is performed through IOU matching. The intersection-union ratio between the unmatched detection box and the unmatched trajectory prediction box is calculated, which is the IOU. The intersection-union ratio is an indicator that measures the degree of overlap between the positions of two boxes. The higher the degree of overlap, the larger the IOU value. By setting an IOU threshold, trajectory detection pairs with highly overlapping positions are filtered out to complete the supplementary matching. After completing cascading matching and IOU matching, the three different results—successful matching, no matching of detection boxes, and no matching of trajectories—are processed separately as follows: For a successfully matched trajectory-detection pair, a Kalman filter update is performed. The actual position of the detection box is used to correct the previous prediction error of the Kalman filter. At the same time, the motion state of the trajectory is updated, and the feature vector extracted from the detection box is added to the feature library of the trajectory. The mean of the feature library is updated to improve the identity information of the target and make the identity features of the trajectory more consistent with the current appearance of the target. An unmatched detection box indicates that the target corresponding to the detection box is a newly entered target in the monitoring area. At this time, a new target trajectory is generated for the detection box and the trajectory is marked as unconfirmed. At the same time, the feature vector of the detection box is used as the initial data of the new trajectory feature library. An unmatched trajectory indicates that the target corresponding to the trajectory is temporarily mismatched, such as the target being heavily obscured or temporarily leaving the monitoring area. The model accumulates one unmatch count for it. If the number of unmatches exceeds a preset threshold, the trajectory is determined to be an invalid trajectory and deleted from the trajectory database to avoid invalid trajectories occupying system resources and to prevent invalid trajectories from interfering with subsequent matching.
[0037] In addition, to ensure that the model is adapted to the road monitoring scenario, the YOLOv8n model and the ReID model in the DeepSORT algorithm framework are trained using the dataset constructed through the data acquisition steps. The data used for training is a preprocessed dataset, which can be a public dataset of road monitoring or a self-built dataset. The data in the dataset needs to be preprocessed, and the input to the YOLOv8n model is adjusted to a size of 640×640 pixels, and the input to the ReID model is adjusted to a size of 256×128 pixels. The YOLOv8n model was trained using stochastic gradient descent with an initial learning rate of 0.01. After multiple training epochs, precision, recall, and mean AP were calculated after each epoch. Figure 4 The precision-recall curves of the YOLOv8n model after training are shown. Through multiple rounds of training, the model has achieved stable detection performance. The MobileNetV2 lightweight network was used as the backbone network to train the ReID model for target identity feature extraction within the DeepSORT algorithm framework. The training optimizer employed stochastic gradient descent with an initial learning rate of 0.01. The training dataset consisted of labeled pedestrian and vehicle tracking datasets. After multiple training rounds, the loss and Top-1 error rate (top1err) were calculated after each round. The final result is shown below. Figure 5The model convergence curve is shown.
[0038] Traffic flow calculation is based on target detection and target tracking. When traversing the detection results of each frame, pedestrians and vehicles are distinguished by category ID, and the number of different categories of targets is counted according to the corresponding tracking ID to avoid the same target being counted repeatedly, thereby obtaining the traffic flow and pedestrian flow. Among them, traffic flow refers to the number of vehicles passing through a certain road section per unit time; pedestrian flow refers to the number of pedestrians passing through a certain road section per unit time.
[0039] Furthermore, the speed measurement of pedestrians and vehicles is achieved by calculating the displacement of the corresponding targets in consecutive frames. First, the bounding box (x1, y1, x2, y2) of each target in each frame is output based on the YOLOv8n model. Then, the center point position (center_x, center_y) of the target is calculated. Calculating the center position is for computational simplicity and can accurately represent the core position of the target. Moreover, compared with displacement calculation based on arbitrary vertices of the bounding box, the error is smaller. The calculation formula is: center_x=x1+x22, center_y=y1+y22; Where center_x represents the horizontal pixel coordinate of the target center point; center_y represents the vertical pixel coordinate of the target center point; x1 represents the horizontal pixel coordinate of the upper left corner of the bounding box; y1 represents the vertical pixel coordinate of the upper left corner of the bounding box; x2 represents the horizontal pixel coordinate of the lower right corner of the bounding box; y2 represents the vertical pixel coordinate of the lower right corner of the bounding box; and x1, y1, x2, y2 are consistent with the above.
[0040] In this system, the center point position of each target is associated with and stored with the target's tracking ID. Then, the change in pixel position of the same target between adjacent frames is calculated. The center position of the target in the previous frame is (center_x1, center_y1), and the center position in the current frame is (center_x2, center_y2). Therefore, the change in pixel position of the target in adjacent frames can be obtained as follows: distance=center_x2 cneter_x12+center_y2 center_y12, Where center_x1 represents the horizontal pixel coordinate of the center point of the target in the previous frame, center_y1 represents the vertical pixel coordinate of the center point of the target in the previous frame; center_x2 represents the horizontal pixel coordinate of the center point of the target in the current frame, and center_y2 represents the vertical pixel coordinate of the center point of the target in the current frame. The formula for pixel displacement change takes into account bidirectional displacement along the X and Y axes, which better matches the actual movement trajectory of the target.
[0041] Then, the pixel distance is converted into actual speed, and this needs to be combined with the video's frame rate and the conversion ratio from pixels to actual distance. The formula for calculating the target velocity is: speed=distance×scale×3.6×fps; Where distance is the change in the pixel position of the target in adjacent frames, in pixels; scale is the conversion ratio from pixel to real distance, in meters per pixel, that is, the real physical distance corresponding to 1 pixel; fps is the frame rate of the video data, in frames per second, that is, the number of frames contained in the video per second; and 3.6 in the formula is a unit conversion factor used to convert meters per second to kilometers per hour. In practical applications, the speed calculation and traffic flow detection module calculates the speed of each target based on the center point position of consecutive frames associated with the tracking ID. Simultaneously, it calculates the vehicle and pedestrian traffic flow per unit time. Assuming the speed limit on the main road is 80 km / h, once the target speed of each detected target is obtained using the target speed calculation formula, if a vehicle's speed exceeds 80 km / h, the system determines it as a speeding violation. The data storage module categorizes and stores the vehicle's type, trajectory, speed data, and violation information. The front-end display module displays the monitoring footage in real time, marking the speeding vehicle with a red box and displaying its speed information. Figure 8 As shown; Meanwhile, the traffic flow trend of the road section within 1 hour is displayed in the form of a line graph, and the number of speeding violations in different time periods is displayed in the form of a bar chart. Traffic management personnel can intuitively grasp the road traffic conditions through the front-end interface, deal with speeding violations in a timely manner, and also carry out traffic scheduling based on traffic flow data to alleviate traffic congestion.
[0042] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principle of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A road monitoring method based on multi-target detection and tracking, characterized in that, Includes the following steps: The data acquisition process involves collecting real-time video data of the road and constructing a training dataset. The target information acquisition step involves inputting the video data into the YOLOv8n model to obtain the target information detected in the image. The target information includes the target category, target location, and confidence level. The target motion trajectory acquisition step involves transmitting the target information to the DeepSORT algorithm framework. The DeepSORT algorithm framework assigns a corresponding and unique tracking ID to each target and continuously tracks the target through the tracking ID to obtain the target motion trajectory. The target velocity calculation step involves obtaining the displacement change between consecutive frames of the same target from the target motion trajectory, and calculating the target velocity based on the displacement change.
2. The road monitoring method based on multi-target detection and tracking according to claim 1, characterized in that, The target information acquisition step includes a target location identification strategy, specifically: The YOLOv8n model detects each frame of video image in the video data and represents the position of the target in the image in the form of a two-dimensional bounding box, obtaining the bounding box (x1, y1, x2, y2) of each target, where (x1, y1) is the pixel coordinate of the upper left corner of the bounding box and (x2, y2) is the pixel coordinate of the lower right corner of the bounding box.
3. The road monitoring method based on multi-target detection and tracking according to claim 2, characterized in that, The target categories include vehicles and pedestrians.
4. The road monitoring method based on multi-target detection and tracking according to claim 3, characterized in that, The specific steps for calculating the target velocity are as follows: In each frame of the video image, the center position (center_x, center_y) of the target is calculated. The calculation formula is: center_x=x1+x22, center_y=y1+y22; To obtain the pixel position change of the same target between adjacent frames in consecutive frames, where the center position of the target in the previous frame is (center_x1, center_y1) and the center position in the current frame is (center_x2, center_y2), the pixel position change between adjacent frames can be obtained as follows: distance=center_x2 cneter_x12+center_y2 center_y12; The target velocity is obtained by converting the change in pixel position using the following formula: speed=distance×scale×3.6×fps; Where scale is the conversion ratio from pixel to actual distance; fps is the frame rate of the video data.
5. The road monitoring method based on multi-target detection and tracking according to claim 1, characterized in that, The data acquisition step includes a data preprocessing strategy, specifically comprising: The video frame extraction operation is completed by using the equal-time frame extraction method or the motion detection-based frame extraction method. Perform blur removal and low-quality image removal operations on each frame of video data that has undergone frame extraction processing; The remaining video frames are augmented through rotation, translation, and misplacement to obtain preprocessed video data.
6. A system applicable to the road monitoring method based on multi-target detection and tracking as described in any one of claims 1-6, characterized in that, The system includes: The data acquisition module is a camera that collects video data of the road in real time. The data processing module has a built-in data preprocessing strategy to preprocess the acquired video data. The target detection module has a built-in YOLOv8n model for target detection on preprocessed video data. The target tracking module has a built-in DeepSORT algorithm framework, which assigns a corresponding tracking ID to each detected target and tracks it continuously. A speed calculation and flow detection module is used to calculate the target speed and obtain the target flow.
7. A road monitoring system based on multi-target detection and tracking according to claim 6, characterized in that, The system also includes a data storage module, which is used to classify and store data, specifically according to target category, target movement trajectory, target quantity, and target violation statistics category.
8. A road monitoring system based on multi-target detection and tracking according to claim 6, characterized in that, The system also includes a front-end display module, which constructs a front-end interface and displays the processed monitoring images and various traffic statistics in real time through the front-end interface, marks the targets of violations, and presents the traffic monitoring data intuitively in the form of charts.