A real-time cross-camera vehicle tracking method

By using incremental clustering algorithms and sliding window management, the real-time and memory usage issues in cross-camera tracking methods are resolved, achieving high-precision vehicle tracking with a response time of up to seconds, adapting to different scenario requirements.

CN121616627BActive Publication Date: 2026-05-29NINGBO LANGDA ENG TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NINGBO LANGDA ENG TECH CO LTD
Filing Date
2026-02-02
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing cross-camera tracking methods suffer from poor real-time performance, excessive memory consumption, lack of dynamic adjustment capabilities, and low efficiency in trajectory data management, making it impossible to maintain high-precision vehicle tracking while ensuring second-level response.

Method used

By employing incremental clustering algorithms and sliding window management, and through real-time video stream detection and tracking from multiple cameras, a global trajectory buffer is constructed. The multidimensional similarity between local vehicle trajectories and global trajectories is dynamically calculated, and the clustering strategy and threshold are adjusted in real time to achieve cross-camera vehicle tracking.

Benefits of technology

It achieves cross-camera tracking with a response time of up to seconds, reduces system latency, controls memory usage, adapts to different scenario requirements, and ensures high-precision vehicle tracking results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121616627B_ABST
    Figure CN121616627B_ABST
Patent Text Reader

Abstract

The application discloses a real-time cross-camera vehicle tracking method, comprising the following steps: performing single-camera vehicle detection and tracking based on a video stream collected in real time by multiple cameras to obtain local vehicle trajectories corresponding to each camera respectively; constructing a global trajectory buffer and storing the obtained local vehicle trajectories in the global trajectory buffer; performing trajectory association matching on the local vehicle trajectories and existing clustered trajectories in the global trajectory buffer; updating the clustered trajectories or creating new clustered trajectories according to the association matching result to obtain multi-camera vehicle trajectories with unique global IDs. The application has the beneficial effects that: the incremental clustering algorithm and the sliding window management are adopted to realize cross-camera tracking with a response of seconds, and the delay is greatly reduced compared with the traditional batch processing method, thereby meeting the strict requirements of real-time monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of visual surveillance technology, and in particular to a real-time cross-camera vehicle tracking method. Background Technology

[0002] With the rapid development of intelligent transportation systems and computer vision technology, multi-camera cross-camera tracking has become a core technology in modern traffic monitoring systems. In complex scenarios such as highway service areas, urban parking lots, and industrial parks, multiple cameras are typically deployed to form a monitoring network to achieve real-time vehicle tracking and behavior analysis across the entire area. However, existing technologies have the following drawbacks:

[0003] (1) Batch processing mode leads to poor real-time performance: Existing cross-camera tracking methods generally adopt offline batch processing mode, which requires waiting for all camera data to be collected before global cluster analysis is performed, resulting in system delays of up to minutes, which cannot meet the second-level response requirements of real-time monitoring.

[0004] (2) Global clustering algorithm has excessive memory usage: Traditional methods use global clustering algorithms to process all historical trajectory data. As time goes by, memory usage increases linearly, which can easily lead to memory overflow in long-term running scenarios.

[0005] (3) Lack of dynamic adjustment capability: Existing methods cannot dynamically adjust clustering parameters according to real-time monitoring needs, cannot adapt to the tracking accuracy and real-time requirements of different scenarios, and lack adaptive optimization mechanism.

[0006] (4) Inefficient trajectory data management: Traditional methods lack an effective trajectory data management mechanism and cannot control memory usage while ensuring tracking accuracy, resulting in a decrease in system performance over time.

[0007] (5) The contradiction between cross-camera association accuracy and real-time performance: Existing methods often sacrifice real-time performance while improving cross-camera association accuracy, and cannot maintain high tracking accuracy while ensuring second-level response. Summary of the Invention

[0008] One objective of this application is to provide a real-time cross-camera vehicle tracking method that can overcome at least one of the deficiencies in the aforementioned background art.

[0009] To achieve at least one of the above objectives, the technical solution adopted in this application is: a real-time cross-camera vehicle tracking method, comprising the following steps:

[0010] S100: Based on the video stream acquired in real time by multiple cameras, vehicle detection and tracking are performed by a single camera to obtain the local vehicle trajectory corresponding to each camera and extract the ReID features of each local vehicle trajectory.

[0011] S200: Construct a global trajectory buffer and store the real-time local vehicle trajectories into the global trajectory buffer; wherein, the global trajectory buffer manages the stored trajectory data based on time and / or frame number;

[0012] S300: For newly stored local vehicle trajectories in the global trajectory buffer, an incremental clustering algorithm is used to dynamically calculate the multidimensional similarity between the trajectory and the existing clustered trajectories in the global trajectory buffer in order to perform trajectory association matching.

[0013] S400: Based on the association matching results, update the existing clustered trajectories in the global trajectory buffer or create new clustered trajectories to obtain multi-camera vehicle trajectories with unique global IDs, thereby achieving cross-camera vehicle tracking.

[0014] Preferably, in step S200, the trajectory data management for the global trajectory buffer includes the following process: designing a dual sliding window mechanism based on time and frame number to limit the number of stored trajectories; using a hierarchical storage structure including a trajectory entry layer and a trajectory layer to store trajectory data; wherein, the trajectory entry layer is used to store trajectory information at a single moment, and the trajectory layer is used to store the complete trajectory sequence; periodically cleaning up trajectory data in the global trajectory buffer that does not meet the limit conditions, and caching the calculated ReID features using a least recently used strategy.

[0015] Preferably, the trajectory entries retained under the dual sliding window mechanism need to meet the following conditions: the difference between the timestamp when the trajectory entry was acquired and the current time does not exceed a preset time window, and the difference between the frame number of the trajectory entry in the video stream and the current frame number does not exceed a preset number of frames window.

[0016] Preferably, when cleaning trajectory data, the interval between two adjacent cleanings is obtained by rounding down the ratio of a preset frame number window to a preset cleaning frequency parameter; when caching ReID features, the upper limit of the cache is set by multiplying the preset frame number window by the total number of cameras.

[0017] Preferably, in step S300, a multidimensional similarity is constructed by weighted fusion of ReID feature similarity, temporal compatibility similarity, and spatial compatibility similarity; the multidimensional similarity between the local vehicle trajectory and the existing clustered trajectories in the global trajectory buffer is calculated; if the highest value of the calculated multidimensional similarity exceeds the dynamically adjusted threshold, the local vehicle trajectory is associated and matched with the clustered trajectory with the highest multidimensional similarity.

[0018] Preferably, the multidimensional similarity S total The expression is as follows:

[0019] ;

[0020] ;

[0021] ;

[0022] ;

[0023] Where α1, α2, and α3 represent the ReID feature similarity S, respectively. reid Time compatibility similarity S temporal and spatial compatibility similarity S spatial The corresponding fusion weight, f new ReID feature vectors representing local vehicle trajectories. T represents the average eigenvector of the clustering trajectory. new The timestamp T represents the local vehicle trajectory. cluster The timestamp representing the clustering trajectory, σ t d represents the time decay coefficient. spatial (·) indicates spatial distance calculation, P new P represents the spatial location of a local vehicle trajectory. cluster σ represents the spatial location of the clustering trajectory. s This represents the spatial attenuation coefficient.

[0024] Preferably, when performing the matching of local vehicle trajectories and clustered trajectories, the system calculates the performance index of cross-camera tracking in real time; based on the comparison between the real-time calculated performance index and the preset target value, the threshold used for multi-dimensional similarity judgment is dynamically adjusted.

[0025] Preferably, the performance metrics include ID consistency metric IDF1, multi-target tracking accuracy metric MOTA, ID switching count metric IDSW, real-time performance metric Latency, and resource consumption metric Memory. total The specific expression is:

[0026] ;

[0027] ;

[0028] ;

[0029] ;

[0030] ;

[0031] Where IDTP represents the number of correct ID matches, IDFP represents the number of incorrect ID matches, IDFN represents the number of missed ID matches, FN represents the number of missed detections, FP represents the number of false detections, GT represents the total number of real targets, T represents the total number of frames across cameras, and N... t This represents the total number of targets in frame t. Represents the exponential function, ID i,t and ID i,t-1 Let N represent the IDs of the i-th target in frame t and frame (t-1), respectively. frames T represents the total number of frames processed. output,j T represents the output time of the j-th frame. intput,j Represents the input time of the j-th frame, Memory buffer This indicates the memory usage of the global trajectory buffer. cache Indicates the memory usage of the feature cache. cluster This indicates the memory usage of the clustered data.

[0032] Preferably, if the currently calculated tracking accuracy A current Below the set target accuracy A target The threshold θ used for multidimensional similarity judgment current The specific calculation formula for the reduction adjustment is as follows:

[0033] ;

[0034] If the currently calculated false match rate (FPR) current Higher than the maximum permissible false match rate (FPR) max The threshold θ used for multidimensional similarity judgment current The adjustments will be made, and the specific calculation formula is as follows:

[0035] ;

[0036] Where, θ new γ represents the adjusted threshold, and γ represents the adjustment step size.

[0037] Preferably, after completing the association matching between local vehicle trajectories and clustered trajectories, the associated trajectories are verified, including time consistency checks, spatial rationality checks, and confidence assessments. Among them, the time consistency check is used to verify whether the time order of the associated trajectories is reasonable, the spatial rationality check is used to verify the spatial continuity of the associated trajectories, and the confidence assessment is used to calculate the confidence score of the current associated trajectory. After the associated trajectory meets the verification conditions, a unique global ID is assigned.

[0038] Compared with the prior art, the beneficial effects of this application are as follows:

[0039] (1) By adopting incremental clustering algorithm and sliding window management, cross-camera tracking with a response time of seconds is realized. Compared with the traditional batch processing method, the latency is greatly reduced, which meets the strict requirements of real-time monitoring.

[0040] (2) Through the sliding window mechanism and periodic cleanup strategy, the system memory usage remains stable and will not increase linearly with running time, supporting long-term continuous operation.

[0041] (3) The system can automatically adjust the clustering parameters according to real-time performance indicators, optimize the processing speed while ensuring tracking accuracy, and adapt to different scenario requirements.

[0042] (4) By using multidimensional similarity calculation and intelligent association strategy, high tracking accuracy is maintained while ensuring second-level response, thus solving the contradiction between accuracy and real-time performance of traditional methods. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of the overall working steps of this application. Detailed Implementation

[0044] The present application will now be further described in conjunction with specific embodiments. It should be noted that, in the description of this specification, the use of terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicates that the specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms should not be construed as necessarily referring to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.

[0045] In the description of this application, it should be noted that the terms "center", "lateral", "longitudinal", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", etc., which indicate the orientation and positional relationship based on the orientation or positional relationship shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and should not be construed as limiting the specific protection scope of this application.

[0046] It should be noted that the terms "first," "second," etc., in the specification and claims of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0047] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0048] In this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature being directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature being directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.

[0049] The terms “comprising” and “having”, and any variations thereof, in the specification and claims of this application are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0050] One preferred embodiment of this application, such as Figure 1 As shown, a real-time cross-camera vehicle tracking method includes the following steps:

[0051] S100: Based on the video stream acquired in real time by multiple cameras, perform vehicle detection and tracking by a single camera, obtain the local vehicle trajectory corresponding to each camera, and extract the ReID features of each local vehicle trajectory.

[0052] S200: Construct a global trajectory buffer and store the real-time local vehicle trajectories into the global trajectory buffer; wherein, the global trajectory buffer manages the stored trajectory data based on time and / or frame number.

[0053] S300: For newly stored local vehicle trajectories in the global trajectory buffer, an incremental clustering algorithm is used to dynamically calculate their multidimensional similarity with existing clustered trajectories in the global trajectory buffer in order to perform trajectory association matching.

[0054] S400: Based on the association matching results, update the existing clustered trajectories in the global trajectory buffer or create new clustered trajectories to obtain multi-camera vehicle trajectories with unique global IDs, thereby achieving cross-camera vehicle tracking.

[0055] Understandably, in real-time monitoring scenarios, vehicle cross-camera tracking presents a typical contradiction between high real-time performance and high accuracy requirements, influenced by factors such as the number of cameras, video frame rate, trajectory complexity, and computing resources. Traditional offline batch processing methods, due to issues such as excessive latency, large memory consumption, and lack of dynamic adjustment capabilities, are insufficient to meet real-time monitoring needs. Therefore, the technical problem this application aims to solve is: how to achieve real-time cross-camera correlation of vehicle trajectories in a multi-camera monitoring network, maintaining high tracking accuracy while ensuring a response time within seconds, and controlling memory consumption within a reasonable range.

[0056] To address the aforementioned technical challenges, this application employs the following technical solution: First, real-time video data acquisition and processing via multiple cameras provides high-quality trajectory segments and features for subsequent stages. Then, the system utilizes a global trajectory buffer for data standardization and management, entering the core incremental clustering stage. In this stage, the algorithm dynamically calculates the multidimensional similarity between each newly arriving local vehicle trajectory and existing clusters, adaptively adjusting the clustering strategy and similarity threshold based on real-time performance monitoring metrics. The system rigorously filters trajectory-cluster pairs that satisfy spatial-temporal physical constraints, ensuring that only targets with reasonable continuity are associated. For matching pairs meeting the adaptive threshold, the system performs incremental merging operations, updating cluster centers and confidence levels, and refreshing the global trajectory set in real-time. This iterative process continues, achieving real-time cross-camera association and global ID allocation. Finally, the system outputs multi-camera vehicle trajectories with unique global IDs and presents the tracking results through real-time visualization. For ease of understanding, the specific working process of each step is described in detail below.

[0057] In this embodiment, when executing step S100, a multi-threaded parallel processing architecture can be established for the monitoring network constructed by multiple cameras; that is, each camera is assigned an independent processing thread. According to the established processing architecture, the video streams captured by each camera can be processed. The specific processing steps include three stages: frame rate adaptive recognition, buffer management, and data preprocessing.

[0058] Specifically, adaptive frame rate recognition automatically identifies the video frame rate f by analyzing the timestamp information of the video stream.i The system then dynamically adjusts its processing strategy based on the identified frame rate to ensure compatibility with videos of different frame rates. Buffer management employs a circular buffer design, with each camera maintaining an independent frame buffer of size B. i The process is dynamically adjusted based on frame rate and processing capabilities. Data preprocessing is used to remove abnormal frame data.

[0059] Understandably, the buffer size B i The calculation formula is:

[0060] .

[0061] Among them, B max T represents the size of the maximum buffer. process Indicates the processing time per frame. This indicates rounding up to the nearest integer.

[0062] It's important to note that the buffers for each processing thread are completely different from the global trajectory buffer. Each processing thread's buffer is located at the very front of its thread, serving as the data input layer. It stores raw or decoded video frames and employs a circular design to facilitate the overwriting of older video frame data by newer data, focusing solely on the newer frames. The global trajectory buffer, on the other hand, resides at the system level and stores structured and characteristic trajectory entry data, providing a controlled, high-quality dataset for real-time cross-camera trajectory correlation.

[0063] Specifically, for vehicle detection using a single camera, state-of-the-art YOLOv11 or YOLO26 models can be used to detect vehicles on the input video frames. The specific working principles of YOLOv11 and YOLO26 models are well-known to those skilled in the art and will not be elaborated upon here. The detection process includes three steps: feature extraction, bounding box regression, and classification. For each detected target vehicle, the bounding box coordinates, confidence score, and class probability distribution are output. For vehicle tracking using a single camera, the ByteTrack algorithm can be used. This algorithm addresses the impact of detection scores on tracking performance by employing a phased matching strategy. First, Kalman filtering is used to predict the target's position in the next frame. Then, for high-scoring detection boxes, the Hungarian algorithm, combined with costs such as intersection-over-union ratio (IoU), is used to match the predicted trajectory, completing the main tracking association. For low-scoring detection boxes, a secondary matching is performed to minimize the loss of target vehicle IDs. The prediction, matching, and update steps work closely together: prediction provides prior positions for matching, matching determines the tracking association, and updating corrects the tracking state based on the matching results, thereby achieving more stable target tracking.

[0064] Specifically, for ReID feature extraction of local vehicle trajectories, a ReID feature extractor based on deep neural networks can be used to map vehicle images into a high-dimensional feature space. Simply put, mature backbone networks such as ResNet50-IBN or DenseNet121 are used as feature extractors. These are pre-trained on large-scale vehicle ReID datasets (such as VeRi-776 and VehicleID) and fine-tuned on target scene data to adapt to the characteristics of the specific monitoring environment, thus forming the required ReID feature extractor.

[0065] In this embodiment, the management of the global trajectory buffer during step S200 can be divided into three parts: a dual sliding window design, a trajectory data storage structure design, and a memory optimization strategy design. The dual sliding window mechanism and periodic cleanup strategy ensure stable system memory usage, preventing linear growth over runtime and supporting long-term continuous operation. For ease of understanding, these three parts are described in detail below.

[0066] For the dual sliding window design: A dual sliding window mechanism based on time and frame count is designed to limit the number of stored trajectories, ensuring controllable and stable memory usage. Trajectory entries retained under the dual sliding window mechanism must meet the following conditions: the difference between the timestamp of the trajectory entry when it was acquired and the current time does not exceed a preset time window; and the difference between the frame number of the trajectory entry in the video stream and the current frame number does not exceed a preset frame count window. The preset time window limits the time range of the trajectory data, and the preset frame count window limits the quantity range of the trajectory data. The specific values ​​of the preset time window and frame count window can be selected according to the actual needs of those skilled in the art.

[0067] The storage structure design for trajectory data employs a hierarchical storage structure including a trajectory entry layer and a trajectory layer. The trajectory entry layer stores trajectory information at a single moment, while the trajectory layer stores complete trajectory sequences. The trajectory entry layer contains fields such as camera identifier, trajectory ID, frame number, timestamp, bounding box coordinates, ReID features, vehicle category, confidence level, and attribute information. The trajectory layer contains fields such as trajectory ID, trajectory entry list, global ID, and feature cache. In simpler terms, if multiple target vehicles exist within the camera's field of view at a given moment, trajectory information corresponding to different target vehicles can be obtained during vehicle detection; this trajectory information is stored in the trajectory entry layer. Trajectory information corresponding to the same target vehicle at multiple consecutive moments is aggregated to obtain a trajectory sequence of multiple consecutive frames within the same target; this trajectory sequence can be stored in the trajectory layer. When a target vehicle moves across different cameras, the trajectory sequences corresponding to the target vehicle under different cameras can be clustered.

[0068] For memory optimization, a periodic cleanup strategy and a feature caching strategy are adopted. The periodic cleanup strategy can periodically clean up trajectory data in the global trajectory buffer that does not meet the constraints; the feature caching strategy caches calculated ReID features to avoid duplicate calculations.

[0069] It's important to know that for periodic cleaning strategies, a cleaning interval (I) can be set. cleanup That is, every I cleanup Each frame performs a trajectory data cleanup operation. The cleanup interval is I. cleanup Through the preset frame rate window W frames With the preset cleaning frequency parameter N cleanup The ratio is obtained by rounding down; the preset cleaning frequency parameter N cleanup The specific value can be selected by those skilled in the art based on their actual needs. Cleaning interval I cleanup The specific expression is:

[0070] .

[0071] For feature caching strategies, calculated ReID features can be cached using a least recently used strategy. When caching ReID features, a preset frame window W is used. frames With the total number of cameras N cameras The product sets the cache limit C. cache Cache limit C cache The specific expression is:

[0072] .

[0073] Wherein, α represents the cache ratio coefficient, and the specific value can be selected by those skilled in the art based on their actual needs.

[0074] In this embodiment, during step S300, a multidimensional similarity is constructed by weighted fusion of ReID feature similarity, temporal compatibility similarity, and spatial compatibility similarity. The multidimensional similarity between the local vehicle trajectory and existing clustered trajectories in the global trajectory buffer is calculated. If the highest value of the calculated multidimensional similarity exceeds a dynamically adjusted threshold, an incremental clustering algorithm is used to associate and match the local vehicle trajectory with the clustered trajectory having the highest multidimensional similarity. This scheme employs incremental clustering and sliding window management to achieve cross-camera tracking with a response time of seconds, significantly reducing latency compared to traditional batch processing methods and meeting the stringent requirements of real-time monitoring. Simultaneously, through multidimensional similarity calculation and intelligent association strategies, high tracking accuracy is maintained while ensuring a response time of seconds, resolving the contradiction between accuracy and real-time performance in traditional methods.

[0075] Understandably, the multidimensional similarity S total The expression is as follows:

[0076] .

[0077] Where α1, α2, and α3 represent the ReID feature similarity S, respectively. reid Time compatibility similarity S temporal and spatial compatibility similarity S spatial The corresponding fusion weights.

[0078] When performing correlation matching between local vehicle trajectories and clustered trajectories, it is necessary to combine the calculated multidimensional similarity S... total The highest value in (S) total ) max With the set threshold θ current Compare; if (S total ) max ≥θ current Then the local vehicle trajectory will be compared with (S) total ) max The corresponding clustering trajectories are then matched for association.

[0079] Among them, the ReID feature similarity S reid Cosine similarity is used, and the specific expression is as follows:

[0080] .

[0081] .

[0082] .

[0083] In the formula, f new ReID feature vectors representing local vehicle trajectories. w represents the average eigenvector of the clustered trajectory, N represents the number of trajectory segments contained in the clustered trajectory, and w x L represents the weight corresponding to the x-th trajectory segment. x and L y Let C represent the lengths of the x-th and y-th trajectory segments, respectively. x and C y and represent the average confidence levels of the x-th trajectory segment and the y-th trajectory segment, respectively.

[0084] Among them, the time compatibility similarity S temporal The calculation is based on the trajectory time interval, and the specific expression is as follows:

[0085] .

[0086] In the formula, T new The timestamp T represents the local vehicle trajectory. cluster The timestamp representing the clustering trajectory, σ t This represents the time decay coefficient.

[0087] Among them, spatial compatibility similarity S spatial The specific expression is calculated based on the trajectory spatial distance:

[0088] .

[0089] In the formula, d spatial (·) indicates spatial distance calculation, P new P represents the spatial location of a local vehicle trajectory. cluster σ represents the spatial location of the clustering trajectory. s This represents the spatial attenuation coefficient.

[0090] It is important to note that environmental factors have a significant impact on the recognition accuracy of cameras; therefore, when setting a threshold θ... current If fixed parameters are used during the setting process, changes in environmental conditions or fluctuations in system operation may prevent the clustering of numerous local vehicle trajectories, resulting in a significant decrease in system tracking performance. Therefore, when matching local vehicle trajectories with clustered trajectories, the system's cross-camera tracking performance metrics are calculated in real time. Based on a comparison between the real-time calculated performance metrics and the preset target value, the threshold θ used for multidimensional similarity judgment is dynamically adjusted. current Compared to traditional methods, this application can automatically adjust clustering parameters based on real-time performance indicators, optimizing processing speed while ensuring tracking accuracy, and adapting to different scenario requirements.

[0091] Specifically, the system's performance metrics include ID consistency (IDF1), multi-target tracking accuracy (MOTA), ID switching frequency (IDSW), real-time performance (Latency), and resource consumption (Memory). total .

[0092] The ID consistency metric IDF1 is the core evaluation indicator for achieving cross-camera vehicle tracking, reflecting the system's ability to assign a unique global ID to the same vehicle. The IDF1 value ranges from [0, 1], with higher values ​​indicating better ID consistency. The specific expression is:

[0093] .

[0094] In the formula, IDTP represents the number of correct ID matches, that is, the number of times the system correctly associates the same vehicle in different cameras with the same global ID; IDFP represents the number of incorrect ID matches, that is, the number of times the system incorrectly associates different vehicles with the same global ID; and IDFN represents the number of missing ID matches, that is, the number of times the system fails to associate the trajectory of the same vehicle in different cameras.

[0095] The Multi-Target Tracking Accuracy (MOTA) metric is used to evaluate the overall tracking performance of a system. The MOTA value typically ranges from [0, 1], with higher values ​​indicating higher tracking accuracy. MOTA comprehensively considers detection capability and ID consistency, and its specific expression is:

[0096] .

[0097] In the formula, FN represents the number of missed detections, which is the number of vehicles that actually exist but have not been detected by the system; FP represents the number of false detections, which is the number of fake targets that the system detects but do not actually exist; IDSW represents the ID switching count index, which is the number of times the global ID of the same vehicle changes; and GT represents the total number of real targets.

[0098] ID Switching Count (IDSW) is an important indicator for measuring the stability of cross-camera association. Fewer ID switches indicate better ID consistency in the system. The specific expression is:

[0099] .

[0100] In the formula, T represents the total number of frames across cameras for the target, and N t This represents the total number of targets in frame t. This represents an exponential function; the value is 1 if the logic within the parentheses is true, and 0 otherwise. ID i,t and ID i,t-1 These represent the IDs of the i-th target in frame t and frame (t-1), respectively.

[0101] Real-time performance metric Latency is primarily represented by physical latency, measured as the average end-to-end processing time. The specific expression is:

[0102] .

[0103] In the formula, N frames T represents the total number of frames processed. output,j T represents the output time of the j-th frame. intput,j This represents the input time of the j-th frame.

[0104] Resource usage metrics (Memory) total It is mainly represented by memory usage, and the specific expression is:

[0105] .

[0106] In the formula, Memory buffer This indicates the memory usage of the global trajectory buffer. cache Indicates the memory usage of the feature cache. cluster This indicates the memory usage of the clustered data.

[0107] In this embodiment, the execution threshold θ current During adaptive adjustment, quantified tracking accuracy and mismatch rate are used as core feedback signals to achieve closed-loop optimization control of the cross-camera vehicle tracking process. Tracking accuracy is mainly related to the ID consistency index IDF1, the multi-target tracking accuracy index MOTA, and the ID switching count index IDSW. The ID consistency index IDF1 is a direct quantification of tracking accuracy in the identity consistency dimension, and the two can be approximated in value. The multi-target tracking accuracy index MOTA is a comprehensive reflection of tracking accuracy in detection and ID consistency; a higher MOTA value indicates higher tracking accuracy. Higher tracking accuracy also places higher demands on ID stability, resulting in a lower ID switching count index IDSW. The mismatch rate is mainly related to the ID consistency index IDF1, the multi-target tracking accuracy index MOTA, the real-time performance index Latency, and the resource consumption index Memory. total Relatedly, an increase in the false match rate will directly lead to an increase in the number of incorrect ID matches (IDFP), and the corresponding number of false detections (FP) will also increase, thereby causing a decrease in the ID consistency index (IDF1) and the multi-target tracking accuracy index (MOTA). An increase in the false match rate may lead to incorrect clustering results, which will increase the computational burden, resulting in increased computational latency and memory usage.

[0108] Therefore, when performing threshold θ current During adaptive adjustment, if the currently calculated tracking accuracy A current Below the set target accuracy A target The threshold θ used for multidimensional similarity judgment current A reduction adjustment is made to associate more potential, slightly less similar correct trajectory pairs, aiming to improve the recall rate of the associations, thereby improving the ID consistency metric IDF1 and the multi-target tracking accuracy metric MOTA, etc. Threshold θ current The expression for adaptive adjustment is:

[0109] .

[0110] Where, θ new γ represents the adjusted threshold, and γ represents the adjustment step size.

[0111] If the currently calculated false match rate (FPR) current Higher than the maximum permissible false match rate (FPR) max The threshold θ used for multidimensional similarity judgment current Adjustments are made to filter out highly similar but actually erroneous associated trajectories, aiming to improve the accuracy of associations. This frees up memory and indirectly protects the ID consistency metric IDF1 and the multi-target tracking accuracy metric MOTA from mismatch contamination. Threshold θ current The expression for adaptive adjustment is:

[0112] .

[0113] In this embodiment, when matching local vehicle trajectories with existing clustered trajectories in the global trajectory buffer, existing clustered trajectories can be filtered first by setting a matching time window. This allows the selected candidate clustered trajectories to be matched with the local vehicle trajectory, reducing computational load. Since the target vehicle's cross-camera travel time is generally short, a matching time window can be set when performing cross-camera trajectory matching. Then, the time difference between the current local vehicle trajectory and all existing clustered trajectories is calculated. For clustered trajectories exceeding this matching time window, it is clear that the local vehicle trajectory is not associated with them.

[0114] In this embodiment, after completing the association matching between local vehicle trajectories and clustered trajectories, the associated trajectories can be verified to ensure the accuracy of the associated trajectories obtained through clustering. This verification includes temporal consistency checks, spatial rationality checks, and confidence assessments. Specifically, the temporal consistency check verifies the rationality of the temporal order of the associated trajectories, the spatial rationality check verifies the spatial continuity of the associated trajectories, and the confidence assessment calculates the confidence score of the current associated trajectory. Once the associated trajectory meets the verification conditions, a unique global ID is assigned to it.

[0115] Specifically, for time consistency checks, the timestamps of any two adjacent trajectory segments in the associated trajectory can be compared to determine whether the two trajectory segments are logically consistent in time sequence, ensuring that the end time of the previous trajectory segment is not later than the start time of the next trajectory segment, and that the ID of the same target vehicle in the same camera does not show time reversal, etc.

[0116] For spatial rationality checks, the spatial distance between any two adjacent trajectory segments in the associated trajectory, as well as the maximum travel distance of the target vehicle over the time span of the two trajectory segments, can be calculated. If the calculated spatial distance is less than or equal to the calculated maximum travel distance, it indicates that the associated trajectory meets the spatial rationality check.

[0117] For confidence assessment, the score is calculated by multiplying the multidimensional similarity of the associated trajectories with the consistency score. The consistency score is related to the results of the temporal consistency and spatial reasonableness checks. That is, when the associated trajectories meet the conditions of temporal consistency and spatial reasonableness, the consistency score is higher, for example, it can be 0.8 to 1; when the associated trajectories do not meet the conditions of temporal consistency or spatial reasonableness, the consistency score is 0. When the calculated confidence score is greater than the set confidence threshold, it indicates that the associated trajectories meet the confidence assessment conditions. The specific value of the confidence threshold can be determined by those skilled in the art based on their actual needs.

[0118] The basic principles, main features, and advantages of this application have been described above. Those skilled in the art should understand that this application is not limited to the above embodiments. The embodiments and descriptions in the specification are merely the principles of this application. Various changes and modifications can be made to this application without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claims. The scope of protection claimed by this application is defined by the appended claims and their equivalents.

Claims

1. A real-time cross-camera vehicle tracking method, characterized in that, Includes the following steps: S100: Based on the video stream acquired in real time by multiple cameras, vehicle detection and tracking are performed by a single camera to obtain the local vehicle trajectory corresponding to each camera and extract the ReID features of each local vehicle trajectory. S200: Construct a global trajectory buffer and store the real-time local vehicle trajectories into the global trajectory buffer; wherein, the global trajectory buffer manages the stored trajectory data based on time and / or frame number; wherein, the trajectory data management for the global trajectory buffer includes the following process: Design a dual sliding window mechanism based on time and frame count to limit the number of stored trajectories; A hierarchical storage structure, including a trajectory entry layer and a trajectory layer, is used to store trajectory data; the trajectory entry layer is used to store trajectory information at a single moment, and the trajectory layer is used to store the complete trajectory sequence. Periodically clean up trajectory data in the global trajectory buffer that does not meet the constraints, and cache the calculated ReID features using the least recently used strategy; S300: For newly stored local vehicle trajectories in the global trajectory buffer, an incremental clustering algorithm is used to dynamically calculate the multidimensional similarity between the trajectory and the existing clustered trajectories in the global trajectory buffer in order to perform trajectory association matching. S400: Based on the association matching results, update the existing clustered trajectories in the global trajectory buffer or create new clustered trajectories to obtain multi-camera vehicle trajectories with unique global IDs, thereby achieving cross-camera vehicle tracking.

2. The real-time cross-camera vehicle tracking method as described in claim 1, characterized in that, The trajectory entries retained based on the dual sliding window mechanism must meet the following conditions: The difference between the timestamp when the trajectory entry was acquired and the current time does not exceed a preset time window, and the difference between the frame number of the trajectory entry in the video stream and the current frame number does not exceed a preset number of frames.

3. The real-time cross-camera vehicle tracking method as described in claim 1, characterized in that, When cleaning trajectory data, the interval between two adjacent cleaning operations is obtained by rounding down the ratio of a preset frame number window to a preset cleaning frequency parameter. When caching ReID features, the cache limit is set by multiplying the preset frame rate window by the total number of cameras.

4. The real-time cross-camera vehicle tracking method as described in any one of claims 1-3, characterized in that, In step S300, a multidimensional similarity is constructed by weighted fusion of ReID feature similarity, temporal compatibility similarity, and spatial compatibility similarity. Calculate the multidimensional similarity between local vehicle trajectories and existing clustered trajectories in the global trajectory buffer; If the highest value of the calculated multidimensional similarity exceeds the dynamically adjusted threshold, the local vehicle trajectory will be associated and matched with the clustered trajectory with the highest multidimensional similarity.

5. The real-time cross-camera vehicle tracking method as described in claim 4, characterized in that, Multidimensional similarity S total The expression is as follows: ; ; ; ; Where α1, α2, and α3 represent the ReID feature similarity S, respectively. reid Time compatibility similarity S temporal and spatial compatibility similarity S spatial The corresponding fusion weight, f new ReID feature vectors representing local vehicle trajectories. T represents the average eigenvector of the clustering trajectory. new The timestamp T represents the local vehicle trajectory. cluster The timestamp representing the clustering trajectory, σ t d represents the time decay coefficient. spatial (·) indicates spatial distance calculation, P new P represents the spatial location of a local vehicle trajectory. cluster σ represents the spatial location of the clustering trajectory. s This represents the spatial attenuation coefficient.

6. The real-time cross-camera vehicle tracking method as described in claim 4, characterized in that, When matching local vehicle trajectories with clustered trajectories, the system calculates the performance metrics of cross-camera tracking in real time; based on the comparison between the real-time calculated performance metrics and the preset target values, the threshold used for multi-dimensional similarity judgment is dynamically adjusted.

7. The real-time cross-camera vehicle tracking method as described in claim 6, characterized in that, Performance metrics include ID consistency metric IDF1, multi-target tracking accuracy metric MOTA, ID switching count metric IDSW, real-time performance metric Latency, and resource consumption metric Memory. total The specific expression is: ; ; ; ; ; Where IDTP represents the number of correct ID matches, IDFP represents the number of incorrect ID matches, IDFN represents the number of missed ID matches, FN represents the number of missed detections, FP represents the number of false detections, GT represents the total number of real targets, T represents the total number of frames across cameras, and N... t This represents the total number of targets in frame t. ID represents the exponential function. i,t and ID i,t-1 Let N represent the IDs of the i-th target in frame t and frame (t-1), respectively. frames T represents the total number of frames processed. output,j T represents the output time of the j-th frame. intput,j Represents the input time of the j-th frame, Memory buffer This indicates the memory usage of the global trajectory buffer. cache Indicates the memory usage of the feature cache. cluster This indicates the memory usage of the clustered data.

8. The real-time cross-camera vehicle tracking method as described in claim 7, characterized in that, If the current calculated tracking accuracy A current Below the set target accuracy A target The threshold θ used for multidimensional similarity judgment current The specific calculation formula for the reduction adjustment is as follows: ; If the currently calculated false match rate (FPR) current Higher than the maximum permissible false match rate (FPR) max The threshold θ used for multidimensional similarity judgment current The adjustments will be made, and the specific calculation formula is as follows: ; Where, θ new γ represents the adjusted threshold, and γ represents the adjustment step size.

9. The real-time cross-camera vehicle tracking method as described in claim 1, characterized in that, After completing the association matching between local vehicle trajectories and clustered trajectories, the associated trajectories are validated, including temporal consistency checks, spatial rationality checks, and confidence assessments. Among them, the time consistency check is used to verify whether the time order of the associated trajectories is reasonable, the spatial rationality check is used to verify the spatial continuity of the associated trajectories, and the confidence assessment is used to calculate the confidence score of the current associated trajectory. After the associated trajectory meets the verification conditions, a unique global ID is assigned.