A multi-target tracking method and device based on YOLOv12 and dynamic feature fusion

CN122597777APending Publication Date: 2026-08-18GUANGDONG POWER GRID CORP ZHAOQING POWER SUPPLY BUREAU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610860231.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-15
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0005]本发明提供了一种基于YOLOv12与动态特征融合的多目标追踪方法及装置,解决了现有的多目标追踪方法易出现特征失配与目标ID切换,导致后续检测与跟踪精度下降的技术问题

Benefits of technology

本发明的上述技术方案提供了一种基于YOLOv12与动态特征融合的多目标追踪方法,获取原始视频流中的连续视频帧像素矩阵,并对连续视频帧像素矩阵进行视频帧预处理,输出预处理后的高质量图像;采用预训练YOLOv12检测模型对预处理后的高质量图像进行目标检测,输出目标检测结果;对目标检测结果和预处理后的高质量图像进行多维度特征提取,输出外观特征向量和运动特征向量;对外观特征向量、运动特征向量和目标检测结果进行动态特征融合,输出融合特征向量;采用自适应卡尔曼滤波算法对目标检测结果和运动特征向量进行轨迹预测,输出目标未来帧预测位置和状态协方差矩阵;采用匈牙利算法对融合特征向量、目标未来帧预测位置和状态协方差矩阵进行目标关联与轨迹更新,输出多目标追踪结果;基于上述方案,本发明通过视频帧预处理优化目标检测的输入基础,依托预训练YOLOv12检测模型保障目标检测的有效性,通过多维度特征提取同时获取外观特征与运动特征以丰富目标特征维度,再结合目标检测结果实现外观特征与运动特征的动态特征融合,能够根据目标实际状态适配特征融合逻辑,从根本上避免固定融合方式引发的特征失配问题,进而杜绝因特征失配导致的目标ID切换情况,同时通过自适应卡尔曼滤波算法结合运动特征完成精准轨迹预测,提升轨迹预测的适配性与准确性,再配合匈牙利算法基于融合特征向量、目标未来帧预测位置和状态协方差矩阵完成目标关联与轨迹更新,保障目标追踪的连贯性与稳定性,大幅提升了多目标检测与跟踪的整体精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122597777A_ABST
    Figure CN122597777A_ABST
Patent Text Reader

Abstract

The application discloses a multi-target tracking method and device based on YOLOv12 and dynamic feature fusion, relates to the technical field of computer vision, and solves the technical problem that the existing multi-target tracking method is prone to feature mismatch and target ID switching, resulting in the decline of subsequent detection and tracking precision. The method comprises the following steps: obtaining a continuous video frame pixel matrix of an original video stream and preprocessing, and outputting a high-quality image; adopting a pre-trained YOLOv12 detection model to perform target detection and output a target detection result; extracting appearance and motion feature vectors from the target detection result and the preprocessed image, and obtaining a fusion feature vector through dynamic feature fusion; adopting an adaptive Kalman filtering algorithm to perform trajectory prediction and output a target future frame prediction position and a state covariance matrix; adopting a Hungarian algorithm to complete target association and trajectory updating, and output a multi-target tracking result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a multi-target tracking method and apparatus based on YOLOv12 and dynamic feature fusion. Background Technology

[0002] Multi-target tracking technology is a core application area in the field of computer vision. This technology achieves full-process tracking of the target's motion state by continuously locating and associating the trajectories of multiple targets in a video sequence. It has been widely used in various practical scenarios such as intelligent monitoring, traffic management, and drone inspection, and is a key technology supporting intelligent visual perception and dynamic target analysis.

[0003] Currently, the mainstream technical framework for multi-object tracking is "detection-association-tracking." The overall implementation logic involves first obtaining the target position through object detection algorithms, and then completing cross-frame tracking based on feature matching and trajectory prediction. The industry commonly uses the YOLO (You Only Look Once) series of detection models combined with the DeepSORT tracking framework (Simple Online and Realtime Tracking with a Deep Association Metric) to build tracking systems, and uses a fixed-weight feature fusion strategy to complete feature processing. However, this type of technical solution still has significant shortcomings in tracking performance when facing complex scenarios.

[0004] Existing multi-target tracking methods all adopt a fixed-weight feature fusion strategy, which does not dynamically adjust according to the target's occlusion degree, movement speed, and other real-time conditions. When appearance features fail in occluded scenarios or motion features fluctuate in high-speed motion scenarios, feature mismatch and target ID switching are likely to occur, leading to a decrease in subsequent detection and tracking accuracy. Summary of the Invention

[0005] This invention provides a multi-target tracking method and apparatus based on YOLOv12 and dynamic feature fusion, which solves the technical problem that existing multi-target tracking methods are prone to feature mismatch and target ID switching, leading to a decrease in subsequent detection and tracking accuracy.

[0006] The first aspect of this invention provides a multi-target tracking method based on YOLOv12 and dynamic feature fusion, comprising: Obtain the pixel matrix of consecutive video frames in the original video stream, perform video frame preprocessing on the pixel matrix of consecutive video frames, and output the preprocessed high-quality image. A pre-trained YOLOv12 detection model is used to perform target detection on the preprocessed high-quality image, and the target detection results are output. Multi-dimensional feature extraction is performed on the target detection results and the preprocessed high-quality image to output appearance feature vectors and motion feature vectors; Dynamic feature fusion is performed on the appearance feature vector, the motion feature vector, and the target detection result to output a fused feature vector; An adaptive Kalman filter algorithm is used to predict the trajectory of the target detection results and the motion feature vector, and the predicted position and state covariance matrix of the target in the future frame are output. The Hungarian algorithm is used to perform target association and trajectory update on the fused feature vector, the predicted position of the target in the future frame, and the state covariance matrix, and outputs multi-target tracking results.

[0007] Optionally, the step of performing video frame preprocessing on the pixel matrix of the consecutive video frames to output a preprocessed high-quality image includes: Perform normalization processing on the pixel matrix of the consecutive video frames and output the normalized image; The standardized image is initially denoised, and the guided-filtered image is output. Dynamic blur suppression is applied to the guided filter image to output a high-quality preprocessed image.

[0008] Optionally, the pre-trained YOLOv12 detection model includes an R-ELAN backbone network, separable convolutions, and an FPN feature pyramid; the step of using the pre-trained YOLOv12 detection model to perform object detection on the preprocessed high-quality image and outputting object detection results includes: The preprocessed high-quality image is input into the R-ELAN backbone network to extract multi-scale features; Separable convolution is used to expand the receptive field of the multi-scale features, and multiple hierarchical feature maps are output. Multiple hierarchical feature maps are input into the FPN feature pyramid to obtain multiple initial detection results; The target detection result is obtained by filtering the multiple initial detection results.

[0009] Optionally, the step of performing multi-dimensional feature extraction on the target detection result and the preprocessed high-quality image to output appearance feature vectors and motion feature vectors includes: Based on the bounding box coordinates in the target detection results, the target region is cropped from the preprocessed high-quality image and its size is normalized to obtain the normalized target region. Visual features are extracted from the normalized target region, and an appearance feature vector is output. Based on the target bounding box coordinates of the current frame and the previous frame in the target detection results, calculate the motion velocity and acceleration; Normalize the motion velocity and the acceleration, and output the motion feature vector.

[0010] Optionally, the step of dynamically fusing the appearance feature vector, the motion feature vector, and the target detection result to output a fused feature vector includes: Calculate the degree of target occlusion based on the multi-target bounding box coordinates in the target detection results; Based on the target occlusion degree and the motion velocity in the motion feature vector, adaptive fusion weights are determined; The appearance feature vector and the motion feature vector are weighted and fused according to the adaptive fusion weights, and the fused feature vector is output.

[0011] Optionally, the step of using an adaptive Kalman filter algorithm to predict the trajectory of the target detection result and the motion feature vector, and outputting the target's predicted position and state covariance matrix for future frames, includes: Calculate the coordinates of the target observation center based on the target bounding box in the target detection results; Based on the motion velocity in the motion feature vector, the Kalman filter process noise matrix is ​​dynamically adjusted to obtain an adaptive process noise matrix; Kalman filtering is performed to update and predict the target based on the target observation center coordinates and the adaptive process noise matrix, outputting the target's predicted future frame position and state covariance matrix.

[0012] Optionally, the step of using the Hungarian algorithm to perform target association and trajectory update on the fused feature vector, the predicted future frame position of the target, and the state covariance matrix, and outputting multi-target tracking results, includes: Based on the fused feature vector, the feature similarity between the detected target and the historical trajectory is calculated; Calculate the positional distance between the detected target and the historical trajectory based on the predicted position of the target in the future frame and the state covariance matrix; A matching cost matrix is ​​constructed based on the feature similarity between the detected target and the historical trajectory and the positional distance between the detected target and the historical trajectory; The matching cost matrix is ​​input into the Hungarian algorithm to solve for the optimal matching and obtain the matching result; The matching results are updated to reflect the trajectory, and the multi-target tracking results are output.

[0013] A second aspect of the present invention provides a multi-target tracking device based on YOLOv12 and dynamic feature fusion, comprising: The acquisition module is used to acquire the pixel matrix of consecutive video frames in the original video stream, perform video frame preprocessing on the pixel matrix of consecutive video frames, and output a high-quality image after preprocessing. The detection module is used to perform target detection on the preprocessed high-quality image using a pre-trained YOLOv12 detection model and output the target detection results. The extraction module is used to extract multi-dimensional features from the target detection results and the preprocessed high-quality image, and output appearance feature vectors and motion feature vectors. The fusion module is used to dynamically fuse the appearance feature vector, the motion feature vector, and the target detection result, and output the fused feature vector. The prediction module is used to perform trajectory prediction on the target detection results and the motion feature vector using an adaptive Kalman filter algorithm, and output the target's predicted position and state covariance matrix for future frames. The update module is used to perform target association and trajectory update on the fused feature vector, the target's predicted future frame position, and the state covariance matrix using the Hungarian algorithm, and output multi-target tracking results.

[0014] A third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the multi-target tracking method based on YOLOv12 and dynamic feature fusion as described above.

[0015] The fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed, it implements the multi-target tracking method based on YOLOv12 and dynamic feature fusion as described above.

[0016] As can be seen from the above technical solutions, the present invention has the following advantages: The above-mentioned technical solution of the present invention provides a multi-target tracking method based on YOLOv12 and dynamic feature fusion. It obtains the pixel matrix of consecutive video frames in the original video stream, performs video frame preprocessing on the pixel matrix, and outputs a high-quality preprocessed image. A pre-trained YOLOv12 detection model is used to detect targets in the preprocessed high-quality image, outputting the target detection result. Multi-dimensional feature extraction is performed on the target detection result and the preprocessed high-quality image, outputting appearance feature vectors and motion feature vectors. Dynamic feature fusion is performed on the appearance feature vector, motion feature vector, and target detection result, outputting a fused feature vector. An adaptive Kalman filter algorithm is used to predict the trajectory of the target detection result and motion feature vector, outputting the predicted position and state covariance matrix of the target in future frames. A Hungarian algorithm is used to perform target association and trajectory update on the fused feature vector, the predicted position and state covariance matrix of the target in future frames. The invention outputs multi-target tracking results. Based on the above scheme, this invention optimizes the input basis of target detection through video frame preprocessing, relies on the pre-trained YOLOv12 detection model to ensure the effectiveness of target detection, and simultaneously obtains appearance features and motion features through multi-dimensional feature extraction to enrich the target feature dimensions. Then, it combines the target detection results to achieve dynamic feature fusion of appearance features and motion features, which can adapt the feature fusion logic according to the actual state of the target, fundamentally avoiding the feature mismatch problem caused by fixed fusion methods, and thus eliminating the target ID switching caused by feature mismatch. At the same time, it completes accurate trajectory prediction by combining the adaptive Kalman filter algorithm with motion features, improving the adaptability and accuracy of trajectory prediction. Then, it completes target association and trajectory update based on the fused feature vector, the target's predicted position in the future frame, and the state covariance matrix, ensuring the continuity and stability of target tracking, and greatly improving the overall accuracy of multi-target detection and tracking. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the steps of a multi-target tracking method based on YOLOv12 and dynamic feature fusion, as provided in Embodiment 1 of the present invention. Figure 2 This is a flowchart illustrating a multi-target tracking method based on YOLOv12 and dynamic feature fusion, provided in Embodiment 1 of the present invention. Figure 3This is a structural block diagram of a multi-target tracking device based on YOLOv12 and dynamic feature fusion, provided in Embodiment 2 of the present invention. Detailed Implementation

[0019] This invention provides a multi-target tracking method and apparatus based on YOLOv12 and dynamic feature fusion, which solves the technical problem that existing multi-target tracking methods are prone to feature mismatch and target ID switching, leading to a decrease in subsequent detection and tracking accuracy.

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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. It should be noted that in the optional embodiments of the present invention, the object information and other related data involved require the permission or consent of the object when the embodiments of the present invention are applied to specific products or technologies, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards. That is to say, if the embodiments of the present invention involve data related to the object, it needs to be obtained with the authorization and consent of the object, the authorization and consent of relevant departments, and in compliance with relevant laws, regulations, and standards. If personal information is involved in the embodiments, the acquisition of all personal information requires the consent of the individual. If sensitive information is involved, the separate consent of the information subject is required, and the embodiments also need to be implemented with the authorization and consent of the object.

[0021] Please see Figure 1 , Figure 1 The flowchart illustrates the steps of a multi-target tracking method based on YOLOv12 and dynamic feature fusion, as provided in Embodiment 1 of the present invention.

[0022] This invention provides a multi-target tracking method based on YOLOv12 and dynamic feature fusion, comprising: Step 101: Obtain the pixel matrix of consecutive video frames in the original video stream, perform video frame preprocessing on the pixel matrix of consecutive video frames, and output the preprocessed high-quality image.

[0023] The raw video stream refers to continuous video data containing multiple moving images of targets, and it is the original input data source for this method to perform multi-target tracking.

[0024] A continuous video frame pixel matrix refers to a numerical matrix composed of the grayscale or color values ​​of each pixel in a single frame image after the original video stream has been decomposed into individual frames. It is the direct processing object of video frame preprocessing.

[0025] It should be noted that this step optimizes the original video frames by sequentially performing standardization, preliminary denoising, and dynamic blur suppression on the pixel matrix of the original video frames, resulting in clear image data that can be used for subsequent target detection.

[0026] Further, step 101 may include the following sub-steps: S11. Perform normalization processing on the pixel matrix of consecutive video frames and output the normalized image; S12. Perform preliminary denoising on the standardized image and output the guided filtered image; S13. Perform dynamic blur suppression on the guided filter image and output the preprocessed high-quality image.

[0027] It should be noted that the input continuous video frames are standardized and subjected to dynamic blur adaptive denoising to reduce the interference of environmental noise, lighting changes and dynamic blur, and output a high-quality image I'', which is directly used as the input of the YOLOv12 object detection module.

[0028] For standardization: pixel values ​​are normalized to the [0,1] interval to eliminate the influence of pixel value scale differences. The formula is: ; in, For the standardized image, It is the pixel matrix of the original video frame (i.e., the pixel matrix of consecutive video frames). It is the minimum grayscale value of all pixels in the current frame. I' represents the maximum grayscale value of all pixels in the current frame, and I' represents the image with standardized pixel values ​​in the range [0,1], providing a uniform scale input for subsequent denoising and deblurring processes.

[0029] For dynamic blur adaptive denoising: Traditional Gaussian filtering can only suppress Gaussian noise and cannot recover edge details for dynamically blurred targets in videos. Therefore, a combined strategy of "guided filtering + adaptive non-local means (ANLM)" is adopted to preserve the target edge and structural information while denoising. The formula is as follows: ; ; in, For guided filtering operators, It serves as both the input image and the guide image (i.e., the standardized image) to ensure edge consistency; r is the radius of the filtering window, balancing noise reduction and detail preservation. This is a regularization parameter that controls the smoothness of the filter. The image after preliminary denoising (i.e., the image after guided filtering) has suppressed Gaussian noise and preserved the target edges, laying the foundation for subsequent blur suppression. As an adaptive nonlocal mean filtering operator, the core utilizes the weighted average of redundant similar texture blocks in the image to specifically counteract dynamic blur; h(v) is the adaptive filtering intensity (h(v)=0.05+0.03v, where v is the target motion speed calculated by the subsequent motion feature extraction module. The larger v is, the more severe the dynamic blur and the greater the filtering intensity); w is the search window size to ensure that the complete structure of the dynamically blurred target is covered. The final denoised and deblurred input frame (i.e., the pre-processed high-quality image) eliminates environmental noise and restores the edges and details of dynamically blurred targets. It is then directly input into the YOLOv12 target detection module to ensure the feature extraction accuracy of small targets and high-speed moving targets.

[0030] It is worth mentioning that "bilateral filtering + motion blur kernel estimation" can be used instead of "guided filtering + adaptive nonlocal mean filtering". Dynamic blur inverse recovery can be achieved by estimating the blur kernel, which is suitable for strong blur scenes.

[0031] In this embodiment, the pixel matrix of consecutive video frames is normalized to a uniform range to eliminate pixel scale differences, and a normalized image is output. Guided filtering is applied to the normalized image to perform preliminary denoising, which retains the image edge structure information while filtering out noise, and a guided-filtered image is output. Adaptive nonlocal mean filtering is applied to the guided-filtered image to perform dynamic blur suppression, and the filtering intensity is adapted according to the target motion state to restore the details and edges of the blurred target, and a high-quality preprocessed image is output. This can effectively eliminate the interference caused by noise and dynamic blur, and reduce the detection deviation caused by image quality defects.

[0032] Step 102: Use a pre-trained YOLOv12 detection model to perform object detection on the pre-processed high-quality image and output the object detection results.

[0033] The object detection result refers to the comprehensive detection data output by the YOLOv12 detection model, which includes the object bounding box coordinates, object category label, and detection confidence, providing core support for subsequent multi-dimensional feature extraction.

[0034] The pre-trained YOLOv12 detection model includes the R-ELAN backbone network (Residual Enhanced Layer Aggregation Network), separable convolutions, and the FPN feature pyramid network.

[0035] It should be noted that a pre-trained YOLOv12 detection model (You Only Look Once Version 12, the 12th generation single-view target detection model) is used to perform multi-scale feature extraction and target localization and classification on the pre-processed high-quality image, complete the identification and judgment of multiple targets in the image, and output the target detection results.

[0036] Furthermore, step 102 may include the following sub-steps: S21. Input the preprocessed high-quality image into the R-ELAN backbone network to extract multi-scale features; S22. Separable convolution is used to expand the receptive field of multi-scale features and output multiple hierarchical feature maps. S23. Input multiple hierarchical feature maps into the FPN feature pyramid to obtain multiple initial detection results; S24. Filter multiple initial detection results to obtain the target detection result.

[0037] It should be noted that the preprocessed video frames Input a pre-trained YOLOv12 detection model to achieve accurate multi-object detection (with a focus on optimizing small object detection performance), and output the [x1, y1, x2, y2, class] values ​​for each object. id The results, in the format [confidence], provide the feature extraction module with target region coordinates, category, and confidence information. Here, x1 is the x-coordinate of the top-left corner of the target bounding box, corresponding to the left boundary of the target region, used to define the horizontal starting position of the target in the image; y1 is the y-coordinate of the top-left corner of the target bounding box, corresponding to the top boundary of the target region, used to define the vertical starting position of the target in the image; x2 is the x-coordinate of the bottom-right corner of the target bounding box, corresponding to the right boundary of the target region, used to define the horizontal ending position of the target in the image; and y2 is the y-coordinate of the bottom-right corner of the target bounding box, corresponding to the bottom boundary of the target region, used to define the vertical ending position of the target in the image. id The category label is used to identify the specific type of the target (such as pedestrian, car, truck, etc.), providing target category information for subsequent feature extraction. Confidence is the confidence level of the target detection, representing the degree of credibility of the YOLOv12 detection model in determining the existence of the target and its corresponding category. It is used to filter out invalid detection results with low confidence.

[0038] For example, the input image size is 1920×1080 pixels (high-definition video frame), and the number and type of targets are 3 small targets (pedestrians, pixel size 25×40, 30×45, 28×42), 4 medium targets (cars, pixel size 80×50, 90×55, 85×52, 95×58), and 1 large target (truck, pixel size 200×120). The input image content is an urban road monitoring scene, including a dynamically blurred car (driving at high speed in the right lane), pedestrians, and stationary trucks.

[0039] The output image size is kept at 1920×1080 pixels. Each target is marked with a red rectangular detection box, and the category label and confidence level (both ≥0.5) are marked inside the box.

[0040] For small-target pedestrians: the detection box coordinates are (320,450,345,490), (410,460,440,505), and (520,455,548,497), with confidence levels of 0.58, 0.62, and 0.55, respectively; For the target sedan: the detection box coordinates are (650,380,730,430), (780,375,870,430), (920,385,1005,437), and (1050,390,1145,448), where (1050,390,1145,448) is a dynamically blurred target with a detection confidence of 0.65. For a large target truck: the detection box coordinates are (1200, 350, 1400, 470), with a confidence level of 0.82.

[0041] Furthermore, multi-scale features are extracted using the Yolov12 backbone network R-ELAN, and the receptive field is expanded by combining 7×7 large-kernel separable convolutions. Finally, feature maps of three different levels, C3, C4, and C5 (i.e., multiple levels of feature maps), are output, and their specific meanings are shown in Table 1. Table 1 Feature maps of three different levels: C3, C4, and C5

[0042] Furthermore, C3, C4, and C5 are fused across layers using a Feature Pyramid Network (FPN) to generate five prediction layers, P3 to P7, each corresponding to the detection of targets of different sizes. The specific correspondence is shown in Table 2. Table 2 Detection of targets of different sizes

[0043] It's worth noting that the YOLOv12 detection model uses a multi-task loss function during training to balance classification accuracy and bounding box regression accuracy. The formula is as follows: ; in, For the total loss, For classification loss (optimizing the accuracy of category label prediction). The bounding box regression loss is used (CIoU loss is adopted to optimize the target location prediction accuracy). This is for confidence loss (optimizing the judgment of detection confidence). , , All are loss weights ( , , The sum of its values ​​is 1.0.

[0044] Furthermore, for the model output: a confidence threshold of 0.5 is set to filter low-confidence detection results to reduce false detection interference. The final output of effective detection results (boundary box coordinates, category, confidence) provides target regions (based on bounding box cropping ROI) and basic information for subsequent multi-dimensional feature extraction.

[0045] It is worth mentioning that the YOLOv12 detection model can be replaced with the enhanced version of YOLOv11 or PP-YOLOE+, which further optimizes the detection performance in specific scenarios such as low light at night while maintaining real-time performance.

[0046] In this embodiment, the preprocessed high-quality image is input into the R-ELAN backbone network. The image is encoded with multi-dimensional features through a residual enhancement layer aggregation structure to extract multi-scale features containing different spatial details. Then, separable convolution is used to expand the receptive field of the multi-scale features, which reduces computational complexity and expands the feature perception range, outputting multiple hierarchical feature maps. Subsequently, the multiple hierarchical feature maps are input into the FPN feature pyramid. The semantic and detailed information of different levels is integrated through top-down feature fusion and upsampling operations to obtain multiple initial detection results. Then, the multiple initial detection results are filtered according to the preset confidence threshold and non-maximum suppression rule to remove duplicate detections and invalid results with low confidence, so as to obtain the target detection result. This improves the detection stability of targets of different sizes in complex scenes and reduces the subsequent feature extraction and matching errors caused by detection result deviations.

[0047] Step 103: Perform multi-dimensional feature extraction on the target detection results and the preprocessed high-quality image, and output appearance feature vector and motion feature vector.

[0048] Appearance feature vectors are numerical vectors extracted from the target region image to characterize the static visual attributes of the target, such as appearance, texture, and shape, reflecting the inherent visual characteristics of the target.

[0049] Motion feature vectors are numerical vectors calculated based on target detection results from previous and subsequent frames. They are used to characterize the dynamic state attributes of a target, such as its velocity and acceleration, and reflect the target's motion change characteristics.

[0050] It should be noted that multi-dimensional feature extraction is performed on the target detection results and the preprocessed high-quality image. That is, the target region is cropped from the preprocessed high-quality image based on the bounding box in the target detection results to extract appearance features. At the same time, the target motion parameters are calculated by combining the target detection results of the previous and next frames to generate motion features, and the appearance feature vector and motion feature vector are output.

[0051] Furthermore, step 103 may include the following sub-steps: S31. Based on the bounding box coordinates in the target detection results, crop the target region from the preprocessed high-quality image and perform size normalization processing to obtain the normalized target region; S32. Extract visual features from the normalized target region and output the appearance feature vector; S33. Calculate the motion velocity and acceleration based on the target bounding box coordinates of the current frame and the previous frame in the target detection results; S34. Normalize the motion velocity and acceleration, and output the motion feature vector.

[0052] The normalized target region refers to a local image patch centered on the target, cropped from the preprocessed high-quality image based on the bounding box coordinates provided by the target detection results. This image patch completely includes the main pixel region of the target (such as the human outline, clothing texture and posture features of a pedestrian, or the body shape, color markings and key component features of a vehicle), and includes a small number of adjacent background pixels within the bounding box to preserve the association information between the target and the scene. Subsequently, after size normalization processing, the image patch is adjusted to a preset uniform fixed resolution to eliminate the problem of inconsistent original sizes of different targets caused by differences in shooting distance and viewing angle, providing input data with uniform scale and complete content for subsequent appearance feature extraction.

[0053] It should be noted that, based on the effective detection results output by YOLOv12, the target region is first determined by the detection box, and then the appearance features and motion features of the target are extracted in parallel (the two types of features are complementary: appearance features are used to distinguish the target identity, and motion features are used to characterize the motion state), providing input for the dynamic feature fusion module.

[0054] Furthermore, for appearance feature extraction: target region preprocessing: based on the bounding box coordinates (x1, y1, x2, y2) output by YOLOv12, from the preprocessed image... The target ROI (Region of Interest) is cropped in the middle; the ROI is then normalized to a uniform size of 128×128 pixels. The normalized 128×128 ROI is then input into a lightweight ReID (Person Re-identification) network (MobileNetV3 backbone network). The specific extraction steps are as follows: Layers 1-8 are depthwise separable convolutions + Batch Normalization + Hard-Swish activation, progressively extracting low-level visual features (edges, color distribution); Layer 9 is a 7×7 global average pooling layer, compressing the 128×128×576 feature map into a 1×1×576 feature vector; Layer 10 is a fully connected layer (576-dimensional input, 128-dimensional output) + L2 normalization, outputting a 128-dimensional appearance feature vector F. app This vector represents the target's unique appearance information (such as color, texture, and outline details).

[0055] Furthermore, for motion feature extraction: the core input is the coordinates of the target bounding box in the current frame. Bounding box coordinates of the target corresponding to the previous frame Based on the Euclidean distance between the lower right corner coordinates of the target bounding box and the frame interval, the pixel-level motion velocity v is calculated using the following formula: ; Where t is the current frame number, t-1 is the previous frame number, and Δt is the frame interval time (default 1 / 30s). , The x and y coordinates of the bottom right corner of the target bounding box in the current frame. , The coordinates are the coordinates of the previous frame, and v is the pixel-level motion speed (i.e., motion speed).

[0056] The formula for calculating acceleration is: ; in, The motion speed of the current frame. 'a' represents the motion velocity of the previous frame, and 'a' represents the acceleration.

[0057] After normalizing the velocity v and acceleration a, a 2D motion feature vector F is constructed. mot =[v norm ,a norm [] is used to describe the motion state of a target (uniform speed, acceleration, deceleration).

[0058] In this embodiment, based on the bounding box coordinates in the target detection results, a local region containing only the target is cropped from the preprocessed high-quality image. This region is then adjusted to a fixed size to eliminate the influence of target size differences, resulting in a normalized target region. Next, visual feature extraction is performed on the normalized target region. The static attributes of the target, such as texture, color, and contour, are captured through convolution and batch normalization operations of a lightweight ReID network, and an appearance feature vector is output. Simultaneously, based on the target bounding box coordinates of the current frame and the previous frame in the target detection results, the change in the target center position is calculated, and the motion velocity is obtained by combining it with the time interval between video frames. Then, the motion velocity of two consecutive frames is differentially calculated to obtain the acceleration. Subsequently, the motion velocity and acceleration are normalized to a unified numerical range, and a motion feature vector is output. This provides multi-dimensional feature data with consistent dimensions and controllable noise for subsequent dynamic feature fusion, reducing the probability of feature mismatch caused by feature scale mismatch or noise interference, and reducing the occurrence of target ID switching.

[0059] Step 104: Perform dynamic feature fusion on the appearance feature vector, motion feature vector and target detection results, and output the fused feature vector.

[0060] It should be noted that dynamic feature fusion is performed on the appearance feature vector, motion feature vector, and target detection results. That is, by combining the scene state information provided by the target detection results, the contribution weights of appearance features and motion features are adjusted according to the real-time occlusion and motion of the target, and the two types of feature vectors are weighted and integrated to output a fused feature vector.

[0061] Furthermore, step 104 may include the following sub-steps: S41. Calculate the degree of target occlusion based on the coordinates of the multi-target bounding boxes in the target detection results; S42. Determine adaptive fusion weights based on the target occlusion degree and the motion velocity in the motion feature vector; S43. Perform weighted fusion of appearance feature vector and motion feature vector according to adaptive fusion weight, and output fused feature vector.

[0062] It should be noted that for dynamic feature fusion, this invention employs a lightweight dynamic fusion sub-network, with the input appearance feature vector F... app (128-dimensional) and motion feature vector F mot (2D) Combining the target occlusion degree S, the fusion weights are adaptively adjusted to generate a fusion feature vector F. fuse (130 dimensions) provide highly discriminative features for the target association module. A self-attention module can be used to replace the weighted fusion formula, automatically learning feature fusion weights to adapt to more complex target state changes.

[0063] Furthermore, the fusion sub-network is a lightweight architecture, comprising a weight prediction branch and a feature fusion branch. The weight prediction branch takes the occlusion level S and the velocity v from the motion features as inputs, passes through two fully connected layers (the first layer has a 2D input and a 16D output; the second layer has a 16D input and a 2D output) + sigmoid activation, and outputs dynamic weights. (Appearance feature weight) and (Motion feature weights), the weight calculation formula is derived from network adaptive learning, and the core constraint logic is: =MLP(S,v) out1 , =MLP(S,v) out2 , + =1, where MLP (Multi-Layer Perceptron) is a multilayer perceptron. When occlusion is severe or the speed is high, Reduce Increase; when the occlusion is slight or the speed is slow, Enlarge Decrease.

[0064] For the feature fusion branch: F app (128-dimensional) and F mot (2D) directly concatenated into a 130-dimensional feature vector, then combined with the output of the weighted prediction branch. , The element-wise weighted fusion is performed using the following formula: ; in, Indicates that F app Expanded to 130 dimensions (with zeros added to the last two dimensions). Indicates that F mot Expand to 130 dimensions (padded with 0s for the first 128 dimensions) to ensure dimension matching.

[0065] Furthermore, for the calculation of the occlusion degree S (a key parameter input to the fusion sub-network), the occlusion degree is determined by the intersection-over-union (IoU) ratio of the target detection boxes, as shown in the formula: ; Among them, IoU i,j S is the intersection-union ratio of the detection boxes of the i-th target and the j-th target. The value of S is in the range of [0,1]. S=0 indicates no occlusion and S=1 indicates complete occlusion. S is directly input into the weight prediction branch to participate in the dynamic weight calculation.

[0066] It is worth mentioning that the appearance feature extraction can be replaced with a ResNet-18 network (Residual Network-18), which enhances the feature representation capability but slightly increases the computational complexity; the motion feature can be enhanced by adding an angular velocity parameter, which is suitable for rotating moving target scenarios.

[0067] In this embodiment, based on the coordinates of the multi-target bounding boxes in the target detection results, the spatial coverage relationship is quantified by calculating the proportion of overlapping areas between different target bounding boxes, and the target occlusion degree S is accurately calculated. Then, the target occlusion degree S and the motion velocity parameter v representing the target's motion state in the motion feature vector are combined and input into a multilayer perceptron (MLP) network for nonlinear feature mapping and weight generation, and adaptive fusion weights are dynamically output. Subsequently, the adaptive fusion weights generated by this network are used to perform weighted superposition operations on the appearance feature vector and the motion feature vector respectively, realizing the organic integration of the two types of feature information and outputting a fused feature vector. This can flexibly adjust the feature fusion ratio according to the real-time occlusion and motion state of the target, avoid the feature expression imbalance caused by a fixed fusion method, effectively avoid the occurrence of feature mismatch problems, reduce the target ID switching phenomenon from the feature association level, and ensure the continuity of the subsequent tracking process and the overall accuracy of detection and tracking.

[0068] Step 105: Use the adaptive Kalman filter algorithm to predict the trajectory of the target detection results and motion feature vectors, and output the target's predicted position and state covariance matrix for future frames.

[0069] The target's predicted position in future frames is obtained by using a filtering algorithm to extrapolate the target's pixel spatial coordinates in the image coordinate system of subsequent video frames. Specifically, it includes the horizontal and vertical pixel coordinates of the target's bounding box center point. This accurately predicts the spatial region in which the target is likely to appear in the next frame and subsequent consecutive frames, thus defining the search range for cross-frame target association and matching.

[0070] The state covariance matrix is ​​a second-order symmetric square matrix that characterizes the estimation error of each dimension component of the target's motion state. The matrix dimension matches the dimension of the target's motion state parameters, specifically including the estimation error variance of each state component such as target position, motion velocity, and motion acceleration. It also includes the error correlation coefficient between different state components, which can quantify the error fluctuation amplitude of the trajectory prediction result and the coupling correlation characteristics between various motion parameters.

[0071] It should be noted that the adaptive Kalman filter algorithm is used to predict the trajectory of the target detection results and motion feature vectors. Based on the target detection results, the current spatial state of the target is determined. The motion state model is iteratively updated by combining the motion parameters contained in the motion feature vectors. The noise parameters in the filtering process are adaptively corrected to infer the subsequent motion direction of the target and output the predicted position and state covariance matrix of the target in future frames.

[0072] Furthermore, step 105 may include the following sub-steps: S51. Calculate the coordinates of the target observation center based on the target bounding box in the target detection results; S52. Based on the motion velocity in the motion feature vector, dynamically adjust the Kalman filter process noise matrix to obtain the adaptive process noise matrix; S53. Perform Kalman filtering update and prediction based on the target observation center coordinates and the adaptive process noise matrix, and output the target's predicted position and state covariance matrix for future frames.

[0073] The target observation center coordinates refer to the center position coordinates of the target in the image, calculated based on the pixel coordinates of the upper left and lower right corners of the target bounding box. They are in pixels and reflect the actual observation position of the target in the current frame image. They are the basis of the observation data in the Kalman filter update stage.

[0074] The process noise matrix is ​​a covariance matrix used in Kalman filtering to characterize the uncertainty in the target's motion state transition process. It contains the noise variance of state components such as position and velocity, and reflects the error level of the target motion model itself.

[0075] The adaptive process noise matrix is ​​a process noise matrix that dynamically adjusts the component variance based on the target's motion velocity. By matching the intensity of the target's motion to adjust the noise estimation, the Kalman filter's state transition model can adapt to the target's uncertainty under different motion conditions, thereby improving the robustness of trajectory prediction.

[0076] It should be noted that this invention employs Kalman filtering with an adaptive noise matrix, and the input to the output of the preceding stage (target position detected by YOLOv12, motion feature F) is... mot The velocity v in the target is used to dynamically adjust the process noise matrix Q, optimize the trajectory prediction accuracy, and output the predicted position and state covariance matrix of the target in the next frame, providing position constraint basis for the target association module.

[0077] Furthermore, this invention uses the center coordinates (x, y) of the target bounding box output by the YOLOv12 target detection module. t ,y t )(Depend on( + ) / 2、( + (Calculated as ) / 2), which serves as the observation Z for Kalman filtering. t The motion features F output by the multi-dimensional feature extraction module mot The velocity v in the matrix is ​​used to dynamically adjust the process noise matrix Q; the target's predicted position in the next frame (x) t+1|t , y t +1|t ) and the state covariance matrix P t+1|t , directly input the target associated module.

[0078] Furthermore, for state modeling: define the target state vector X as equal to [x, y, v] x ,v y ], where (x, y) are the center coordinates of the target bounding box, v x v y These are the velocity components in the x and y directions, respectively.

[0079] The state equations are as follows: X t|t-1 =A·X t-1 +w; In the formula, X t|t-1 Let X = [x, y, v] be the predicted state value for frame t based on frame t-1. x ,v y ] T The state vector ((x,y) represents the center coordinates of the target bounding box, v) x v y (Velocity components in the x and y directions), A = Let w be the state transition matrix, and w~N(0,Q) be the process noise (which follows a Gaussian distribution).

[0080] The prediction equation is as follows: Z t =H·X t +v; In the formula, Z t H = t frames of observation (the center coordinates of the bounding box detected by YOLOv12). Let v be the observation matrix, v~N(0,R) be the observation noise, and R= This is the observation noise matrix, used for observation error stabilization.

[0081] The adaptive process noise matrix is ​​specifically defined as follows: the process noise matrix Q is dynamically adjusted according to the target's velocity v. The higher the velocity, the larger Q becomes, thus improving the trajectory's adaptability to changes in motion. The formula is: Q=k·v 2 ·I; In the formula, k=0.05 is the adjustment coefficient, v is the velocity value, and I is a 4×4 identity matrix. In these formulas, the larger v is (the faster the target moves), the larger Q is, and the higher the tolerance of trajectory prediction to changes in motion state, thus solving the trajectory drift problem for high-speed, changing-direction targets.

[0082] For state updates: the predicted state is corrected using the Kalman gain k, as shown in the formula: K=P t|t-1 ·H T ·(H·P t|t-1 ·H T +R)-1; X t =X t|t-1 +K·(Z t -H X t|t-1 ); P t =(IK·H)·P t|t-1 ; Where K is the Kalman gain, a weighting coefficient in Kalman filtering used to balance the confidence level of the predicted state and the observed data. It determines the strength of the correction effect of the observed data on the state update; a larger value indicates higher confidence in the observed data and a stronger correction effect on the predicted state. t|t-1 To predict the state covariance matrix, P t The updated state covariance matrix is ​​given by the predicted position X. t+1|t The output is jointly sent to the target correlation module, where H is the observation matrix, R is the observation noise covariance matrix, and X is the target correlation matrix. t Let X be the updated target state vector. t|t-1 To predict the state vector, Z t Let P be the observation vector at the current moment. t Let I be the updated state covariance matrix, and X be the identity matrix. t+1|t The predicted state vector for the next moment is the state vector related to the predicted position of the target in the future frame. It is the predicted state of the target in the next moment, which is derived from the updated state at the current moment and includes motion parameters such as the position of the target in the future frame.

[0083] It is worth mentioning that the fusion feature F fuse Instead of being directly input into this module, it is used as the core feature for distinguishing the target identity and input into the target association module in the next stage. It works in conjunction with the predicted location output by this module to achieve accurate association.

[0084] In this embodiment, based on the target bounding box in the target detection result, the pixel coordinates of the upper left and lower right corners of the bounding box are extracted. The coordinates of the target observation center are calculated by the coordinate mean operation. These coordinates reflect the actual observation position of the target in the current frame image. Then, based on the motion velocity in the motion feature vector, the intensity of the target's current motion is quantified. When the target's motion velocity is high, the uncertainty representing its motion state increases, correspondingly increasing the variance of the position and velocity components in the process noise matrix; when the target's motion velocity is low, the stability representing its motion state is strong, correspondingly decreasing the component variance in the process noise matrix. This dynamically adjusts to obtain an adaptive process noise matrix, which is then used for further processing. An observation vector is constructed based on the target observation center coordinates. The state transition model of the Kalman filter is initialized by combining the adaptive process noise matrix. The state and covariance deduction of the prediction stage are performed sequentially. Then, the Kalman gain is calculated and the state is updated based on the target observation center coordinates to correct the target's current state estimate. Subsequently, the predicted position of the target in the future frame is obtained through the state transition model deduction, and the updated state covariance matrix is ​​output synchronously. It can dynamically adapt the filtering parameters according to the target's motion state, improve the accuracy of trajectory prediction under different motion conditions, reduce the prediction deviation caused by fixed noise assumptions, provide a more reliable position reference for subsequent target association matching, and reduce the probability of target ID switching.

[0085] Step 106: Use the Hungarian algorithm to perform target association and trajectory update on the fused feature vector, the target's predicted position in the future frame, and the state covariance matrix, and output the multi-target tracking results.

[0086] It should be noted that the Hungarian algorithm is used to perform target association and trajectory update on the fused feature vector, the target's predicted position in the future frame, and the state covariance matrix. Specifically, the appearance similarity between targets is calculated by combining the fused feature vector, the association cost matrix is ​​constructed based on the target's predicted position in the future frame and the state covariance matrix, the optimal matching scheme is solved by the Hungarian algorithm, the current detected target is matched with the historical trajectory, the trajectory is updated, and the multi-target tracking results are output.

[0087] Furthermore, step 106 may include the following sub-steps: S61. Based on the fused feature vector, calculate the feature similarity between the detected target and the historical trajectory; S62. Calculate the positional distance between the detected target and the historical trajectory based on the target's predicted position and state covariance matrix in the future frame. S63. Construct a matching cost matrix based on the feature similarity between the detected target and the historical trajectory and the positional distance between the detected target and the historical trajectory; S64. Input the matching cost matrix into the Hungarian algorithm to solve for the optimal matching and obtain the matching result; S65. Perform trajectory update on the matching results and output the multi-target tracking results.

[0088] The association cost matrix is ​​a two-dimensional matrix with dimensions of [number of targets detected in the current frame × number of historical trajectories]. Each element C(i,j) in the matrix represents the cost of matching the i-th currently detected target with the j-th historical trajectory. This cost is calculated by weighting the target appearance similarity, position prediction error, and state uncertainty. The appearance similarity is quantified based on the cosine distance or Euclidean distance of the fused feature vectors. The larger the distance (the lower the similarity), the higher the cost. The position prediction error is calculated by the spatial distance between the observation center coordinates of the currently detected target and the predicted position of the historical trajectory. The larger the error, the higher the cost. The state uncertainty is combined with the state covariance matrix to reflect the credibility of the predicted position. The higher the uncertainty, the higher the cost. The lower the value of the matrix element, the higher the rationality of the corresponding matching combination.

[0089] Multi-target tracking results are structured data containing motion information of all targets in the video sequence. Each target is assigned a globally unique and unchanging target ID. For each target ID, its complete continuous trajectory sequence is recorded, including the timestamp of each frame, the target bounding box coordinates or center position, motion speed, acceleration and other state parameters, as well as state indicators such as whether the target is occluded and whether the trajectory is valid, thus fully presenting the entire process of the target's appearance, movement and disappearance in the video.

[0090] It should be noted that this invention uses the Hungarian algorithm to achieve a dual association based on "feature similarity + location distance," which is input to the output of the preceding step (F of the dynamic feature fusion module). fuse The adaptive Kalman filter module (predicted position and state covariance) constructs a coherent target trajectory, ensuring seamless input-output transitions.

[0091] Among them, the dynamic feature fusion module outputs the fused features of each detected target. (i is the index of the detected target in the current frame); the predicted position of each historical trajectory output by the adaptive Kalman filter module ( , ) and state covariance matrix (j is the index of the historical trajectory); the feature mean of each trajectory in the historical trajectory set. (F from the trajectory of previous frames) fuse (Average obtained).

[0092] Furthermore, for constructing the cost matrix: the cost matrix has a dimension of M×N (M is the number of detected targets in the current frame, and N is the number of historical trajectories), and each element Cost(i,j) is the matching cost between the i-th detected target and the j-th historical trajectory, which is obtained by weighting the feature similarity cost and the location distance cost: Cost(i,j)= ·(1-Sim(i,j))+ Mahalanobis(i,j); Where: Sim(i,j) is the cosine similarity (based on fusion features), and the formula is: ; The higher the similarity, the lower the cost; Mahalanobis(i,j) is the Mahalanobis distance (based on the predicted position), and the formula is: ; Where Cost(i,j) is the (i,j)th element in the association cost matrix, representing the matching cost between the i-th current detected target and the j-th historical trajectory. Let i be the fused feature vector of the i-th currently detected target. Let be the fused feature vector of the j-th historical trajectory. The coordinates of the center of the current detection target (i.e., the coordinates of the observation center of the i-th current detection target). The predicted position of the trajectory (i.e., the predicted position of the target future frame of the j-th historical trajectory). Let $\mathbf{j}$ be the state covariance matrix (i.e., the state covariance matrix of the j-th historical trajectory). The closer the distance, the lower the cost. , Weights are determined by feature similarity (which is dominant).

[0093] Furthermore, for the Hungarian algorithm to find the optimal match: input the cost matrix into the Hungarian algorithm to find the matching relationship corresponding to the minimum cost; matching judgment threshold: when Sim(i,j)≥0.7 and Mahalanobis(i,j)≤20, it is judged as a valid match, and the detected target is associated with the historical trajectory; unmatched handling: when the detected target has no matching trajectory, a new trajectory is created and a unique ID is assigned; when the trajectory has no matching detected target for 3 consecutive frames, it is marked as lost and removed from the trajectory set.

[0094] Furthermore, for trajectory updates: for successfully matched trajectories, update their feature mean. ; Where T is the cumulative number of frames for the trajectory; and X is the state vector for updating the trajectory. j With covariance matrix P j (Result updated using Kalman filtering); Record the trajectory ID and bounding box sequence to provide historical information for association in the next frame.

[0095] Specifically, when calculating the feature similarity between the detected target and the historical trajectory based on the fused feature vector, cosine similarity is used for quantification. The fused features of the current detected target come from the output of the dynamic feature fusion module, while the features of the historical trajectory are taken as the average of the fused features of all previous frames of the trajectory. This reflects the similarity between the two in terms of appearance and motion fusion features. The higher the similarity, the greater the probability that the two are the same target. When calculating the positional distance between the detected target and the historical trajectory based on the target's predicted position in the future frame and the state covariance matrix, Mahalanobis distance is used. The observation center coordinates of the current detected target, the target's predicted position in the future frame of the historical trajectory, and the state covariance matrix of the trajectory are all used in the calculation. This distance reflects both the spatial deviation between the detected target and the predicted position and incorporates the uncertainty of trajectory prediction through the state covariance matrix. The smaller the distance, the higher the positional matching degree. When constructing the matching cost matrix based on feature similarity and positional distance, the matrix dimension is a combination of the number of detected targets in the current frame and the number of historical trajectories. Each element is the matching cost between the corresponding detected target and the historical trajectory. This cost is obtained by weighting the feature similarity cost and the positional distance cost. The feature similarity cost increases with the similarity. The cost of location distance decreases as Mahalanobis distance decreases, and feature similarity plays a dominant role in cost calculation, thus comprehensively balancing the impact of feature and location information on matching rationality. When the matching cost matrix is ​​input into the Hungarian algorithm for optimal matching, the algorithm finds the matching relationship between the detected target and historical trajectory corresponding to the minimum cost. At the same time, a matching judgment threshold is set. When the feature similarity is not lower than the set value and the Mahalanobis distance is not higher than the set threshold, the match is judged as a valid match, and the current detected target is associated with the corresponding historical trajectory. For detected targets without matching trajectories, a new trajectory is created and a unique ID is assigned. For historical trajectories without matching detected targets for multiple consecutive frames, they are marked as lost and removed from the trajectory set. When updating the trajectory for the matching results, the mean of the fused features of the successfully matched historical trajectories is updated. A weighted average method is used to combine the accumulated frame number of the trajectory with the fused features of the current detected target to obtain a new mean of trajectory features. At the same time, the state vector and state covariance matrix of the trajectory are updated based on the updated result of Kalman filtering, and the unique ID, bounding box sequence and related state information of the trajectory are recorded to provide historical information for target association in the next frame. Finally, the multi-target tracking result containing all target trajectories is output.

[0096] It is worth mentioning that the Hungarian algorithm can be replaced by the Jonker-Volgenant algorithm to improve the association efficiency in large-scale multi-target scenarios (number of targets > 50).

[0097] For comparison of technical effectiveness, existing technologies can be used as a reference. Currently, multi-target tracking technologies are mainly divided into three categories: detection-based tracking, association-based tracking, and deep learning-based end-to-end tracking. Detection-based tracking is the mainstream approach, which first detects the target frame by frame, then predicts the trajectory using Kalman filtering and associates the target using the Hungarian algorithm. A representative method is YOLO+DeepSORT. Association-based tracking constructs the trajectory by directly matching target features between frames, which is suitable for low frame rate scenarios. End-to-end tracking completes detection and tracking simultaneously through a single network, but it has high computational complexity and insufficient real-time performance.

[0098] Some existing technologies obtain target confidence, bounding boxes, and category information through target detection, calculate matching costs, and then combine them with feature matching to generate trajectories. The core idea is to reduce the impact of low-confidence targets through multiple rounds of matching. However, the fixed-weight feature fusion method does not consider the dynamic changes in target motion state and occlusion degree, resulting in insufficient robustness of feature matching in complex scenes. Another approach adds an improved DfDC module (Dual Feature Dynamic Compensation) and VSST attention mechanism (Visual Spatial Self-Transformer) to the YOLO model to optimize target recognition accuracy in traffic scenes. However, this approach relies on the Transformer-Yolo feature extraction architecture and does not introduce an efficient multi-scale feature aggregation mechanism, making it difficult to balance recall and real-time performance for small target detection. Some solutions employ EfficientNet (high-efficiency convolutional network) to extract features and utilize EIoU (Enhanced Intersection over Union) dynamic matching strategies and Extended Kalman Filter (EKF) to optimize tracking performance in UAV scenarios. However, the noise matrix parameters of EKF are fixed, resulting in insufficient adaptability to trajectory prediction for high-speed, directional moving targets, and a tendency for trajectory drift. Furthermore, some techniques generate target text descriptions using BLIP (Bootstrapping Language-Image Pre-training) models, fusing visual and textual features to improve tracking robustness. However, the feature fusion weights are fixed values ​​from the training phase and cannot be dynamically adjusted based on the target's real-time motion state, leading to target identity switching issues in occluded or high-speed moving scenarios. While these solutions optimize multi-target tracking performance for specific scenarios, their core frameworks share common limitations, failing to simultaneously address the three core issues of dynamic adaptability in feature fusion, accuracy in small target detection, and robustness in trajectory prediction.

[0099] Based on the above, the shortcomings of the existing solutions mainly include four aspects: 1. Static Feature Fusion: Existing methods all adopt a fixed weight feature fusion strategy, which does not dynamically adjust according to the real-time status such as the degree of target occlusion and movement speed. When appearance features fail in occluded scenarios or motion features fluctuate in high-speed motion scenarios, feature mismatch and target ID switching are likely to occur.

[0100] 2. Insufficient accuracy in small target detection: The feature extraction architecture, which relies on models such as Transformer-Yolo and traditional YOLO, lacks an efficient multi-scale feature aggregation mechanism. It has a weak ability to capture features of low-resolution and small-sized targets, resulting in a high false negative rate and a high false positive rate.

[0101] 3. Poor adaptability of trajectory prediction: The trajectory prediction module uses Kalman filtering or extended Kalman filtering with a fixed noise matrix, which cannot adapt to changes in the target's motion state (such as high speed or change of direction), resulting in large trajectory prediction errors and a high target loss rate in complex motion scenarios.

[0102] 4. Insufficient dynamic blur processing: Existing technologies mostly use a single Gaussian filter for noise reduction, which can only suppress Gaussian noise and cannot alleviate the edge blurring and loss of details of dynamically blurred targets (such as high-speed moving vehicles and pedestrians) in the video, resulting in a decrease in the accuracy of subsequent detection and tracking.

[0103] Therefore, the technical problems to be solved by the present invention include: 1. Enhance the dynamic adaptability of feature fusion: Design a dynamic feature fusion module that adaptively adjusts the fusion weights of appearance features and motion features based on the target occlusion degree and motion speed, thus solving the problem of insufficient robustness in complex scenes caused by static fusion.

[0104] 2. Optimize small target detection performance: The residual efficient layer aggregation network (R-ELAN) of YOLOv12 model and 7×7 large kernel separable convolution are adopted to enhance the feature capture capability of small targets and reduce the false negative rate and false positive rate.

[0105] 3. Improve trajectory prediction accuracy: An adaptive Kalman filter algorithm is proposed, which dynamically adjusts the process noise matrix by adjusting the target's motion speed to adapt to high-speed, change-of-direction moving targets and reduce trajectory prediction errors.

[0106] 4. Enhanced Synergistic Suppression of Dynamic Blur and Noise: A combined scheme of "guided filtering + adaptive nonlocal mean filtering" is proposed to replace the traditional Gaussian filtering. While removing noise, it restores the edges and details of the dynamically blurred target, providing high-quality input for subsequent detection.

[0107] Specifically, such as Figure 2As shown, this invention proposes a multi-target tracking method based on YOLOv12 and dynamic feature fusion, comprising six core modules: video frame preprocessing, YOLOv12 target detection, multi-dimensional feature extraction, dynamic feature fusion, adaptive Kalman filtering, target association, and trajectory update. These modules are progressively integrated, with the two sub-modules of multi-dimensional feature extraction operating in parallel. The overall process is as follows: After preprocessing (standardization + dynamic blur adaptive denoising) of the input video frame, the YOLOv12 model detects targets and outputs bounding boxes, categories, and confidence scores; based on the detection boxes, the target region is cropped, and appearance and motion features are extracted in parallel; the dynamic fusion module adaptively adjusts the weights according to the target occlusion degree and motion speed to generate the fused feature F. fuse The adaptive Kalman filter module dynamically adjusts the process noise matrix using velocity parameters from motion features to predict the target's position in the next frame; the target association module uses fused features F fuse The calculated similarity and Kalman filter predicted position are used as dual inputs. The Hungarian algorithm is used to achieve the optimal association between the detected target and the historical trajectory. Finally, the trajectory information is updated and the tracking result is output. This scheme accurately solves the three major shortcomings of existing technologies through dynamic feature fusion, adaptive filtering optimization, efficient detection and dynamic blur suppression.

[0108] In summary, the key points of this invention are: 1. Dynamic feature fusion mechanism: Based on a deep learning sub-network, the fusion weights of appearance features and motion features are adaptively adjusted by combining the target occlusion degree and motion speed. Through the weight prediction branch and feature weighted fusion process, the robustness of feature matching in complex scenarios is improved.

[0109] 2. Adaptive Kalman Filter Optimization: The noise matrix Q is dynamically adjusted by the motion speed output by the multi-dimensional feature extraction module, the dependencies between formulas are clarified, and the problem of large prediction error of high-speed and changing target trajectory caused by fixed noise matrix is ​​solved.

[0110] 3. YOLOv12 and multi-feature collaborative detection: Utilizing the efficient feature aggregation capabilities of YOLOv12's R-ELAN network and 7×7 large kernel convolution, the meaning of C3~C5 features and their correspondence with the target size of P3~P7 are clarified. Combined with multi-dimensional feature extraction, the detection accuracy of small targets is enhanced.

[0111] 4. Dynamic Blur Adaptive Denoising Scheme: A combined strategy of "guided filtering + adaptive nonlocal mean filtering" is proposed to replace the traditional Gaussian filtering. While denoising, it restores the edge details of the dynamically blurred target and improves the basic input quality for subsequent detection and tracking.

[0112] 5. Dual-constraint target association strategy: Based on the cosine similarity of fused features and the Mahalanobis distance of the predicted position by Kalman filter, a cost matrix is ​​constructed. The Hungarian algorithm is used to achieve accurate association between the detected target and the historical trajectory, taking into account both identity consistency and position continuity.

[0113] Compared with the prior art, the advantages of the present invention are as follows: 1. More adaptive feature fusion: The dynamic weight adjustment mechanism enables feature fusion to adapt to the real-time motion state of the target, reducing the target ID switching rate by 35% in occluded scenarios and improving the matching accuracy of high-speed moving targets by 40%.

[0114] 2. Higher accuracy in small target detection: YOLOv12’s efficient feature aggregation capability is superior to the Transformer-Yolo architecture, improving the recall rate of small target (pixel size <30×30) detection by 28% and reducing the false detection rate by 15%.

[0115] 3. More accurate trajectory prediction: trajectory prediction error is reduced by 32%, and the loss rate of high-speed and change-of-direction targets is reduced by 27%.

[0116] 4. More efficient dynamic blur processing: Compared with traditional Gaussian filtering, "guided filtering + adaptive nonlocal mean filtering" improves the edge detail recovery rate of dynamically blurred targets by 45%, and the subsequent detection confidence is improved by an average of 0.12.

[0117] 5. Superior real-time performance: YOLOv12's lightweight features combined with GPU parallel acceleration enable high-resolution video (1920×1080) processing at a frame rate of 65FPS, meeting real-time tracking requirements.

[0118] In this embodiment of the invention, a multi-target tracking method based on YOLOv12 and dynamic feature fusion is provided. The method acquires the pixel matrix of consecutive video frames in the original video stream, performs video frame preprocessing on the pixel matrix, and outputs a high-quality preprocessed image. A pre-trained YOLOv12 detection model is used to detect targets in the preprocessed high-quality image, outputting the target detection result. Multi-dimensional feature extraction is performed on the target detection result and the preprocessed high-quality image, outputting appearance feature vectors and motion feature vectors. Dynamic feature fusion is performed on the appearance feature vector, motion feature vector, and target detection result, outputting a fused feature vector. An adaptive Kalman filter algorithm is used to predict the trajectory of the target detection result and motion feature vector, outputting the target's predicted position in future frames and state covariance matrix. A Hungarian algorithm is used to correlate the fused feature vector, the target's predicted position in future frames, and the state covariance matrix with the target and improve the trajectory. The invention provides new multi-target tracking results. Based on the above scheme, this invention optimizes the input basis for target detection through video frame preprocessing, relies on the pre-trained YOLOv12 detection model to ensure the effectiveness of target detection, and simultaneously obtains appearance and motion features through multi-dimensional feature extraction to enrich the target feature dimensions. Then, it combines the target detection results to achieve dynamic feature fusion of appearance and motion features, which can adapt the feature fusion logic according to the actual state of the target, fundamentally avoiding the feature mismatch problem caused by fixed fusion methods, and thus eliminating target ID switching caused by feature mismatch. At the same time, it completes accurate trajectory prediction by combining the adaptive Kalman filter algorithm with motion features, improving the adaptability and accuracy of trajectory prediction. In addition, it completes target association and trajectory update based on the fused feature vector, the target's predicted position in the future frame, and the state covariance matrix, ensuring the continuity and stability of target tracking and significantly improving the overall accuracy of multi-target detection and tracking.

[0119] Please see Figure 3 , Figure 3 This is a structural block diagram of a multi-target tracking device based on YOLOv12 and dynamic feature fusion, provided in Embodiment 2 of the present invention.

[0120] This invention provides a multi-target tracking device based on YOLOv12 and dynamic feature fusion, comprising: The acquisition module 301 is used to acquire the pixel matrix of consecutive video frames in the original video stream, perform video frame preprocessing on the pixel matrix of consecutive video frames, and output the preprocessed high-quality image. Detection module 302 is used to perform target detection on the pre-processed high-quality image using a pre-trained YOLOv12 detection model and output the target detection results; Extraction module 303 is used to extract multi-dimensional features from the target detection results and the preprocessed high-quality image, and output appearance feature vector and motion feature vector; The fusion module 304 is used to dynamically fuse appearance feature vectors, motion feature vectors and target detection results, and output a fused feature vector. Prediction module 305 is used to predict the trajectory of the target detection result and motion feature vector using an adaptive Kalman filter algorithm, and output the target's predicted position and state covariance matrix for future frames. The update module 306 is used to perform target association and trajectory update on the fused feature vector, the target's predicted position in the future frame, and the state covariance matrix using the Hungarian algorithm, and output multi-target tracking results.

[0121] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0122] This invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program; when the computer program is executed by the processor, the processor performs the steps of the multi-target tracking method based on YOLOv12 and dynamic feature fusion as described in the above embodiments.

[0123] This invention also provides a computer-readable storage medium storing a computer program / instructions thereon, which, when executed by a processor, implements the steps of the multi-target tracking method based on YOLOv12 and dynamic feature fusion as described in the above embodiments.

[0124] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

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

[0126] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0127] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0128] 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 multi-target tracking method based on YOLOv12 and dynamic feature fusion, characterized in that, include: Obtain the pixel matrix of consecutive video frames in the original video stream, perform video frame preprocessing on the pixel matrix of consecutive video frames, and output the preprocessed high-quality image. A pre-trained YOLOv12 detection model is used to perform target detection on the preprocessed high-quality image, and the target detection results are output. Multi-dimensional feature extraction is performed on the target detection results and the preprocessed high-quality image to output appearance feature vectors and motion feature vectors; Dynamic feature fusion is performed on the appearance feature vector, the motion feature vector, and the target detection result to output a fused feature vector; An adaptive Kalman filter algorithm is used to predict the trajectory of the target detection results and the motion feature vector, and the predicted position and state covariance matrix of the target in the future frame are output. The Hungarian algorithm is used to perform target association and trajectory update on the fused feature vector, the predicted position of the target in the future frame, and the state covariance matrix, and outputs multi-target tracking results.

2. The multi-target tracking method based on YOLOv12 and dynamic feature fusion according to claim 1, characterized in that, The step of performing video frame preprocessing on the pixel matrix of the continuous video frames and outputting a preprocessed high-quality image includes: Perform normalization processing on the pixel matrix of the consecutive video frames and output the normalized image; The standardized image is initially denoised, and the guided-filtered image is output. Dynamic blur suppression is applied to the guided filter image to output a high-quality preprocessed image.

3. The multi-target tracking method based on YOLOv12 and dynamic feature fusion according to claim 1, characterized in that, The pre-trained YOLOv12 detection model includes an R-ELAN backbone network, separable convolutions, and an FPN feature pyramid. The pre-trained YOLOv12 detection model is used to perform object detection on the preprocessed high-quality image, and the object detection results are output, including: The preprocessed high-quality image is input into the R-ELAN backbone network to extract multi-scale features; Separable convolution is used to expand the receptive field of the multi-scale features, and multiple hierarchical feature maps are output. Multiple hierarchical feature maps are input into the FPN feature pyramid to obtain multiple initial detection results; The target detection result is obtained by filtering the multiple initial detection results.

4. The multi-target tracking method based on YOLOv12 and dynamic feature fusion according to claim 1, characterized in that, The step of performing multi-dimensional feature extraction on the target detection result and the preprocessed high-quality image, and outputting appearance feature vectors and motion feature vectors, includes: Based on the bounding box coordinates in the target detection results, the target region is cropped from the preprocessed high-quality image and its size is normalized to obtain the normalized target region. Visual features are extracted from the normalized target region, and an appearance feature vector is output. Based on the target bounding box coordinates of the current frame and the previous frame in the target detection results, calculate the motion velocity and acceleration; Normalize the motion velocity and the acceleration, and output the motion feature vector.

5. The multi-target tracking method based on YOLOv12 and dynamic feature fusion according to claim 1, characterized in that, The step of dynamically fusing the appearance feature vector, the motion feature vector, and the target detection result to output a fused feature vector includes: Calculate the degree of target occlusion based on the multi-target bounding box coordinates in the target detection results; Based on the target occlusion degree and the motion velocity in the motion feature vector, adaptive fusion weights are determined; The appearance feature vector and the motion feature vector are weighted and fused according to the adaptive fusion weights, and the fused feature vector is output.

6. The multi-target tracking method based on YOLOv12 and dynamic feature fusion according to claim 1, characterized in that, The adaptive Kalman filter algorithm is used to predict the trajectory of the target detection result and the motion feature vector, and outputs the target's predicted position and state covariance matrix for future frames, including: Calculate the coordinates of the target observation center based on the target bounding box in the target detection results; Based on the motion velocity in the motion feature vector, the Kalman filter process noise matrix is ​​dynamically adjusted to obtain an adaptive process noise matrix; Kalman filtering is performed to update and predict the target based on the target observation center coordinates and the adaptive process noise matrix, outputting the target's predicted future frame position and state covariance matrix.

7. The multi-target tracking method based on YOLOv12 and dynamic feature fusion according to claim 1, characterized in that, The Hungarian algorithm is used to perform target association and trajectory update on the fused feature vector, the predicted future frame position of the target, and the state covariance matrix, outputting multi-target tracking results, including: Based on the fused feature vector, the feature similarity between the detected target and the historical trajectory is calculated; Calculate the positional distance between the detected target and the historical trajectory based on the predicted position of the target in the future frame and the state covariance matrix; A matching cost matrix is ​​constructed based on the feature similarity between the detected target and the historical trajectory and the positional distance between the detected target and the historical trajectory; The matching cost matrix is ​​input into the Hungarian algorithm to solve for the optimal matching and obtain the matching result; The matching results are updated to reflect the trajectory, and the multi-target tracking results are output.

8. A multi-target tracking device based on YOLOv12 and dynamic feature fusion, characterized in that, include: The acquisition module is used to acquire the pixel matrix of consecutive video frames in the original video stream, perform video frame preprocessing on the pixel matrix of consecutive video frames, and output a high-quality image after preprocessing. The detection module is used to perform target detection on the preprocessed high-quality image using a pre-trained YOLOv12 detection model and output the target detection results. The extraction module is used to extract multi-dimensional features from the target detection results and the preprocessed high-quality image, and output appearance feature vectors and motion feature vectors. The fusion module is used to dynamically fuse the appearance feature vector, the motion feature vector, and the target detection result, and output the fused feature vector. The prediction module is used to perform trajectory prediction on the target detection results and the motion feature vector using an adaptive Kalman filter algorithm, and output the target's predicted position and state covariance matrix for future frames. The update module is used to perform target association and trajectory update on the fused feature vector, the target's predicted future frame position, and the state covariance matrix using the Hungarian algorithm, and output multi-target tracking results.

9. An electronic device, characterized in that, The system includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the multi-target tracking method based on YOLOv12 and dynamic feature fusion as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the multi-target tracking method based on YOLOv12 and dynamic feature fusion as described in any one of claims 1-7.