A method for cross-camera vehicle tracking and trajectory matching
By dynamically adjusting the clustering threshold and the phased clustering strategy, combined with confidence and duration features, and strict spatiotemporal constraints, the adaptability and accuracy issues of trajectory merging in multi-camera monitoring systems are solved, achieving high-precision and stable trajectory matching.
Patent Information
- Application Number
- CN202511173531.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-08-21
AI Technical Summary
In existing multi-camera monitoring systems, trajectory merging suffers from problems such as insufficient adaptability of fixed thresholds, lack of dynamic adaptability of clustering strategies, inadequate spatiotemporal constraints, and lack of posterior backtracking optimization, resulting in insufficient trajectory matching accuracy and stability.
By employing a dynamic adjustment of clustering thresholds, a phased clustering strategy, and a strict spatiotemporal constraint mechanism, combined with the confidence and duration characteristics of trajectory segments, trajectory merging is performed by calculating similarity and multiple constraints to ensure rationality and accuracy.
It improves the accuracy and robustness of trajectory matching, avoids over-merging or under-merging, ensures the physical rationality of trajectory merging, and enhances the accuracy and stability of multi-camera target tracking systems.
Smart Images

Figure CN120672803B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent transportation technology, and in particular to a method for cross-camera vehicle tracking and trajectory matching. Background Technology
[0002] With the rapid development of intelligent transportation systems and computer vision technology, multi-camera monitoring networks have become a core component of modern traffic management systems. In complex traffic scenarios such as highways, service areas, and urban roads, the same vehicle is often captured in segments by multiple cameras, forming several independent trajectory fragments. However, due to differences in monitoring angle, camera depth of field, and pixel specifications, the same vehicle often exhibits significant differences in target size, shooting angle, image clarity, and target completeness in the video footage from different cameras. Furthermore, the spatiotemporal complexity of a vehicle entering another camera's field of view after exiting one camera's view makes the collaborative association mechanism between multiple devices crucial for cross-camera target trajectory matching. Therefore, how to accurately merge trajectory fragments of the same vehicle under different cameras, construct a complete cross-camera trajectory, and effectively avoid erroneous identity switching has become a core technical challenge that intelligent traffic monitoring systems urgently need to overcome.
[0003] Currently, mainstream multi-target multi-camera (MTMC) tracking technologies generally employ trajectory segment similarity clustering methods with a fixed threshold to achieve trajectory merging. However, these methods have the following technical limitations:
[0004] The fixed threshold lacks adaptability: The use of a globally uniform similarity threshold for trajectory merging fails to dynamically adjust the judgment criteria based on the quality characteristics of trajectory segments (such as confidence and completeness). This results in a dual problem: high-confidence trajectories are over-merged due to threshold restrictions, while low-confidence trajectories are missed due to lenient thresholds.
[0005] Clustering strategies lack dynamic adaptability: relying on a single clustering strategy throughout the entire process cannot match the characteristics and needs of different clustering stages (such as large-scale merging in the early stage and fine-grained optimization in the later stage), which can easily lead to incorrect trajectory association or omission of key segments.
[0006] Inadequate spatiotemporal constraint mechanism: The spatiotemporal constraint check for cross-camera trajectory merging is not systematic enough and does not fully cover physical rationality verification (such as time connection logic and spatial motion law), which can easily lead to trajectory merging results that violate objective laws.
[0007] Post-hoc backtracking optimization is lacking: After clustering is completed, no confidence assessment system and error correction mechanism for the merging results are established, making it difficult to identify low-quality merged trajectories and perform backtracking optimization, resulting in erroneous results that directly affect the overall tracking accuracy. Summary of the Invention
[0008] One objective of this application is to provide a cross-camera vehicle tracking and trajectory matching method that can solve at least one of the defects in the aforementioned background art.
[0009] To achieve at least one of the above objectives, the technical solution adopted in this application is: a cross-camera vehicle tracking and trajectory matching method, comprising the following steps:
[0010] S100: Acquire vehicle trajectory segments detected by each camera and extract feature information for each trajectory segment, including ReID features, confidence level, duration and spatial location;
[0011] S200: Calculate the similarity and clustering threshold of any two trajectory segments based on their feature information, and then cluster the trajectory segments with similarity greater than or equal to the clustering threshold in sequence;
[0012] S300: After each clustering is completed, the number of remaining unmerged trajectory segments is identified; based on the different number of remaining unmerged trajectory segments, the entire clustering process is divided into three stages: initial, intermediate, and final; the similarity values for the three stages are taken as maximum similarity, average similarity, and minimum similarity, respectively.
[0013] S400: Apply temporal, spatial, and connectivity constraints to the cameras corresponding to the clustered trajectory segments, and merge trajectory segments where all constraints are satisfied.
[0014] Preferably, in step S200, for the clustering threshold It is calculated using the confidence level and duration of the trajectory segment, and the specific calculation formula is as follows:
[0015] ;
[0016] ;
[0017] in, and These represent the given highest and lowest thresholds, respectively; Score represents the overall score; norm represents the minimum and maximum thresholds. conf Normalized confidence level, norm dur α represents the normalized duration, β represents the confidence weight, and β represents the duration weight.
[0018] Preferably, the normalization of confidence level and duration is suitable for normalizing parameters within the actual range to the [0, 1] interval; the normalized confidence level norm conf and normalized duration norm dur The expression is as follows:
[0019] ;
[0020] ;
[0021] Among them, avg conf conf represents the average confidence level of two trajectory segments. max and conf min These represent the preset maximum and minimum confidence levels, respectively; duration represents the number of frames in the trajectory segment with fewer frames between the two trajectory segments, dur max and dur min These represent the maximum and minimum durations of the preset trajectory segments, respectively.
[0022] Preferably, the lower limit of the clustering threshold is set to 0.5~0.6; when calculating the clustering threshold of the trajectory segment in step S200, if the duration of the trajectory segment is less than 10 frames or the average confidence is less than 0.3, the set lower limit is used as the calculated value of the clustering threshold and compared with the similarity.
[0023] Preferably, in step S300, if the number of remaining trajectory segments is greater than or equal to 30% of the total number of trajectory segments, it is defined as the initial stage; if the number of remaining trajectory segments is greater than 5% of the total number of trajectory segments but less than 30% of the total number of trajectory segments, it is defined as the intermediate stage; and if the number of remaining trajectory segments is less than or equal to 5% of the total number of trajectory segments, it is defined as the closing stage.
[0024] Preferably, when clustering the trajectory segments in step S300, the trajectory segments from different cameras are clustered; wherein, the maximum similarity sim single Average similarity sim average and minimum similarity sim complete The calculation formula is as follows:
[0025] ;
[0026] ;
[0027] ;
[0028] ;
[0029] Where, sim(T) i T j ) represents the trajectory segment T corresponding to any two cameras. i and T j cosine similarity, M i and M jThese represent the total number of trajectory segments T. i and T j The trajectory family, where A and B represent the trajectory family M respectively. i and M j The number of trajectory segments within, and Representing trajectory segments T respectively i and T j The ReID characteristics.
[0030] Preferably, when performing step S400, the following four constraints are set for merging trajectory segments: setting a frame overlap constraint within the same camera to avoid merging two trajectory segments from the same camera; setting a position overlap constraint for non-overlapping camera pairs to avoid erroneous merging of trajectories with similar ReID features but too far apart in space; setting an adjacent camera constraint to avoid impossible cross-camera merging; and setting a time window constraint to avoid merging two trajectory segments with too short or too long intervals.
[0031] Preferably, the confidence level of the trajectory segment obtained after merging multiple trajectory segments in step S400 is calculated; if the calculated confidence level is lower than a set threshold, the corresponding trajectory segment is split; if the calculated confidence level is higher than the set threshold, the trajectory segment is retained.
[0032] Preferably, the confidence level C for each trajectory segment is... i The calculation formula is as follows:
[0033] ;
[0034] ;
[0035] ;
[0036] Where w1, w2, and w3 represent the internal similarity C, respectively. internal Trajectory quality C quality Spatial consistency C spatial The weights; N represents the number of trajectory pairs in the trajectory segment, quality(T) k ) represents trajectory segment T in the trajectory segment. k The quality, K represents the total number of all trajectory segments in the trajectory segment, and spatial consistency C spatial The results are obtained by calculating the spatial distribution of the trajectory segments that make up the trajectory segment in the world coordinate system.
[0037] Preferably, for trajectory segment T k quality (T) k The calculation formula for ) is as follows:
[0038] ;
[0039] ;
[0040] ;
[0041] in, Represents trajectory segment T k The confidence quality Represents trajectory segment T k Duration quality, Represents trajectory segment T k Mean confidence score of all detected frames Represents trajectory segment T k The number of consecutive frames.
[0042] Compared with the prior art, the beneficial effects of this application are as follows:
[0043] (1) This application dynamically adjusts the clustering threshold based on the confidence level and duration of the trajectory segments, and adopts different merging strategies for trajectory segments of different qualities, thereby improving the accuracy and robustness of trajectory matching.
[0044] (2) This application adopts a phased clustering strategy and dynamically adjusts the clustering method according to the number of remaining unmerged trajectory segments. This not only makes full use of the various feature information of trajectory segments, but also avoids the problems of excessive merging or missed merging, thereby improving the accuracy and stability of trajectory matching.
[0045] (3) Compared with traditional methods that rely solely on feature similarity for trajectory merging, this application ensures the rationality of trajectory merging through strict spatiotemporal constraints, effectively preventing physically impossible phenomena such as "instantaneous movement" and "excessive dwell time". Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the overall working steps of this application.
[0047] Figure 2 This is a schematic diagram of the overall implementation process of this application. Detailed Implementation
[0048] 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.
[0049] 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.
[0050] 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.
[0051] 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.
[0052] 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.
[0053] 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.
[0054] One preferred embodiment of this application, such as Figure 1 and Figure 2 As shown, a cross-camera vehicle tracking and trajectory matching method includes the following steps:
[0055] S100: Acquire vehicle trajectory segments detected by each camera and extract feature information for each trajectory segment, including ReID features, confidence level, duration, and spatial location.
[0056] It should be noted that ReID features are typically represented by a fixed-dimensional vector. In this step, the ReID feature is the weighted average of the detection box areas of the ReID feature vectors of all frames in the trajectory segment, reflecting the appearance and identity features of the trajectory segment. Confidence indicates the degree to which the system trusts the trajectory segment, reflecting the overall detection quality of the trajectory segment. Duration indicates the time span of the entire trajectory segment formation process, reflecting the time span information of the trajectory segment. Spatial location indicates the position of the trajectory segment in spatial coordinates, reflecting the spatial distribution information of the trajectory segment in the monitoring scene.
[0057] After extracting ReID features, confidence level, duration, and spatial location information for each trajectory segment, normalization processing is required to eliminate dimensional differences between different features. Simultaneously, a spatial relationship model is established between the cameras, including camera position, field of view, and adjacency relationships.
[0058] S200: Calculate the similarity and clustering threshold of any two trajectory segments based on their feature information, and then cluster the trajectory segments with similarity greater than or equal to the clustering threshold in sequence.
[0059] It should be understood that each camera can correspond to multiple trajectory segments, and the purpose of clustering is to summarize the trajectory segments with high feature similarity from the trajectory segments corresponding to different cameras.
[0060] S300: After each clustering is completed, the number of remaining unmerged trajectory segments is identified; based on the different number of remaining unmerged trajectory segments, the entire clustering process is divided into three stages: initial, intermediate, and final; the similarity values for the three stages are taken as maximum similarity, average similarity, and minimum similarity, respectively.
[0061] It should be understood that during clustering, there may be some trajectory segments that meet the characteristic similarity requirements but clearly do not conform to the physical spatiotemporal relationship. Therefore, it is necessary to prevent the merging of such trajectory segments.
[0062] S400: Apply temporal, spatial, and connectivity constraints to the cameras corresponding to the clustered trajectory segments, merge the trajectory segments that satisfy all constraints, and obtain at least one corresponding trajectory segment.
[0063] Understandably, the technology in this application can dynamically adjust the clustering threshold based on features such as the confidence level and duration of trajectory segments, thereby solving the problem of poor adaptability of traditional methods using fixed thresholds. By comprehensively considering multiple features such as confidence level and duration, different merging strategies can be adopted for trajectory segments of different qualities, thus improving the accuracy and robustness of trajectory matching. During clustering, this application employs a staged clustering strategy, dynamically adjusting the clustering method based on the number of remaining trajectories. This not only fully utilizes the various feature information of trajectory segments but also avoids over-merging or under-merging, thereby improving the accuracy and stability of trajectory matching. Compared to traditional methods that rely solely on feature similarity for trajectory merging, this application ensures the rationality of trajectory merging through strict spatiotemporal constraints, effectively preventing physically impossible phenomena such as "instantaneous movement" and "excessive dwell time." For ease of understanding, each step will be described in detail below.
[0064] In this embodiment, during step S200, a clustering threshold is calculated based on the confidence level and duration of the trajectory segments. The dynamic calculation. For any two single-camera trajectory segments T... i and T j Clustering threshold The calculation formula is:
[0065] .
[0066] .
[0067] in, and These represent the given highest and lowest thresholds, respectively; Score represents the overall score; norm represents the minimum and maximum thresholds. conf Normalized confidence level, norm dur α represents the normalized duration, β represents the confidence weight, and β represents the duration weight.
[0068] It should be noted that traditional methods generally only provide [ , Clustering is performed using a fixed clustering threshold. However, in the technical solution of this application, the clustering threshold is dynamically calculated by introducing confidence level and duration, thus achieving adaptive clustering threshold. The specific values of confidence level weight α and duration weight β can be determined according to the actual needs of those skilled in the art. In this embodiment, the value of confidence level weight α is preferably 0.6~0.8, and the value of duration weight β is preferably 0.2~0.4. More preferably, the value of confidence level weight α is 0.7, and the value of duration weight β is 0.3.
[0069] It is understandable that confidence level is typically a probability value between 0 and 1, which is dimensionless; while duration is usually measured in seconds, which is dimensional. Directly using either for clustering threshold calculation would result in inconsistent dimensions. Therefore, this embodiment normalizes both confidence level and duration, mapping their actual ranges to a unified interval, i.e., normalizing them to the [0, 1] interval, to obtain the corresponding normalized confidence level (norm). conf and normalized duration norm dur Among them, the normalized confidence level (norm) conf and normalized duration norm dur The expression is as follows:
[0070] .
[0071] Among them, avg conf Represents two trajectory segments T i and T j Average confidence level; conf max and conf min These represent the preset maximum and minimum confidence levels, respectively. The specific values can be determined by those skilled in the art based on their actual needs. In this embodiment, conf is preferred. max The value ranges from 0.8 to 1, conf min The value of conf ranges from 0.2 to 0.4, with conf being a more preferred value. max =0.9, conf min =0.3. The confidence level was normalized to 0.3.conf The actual confidence range [0.3, 0.9] can be normalized to the interval [0, 1], meaning that detection results with a confidence level below 0.3 are truncated to the normal range. conf =0, detection results with a confidence level higher than 0.9 are adjusted to normal. conf =1.
[0072] .
[0073] Where duration represents the number of frames in the trajectory segment with fewer frames between the two trajectory segments, dur max and dur min These represent the maximum and minimum values of the preset trajectory segment duration, respectively. The specific values can be determined by those skilled in the art based on their actual needs; in this embodiment, `dur` is preferred. max The value ranges from 40 to 60, dur min The value of dur is 5~15, with dur being more preferred. max =50, dur min =10. Duration normalized by norm. dur The actual duration range [10, 50] can be normalized to the interval [0, 1], meaning that detection results with a duration less than 10 frames are truncated to the normal range. dur =0, detection results with a duration greater than 50 frames are adjusted to normal. dur =1.
[0074] In this embodiment, when calculating the clustering threshold, the quality of the trajectory segments can be preliminarily judged based on their confidence level and duration. Based on the judgment result, the trajectory segments can be divided into low-quality and high-quality trajectory segments. Specifically, trajectory segments with a duration of less than 10 frames or an average confidence level below 0.3 can be defined as low-quality trajectory segments. For these low-quality trajectory segments, the calculated clustering threshold is often low, such as 0.2 to 0.3, which allows two trajectory segments with low similarity to be clustered together.
[0075] Therefore, in this embodiment, to prevent erroneous clustering and merging of low-quality trajectory segments, a protection mechanism can be set for low-quality trajectory segments. Specifically, a lower limit for the clustering threshold is set to 0.5~0.6, preferably 0.55. When the clustering threshold calculated in step S200 is lower than the set lower limit, if the duration of the trajectory segment is less than 10 frames or the average confidence level is lower than 0.3, the set lower limit is used as the calculated value of the clustering threshold and compared with the similarity score. Through this protection mechanism, the clustering threshold corresponding to low-quality trajectory segments can be forcibly raised to no less than 0.55 to prevent erroneous merging of low-quality trajectory segments and ensure the reliability of the merging results.
[0076] In this embodiment, as Figure 2 As shown, after acquiring trajectory segment data from all cameras that collect vehicle motion trajectories, these trajectory segment data can be aggregated into a trajectory segment set. During clustering, the system also maintains a remaining trajectory segment set. That is, each time clustering occurs, the trajectory segments to be clustered are extracted from the trajectory segment set, and the remaining unmerged trajectory segments form a remaining trajectory segment set. Based on the number of trajectory segments in the remaining trajectory segment set, the entire clustering process can be divided into three stages: the initial stage, the intermediate stage, and the closing stage. In the initial stage, a single-linkage method is used to quickly merge locally similar trajectories; in the intermediate stage, an average-linkage method is used to balance local and global similarity; and in the closing stage, a full-linkage method is used to strictly constrain cluster compactness. Traditional methods often use a strict linking method in the early stages of clustering, which can easily lead to over-merging; or they use a loose linking method in the later stages of clustering, which can easily result in missed merging.
[0077] Understandably, in each clustering process, the system selects an appropriate similarity calculation method based on the number of remaining trajectory segments, and determines whether the merging conditions are met based on the ratio of the similarity to the clustering threshold. That is, for any two trajectory segments T... i and T j The trajectory pairs formed are merged into new multi-camera trajectory segments only when the similarity of the formed trajectory pairs is greater than or equal to the calculated clustering threshold and the spatiotemporal constraints are met. As trajectory segments are continuously merged, the size of the remaining trajectory segment set gradually decreases. The system will dynamically switch different clustering methods according to the number of remaining trajectory segments to achieve a multi-stage clustering process from coarse to fine and from local to global.
[0078] Specifically, in step S300, the division of the entire clustering process into three stages is as follows: If the number of remaining trajectory segments is greater than or equal to 30% of the total number of trajectory segments, it can be defined as the initial stage, and the similarity is taken as the maximum similarity using the single-link method. If the number of remaining trajectory segments is greater than 5% but less than 30% of the total number of trajectory segments, it can be defined as the intermediate stage, and the similarity is taken as the average similarity using the average-link method. If the number of remaining trajectory segments is less than or equal to 5% of the total number of trajectory segments, it can be defined as the final stage, and the similarity is taken as the minimum similarity using the fully-linked method.
[0079] Understandably, the entire clustering process is performed multiple times, or in multiple rounds. In each round, for a single trajectory pair, the similarity can be calculated based on only the corresponding method, or the similarity can be calculated for all three methods simultaneously, and then only the corresponding value is output based on the clustering stage. The entire clustering process employs a greedy strategy, selecting the trajectory pair with the highest similarity for merging at each stage. After merging, the merged trajectory segment is removed from the set of remaining trajectory segments, and the merged new trajectory segment continues to participate in subsequent clustering processes. This iterative merging strategy ensures the continuity and consistency of the clustering process.
[0080] For ease of understanding, the following can be illustrated by two trajectory clusters M corresponding to multi-camera trajectories. i and M j The merging process, for the maximum similarity sim single Average similarity sim average and minimum similarity sim complete The specific calculation process is described below. Trajectory cluster M i It includes A trajectory segments T i Trajectory cluster M j It includes B trajectory segments T j The values of A and B are at least 1, and each trajectory segment comes from a different camera.
[0081] Specifically, the two trajectory clusters M i and M j The similarity between the two is measured by the ReID features of their internal single-camera trajectory segments. Two single-camera trajectory segments T i With T j The similarity between them is defined as their ReID features. and Cosine similarity between sim(T) i T j ), cosine similarity sim(T) i T jThe specific calculation formula is as follows:
[0082] .
[0083] For two trajectory clusters M corresponding to multiple camera trajectories i and M j Different stages of clustering can be achieved using the cosine similarity mentioned above. Perform two trajectory clusters M i and M j Calculate the similarity between them.
[0084] For the single-link method, two trajectory clusters M i and M j The similarity between them is defined as the maximum similarity between any two single-camera trajectory segments. single Maximum similarity sim single The specific calculation formula is as follows:
[0085] .
[0086] For the average linking method, the two trajectory clusters M i and M j The similarity between them is defined as the average similarity between all corresponding single-camera trajectories. average Average similarity sim average The specific calculation formula is as follows:
[0087] .
[0088] For the fully linked approach, two trajectory clusters M i and M j The similarity between them is defined as the minimum similarity between any two corresponding single-camera trajectories. complete Minimum similarity sim complete The specific calculation formula is as follows:
[0089] .
[0090] In this embodiment, as Figure 2As shown, in the trajectory association process of multi-camera target tracking, to ensure that two trajectory segments can only be merged into the same target when the time, space, and camera connection relationships are all reasonable, this can effectively improve the physical rationality and robustness of the multi-camera target tracking system and avoid erroneous associations caused by unreasonable spatiotemporal relationships. Therefore, spatiotemporal constraints need to be applied to the clustered trajectory segments before merging them. This constraint mechanism not only improves the accuracy of trajectory matching but also enhances the robustness of the system in complex traffic scenarios, providing a reliable physical foundation for multi-camera target tracking.
[0091] Based on the above, the spatiotemporal constraints in step S400 can be mainly divided into the following four types:
[0092] Same camera frame overlap constraint: If two trajectory segments T i and T j If objects originating from the same camera and overlap within the same frame (meaning they are detected at the same time), then they are definitely not the same target. Setting this constraint can prevent similar-looking targets from the same camera and within the same frame from being incorrectly merged.
[0093] Positional overlap constraint for non-overlapping camera pairs: If two cameras do not have overlapping fields of view, their respective image coordinates are transformed to a unified 3D world coordinate system using a homography matrix to determine whether trajectory segments have spatial overlap in world coordinates. For cases of spatial overlap, the mean world coordinate distance between the two trajectory segments on the overlapping frames is calculated. If the mean distance is higher than a set threshold, the two trajectories are considered not to belong to the same target. This constraint uses spatial distance information to assist trajectory merging, preventing trajectories with similar ReID features but too large a spatial distance from being incorrectly merged.
[0094] Adjacency camera constraint: Analyzes whether a target is likely to move from one camera's field of view to another using a predefined camera adjacency table. This constraint is set to prevent impossible cross-camera merging, such as in one-way traffic situations on highways.
[0095] Time window constraint: Whether two trajectory segments can be physically related also needs to consider the reasonable time interval required for the target to disappear from one camera and appear in another. Only when the time interval is within the allowable minimum and maximum range is the trajectory considered to potentially belong to the same target. This constraint is set to prevent unreasonable merging such as "teleportation" or "excessive dwell time".
[0096] In this embodiment, as described above, the clustering and merging of trajectory segments are performed based on individual trajectory segments or trajectory clusters containing multiple trajectory segments, without analyzing the trajectory segments obtained after merging. Therefore, after merging the trajectory segments in step S400 in this embodiment, confidence backtracking correction can be performed on the obtained trajectory segments, which can effectively identify and correct erroneous merging in the clustering process, ensuring that the final output multi-camera trajectory segments have high accuracy and reliability.
[0097] Specifically, such as Figure 2 As shown, after the trajectory pairs are clustered and merged to form trajectory segments, the confidence level of each trajectory segment can be calculated and evaluated. If the calculated confidence level is lower than a set threshold, the corresponding trajectory segment is split; if the calculated confidence level is higher than the set threshold, the trajectory segment is retained and output. The specific value of the threshold used for confidence level judgment can be selected according to the actual needs of those skilled in the art. For the confidence level C of each trajectory segment... i The calculation formula is as follows:
[0098] .
[0099] .
[0100] .
[0101] Where w1, w2, and w3 represent the internal similarity C, respectively. internal Trajectory quality C quality Spatial consistency C spatial The specific values of the weights w1, w2, and w3 can be determined by those skilled in the art based on their actual needs; preferably, the values of w1, w2, and w3 are w1=0.5, w2=0.3, and w3=0.2, respectively. K represents the total number of trajectory segments in the trajectory segment, and N represents the number of trajectory pairs in the trajectory segment. Generally, N=K-1. quality(T) k ) represents trajectory segment T in the trajectory segment. k Quality, spatial consistency C spatial The calculation is performed by the spatial distribution of the trajectory segments that make up the trajectory segment in the world coordinate system. The specific calculation process is a well-known technique to those skilled in the art, so it will not be described in detail here.
[0102] Understandably, trajectory segment T k The quality of a trajectory segment T is related to its confidence level and duration, and can be measured by averaging these two factors. k quality (T) kThe calculation formula for ) is as follows:
[0103] .
[0104] .
[0105] .
[0106] in, Represents trajectory segment T k The confidence quality Represents trajectory segment T k Duration quality, Represents trajectory segment T k The mean confidence score of all detected frames; trajectories with a low mean confidence score are more likely to be false positives or incomplete targets. Represents trajectory segment T k The number of consecutive frames, and the trajectory with a short duration are more likely to be sporadic noise or false detection.
[0107] It is understandable that the aforementioned adaptive trajectory quality control and error correction strategies, combined with the aforementioned adaptive threshold (clustering threshold) calculation, multi-stage clustering strategy, and spatiotemporal constraint checks, constitute the core technical framework of the cross-camera trajectory matching system of this application. This framework not only handles complex cross-camera target association problems but also possesses good robustness and adaptability, capable of addressing various challenges in different scenarios. Compared to traditional methods, this application can identify and correct erroneous merging results and automatically split low-confidence trajectories, thereby improving the reliability and robustness of trajectory matching. Under the unified evaluation framework, the geometric relationships of each trajectory segment are more clearly defined, which helps to quantitatively analyze the rationality of the trajectory structure, thereby improving the stability and spatial adaptability of trajectory matching.
[0108] 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 method for cross-camera vehicle tracking and trajectory matching, characterized in that, Includes the following steps: S100: Acquire vehicle trajectory segments detected by each camera and extract feature information for each trajectory segment, including ReID features, confidence level, duration and spatial location; S200: Calculate the similarity and clustering threshold of any two trajectory segments based on their feature information, and then cluster the trajectory segments with similarity greater than or equal to the clustering threshold in sequence; S300: After each clustering is completed, the number of remaining unmerged trajectory segments is identified; based on the different number of remaining unmerged trajectory segments, the entire clustering process is divided into three stages: initial, intermediate, and final; the similarity values for the three stages are taken as maximum similarity, average similarity, and minimum similarity, respectively. S400: Constrain the cameras corresponding to the clustered trajectory segments in terms of time, space and connectivity, and merge the trajectory segments in which all constraints are satisfied. In step S200, for the clustering threshold It is calculated using the confidence level and duration of the trajectory segment, and the specific calculation formula is as follows: ; ; in, and These represent the given highest and lowest thresholds, respectively; Score represents the overall score; norm represents the minimum and maximum thresholds. conf Normalized confidence level, norm dur α represents the normalized duration, β represents the confidence weight, and β represents the duration weight.
2. The cross-camera vehicle tracking and trajectory matching method as described in claim 1, characterized in that, The normalization of confidence and duration is suitable for normalizing parameters in the actual range to the [0, 1] interval; Normalized confidence level conf and normalized duration norm dur The expression is as follows: ; ; Among them, avg conf conf represents the average confidence level of two trajectory segments. max and conf min These represent the preset maximum and minimum confidence levels, respectively; duration represents the number of frames in the trajectory segment with fewer frames between the two trajectory segments, dur max and dur min These represent the maximum and minimum durations of the preset trajectory segments, respectively.
3. The cross-camera vehicle tracking and trajectory matching method as described in claim 1 or 2, characterized in that, Set the lower limit of the clustering threshold to 0.5~0.6; When calculating the clustering threshold of the trajectory segment in step S200, if the calculated clustering threshold is lower than the set lower limit, and the duration of the trajectory segment is less than 10 frames or the average confidence level is lower than 0.3, the set lower limit is used as the calculated value of the clustering threshold and compared with the similarity.
4. The cross-camera vehicle tracking and trajectory matching method as described in claim 1, characterized in that, In step S300, if the number of remaining trajectory segments is greater than or equal to 30% of the total number of trajectory segments, it is defined as the initial stage; If the number of remaining trajectory segments is greater than 5% of the total number of trajectory segments but less than 30% of the total number of trajectory segments, it is defined as the intermediate stage; If the number of remaining trajectory segments is less than or equal to 5% of the total number of trajectory segments, it is defined as the closing stage.
5. The cross-camera vehicle tracking and trajectory matching method as described in claim 1, characterized in that, When clustering the trajectory segments in step S300, the trajectory segments from different cameras are clustered; among them, the maximum similarity sim single Average similarity sim average and minimum similarity sim complete The calculation formula is as follows: ; ; ; ; Where, sim(T) i T j ) represents the trajectory segment T corresponding to any two cameras. i and T j cosine similarity, M i and M j These represent the total number of trajectory segments T. i and T j The trajectory family, where A and B represent the trajectory family M respectively. i and M j The number of trajectory segments within, and Representing trajectory segments T respectively i and T j The ReID characteristics.
6. The cross-camera vehicle tracking and trajectory matching method as described in claim 1, characterized in that, When performing step S400, the following four constraints are set for merging trajectory segments; Set a frame overlap constraint to prevent two trajectory segments to be merged from coming from the same camera. To set positional overlap constraints for non-overlapping camera pairs, we can prevent trajectories with similar ReID features but too far apart in space from being incorrectly merged. Set adjacent camera constraints to prevent impossible cross-camera merging; Set time window constraints to prevent merging of two trajectory segments with too short or too long intervals.
7. The cross-camera vehicle tracking and trajectory matching method as described in claim 1, characterized in that, Calculate the confidence level of the trajectory segment obtained after merging multiple trajectory segments in step S400; If the calculated confidence level is lower than the set threshold, the corresponding trajectory segment will be split. If the calculated confidence level is higher than the set threshold, the trajectory segment is retained.
8. The cross-camera vehicle tracking and trajectory matching method as described in claim 7, characterized in that, For each trajectory segment, the confidence level C i The calculation formula is as follows: ; ; ; Where w1, w2, and w3 represent the internal similarity C, respectively. internal Trajectory quality C quality Spatial consistency C spatial The weights; N represents the number of trajectory pairs in the trajectory segment, quality(T) k ) represents trajectory segment T in the trajectory segment. k The quality, K represents the total number of all trajectory segments in the trajectory segment, and spatial consistency C spatial The results are obtained by calculating the spatial distribution of each trajectory segment in the world coordinate system.
9. The cross-camera vehicle tracking and trajectory matching method as described in claim 8, characterized in that, For trajectory segment T k quality (T) k The calculation formula for ) is as follows: ; ; ; in, Represents trajectory segment T k The confidence quality Represents trajectory segment T k Duration quality, Represents trajectory segment T k Mean confidence score of all detected frames Represents trajectory segment T k The number of consecutive frames, conf max and conf min These represent the preset maximum and minimum confidence levels, respectively. max and dur min These represent the maximum and minimum durations of the preset trajectory segments, respectively.
Citation Information
Patent Citations
Spectral clustering analysis-based just-in-time learning modeling method
CN107403196A
Social network user recommendation method and system
CN119226612A