Automobile long-distance speed identification and tracking method based on target detection
By combining deep learning and time series modeling, the problem of discontinuous speed calculation under vehicle occlusion and lighting changes in video speed measurement technology is solved, achieving high-precision long-distance vehicle tracking and speed estimation, which is applicable to video surveillance and autonomous driving.
Patent Information
- Application Number
- CN202511759489.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-06
AI Technical Summary
Existing video speed measurement technologies cannot correctly correlate target trajectories when vehicles obstruct or lighting changes, resulting in discontinuous speed calculations. They also require precise camera calibration, leading to high deployment complexity and low speed detection accuracy at low frame rates.
We employ a deep learning-based object detection method combined with time series modeling. By using a pre-trained YOLOv12 model and Kalman filtering, we can directly estimate the velocity in the image pixel space, reducing the dependence on camera parameter calibration. We also introduce a time series deep learning model for dynamic correction.
It significantly improves the accuracy and adaptability of speed estimation, reduces the dependence on camera calibration, and is suitable for long-distance vehicle tracking and speed estimation in video surveillance and autonomous driving scenarios.
Smart Images

Figure CN121482728A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision and deep learning, and particularly relates to a vehicle long-distance speed recognition and tracking method based on target detection. BACKGROUND
[0002] The vehicle speed measurement system is widely used in road monitoring and automatic driving. The existing vehicle speed measurement methods are mainly divided into two categories: one is to rely on hardware for speed measurement, such as radar speed measurement; and the other is to analyze and measure speed through the video pictures, such as DeepSORT algorithm and TrackRNN algorithm.
[0003] Compared with the visual speed measurement scheme, the speed measurement based on special hardware has higher system integration complexity due to the need of additional integration of sensor modules, thereby causing the increase of equipment cost and later operation and maintenance cost, so the video speed measurement is the trend of the future. However, the video speed measurement technology also has a series of problems. When the vehicle is blocked for several frames, such as being blocked by a large vehicle or light transients, the system may not correctly associate the target trajectory, resulting in ID switching or detection interruption, the speed calculation will be zero or jump, and the speed mutation that does not conform to the physical law appears, which affects the data continuity and reliability. The video speed measurement usually needs to calibrate the camera on site, including the accurate measurement of the installation height, the pitch angle, the focal length and other information. If the camera moves or the viewing angle is adjusted, it also needs to be recalibrated, which increases the deployment complexity. The speed measurement calculation is based on the inter-frame displacement, when the frame rate is low, the target moves a large distance in the adjacent frames, and the speed detection accuracy is low, and the speed change trend is difficult to capture due to the decrease of the sampling frequency.
[0004] Therefore, it is necessary to invent an anti-interference video speed measurement algorithm, which has important application value. SUMMARY
[0005] The present application aims at the limitations of the prior art vehicle speed measurement, and provides a vehicle long-distance speed recognition and tracking method based on target detection. The present application is based on a deep learning algorithm, introduces time series modeling, effectively avoids the need for accurate calibration of camera parameters in traditional methods, directly realizes the mapping between pixel displacement and real physical speed in image pixel space, thereby significantly improving the accuracy and adaptability of speed estimation, and is suitable for vehicle long-distance continuous tracking and speed estimation in video monitoring and automatic driving scenes.
[0006] The purpose of the present application is achieved by the following technical scheme: a vehicle long-distance speed recognition and tracking method based on target detection, comprising the following steps: Step 1, real-time acquisition of vehicle driving video by fixing the position and angle, identification of vehicles in each frame image of the driving video by using a pre-trained target detection model, extraction of the center coordinates of the detection box as the geometric center of the vehicle image, and obtaining the position change information of the vehicle in consecutive frames; Step 2, combining the historical position information of the vehicle, using the inter-frame difference method to preliminarily estimate the speed of the vehicle, obtaining a preliminary speed estimate, further obtaining a constrained speed estimate by constraining the speed change rate, and using Kalman filtering to correct the time sequence, obtaining a corrected speed estimate; Step 3, based on the position change information of the vehicle in consecutive frames, calculating the displacement in the horizontal and vertical directions and the motion deflection angle between the current frame and the previous frame, and integrating the corrected speed estimate into time sequence input features; Step 4, inputting the time sequence input features into the trained time sequence deep learning model, dynamically correcting the corrected speed estimate by learning historical motion features, and obtaining a final speed estimate.
[0007] Further, the pre-trained target detection model is specifically obtained by the following method: First, images of vehicles in traffic environments under different weather, different light, different speed and different angle are obtained, and the images are enhanced by multiple data enhancement methods, and the vehicle targets in the enhanced images are annotated by boundary boxes with the help of an open-source annotation tool, to construct a single-class vehicle target detection dataset with high annotation accuracy; Then, YOLOv12 is selected as the target detection model, the input of which is an image, and the output of which is the vehicle class probability, confidence and detection box; Secondly, the single-class vehicle target detection dataset is used to train YOLOv12, and the model parameters of YOLOv12 are adjusted to minimize the total loss function as the optimization objective during the training process, to obtain the trained YOLOv12; Finally, the ByTrack attention mechanism is added after the detection head output of the trained YOLOv12, as the pre-trained target detection model.
[0008] Further, the data enhancement method includes brightness disturbance, blur interference and noise disturbance.
[0009] Further, the training of YOLOv12 using the single-class vehicle target detection dataset specifically includes: The image in the single-class vehicle target detection data set is input into the YOLOv12 to obtain a vehicle category probability, a confidence and a detection frame; a classification loss is calculated based on the vehicle category probability and a real category corresponding to the image, a bounding box regression loss is calculated based on the detection frame and a bounding box label corresponding to the image in the single-class vehicle target detection data set, and a total loss function of the target detection model is obtained according to the classification loss and the bounding box regression loss; the model parameters of the YOLOv12 are adjusted by using the AdamW optimizer and the cosine annealing learning rate scheduler through the back propagation method until a preset training round is reached, so as to obtain the trained YOLOv12.
[0010] Further, the historical position information of the vehicle is combined, and the frame difference method is used to preliminarily estimate the speed of the vehicle to obtain a preliminary speed estimation value, specifically including: Based on the position change information of the vehicle in the continuous frames, i.e., the vehicle position sequence obtained in step 1 , the frame difference method is used to calculate the pixel displacement amount of the vehicle between adjacent frames; the pixel displacement amount is converted into a preliminary speed estimation value according to a conversion coefficient of pixels and actual distance , which is expressed as: In the formula, represents the preliminary speed estimation value at time t; represents the conversion coefficient at time t, which is obtained by calculating the ratio between the average height H of the real vehicle and the height of the target detection frame; represents the pixel displacement amount between adjacent frames at time t, , represents the horizontal coordinate and the vertical coordinate of the vehicle position at time t of the video frame; represents the time interval corresponding to the video frame rate.
[0011] Further, the speed estimation value after constraint is obtained by constraining the speed change rate, and the Kalman filtering method is used to correct the speed estimation value in time sequence to obtain a corrected speed estimation value, specifically including: First, the speed change rate is constrained, and the preliminary speed estimation value is automatically cropped according to the following formula to make the speed change rate less than or equal to a preset maximum acceleration threshold: In the formula, represents the speed estimation value after constraint, represents the speed change rate, , represents the preset maximum acceleration threshold; Then the Kalman filter is used to correct the constrained speed estimation value in time sequence, and the constrained speed estimation value as a new speed observation value input for each frame , the Kalman filter updates as follows: Prediction stage: ; Correction stage: ; In the formula, , indicates the state vector, and respectively indicate the speed and acceleration of the vehicle at the current time t; , indicates the Kalman state transition matrix, , indicates the observation matrix; , indicates the Kalman gain, which is calculated from the system noise covariance and the observation noise covariance ; The first component of the final Kalman filtered state vector is the corrected speed estimation value .
[0012] Further, in step 3, the time series input feature is represented as: , wherein , indicates the time series input feature at time t, and respectively indicate the displacement increment in the x direction and the y direction of the adjacent frames at time t, , indicates the pixel displacement between the adjacent frames at time t, and respectively indicate the sine value and the cosine value of the motion deflection angle at time t, , indicates the corrected speed estimation value.
[0013] Further, the time series deep learning model includes a feature transformation layer, a time series modeling layer, and a nonlinear correction layer, wherein the feature transformation layer adopts a fully connected network to map the time series input feature input to the time series deep learning model to a high-dimensional representation space; the time series modeling layer adopts a single-layer long short-term memory unit to model the time dependence of the feature sequence output by the feature transformation layer; the nonlinear correction layer is used to convert the output of the time series modeling layer through nonlinear mapping to the final speed estimation value, to realize dynamic correction of the corrected speed estimation value.
[0014] Further, the trained time series deep learning model is obtained by the following method: Based on the collected vehicle driving video and the corresponding real observation speed, a training data set is constructed; Based on the videos in the training data set, the corresponding final speed estimation value is obtained through steps 1-3 above; The final speed estimation value is supervised trained with the real observed speed by using the SmoothL1 loss function, and an acceleration regularization term is introduced to obtain the total loss function of the time series deep learning model; Taking minimizing the total loss function of the time series deep learning model as the optimization goal, the AdamW optimizer and the cosine annealing learning rate scheduler are used to adjust the parameters of the time series deep learning model until the preset training round is reached, and the trained time series deep learning model is obtained.
[0015] Compared with the prior art, the beneficial effects of the present application are: (1) The present application breaks through the restriction of camera calibration and is more flexible in deployment; the "FC-LSTM-CorrNet" network structure proposed by the present application combines the feature transformation capability of the fully connected network with the time series modeling advantage of the LSTM, establishes the mapping relationship between the pixel displacement and the speed, significantly reduces the dependence on the physical space calibration, and has stronger actual deployment adaptability.
[0016] (2) The present application combines deep detection and time series learning, and can accurately model dynamic trajectories; the present application first organically fuses YOLOv12 and LSTM architecture, introduces motion direction, deflection angle, preliminary speed estimation and other features, forms multi-dimensional time series input, improves the perception ability of the model to the motion trend, and is especially suitable for vehicle tracking and speed measurement tasks in long-distance and low-resolution scenes, and significantly improves the accuracy and adaptability of speed estimation. BRIEF DESCRIPTION OF DRAWINGS
[0017] Figure 1 is the flowchart of the vehicle long-distance speed recognition and tracking method based on target detection of the present application; Figure 2 is a network structure schematic diagram of the A2C2f module of the present application; Figure 3 is a training result diagram of YOLOv12 of the present application; Figure 4 is a comparison diagram of speed prediction and preliminary prediction speed, real observed speed of the time series deep learning model of the present application. DETAILED DESCRIPTION
[0018] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, like reference numerals refer to like elements throughout the description. The following exemplary embodiments described therein represent illustrations only of aspects of the present application. Therefore, no limitation is to be inferred internal the scope of the present application with respect to a particular embodiment described herein. Rather, the exemplary embodiments are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the appended claims.
[0019] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0020] It is to be understood that the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. It is to be further understood that the terms "comprise," "comprises," and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It is to be further understood that the term "comprising" as used in this specification, is intended to indicate the presence of one or more features, integers, steps, operations, elements, components, and / or groups thereof, but not to preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0021] The present application will be described in detail below with reference to the attached drawings. The features of the embodiments and implementation described below can be combined with each other, without conflict.
[0022] The present application provides a vehicle long-distance speed recognition and tracking method based on target detection, which is suitable for fixed angle video monitoring or vehicle-mounted camera scene, such as Figure 1 As shown in the figure, the method specifically comprises the following steps: Step 1, real-time acquisition of vehicle driving video through fixed position and angle, identification of vehicles in each frame image of driving video by using pre-trained target detection model, extraction of detection box center coordinates as vehicle image geometric center, and acquisition of vehicle position change information in continuous frames.
[0023] In this embodiment, the pre-trained target detection model is obtained through the following steps: Step 1.1: First, select typical urban roads and highway scenes, and use cameras to capture images of cars in traffic environments under different weather conditions, lighting conditions, vehicle speeds, and angles (such as front, side, and turning angles). Then, enhance the images using various enhancement methods and use open-source annotation tools such as LabelImg to annotate the bounding boxes of vehicle targets in the enhanced images to construct a single-class car target detection dataset with high annotation accuracy.
[0024] Data augmentation methods include brightness perturbation, blur interference, and noise perturbation.
[0025] It should be noted that this single-class vehicle target detection dataset is used for customized training of target detection models. It not only covers different climates, lighting, vehicle speeds and angles during the data collection process, but also introduces enhancement methods such as brightness perturbation, blur interference and noise perturbation in the image quality dimension to ensure the stable operation of the target detection model. This can improve the adaptability of the target detection model to real complex environments, expand the original dataset, and increase the training samples for subsequent target detection models.
[0026] Step 1.2: To improve the accuracy and real-time performance of the model in obtaining the geometric center coordinates of the car, the existing YOLOv12 is selected as the object detection model. Its input is an image, and its output is the car category probability, confidence score, and detection box. YOLOv12 is a publicly available object detection model; its network structure will not be detailed here, but it includes an A2C2f module. The structure of the A2C2f module is as follows... Figure 2 As shown, it specifically includes convolutional layers, an Ablock module, and a stitching layer. The Ablock module contains region attention A2 and convolutional layers. From Figure 2 As can be seen, the A2C2f module introduces a residual shortcut connection from input to output, which ensures the gradient stability of YOLOv12, enabling the object detection model to converge effectively even in complex scenarios. At the same time, YOLOv12 uses only one convolutional layer to compress the input channels to a uniform dimension at once, eliminating redundant splitting operations. This results in a simultaneous decrease in the number of parameters, memory usage, and floating-point operations (FLOPs), thereby effectively reducing inference latency.
[0027] Step 1.3: Train YOLOv12 using a single-class car target detection dataset. During training, minimize the total loss function as the optimization objective and adjust the YOLOv12 model parameters to obtain a well-trained YOLOv12.
[0028] Specifically, images from a single-class car target detection dataset are input into YOLOv12 to obtain car category probabilities, confidence scores, and detection boxes. Classification loss is calculated based on the car category probability and the corresponding ground truth class of the image. Boundary box regression loss is obtained by calculating the intersection-union ratio (IU / R) based on the detection boxes and the corresponding bounding box labels in the single-class car target detection dataset. The total loss function of the target detection model is obtained based on the classification loss and the bounding box regression loss. With minimizing the total loss function of the target detection model as the optimization objective, the AdamW optimizer and a cosine annealing learning rate scheduler (initial learning rate can be set to 0.01, number of iterations can be set to 500, batch size can be set to 32) are used to adjust the YOLOv12 model parameters through backpropagation until the preset number of training epochs is reached, thus obtaining a trained YOLOv12.
[0029] It should be understood that using the AdamW optimizer and cosine annealing learning rate scheduler can accelerate the convergence speed of the YOLOv12 model, and the training results are as follows: Figure 3 As shown, when the confidence level reaches 0.973, the model accuracy reaches 1.0, which meets the requirements for efficient deployment of vehicle recognition in monitoring and intelligent driving scenarios.
[0030] Step 1.4: After the output of the trained YOLOv12 detection head, add the ByTrack attention mechanism as a pre-trained object detection model for subsequent inference. The addition of the ByTrack attention mechanism enhances the consistency of vehicle identity judgment between consecutive frames, enabling long-term vehicle tracking and preventing the vehicle from moving too fast and losing the target.
[0031] Furthermore, during the inference phase, the pre-trained target detection model is applied to driving videos captured from fixed camera positions, and real speed data recorded by speed sensors is used for comparison. A ByTrack mechanism is integrated during detection to continuously lock onto targets and prevent target loss due to occlusion or passing. The pre-trained target detection model is used to analyze the captured fixed-camera videos frame by frame, identifying vehicles in each frame to extract and locate the bounding boxes of cars in each frame, and accurately recording their geometric center coordinate sequences. In this process, the geometric center coordinates of the detection box are extracted frame by frame to construct a vehicle position sequence, which provides information on the vehicle's position changes in consecutive frames. This provides stable and consistent target position information input for the subsequent speed estimation stage, achieving accurate single-target detection of the vehicle. This represents the sequence of geometric center coordinates of the detection box, and also the sequence of vehicle positions. The x and y coordinates represent the vehicle's position at time t in video frame t, where T represents the total number of video frames.
[0032] Step 2: Combining the historical location information of the vehicle obtained in Step 1, the vehicle's speed is initially estimated using the inter-frame difference method (i.e., Euclidean distance divided by the time interval). Then, the speed estimate is obtained by constraining the rate of change of speed. Finally, the constrained speed estimate is corrected by using Kalman filtering to obtain the corrected speed estimate, making the obtained speed smoother.
[0033] Furthermore, combining the vehicle's historical location information, the inter-frame difference method is used to perform a preliminary speed estimation of the vehicle, obtaining a preliminary speed estimate. Specifically, this includes: based on the vehicle position sequence obtained in step 1... The inter-frame difference method is used to calculate the pixel displacement of the vehicle between adjacent frames; the pixel displacement is then converted into a preliminary speed estimate based on the conversion factor between the pixel and the actual distance. , is represented as: In the formula, This represents the initial velocity estimate at time t; The conversion factor at time t is calculated by comparing the average height H of the actual vehicle (H = 1.6m in this embodiment) with the height of the target detection box. The ratio between them is used to construct the conversion coefficient between pixels and actual distances. ; This represents the pixel displacement between adjacent frames at time t. , The x and y coordinates represent the vehicle's position at time t in video frame t; This represents the time interval corresponding to the video frame rate (in this embodiment, the frame rate is 60fps, then...). ).
[0034] Furthermore, by constraining the rate of change of velocity to obtain a constrained velocity estimate, a Kalman filter is used to perform time-series correction to obtain a corrected velocity estimate. Specifically, to prevent abnormal velocity transitions caused by factors such as occlusion and false detection, the system further constrains the rate of change of velocity. Specifically, the initial velocity estimate is automatically trimmed according to the following formula to ensure that the rate of change of velocity is less than or equal to a preset maximum acceleration threshold. : In the formula, This represents the constrained speed estimate. To represent the rate of change of velocity, it is required that... , The preset maximum acceleration threshold is used. Subsequently, to improve the stability and temporal continuity of the velocity estimation, a Kalman filter is introduced. The Kalman filter is used to perform temporal correction on the constrained velocity estimates, thus modifying the constrained velocity estimates. As a new velocity observation input for each frame ,Right now The Kalman filter is updated in the following two steps: ①Prediction phase: ; ② Correction stage: ; In the formula, Represents the state vector. and Let these represent the vehicle's velocity and acceleration at time t, respectively. Indicates the Kalman state transition moments, Represents the observation moments; The Kalman gain is expressed as a function of the system noise covariance. and observation noise covariance Calculated; This is the intermediate state vector, which has no practical meaning. The first component of the state vector after Kalman filtering. This is the corrected speed estimate. ,Right now This corrected velocity estimate serves as one of the input features for subsequent deep learning models. The first component of the final Kalman-filtered state vector... This is the corrected speed estimate. .
[0035] Step 3: Based on the vehicle position change information in consecutive frames obtained in Step 1, calculate the displacement in the horizontal and vertical directions and the motion deflection angle between the current frame and the previous frame, and integrate them with the corrected speed estimate obtained in Step 2 to form the time series input features.
[0036] Specifically, based on the vehicle's position change information in consecutive frames obtained in step 1, i.e., the vehicle position sequence The formulas for calculating the displacement increments in the horizontal and vertical directions and the sine and cosine values of the motion deflection angles of adjacent frames are as follows: In the formula, This represents the displacement increment in the x-direction between adjacent frames at time t. This represents the displacement increment in the y-direction between adjacent frames at time t. and Let x and y represent the x and y coordinates of the vehicle's position at time t in video frame t, respectively. and Let represent the sine and cosine values of the deflection angle at time t, respectively. To prevent the perturbation term introduced by division by zero, the displacement increments of adjacent frames in the horizontal and vertical directions obtained above are... and and the sine of the deflection angle. Sum of cosine values Combined with time and the pixel displacement obtained in step 2 and the corrected speed estimate Finally, time series input features are constructed. This provides a stable and semantically rich input representation for subsequent velocity estimation.
[0037] Step 4: Input the time series input features obtained in Step 3 into the trained time series deep learning (Fully-Connected LSTM Correction Network, FC-LSTM-CorrNet) model. By learning historical motion features, the corrected velocity estimate is dynamically corrected to obtain a more accurate and precise final velocity estimate.
[0038] In this embodiment, the FC-LSTM-CorrNet model is a lightweight, high-precision temporal learning network that integrates fully connected feature maps and the sequence modeling capabilities of Long Short-Term Memory (LSTM) units. Leveraging its ability to model temporal patterns of motion trajectories, the aim is to use the trained FC-LSTM-CorrNet model to refine the initial velocity estimation results (i.e., the corrected velocity estimate obtained in step 2). Dynamic correction is performed to achieve high-precision speed identification and output a more accurate final speed estimate.
[0039] Specifically, the FC-LSTM-CorrNet model comprises three layers: a feature transformation layer, a temporal modeling layer, and a nonlinear correction layer. The feature transformation layer uses a fully connected network to map the time-series input features to the FC-LSTM-CorrNet model to a high-dimensional representation space, as shown below: In the formula, This represents the output of the feature transformation layer. , Representing the time series input features, , This represents the weight matrix of the feature transformation layer. , This represents the bias vector of the feature transformation layer. This represents the ReLU activation function. The temporal modeling layer uses a single-layer Long Short-Term Memory (LSTM) unit to model the temporal dependencies of the feature sequence output from the feature transformation layer, capturing the temporal dependency patterns of velocity changes, as shown below: In the formula, and Let these represent the hidden state and the memory state at time t, respectively, as output by the temporal modeling layer. This represents a Long Short-Term Memory (LSTM) unit. The nonlinear correction layer is used to convert the output of the timing modeling layer into a final velocity estimate through a nonlinear mapping, enabling dynamic correction of the corrected velocity estimate. This is represented as: In the formula, This represents the final velocity estimate after dynamic correction. This represents the weight matrix of the nonlinear correction layer. , This represents the bias vector of the nonlinear correction layer.
[0040] Furthermore, the trained FC-LSTM-CorrNet model is obtained through the following steps: Step 4.1: Construct a training dataset based on the collected car driving videos and the corresponding actual observed speeds.
[0041] Step 4.2: Based on the videos in the training dataset, obtain the corresponding final velocity estimates through steps 1-3 above. .
[0042] Step 4.3: Apply the SmoothL1 loss function to the final velocity estimate. Its corresponding actual observation speed Supervised training is performed, and a lightweight acceleration regularization term is introduced to obtain the total loss function of the FC-LSTM-CorrNet model, which is expressed as: In the formula, This represents the total loss function of the FC-LSTM-CorrNet model. Represents the SmoothL1 loss function. This represents the acceleration regularization term. This represents the error factor, used to balance the effects of velocity error and acceleration error. In this embodiment, Introducing the SmoothL1 loss function and acceleration regularization term can improve the speed smoothness, physical plausibility, and continuity of the FC-LSTM-CorrNet model across consecutive frames.
[0043] Step 4.4: With minimizing the total loss function of the FC-LSTM-CorrNet model as the optimization objective, the AdamW optimizer and cosine annealing learning rate scheduler are used to adjust the parameters of the FC-LSTM-CorrNet model until the preset number of training epochs is reached, such as 500 training epochs, to obtain the trained FC-LSTM-CorrNet model.
[0044] Furthermore, the sequence feature tensor captured in real time The input is fed into the FC-LSTM-CorrNet model to obtain the final velocity estimate after dynamic correction. Dynamically corrected velocity (i.e., final velocity estimate) ) and the initial predicted speed (i.e., the corrected speed estimate) A comparison chart of actual observed speeds is shown below. Figure 4 As shown.
[0045] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for long-distance vehicle speed recognition and tracking based on target detection, characterized in that, Includes the following steps: Step 1: Real-time acquisition of vehicle driving video using a fixed camera position and angle; identification of vehicles in each frame of the driving video using a pre-trained target detection model; extraction of the center coordinates of the detection box as the geometric center of the vehicle image; obtaining information on the positional changes of the vehicle in consecutive frames. Step 2: Combining the vehicle's historical location information, the inter-frame difference method is used to perform a preliminary speed estimation of the car to obtain a preliminary speed estimate. Then, the speed change rate is constrained to obtain a constrained speed estimate. Kalman filtering is used to perform time-series correction to obtain a corrected speed estimate. Step 3: Based on the vehicle's position change information in consecutive frames, calculate the displacement in the horizontal and vertical directions and the motion deflection angle between the current frame and the previous frame, and integrate them with the corrected speed estimate to form the time series input features. Step 4: Input the time series input features into the trained time series deep learning model, and dynamically correct the corrected velocity estimate by learning historical motion features to obtain the final velocity estimate.
2. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 1, characterized in that, The pre-trained target detection model is obtained through the following method: First, images of cars in traffic environments under different weather conditions, lighting conditions, vehicle speeds, and angles are acquired. Then, the images are enhanced using various data augmentation methods. Finally, bounding box annotations are added to the vehicle targets in the enhanced images using open-source annotation tools to construct a single-class car target detection dataset with high annotation accuracy. Then YOLOv12 was selected as the object detection model, with the image as input and the car category probability, confidence score and detection box as output. Secondly, YOLOv12 was trained using a single-class car target detection dataset. During the training process, the model parameters of YOLOv12 were adjusted with the goal of minimizing the total loss function in order to obtain a well-trained YOLOv12. Finally, a ByTrack attention mechanism is added after the output of the trained YOLOv12 detection head to serve as a pre-trained object detection model.
3. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 2, characterized in that, The data augmentation methods include brightness perturbation, blur interference, and noise perturbation.
4. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 3, characterized in that, The training of YOLOv12 using a single-class car target detection dataset specifically includes: Images from a single-class car target detection dataset are input into YOLOv12 to obtain car category probabilities, confidence scores, and bounding boxes. Classification loss is calculated based on the car category probability and the corresponding ground truth class of the image. Bounding box regression loss is obtained by calculating the intersection-union ratio (IU / U) based on the bounding box labels and the corresponding bounding box labels in the single-class car target detection dataset. The total loss function of the target detection model is obtained based on the classification loss and the bounding box regression loss. With minimizing the total loss function of the target detection model as the optimization objective, the AdamW optimizer and cosine annealing learning rate scheduler are used to adjust the YOLOv12 model parameters through backpropagation until a preset number of training epochs are reached, resulting in a trained YOLOv12.
5. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 1, characterized in that, The process involves combining the vehicle's historical location information with an inter-frame difference method to perform a preliminary speed estimate, yielding a preliminary speed estimate, specifically including: Based on the vehicle's position change information in consecutive frames obtained in step 1, i.e., the vehicle position sequence The inter-frame difference method is used to calculate the pixel displacement of the vehicle between adjacent frames; the pixel displacement is then converted into a preliminary speed estimate based on the conversion factor between the pixel and the actual distance. , represented as: In the formula, This represents the initial velocity estimate at time t; This represents the conversion factor at time t, calculated by comparing the average height H of the actual vehicle with the height of the target detection box. Obtaining the ratio between them; This represents the pixel displacement between adjacent frames at time t. , The x and y coordinates represent the vehicle's position at time t in video frame t; This indicates the time interval corresponding to the video frame rate.
6. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 1, characterized in that, The process of obtaining a constrained velocity estimate by imposing constraints on the rate of change of velocity, and then applying a Kalman filter to perform time-series correction on the estimate to obtain a corrected velocity estimate, specifically includes: First, the rate of change of velocity is constrained. Specifically, the preliminary velocity estimate is automatically cropped according to the following formula to ensure that the rate of change of velocity is less than or equal to a preset maximum acceleration threshold: In the formula, This represents the constrained speed estimate. Represents the rate of change of velocity. , This indicates the preset maximum acceleration threshold; Then, Kalman filtering is used to perform time-series correction on the constrained velocity estimates, and the constrained velocity estimates are... As a new velocity observation input for each frame The Kalman filter is updated in the following two stages: Prediction phase: ; Correction phase: ; In the formula, Represents the state vector. and Let these represent the vehicle's velocity and acceleration at time t, respectively. Indicates the Kalman state transition moments, Represents the observation moments; The Kalman gain is expressed as a function of the system noise covariance. and observation noise covariance Calculated; The first component of the final Kalman filtered state vector This is the corrected speed estimate. .
7. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 1, characterized in that, In step 3, the time series input features are represented as follows: ,in This represents the time series input features at time t. and Let represent the displacement increments in the x and y directions of adjacent frames at time t, respectively. This represents the pixel displacement between adjacent frames at time t. and Let represent the sine and cosine values of the deflection angle at time t, respectively. This represents the corrected speed estimate.
8. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 1, characterized in that, The time series deep learning model includes a feature transformation layer, a temporal modeling layer, and a nonlinear correction layer. The feature transformation layer uses a fully connected network to map the time series input features into the time series deep learning model to a high-dimensional representation space. The temporal modeling layer uses a single-layer long short-term memory unit to perform time dependency modeling on the feature sequence output by the feature transformation layer. The nonlinear correction layer is used to convert the output of the temporal modeling layer into the final velocity estimate through nonlinear mapping, so as to achieve dynamic correction of the corrected velocity estimate.
9. The method for long-distance vehicle speed recognition and tracking based on target detection according to claim 1, characterized in that, The trained time-series deep learning model is obtained through the following method: A training dataset is constructed based on the collected videos of vehicles driving and the corresponding actual observed speeds; Based on the videos in the training dataset, the corresponding final velocity estimates are obtained through steps 1-3 above. The SmoothL1 loss function is used to supervise the training of the final velocity estimate and its corresponding real observed velocity. At the same time, an acceleration regularization term is introduced to obtain the total loss function of the time series deep learning model. With minimizing the total loss function of the time series deep learning model as the optimization objective, the AdamW optimizer and cosine annealing learning rate scheduler are used to adjust the parameters of the time series deep learning model until the preset number of training rounds is reached, thus obtaining a well-trained time series deep learning model.
Citation Information
Patent Citations
Vehicle detection and tracking method for highway traffic monitoring scene
CN116453012A
Multi-target tracking method and system based on unscented Kalman filtering and long and short term memory fusion
CN117611627A
Multi-target tracking method based on weak clue and trajectory prediction
CN119904485A
Fusion optimization method and device based on Kalman filtering and LSTM cascade, and integrated navigation method and system
CN120628073A
Vehicle monitoring method based on frame difference and deep learning fusion
CN120823567A
Cited By
Engineering vehicle surface dirt identification method, identification device and cleaning system
CN121734315A
