A clustering method, device, equipment and storage medium
By using the iterative clustering method and purity recognition network of appearance similarity and spatiotemporal constraints in the multi-target tracking task to process the trajectory segments in the multi-camera scene, the problem of low purity of trajectory segment clustering is solved and achieved. Accuracy of multiple target tracking.
Patent Information
- Application Number
- CN202010316188.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-21
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-04-21
AI Technical Summary
In multi-target tracking tasks, it is difficult to ensure the purity of clustering of trajectory segments in multi-camera scenes, which affects the accuracy of the final trajectory.
An iterative clustering method based on appearance similarity and spatio-temporal constraints is used, combined with the purity identification network, to merge and de-overlap candidate clusters to obtain high-purity target clusters.
It improves the purity of clustering of trajectory segments, ensures the accuracy of cross-camera multi-target tracking tasks, ensures that trajectory segments of the same target are clustered in the same cluster, and trajectory segments of different targets are clustered in different clusters.
Smart Images

Figure CN113536862B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a clustering method, device, equipment and storage medium. Background Art
[0002] In recent years, target tracking technology has been one of the hot topics in the field of computer vision research, and it has broad application prospects in security monitoring and other aspects. Target tracking technology can locate the position of the target in each frame of video image and generate the trajectory fragment of the target movement based on it.
[0003] Due to the limited shooting range of a single camera, multiple cameras are currently generally installed in large and medium-sized scenes (such as shopping malls, parking lots, airports, amusement parks, etc.) to ensure that the entire scene can be fully monitored. When tracking multiple targets in such scenes, it is necessary to first determine the trajectory segments of each target under each camera in the scene, and then cluster the trajectory segments of each target under each camera to obtain the clusters corresponding to each target, and then perform cross-camera data association for the trajectory segments in the clusters corresponding to each target to obtain the complete trajectory of the target in the entire scene.
[0004] However, in practical applications, due to the large changes in the appearance of the same target across cameras, the complexity of the target's motion trajectory, and the overlap of fields of view across cameras, it is usually difficult to ensure the purity of the clustering when clustering the trajectory fragments of each target under each camera. That is, the cluster corresponding to a certain target is very likely to include a large number of trajectory fragments of other targets, which will seriously affect the accuracy of the final determined complete trajectory.
[0005] It can be seen that how to improve the clustering purity of trajectory segments has become an urgent problem to be solved in the multi-target tracking task. Summary of the invention
[0006] The embodiments of the present application provide a clustering method, apparatus, device and storage medium, which can improve the clustering purity of trajectory segments and ensure the accuracy of cross-camera multi-target tracking tasks.
[0007] In view of this, the first aspect of the present application provides a clustering method, the method comprising:
[0008] Obtain the trajectory segments of each target under each camera in the target scene to form a trajectory segment set;
[0009] For the trajectory segment set, iterative clustering processing is performed based on appearance similarity constraints and spatiotemporal constraints, and multiple candidate clustering clusters are obtained in the iterative clustering process; the appearance similarity constraints are used to measure whether the candidate clustering clusters need to be merged according to the similarity of appearance features between the candidate clustering clusters; the spatiotemporal constraints are used to measure whether the candidate clustering clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features between the candidate clustering clusters;
[0010] Determining the purity corresponding to each of the plurality of candidate clusters through a purity recognition network;
[0011] According to the purity corresponding to each of the multiple candidate clusters, the multiple candidate clusters are de-overlapped to obtain multiple target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene.
[0012] Optionally, whether the candidate clusters satisfy the appearance similarity constraint is measured in the following manner:
[0013] Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations;
[0014] For each candidate cluster combination, perform the following operations:
[0015] Calculating the minimum cosine distance between the appearance features of each candidate cluster in the candidate cluster combination as the similarity corresponding to the candidate cluster combination; the appearance features of the candidate cluster are determined according to the appearance features of each trajectory segment included therein;
[0016] It is determined whether the similarity corresponding to the candidate cluster combination is greater than the appearance similarity threshold of the current round of clustering processing. If so, it is determined that the candidate clusters in the candidate cluster combination meet the appearance similarity constraint condition.
[0017] Optionally, whether the candidate clusters satisfy the spatiotemporal constraints is measured in the following manner:
[0018] Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations;
[0019] For each candidate cluster combination, perform the following operations:
[0020] Determine whether the spanning time of each candidate cluster in the candidate cluster combination overlaps; the spanning time of the candidate cluster is a set of timestamps of each trajectory segment included therein;
[0021] If there is no overlap, then determine whether the candidate clusters in the candidate cluster combination meet the time constraint condition according to the time interval between the spanning times of each candidate cluster in the candidate cluster combination; and determine whether the candidate clusters in the candidate cluster combination meet the space constraint condition according to the positional relationship between the predicted trajectory and the true trajectory of each candidate cluster in the candidate cluster combination; when the candidate clusters in the candidate cluster combination meet the time constraint condition and the space constraint condition, determine that the candidate clusters in the candidate cluster combination meet the time and space constraint conditions;
[0022] If there is overlap, determine whether the candidate clusters in the candidate cluster combination meet the spatiotemporal constraints based on the camera index identifiers to which the trajectory segments of each candidate cluster in the candidate cluster combination within the overlapping time belong, and / or the positional relationship between the real trajectories of each candidate cluster in the candidate cluster combination within the overlapping time.
[0023] Optionally, the candidate cluster combination includes a first candidate cluster and a second candidate cluster; and determining whether the candidate clusters in the candidate cluster combination meet the time constraint condition according to the time interval between the spanning times of the candidate clusters in the candidate cluster combination includes:
[0024] Determine a time interval between the closest timestamps in the span time of the first candidate cluster and the span time of the second candidate cluster;
[0025] Determine whether the time interval is less than the time constraint threshold of the current round of clustering processing, and if so, determine whether the candidate cluster in the candidate cluster combination satisfies the time constraint condition;
[0026] The determining, based on the positional relationship between the predicted trajectory and the actual trajectory of each candidate cluster in the candidate cluster combination, whether the candidate clusters in the candidate cluster combination satisfy the spatial constraint condition comprises:
[0027] Predicting a trajectory of the second candidate cluster over the time span of the first candidate cluster as the predicted trajectory of the first candidate cluster; calculating an average Euclidean distance between the predicted trajectory of the first candidate cluster and the true trajectory as the first distance;
[0028] Predicting a trajectory of the first candidate cluster over the time span of the second candidate cluster as the predicted trajectory of the second candidate cluster; calculating an average Euclidean distance between the predicted trajectory of the second candidate cluster and the true trajectory as the second distance;
[0029] Calculating an average of the first distance and the second distance;
[0030] It is determined whether the average value is less than the first space constraint threshold of the current round of clustering processing. If so, it is determined that the candidate clusters in the candidate cluster cluster combination meet the space constraint condition.
[0031] Optionally, the candidate cluster combination includes a first candidate cluster and a second candidate cluster; the determining whether the candidate clusters in the candidate cluster combination meet the spatiotemporal constraints according to the camera index identifiers to which the trajectory segments of each candidate cluster in the candidate cluster combination within the overlapping time belong, and / or the positional relationship between the real trajectories of each candidate cluster in the candidate cluster combination includes:
[0032] Combining the camera index identifiers to which the trajectory segments within the overlapping time belong in the first candidate clusters to obtain a first camera identifier set; combining the camera index identifiers to which the trajectory segments within the overlapping time belong in the second candidate clusters to obtain a second camera identifier set;
[0033] If the first camera identification set and the second camera identification set have an intersection, determining that the candidate cluster in the candidate cluster combination does not satisfy the spatiotemporal constraint condition;
[0034] If there is no intersection between the first camera identification set and the second camera identification set, determine the average Euclidean distance between the actual trajectory of the first candidate clustering cluster and the actual trajectory of the second candidate clustering cluster within the overlapping time, and judge whether the average Euclidean distance is less than the second spatial constraint threshold of this round of clustering processing. If so, determine that the candidate clustering clusters in the candidate clustering cluster combination meet the spatiotemporal constraints.
[0035] Optionally, determining the purity corresponding to each of the plurality of candidate clusters through a purity recognition network includes:
[0036] For each candidate cluster, the basic features of the candidate cluster are determined according to the appearance features of the trajectory segments included therein and the spatial distances between the trajectory segments with adjacent start timestamps; and the purity corresponding to the candidate cluster is determined according to the basic features of the candidate cluster through the purity recognition network.
[0037] Optionally, performing de-overlapping processing on the multiple candidate clusters according to the purity corresponding to each of the multiple candidate clusters to obtain multiple target clusters includes:
[0038] Determining scores corresponding to each of the plurality of candidate clusters according to the purity corresponding to each of the plurality of candidate clusters and the length of the included trajectory segments;
[0039] According to the scores corresponding to the multiple candidate clustering clusters, the multiple candidate clustering clusters are sorted in descending order;
[0040] Determining the trajectory segment retention priority of the plurality of candidate clustering clusters according to the sorting order of the plurality of candidate clustering clusters, wherein the trajectory segment retention priority of the candidate clustering cluster with a higher sorting order is higher than the trajectory segment retention priority of the candidate clustering cluster with a lower sorting order;
[0041] According to the trajectory segment retention priorities of the multiple candidate clusters, de-overlapping processing is performed on the trajectory segments in the multiple candidate clusters to obtain the multiple target clusters.
[0042] A second aspect of the present application provides a clustering device, the device comprising:
[0043] An acquisition module is used to acquire the trajectory segments of each target under each camera in the target scene to form a trajectory segment set;
[0044] A clustering module is used to perform iterative clustering processing on the trajectory segment set based on appearance similarity constraints and spatiotemporal constraints, and obtain multiple candidate clustering clusters in the iterative clustering process; the appearance similarity constraints are used to measure whether the candidate clustering clusters need to be merged according to the similarity of appearance features between the candidate clustering clusters; the spatiotemporal constraints are used to measure whether the candidate clustering clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features between the candidate clustering clusters;
[0045] A purity recognition module, used to determine the purity corresponding to each of the plurality of candidate clusters through a purity recognition network;
[0046] The de-overlapping module is used to perform de-overlapping processing on the multiple candidate clusters according to the purity corresponding to each of the multiple candidate clusters to obtain multiple target clusters; the target clusters are used to determine the movement trajectory of the target in the target scene.
[0047] A third aspect of the present application provides a device, the device comprising: a processor and a memory;
[0048] The memory is used to store computer programs;
[0049] The processor is used to call the computer program to execute the clustering method described in the first aspect.
[0050] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the clustering method described in the first aspect.
[0051] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0052] The embodiment of the present application provides a clustering method, which performs iterative clustering processing on the trajectory segments of each target under each camera in the target scene, and based on the gradually relaxed appearance similarity constraint and spatiotemporal constraint, measures whether each candidate cluster obtained by the previous round of clustering processing can be further merged and clustered, so as to obtain a series of high-quality candidate clusters through multiple iterative clustering. Then, a pre-trained purity recognition network is used to identify the purity corresponding to each candidate cluster obtained in the above-mentioned iterative clustering process, and each candidate cluster is de-overlapped in combination with the purity corresponding to each candidate cluster, so as to obtain a series of target clusters; because it has previously undergone iterative clustering based on the dual constraints of appearance similarity constraint and spatiotemporal constraint, and the recognition results determined by the purity recognition network are considered in the de-overlapping process, the target cluster obtained here usually has a high purity, which can basically ensure that the trajectory segments of the same target are clustered in the same target cluster, and the trajectory segments of different targets are clustered in different target clusters. Accordingly, multi-target tracking based on each target cluster with high purity can effectively ensure the accuracy of the determined tracking trajectory. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A schematic diagram of a clustering method provided in an embodiment of the present application;
[0054] Figure 2 A schematic diagram of the structure of a clustering device provided in an embodiment of the present application;
[0055] Figure 3 A schematic diagram of the structure of a server provided in an embodiment of the present application;
[0056] Figure 4 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0058] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0059] In order to improve the clustering purity of trajectory segments in a cross-camera multi-target tracking task and improve the accuracy of the determined complete motion trajectory of the target, an embodiment of the present application provides a clustering method.
[0060] In the clustering method, the trajectory segments of each target under each camera in the target scene are first obtained to form a trajectory segment set; then, for the trajectory segment set, iterative clustering processing is performed based on appearance similarity constraints and spatiotemporal constraints, and multiple candidate clustering clusters are obtained in the iterative clustering process, wherein the appearance similarity constraint is used to measure whether the candidate clustering clusters need to be further merged and clustered according to the similarity of appearance features between the candidate clustering clusters, and the spatiotemporal constraint is used to measure whether the candidate clustering clusters need to be further merged and clustered according to the correlation relationship between the temporal features and the correlation relationship between the spatial features of the candidate clustering clusters; then, the purity corresponding to each of the multiple candidate clustering clusters is determined by a pre-trained purity recognition network; then, according to the purity corresponding to each of the multiple candidate clustering clusters, the multiple candidate clustering clusters are de-overlapped to obtain multiple target clustering clusters; a target clustering cluster can be used to determine the motion trajectory of a target in the target scene.
[0061] The above method first performs multiple iterative clustering based on the dual constraints of appearance similarity constraint and space-time constraint to obtain a series of high-quality candidate clustering clusters, and then determines the purity corresponding to each candidate clustering cluster through the purity recognition network, and then combines the purity corresponding to each candidate clustering cluster to perform de-overlapping processing on each candidate clustering cluster to obtain a series of target clustering clusters with higher purity. Based on these target clustering clusters with higher purity, the complete trajectory of each target in the target scene is determined, which can effectively ensure the accuracy of the determined complete trajectory.
[0062] It should be noted that the clustering method provided in the embodiment of the present application can be applied to various devices with data processing capabilities, such as terminal devices and servers. Among them, the terminal devices can include computers, tablet computers, personal digital assistants (PDAs) and smart phones, etc.; the server can be an application server or a Web server. When deployed specifically, the server can be an independent server or a cluster server.
[0063] The clustering method provided in this application is described in detail below through examples.
[0064] See also Figure 1 , Figure 1 The flowchart of the clustering method provided in the embodiment of the present application is shown in FIG. For the convenience of description, the following embodiment is introduced by taking the server as the execution subject as an example. Figure 1 As shown, the clustering method includes the following steps:
[0065] Step 101: Obtain the trajectory segments of each target under each camera in the target scene to form a trajectory segment set.
[0066] When the server needs to track multiple targets for a target scene within a target period, the server may obtain the trajectory segments of each target to be tracked under each camera in the target scene within the target period, and use the obtained trajectory segments to form a trajectory segment set.
[0067] In some embodiments, when the server needs to perform multi-target tracking for a target scene within a target time period, the server can obtain the video taken by each camera deployed in the target scene within the target time period, and then identify the movement trajectory of each target in each acquired video, and obtain the trajectory segments of each target under each camera within the target time period, and then use these trajectory segments to form a trajectory segment set.
[0068] In some embodiments, when the server needs to perform multi-target tracking for a target scene within a target period, the server can directly obtain the trajectory segments of each target under each camera within the target period from the relevant device. That is, the relevant device can pre-perform multi-target recognition for the video shot by each camera in the target scene to obtain the trajectory segments of each target under each camera; when the server needs to perform a multi-target tracking task across cameras, it can obtain the trajectory segments of each target under each camera within the target period predetermined by the relevant device, and use these trajectory segments to form a trajectory segment set.
[0069] It should be noted that in different application scenarios, the above-mentioned target is specifically different objects. For example, in the application scenario of pedestrian recognition, the above-mentioned target can be specifically a person to be tracked. For another example, in the application scenario of vehicle recognition, the above-mentioned target can be specifically a vehicle to be tracked. The target to be tracked in this application is not specifically limited here.
[0070] In the embodiment of the present application, the multi-target tracking result under a single camera can be expressed as follows:
[0071]
[0072] Where l is the total number of cameras deployed in the target scene, n k is the number of trajectory segments under the kth camera in the target scene, represents the i-th trajectory segment under the k-th camera; For track segments In timestamp The coordinates of m are the trajectory segments. Here, in order to ensure the synchronization of timestamps between different cameras in the target scene, the timestamps have been pre-set. Alignment processing was performed.
[0073] Step 102: performing iterative clustering processing on the trajectory segment set based on appearance similarity constraints and spatiotemporal constraints, and obtaining a plurality of candidate clusters in the iterative clustering process.
[0074] After the server obtains the set of trajectory segments, it can use the iterative super-vertex algorithm to perform multiple iterative clustering processes on the set of trajectory segments by gradually relaxing the appearance similarity constraint and the spatiotemporal constraint, thereby obtaining a series of high-quality candidate clusters in the iterative clustering process. Among them, the appearance similarity constraint is used to measure whether the candidate clusters need to be further merged according to the similarity of the appearance features between the candidate clusters; the spatiotemporal constraint is used to measure whether the candidate clusters need to be further merged according to the correlation between the temporal features and the correlation between the spatial features between the candidate clusters.
[0075] It should be noted that when performing the first iterative clustering, the server can use a single trajectory segment in the trajectory segment set as a candidate clustering cluster to be merged; when performing the nth iterative clustering, the server can use the candidate clustering cluster generated after the n-1th iterative clustering as the candidate clustering cluster to be merged. When the clustering rounds reach the maximum number of times specified or the convergence condition is met and the clustering is determined to be converged, the clustering iteration is stopped, and the set of all candidate clustering clusters generated by all clustering rounds is used as the final candidate clustering cluster set. When the candidate clustering clusters generated by different rounds are repeated, that is, when they contain the same trajectory segment, only one of the candidate clustering clusters is retained to ensure the uniqueness of each candidate clustering cluster in the final candidate clustering cluster set.
[0076] In the embodiment of the present application, the candidate clusters can be expressed as Among them, j is the index identifier of the candidate cluster, K is the candidate cluster C j The set of camera index identifiers to which the trajectory fragment belongs, I is C j The index set of the trajectory segments in which the trajectory segments belong to the kth camera. In the process of n-iterative clustering, when n=1, the candidate clustering cluster is initialized with a single trajectory segment in the trajectory segment set; when n≠1, the candidate clustering cluster based on this iterative clustering is the candidate clustering clusters obtained by the last iterative clustering, that is, Wherein, A is the index identification set of candidate clusters generated after the n-1th iterative clustering.
[0077] It should be noted that in the technical solution provided in the embodiment of the present application, each iterative clustering will merge and cluster the candidate clusters according to the appearance similarity constraint and the spatiotemporal constraint. When two candidate clusters satisfy both the appearance similarity constraint and the spatiotemporal constraint, it is considered that the trajectory segments included in the two candidate clusters correspond to the same target, and the two candidate clusters need to be merged and clustered. In addition, in order to minimize the number of determined candidate clusters, as the number of iterative clustering increases, the appearance similarity constraint and the spatiotemporal constraint on which each iterative clustering is based will gradually relax.
[0078] In practical applications, before executing each round of clustering processing, it is necessary to combine multiple candidate clustering clusters obtained by the previous round of clustering processing into pairs, so as to obtain multiple candidate clustering cluster combinations; then, for each candidate clustering cluster combination, it is determined whether the candidate clustering clusters meet the appearance similarity constraint conditions and the spatiotemporal constraint conditions.
[0079] The following introduces an implementation method for measuring whether the candidate clusters in the candidate cluster combination meet the appearance similarity constraint condition.
[0080] The minimum cosine distance between the appearance features of each candidate clustering cluster in the candidate clustering cluster combination is calculated as the similarity corresponding to the candidate clustering cluster combination, where the appearance features of the candidate clustering cluster are determined based on the appearance features of each trajectory segment included therein; then, it is determined whether the similarity corresponding to the candidate clustering cluster combination is greater than the appearance similarity threshold of this round of clustering processing. If so, it is determined that the candidate clustering clusters in the candidate clustering cluster combination meet the appearance similarity constraint condition. If not, it is determined that the candidate clustering clusters in the candidate clustering cluster combination do not meet the appearance similarity constraint condition.
[0081] In the embodiment of the present application, the appearance features of the candidate cluster C can be defined as in, represents the N-dimensional appearance features of the j-th trajectory segment in the candidate cluster C, M k is the set of camera index identifiers to which the trajectory segments in candidate cluster C belong. i and C j The appearance similarity between them can be defined as the appearance feature A i and A j The minimum cosine distance between The specific expressions are as follows:
[0082]
[0083] when Greater than the appearance similarity threshold τ of this round of clustering processing app When , the candidate cluster C i and C j The appearance similarity constraint is satisfied.
[0084] It should be understood that the appearance similarity threshold of each round of clustering processing can be set according to actual needs. Generally, as the iterative clustering process proceeds, the appearance similarity constraint will gradually relax, that is, the appearance similarity threshold of each round of clustering processing will gradually decrease. This application does not specifically limit the appearance similarity threshold of each round of clustering processing.
[0085] It should be noted that the appearance features based on which the appearance similarity is calculated can be manually set features, HOG features, features extracted based on SIFT, appearance features extracted by deep learning models, etc. This application does not specifically limit the above appearance features. In addition, in practical applications, in addition to measuring appearance similarity through cosine distance, appearance similarity can also be measured through Euclidean distance, distance predicted by metric network, etc. This application does not limit the implementation method of measuring appearance similarity.
[0086] The following introduces the implementation method of measuring whether the candidate clusters in the candidate cluster combination meet the time and space constraints.
[0087] It is determined whether the spanning time of each candidate cluster in the candidate cluster combination overlaps. Here, the spanning time of the candidate cluster is essentially a set of timestamps of each trajectory segment included therein.
[0088] If the spanning times of the candidate clusters in the candidate cluster combination do not overlap, then according to the time interval between the spanning times of the candidate clusters in the candidate cluster combination, determine whether the candidate clusters in the candidate cluster combination meet the time constraint conditions; and, according to the positional relationship between the predicted trajectory and the actual trajectory of each candidate cluster in the candidate cluster combination, determine whether the candidate clusters in the candidate cluster combination meet the space constraint conditions; when the candidate clusters in the candidate cluster combination meet both the time constraint conditions and the space constraint conditions, it can be determined that the candidate clusters in the candidate cluster combination meet the time and space constraint conditions.
[0089] Assuming that the candidate cluster combination includes a first candidate cluster and a second candidate cluster, when the span time of the first candidate cluster does not overlap with the span time of the second candidate cluster, whether the first candidate cluster and the second candidate cluster meet the time constraint condition can be determined in the following manner:
[0090] First, determine the time interval between the span time of the first candidate clustering cluster and the span time of the second candidate clustering cluster with the closest timestamp interval; then, determine whether the time interval is less than the time constraint threshold of this round of clustering processing. If so, determine that the first candidate clustering cluster and the second candidate clustering cluster in the candidate clustering cluster combination meet the time constraint condition.
[0091] It should be understood that the time constraint threshold of each round of clustering processing can be set according to actual needs. Generally, as the iterative clustering processing proceeds, the time and space constraints will gradually relax, that is, the time constraint threshold of each round of clustering processing will gradually increase. This application does not specifically limit the time constraint threshold of each round of clustering processing.
[0092] Specifically, whether the first candidate cluster and the second candidate cluster meet the spatial constraint condition can be determined in the following manner:
[0093] Predict the trajectory of the second candidate clustering cluster over the time span of the first candidate clustering cluster as the predicted trajectory of the first candidate clustering cluster, and calculate the average Euclidean distance between the predicted trajectory of the first candidate clustering cluster and its true trajectory as the first distance; similarly, predict the trajectory of the first candidate clustering cluster over the time span of the second candidate clustering cluster as the predicted trajectory of the second candidate clustering cluster, and calculate the average Euclidean distance between the predicted trajectory of the second candidate clustering cluster and its true trajectory as the second distance. Then, calculate the average value of the first distance and the second distance, and determine whether the average value is less than the first spatial constraint threshold of this round of clustering processing. If so, determine that the first candidate clustering cluster and the second candidate clustering cluster in the candidate clustering cluster combination meet the spatial constraint condition.
[0094] It should be understood that the first spatial constraint threshold of each round of clustering processing can be set according to actual needs. Generally, as the iterative clustering processing proceeds, the spatiotemporal constraint conditions will gradually relax, that is, the first spatial constraint threshold of each round of clustering processing will gradually increase. This application does not specifically limit the first spatial constraint threshold of each round of clustering processing.
[0095] It should be understood that in actual applications, when there is no overlap in the spanning time of each candidate clustering cluster in the candidate clustering cluster combination, the server can first determine whether the candidate clustering cluster in the candidate clustering cluster combination meets the time constraint conditions, and then determine whether the candidate clustering cluster in the candidate clustering cluster combination meets the space constraint conditions. It can also first determine whether the candidate clustering cluster in the candidate clustering cluster combination meets the space constraint conditions, and then determine whether the candidate clustering cluster in the candidate clustering cluster combination meets the time constraint conditions. It can also simultaneously determine whether the candidate clustering cluster in the candidate clustering cluster combination meets both the time constraint conditions and the space constraint conditions. No limitation is made on the order of determining the time constraint conditions and the space constraint conditions.
[0096] If the spanning time of each candidate cluster in the candidate cluster combination overlaps, then determine whether the candidate clusters in the candidate cluster combination meet the time and space constraints based on the camera index identifier to which the trajectory fragments of each candidate cluster in the candidate cluster combination within the overlapping time belong, and / or the positional relationship between the real trajectories of each candidate cluster in the candidate cluster combination.
[0097] Assuming that the candidate cluster combination includes the first candidate cluster and the second candidate cluster, when the span time of the first candidate cluster overlaps with the span time of the second candidate cluster, it can be determined whether the first candidate cluster and the second candidate cluster meet the spatiotemporal constraints in the following way:
[0098] The camera index identifiers to which the trajectory segments within the overlapping time in the first candidate clustering cluster belong are combined to obtain a first camera identifier set; the camera index identifiers to which the trajectory segments within the overlapping time in the second candidate clustering cluster belong are combined to obtain a second camera identifier set; if the first camera identifier set and the second camera identifier set have an intersection, it is determined that the first candidate clustering cluster and the second candidate clustering cluster in the candidate clustering cluster combination do not satisfy the spatiotemporal constraint conditions; if the first camera identifier set and the second camera identifier set do not have an intersection, the average Euclidean distance between the true trajectory of the first candidate clustering cluster and the true trajectory of the second candidate clustering cluster within the overlapping time is further determined, and it is determined whether the average Euclidean distance is less than the second spatial constraint threshold of this round of clustering processing. If so, it is determined that the first candidate clustering cluster and the second candidate clustering cluster in the candidate clustering cluster combination satisfy the spatiotemporal constraint conditions.
[0099] It should be understood that the second space constraint threshold of each round of clustering processing can be set according to actual needs. Generally, as the iterative clustering processing proceeds, the spatiotemporal constraint conditions will gradually relax, that is, the second space constraint threshold of each round of clustering processing will gradually increase. This application does not specifically limit the second space constraint threshold of each round of clustering processing.
[0100] As an example, in the embodiment of the present application, the span time of the candidate cluster can be expressed as the timestamp set of all trajectory segments it contains, that is, the span time of the candidate cluster C can be expressed as Any two candidate clusters C i and C j The time overlap between
[0101] when , indicating the candidate cluster C i and C j There is no overlap in the span of time.
[0102] At this point, we can select candidate clusters based on i and C j The time interval between the connection points is used to determine the candidate clusters C i and C j Whether the time constraint is met, the candidate cluster C iand C j The connection point pairs are set t i and t j When the absolute value of the difference between the timestamps corresponding to the connection point pair is less than the time constraint threshold τ t When the candidate cluster C i and C j Satisfy time constraints.
[0103] In addition, the embodiment of the present application further defines the Euclidean distance between the predicted trajectory and the actual trajectory of the candidate cluster as a spatial constraint. Specifically, the candidate cluster C can be predicted according to the Kalman filter algorithm. i In the candidate cluster C j The crossing time t j The trajectory on the cluster is then calculated to determine the predicted trajectory and the candidate cluster C j The average Euclidean distance d between the true trajectories j As the first distance; similarly, the candidate cluster C can be predicted according to the Kalman filter algorithm j In the candidate cluster C i The crossing time t i The trajectory on the cluster is then calculated to determine the predicted trajectory and the candidate cluster C i The average Euclidean distance d between the true trajectories i As the second distance. Calculate d i,j =(d i +d j ) / 2 as candidate cluster C i and C j The space-time distance between i,j Less than the first spatial constraint threshold τ d1 When the candidate cluster C i and C j Satisfy the space constraints.
[0104] It should be understood that in practical applications, in addition to using the Euclidean distance between the predicted trajectory and the actual trajectory of the candidate clustering cluster as a spatial constraint, other types of distance calculation methods can also be used to determine the spatial constraint conditions based on the predicted trajectory and the actual trajectory of the candidate clustering cluster. The present application does not impose any restrictions on the distance calculation method used when determining the spatial constraint conditions. In addition, in addition to using the Kalman filter algorithm to determine the predicted trajectory of the candidate clustering cluster, other trajectory prediction algorithms can also be used to determine the predicted trajectory of the candidate clustering cluster. The present application does not impose any restrictions on the algorithm used to determine the predicted trajectory of the candidate clustering cluster.
[0105] When the candidate cluster C i and C jWhen both the time constraint and the space constraint are satisfied, the candidate cluster C can be considered i and C j Satisfy space-time constraints.
[0106] when , indicating the candidate cluster C i and C j There is overlap in the span of time.
[0107] Since the same target will not appear in two spatial locations at the same time, the candidate cluster C can be determined first. i and C j In overlapping time Whether the camera index identification sets to which the trajectory segments in the image belong have an intersection, if so, the candidate cluster C can be determined. i and C j There is a conflict in time and space, and the time and space constraints are not met.
[0108] In addition, the present embodiment also defines a candidate cluster C i and C j In overlapping time The average Euclidean distance d between the true trajectories within i,j As a spatial constraint. i,j Less than the second spatial constraint threshold τ d2 When , we can consider the candidate cluster C i and C j Similarly, in addition to using the average Euclidean distance between two candidate clusters in the overlapping time as the spatial constraint, other distance calculation methods can also be used to calculate the distance between two candidate clusters in the overlapping time as the spatial constraint.
[0109] Step 103: Determine the purity corresponding to each of the plurality of candidate clusters through a purity recognition network.
[0110] After the server obtains multiple candidate clusters through multiple iterative clustering processes (the multiple candidate clusters here include the candidate clusters obtained in all rounds of iterative clustering processes), it can further use the pre-trained purity recognition network to identify the purity corresponding to each candidate cluster. When the trajectory segments included in the candidate cluster all correspond to the same target, the purity corresponding to the candidate cluster should be 1. Conversely, when the trajectory segments included in the candidate cluster correspond to different targets, the purity corresponding to the candidate cluster should be 0.
[0111] In some embodiments, the server can determine the basic features of each candidate cluster according to the appearance features of the trajectory segments included therein and the spatial distances between trajectory segments with adjacent start timestamps; and then determine the purity of the candidate cluster according to the basic features of the candidate cluster through a purity recognition network.
[0112] As an example, the candidate clusters can be The trajectory segments included in the Sort, the candidate cluster C can be expressed as C = {T1, T2, ..., T n}, where n is the number of trajectory segments contained in the candidate cluster C, and In the embodiment of the present application, the trajectory segment T is defined as i The characteristic representation is f i =[a i ,d i-1,i ], as mentioned above, the trajectory segment T i The N-dimensional appearance features can be expressed as d i-1,i is the trajectory segment T i-1 With trajectory segment T i The spatial distance between (when i = 0, d -1,0 =0). After determining the feature expression of each trajectory segment included in the candidate cluster C, the basic feature φ of the candidate cluster C can be determined by the following formula: C :
[0113]
[0114] As an example, the purity recognition network in the embodiment of the present application can be composed of five fully connected layers. By inputting the basic features of the above-mentioned candidate clustering cluster into the purity recognition network, the purity corresponding to the candidate clustering cluster output by the purity recognition network can be obtained accordingly. The purity output by the purity recognition network is usually a value between 0 and 1. The higher the purity, the higher the possibility that the trajectory segments in the candidate clustering cluster correspond to the same target.
[0115] It should be understood that in practical applications, other network structures can also be used as the purity identification network in this application, and no limitation is made to the specific structure of the purity identification network.
[0116] Step 104: performing de-overlapping processing on the multiple candidate clusters according to the purity corresponding to each of the multiple candidate clusters to obtain multiple target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene.
[0117] After the server determines the purity corresponding to each candidate cluster through the purity recognition network, it can perform de-overlapping processing on the candidate clusters obtained in the iterative clustering process in step 102 according to the purity corresponding to each candidate cluster, thereby obtaining multiple target clusters with higher purity.
[0118] In some embodiments, the server may first determine the score corresponding to each candidate clustering cluster according to the purity corresponding to each candidate clustering cluster and the length of the included trajectory segments; then, according to the scores corresponding to each candidate clustering cluster, the multiple candidate clustering clusters are sorted in descending order, and the trajectory segment retention priority of each candidate clustering cluster is determined according to the sorting order of each candidate clustering cluster, and the trajectory segment retention priority of the candidate clustering cluster with a higher sorting is higher than the trajectory segment retention priority of the candidate clustering cluster with a lower sorting; further, according to the trajectory segment retention priority corresponding to each candidate clustering cluster, the trajectory segments included in each candidate clustering cluster are de-overlapped, so as to obtain multiple target clusters.
[0119] Specifically, the server may configure corresponding weight values for purity and trajectory segment length, respectively, and then for each candidate cluster, based on the weight values corresponding to the purity and trajectory segment length, weighted processing is performed on the purity corresponding to the candidate cluster and the trajectory segment length included therein, to obtain the score corresponding to the candidate cluster. After determining the scores corresponding to each candidate cluster, the candidate clusters are sorted in descending order according to the scores corresponding to each candidate cluster, wherein the candidate clusters with higher rankings have higher trajectory segment retention priorities, and the candidate clusters with lower rankings have lower trajectory segment retention priorities. Furthermore, according to the trajectory segment retention priorities of each candidate cluster, the trajectory segments in the candidate cluster with lower trajectory segment retention priorities that overlap with the candidate cluster with higher trajectory segment retention priorities are deleted.
[0120] For example, assuming that the trajectory segment retention priority of candidate cluster A is higher than that of candidate cluster B, candidate cluster A includes trajectory segment 1, trajectory segment 2 and trajectory segment 3, and candidate cluster B includes trajectory segment 2, trajectory segment 4 and trajectory segment 5; since the trajectory segment retention priority of candidate cluster A is higher than that of candidate cluster B, when both candidate cluster A and candidate cluster B include trajectory segment 2, it is necessary to retain trajectory segment 2 in candidate cluster A and remove trajectory segment 2 in candidate cluster B.
[0121] Optionally, after obtaining the multiple target clusters, the server may also determine the complete trajectory of each target in the target scene based on the multiple target clusters.
[0122] The server obtains multiple target clusters after de-overlapping the candidate clusters. Since the target clusters have a high degree of purity, the complete trajectory of each target in the target scene can be determined directly based on each target cluster. Specifically, for each target cluster, cross-camera data association can be performed based on the trajectory segments included therein, so as to obtain the complete motion trajectory of the target in the target cluster in the target scene.
[0123] When the above clustering method performs iterative clustering processing on the trajectory segments of each target under each camera in the target scene, based on the gradually relaxed appearance similarity constraint and spatiotemporal constraint, it measures whether each candidate cluster obtained by the previous round of clustering processing can be further merged and clustered, so that a series of high-quality candidate clusters are obtained through multiple iterative clustering. Then, the purity corresponding to each candidate cluster obtained in the above iterative clustering process is identified by using the pre-trained purity recognition network, and each candidate cluster is de-overlapped in combination with the purity corresponding to each candidate cluster, so as to obtain a series of target clusters; because it has previously undergone iterative clustering based on the dual constraints of appearance similarity constraint and spatiotemporal constraint, and the recognition results determined by the purity recognition network are considered in the de-overlapping process, the target cluster obtained here usually has a high purity, which can basically ensure that the trajectory segments of the same target are clustered in the same target cluster, and the trajectory segments of different targets are clustered in different target clusters. Accordingly, multi-target tracking based on each target cluster with high purity can effectively ensure the accuracy of the determined tracking trajectory.
[0124] The present application also provides a clustering device. Figure 2 , Figure 2 A schematic diagram of a clustering device provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the device comprises:
[0125] An acquisition module 201 is used to acquire the trajectory segments of each target under each camera in the target scene to form a trajectory segment set;
[0126] The clustering module 202 is used to perform iterative clustering processing on the trajectory segment set based on the appearance similarity constraint condition and the spatiotemporal constraint condition, and obtain multiple candidate clusters in the iterative clustering process; the appearance similarity constraint condition is used to measure whether the candidate clusters need to be merged according to the similarity of the appearance features between the candidate clusters; the spatiotemporal constraint condition is used to measure whether the candidate clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features of the candidate clusters;
[0127] A purity recognition module 203, configured to determine the purity corresponding to each of the plurality of candidate clusters through a purity recognition network;
[0128] The de-overlapping module 204 is used to perform de-overlapping processing on the multiple candidate clusters according to the purity corresponding to each of the multiple candidate clusters to obtain multiple target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene.
[0129] Optionally, the clustering module 202 is specifically used for:
[0130] Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations;
[0131] For each candidate cluster combination, perform the following operations:
[0132] Calculating the minimum cosine distance between the appearance features of each candidate cluster in the candidate cluster combination as the similarity corresponding to the candidate cluster combination; the appearance features of the candidate cluster are determined according to the appearance features of each trajectory segment included therein;
[0133] It is determined whether the similarity corresponding to the candidate cluster combination is greater than the appearance similarity threshold of the current round of clustering processing. If so, it is determined that the candidate clusters in the candidate cluster combination meet the appearance similarity constraint condition.
[0134] Optionally, the clustering module 202 is specifically used for:
[0135] Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations;
[0136] For each candidate cluster combination, perform the following operations:
[0137] Determine whether the spanning time of each candidate cluster in the candidate cluster combination overlaps; the spanning time of the candidate cluster is a set of timestamps of each trajectory segment included therein;
[0138] If there is no overlap, then determine whether the candidate clusters in the candidate cluster combination meet the time constraint condition according to the time interval between the spanning times of each candidate cluster in the candidate cluster combination; and determine whether the candidate clusters in the candidate cluster combination meet the space constraint condition according to the positional relationship between the predicted trajectory and the true trajectory of each candidate cluster in the candidate cluster combination; when the candidate clusters in the candidate cluster combination meet the time constraint condition and the space constraint condition, determine that the candidate clusters in the candidate cluster combination meet the time and space constraint conditions;
[0139] If there is overlap, determine whether the candidate clusters in the candidate cluster combination meet the spatiotemporal constraints based on the camera index identifiers to which the trajectory segments of each candidate cluster in the candidate cluster combination within the overlapping time belong, and / or the positional relationship between the real trajectories of each candidate cluster in the candidate cluster combination within the overlapping time.
[0140] Optionally, the candidate cluster combination includes a first candidate cluster and a second candidate cluster; the clustering module 202 is specifically used for:
[0141] Determine a time interval between the closest timestamps in the span time of the first candidate cluster and the span time of the second candidate cluster;
[0142] Determine whether the time interval is less than the time constraint threshold of the current round of clustering processing, and if so, determine whether the candidate cluster in the candidate cluster combination satisfies the time constraint condition;
[0143] Predicting a trajectory of the second candidate cluster over the time span of the first candidate cluster as the predicted trajectory of the first candidate cluster; calculating an average Euclidean distance between the predicted trajectory of the first candidate cluster and the true trajectory as the first distance;
[0144] Predicting a trajectory of the first candidate cluster over the time span of the second candidate cluster as the predicted trajectory of the second candidate cluster; calculating an average Euclidean distance between the predicted trajectory of the second candidate cluster and the true trajectory as the second distance;
[0145] Calculating an average of the first distance and the second distance;
[0146] It is determined whether the average value is less than the first space constraint threshold of the current round of clustering processing. If so, it is determined that the candidate clusters in the candidate cluster cluster combination meet the space constraint condition.
[0147] Optionally, the candidate cluster combination includes a first candidate cluster and a second candidate cluster; the clustering module 202 is specifically used for:
[0148] Combining the camera index identifiers to which the trajectory segments within the overlapping time belong in the first candidate clusters to obtain a first camera identifier set; combining the camera index identifiers to which the trajectory segments within the overlapping time belong in the second candidate clusters to obtain a second camera identifier set;
[0149] If the first camera identification set and the second camera identification set have an intersection, determining that the candidate cluster in the candidate cluster combination does not satisfy the spatiotemporal constraint condition;
[0150] If there is no intersection between the first camera identification set and the second camera identification set, determine the average Euclidean distance between the actual trajectory of the first candidate clustering cluster and the actual trajectory of the second candidate clustering cluster within the overlapping time, and judge whether the average Euclidean distance is less than the second spatial constraint threshold of this round of clustering processing. If so, determine that the candidate clustering clusters in the candidate clustering cluster combination meet the spatiotemporal constraints.
[0151] Optionally, the purity identification module 203 is specifically used for:
[0152] For each candidate cluster, the basic features of the candidate cluster are determined according to the appearance features of the trajectory segments included therein and the spatial distances between the trajectory segments with adjacent start timestamps; and the purity corresponding to the candidate cluster is determined according to the basic features of the candidate cluster through the purity recognition network.
[0153] Optionally, the de-overlapping module 204 is specifically configured to:
[0154] Determining scores corresponding to each of the plurality of candidate clusters according to the purity corresponding to each of the plurality of candidate clusters and the length of the included trajectory segments;
[0155] According to the scores corresponding to the multiple candidate clustering clusters, the multiple candidate clustering clusters are sorted in descending order;
[0156] Determining the trajectory segment retention priority of the plurality of candidate clustering clusters according to the sorting order of the plurality of candidate clustering clusters, wherein the trajectory segment retention priority of the candidate clustering cluster with a higher sorting order is higher than the trajectory segment retention priority of the candidate clustering cluster with a lower sorting order;
[0157] According to the trajectory segment retention priorities of the multiple candidate clusters, de-overlapping processing is performed on the trajectory segments in the multiple candidate clusters to obtain the multiple target clusters.
[0158] When the clustering device performs iterative clustering processing on the trajectory segments of each target under each camera in the target scene, based on the gradually relaxed appearance similarity constraint and spatiotemporal constraint, it measures whether each candidate cluster obtained by the previous round of clustering processing can be further merged and clustered, so as to obtain a series of high-quality candidate clusters through multiple iterative clustering. Then, the purity corresponding to each candidate cluster obtained in the above iterative clustering process is identified by using the pre-trained purity recognition network, and each candidate cluster is de-overlapped in combination with the purity corresponding to each candidate cluster, so as to obtain a series of target clusters; because it has previously undergone iterative clustering based on the dual constraints of appearance similarity constraint and spatiotemporal constraint, and the recognition results determined by the purity recognition network are considered in the de-overlapping process, the target cluster obtained here usually has a high purity, which can basically ensure that the trajectory segments of the same target are clustered in the same target cluster, and the trajectory segments of different targets are clustered in different target clusters. Accordingly, multi-target tracking based on each target cluster with high purity can effectively ensure the accuracy of the determined tracking trajectory.
[0159] The embodiment of the present application also provides a device, which may specifically be a server or a terminal device. The server and terminal device provided in the embodiment of the present application will be introduced below from the perspective of hardware entity.
[0160] See also Figure 3 , Figure 3 A schematic diagram of the structure of a server 300 provided for an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 322 (for example, one or more processors) and a memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 may be temporary storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.
[0161] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0162] The steps performed by the server in the above embodiment can be based on the Figure 3 The server structure shown.
[0163] The CPU 322 is used to execute the following steps:
[0164] Obtain the trajectory segments of each target under each camera in the target scene to form a trajectory segment set;
[0165] For the trajectory segment set, iterative clustering processing is performed based on appearance similarity constraints and spatiotemporal constraints, and multiple candidate clustering clusters are obtained in the iterative clustering process; the appearance similarity constraints are used to measure whether the candidate clustering clusters need to be merged according to the similarity of appearance features between the candidate clustering clusters; the spatiotemporal constraints are used to measure whether the candidate clustering clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features between the candidate clustering clusters;
[0166] Determining the purity corresponding to each of the plurality of candidate clusters through a purity recognition network;
[0167] According to the purity corresponding to each of the multiple candidate clusters, the multiple candidate clusters are de-overlapped to obtain multiple target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene.
[0168] Optionally, the CPU 322 may also be used to execute steps of any implementation of the clustering method provided in the embodiments of the present application.
[0169] See also Figure 4 , Figure 4 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present application. The terminal can be any terminal device including a computer, a tablet computer, a personal digital assistant (English full name: Personal Digital Assistant, English abbreviation: PDA), etc., taking the terminal as a computer as an example:
[0170] Figure 4 FIG. 1 is a block diagram showing a partial structure of a computer related to a terminal provided in an embodiment of the present application. Figure 4 The computer includes: a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. Those skilled in the art will appreciate that Figure 4 The computer structure shown in the figure does not constitute a limitation of the computer, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0171] The memory 420 can be used to store software programs and modules. The processor 480 executes various functional applications and data processing of the computer by running the software programs and modules stored in the memory 420. The memory 420 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the computer (such as audio data, a phone book, etc.), etc. In addition, the memory 420 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0172] The processor 480 is the control center of the computer. It uses various interfaces and lines to connect various parts of the entire computer. It executes various functions of the computer and processes data by running or executing software programs and / or modules stored in the memory 420, and calling data stored in the memory 420, so as to monitor the computer as a whole. Optionally, the processor 480 may include one or more processing units; preferably, the processor 480 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 480.
[0173] In the embodiment of the present application, the processor 480 included in the terminal also has the following functions:
[0174] Obtain the trajectory segments of each target under each camera in the target scene to form a trajectory segment set;
[0175] For the trajectory segment set, iterative clustering processing is performed based on appearance similarity constraints and spatiotemporal constraints, and multiple candidate clustering clusters are obtained in the iterative clustering process; the appearance similarity constraints are used to measure whether the candidate clustering clusters need to be merged according to the similarity of appearance features between the candidate clustering clusters; the spatiotemporal constraints are used to measure whether the candidate clustering clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features between the candidate clustering clusters;
[0176] Determining the purity corresponding to each of the plurality of candidate clusters through a purity recognition network;
[0177] According to the purity corresponding to each of the multiple candidate clusters, the multiple candidate clusters are de-overlapped to obtain multiple target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene.
[0178] Optionally, the processor 480 is further configured to execute steps of any implementation method of the clustering method provided in the embodiments of the present application.
[0179] The embodiment of the present application further provides a computer-readable storage medium for storing program code, wherein the program code is used to execute any implementation of a clustering method described in the aforementioned embodiments.
[0180] An embodiment of the present application further provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any one of the implementations of a clustering method described in the aforementioned embodiments.
[0181] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0182] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0183] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0184] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0185] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (full name in English: Read-Only Memory, English abbreviation: ROM), random access memory (full name in English: Random Access Memory, English abbreviation: RAM), disk or optical disk and other media that can store computer programs.
[0186] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0187] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A clustering method, characterized in that: The method comprises: Obtain the trajectory segments of each target under each camera in the target scene to form a trajectory segment set; For the trajectory segment set, iterative clustering processing is performed based on appearance similarity constraints and spatiotemporal constraints, and multiple candidate clustering clusters are obtained in the iterative clustering process; the appearance similarity constraints are used to measure whether the candidate clustering clusters need to be merged according to the similarity of appearance features between the candidate clustering clusters; the spatiotemporal constraints are used to measure whether the candidate clustering clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features between the candidate clustering clusters; Determining the purity corresponding to each of the plurality of candidate clusters through a purity recognition network; According to the purity corresponding to each of the plurality of candidate clusters, de-overlapping processing is performed on the plurality of candidate clusters to obtain a plurality of target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene; The following method is used to measure whether the candidate clusters satisfy the spatiotemporal constraints: Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations; For each candidate cluster combination, perform the following operations: Determine whether the span time of each candidate cluster in the candidate cluster combination overlaps; the span time of the candidate cluster is a set of timestamps of each trajectory segment included therein; the candidate cluster combination includes a first candidate cluster and a second candidate cluster; If there is no overlap, determine the time interval between the span time of the first candidate clustering cluster and the span time of the second candidate clustering cluster, which is the closest timestamp; determine whether the time interval is less than the time constraint threshold of this round of clustering processing; if so, determine that the candidate clustering clusters in the candidate clustering cluster combination meet the time constraint; predict the trajectory of the second candidate clustering cluster over the span time of the first candidate clustering cluster as the predicted trajectory of the first candidate clustering cluster; calculate the average Euclidean distance between the predicted trajectory of the first candidate clustering cluster and the true trajectory as the first distance; predict the first candidate clustering cluster in the span time of the first candidate clustering cluster; The trajectory of the second candidate cluster clusters across time is used as the predicted trajectory of the second candidate cluster cluster; the average Euclidean distance between the predicted trajectory of the second candidate cluster cluster and the true trajectory is calculated as the second distance; the average value of the first distance and the second distance is calculated; it is determined whether the average value is less than the first spatial constraint threshold of this round of clustering processing, and if so, it is determined that the candidate cluster clusters in the candidate cluster cluster combination meet the spatial constraint condition; when the candidate cluster clusters in the candidate cluster cluster combination meet the time constraint condition and the space constraint condition, it is determined that the candidate cluster clusters in the candidate cluster cluster combination meet the spatiotemporal constraint condition; If there is an overlap, the camera index identifiers to which the trajectory segments in the first candidate clustering clusters belong within the overlapping time are combined to obtain a first camera identifier set; the camera index identifiers to which the trajectory segments in the second candidate clustering clusters belong within the overlapping time are combined to obtain a second camera identifier set; if the first camera identifier set and the second camera identifier set have an intersection, it is determined that the candidate clustering clusters in the candidate clustering cluster combination do not meet the time and space constraints; if the first camera identifier set and the second camera identifier set do not have an intersection, the average Euclidean distance between the actual trajectory of the first candidate clustering cluster and the actual trajectory of the second candidate clustering cluster within the overlapping time is determined, and it is judged whether the average Euclidean distance is less than the second spatial constraint threshold of this round of clustering processing. If so, it is determined that the candidate clustering clusters in the candidate clustering cluster combination meet the time and space constraints.
2. The method according to claim 1, characterized in that Whether the candidate clusters satisfy the appearance similarity constraint is measured in the following way: Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations; For each candidate cluster combination, perform the following operations: Calculating the minimum cosine distance between the appearance features of each candidate cluster in the candidate cluster combination as the similarity corresponding to the candidate cluster combination; the appearance features of the candidate cluster are determined according to the appearance features of each trajectory segment included therein; It is determined whether the similarity corresponding to the candidate cluster combination is greater than the appearance similarity threshold of the current round of clustering processing. If so, it is determined that the candidate clusters in the candidate cluster combination meet the appearance similarity constraint condition.
3. The method according to claim 1, characterized in that The step of determining the purity corresponding to each of the plurality of candidate clusters through a purity recognition network includes: For each candidate cluster, the basic features of the candidate cluster are determined according to the appearance features of the trajectory segments included therein and the spatial distances between the trajectory segments with adjacent start timestamps; and the purity corresponding to the candidate cluster is determined according to the basic features of the candidate cluster through the purity recognition network.
4. The method according to claim 1, characterized in that: The method of performing de-overlapping processing on the multiple candidate clusters according to the purity corresponding to each of the multiple candidate clusters to obtain multiple target clusters includes: Determining scores corresponding to each of the plurality of candidate clusters according to the purity corresponding to each of the plurality of candidate clusters and the length of the included trajectory segments; According to the scores corresponding to the multiple candidate clustering clusters, the multiple candidate clustering clusters are sorted in descending order; Determining the trajectory segment retention priority of the plurality of candidate clustering clusters according to the sorting order of the plurality of candidate clustering clusters, wherein the trajectory segment retention priority of the candidate clustering cluster with a higher sorting order is higher than the trajectory segment retention priority of the candidate clustering cluster with a lower sorting order; According to the trajectory segment retention priorities of the multiple candidate clusters, de-overlapping processing is performed on the trajectory segments in the multiple candidate clusters to obtain the multiple target clusters.
5. A clustering device, characterized in that: The device comprises: An acquisition module is used to acquire the trajectory segments of each target under each camera in the target scene to form a trajectory segment set; A clustering module is used to perform iterative clustering processing on the trajectory segment set based on appearance similarity constraints and spatiotemporal constraints, and obtain multiple candidate clustering clusters in the iterative clustering process; the appearance similarity constraints are used to measure whether the candidate clustering clusters need to be merged according to the similarity of appearance features between the candidate clustering clusters; the spatiotemporal constraints are used to measure whether the candidate clustering clusters need to be merged according to the correlation relationship between the temporal features and the correlation relationship between the spatial features between the candidate clustering clusters; A purity recognition module, used to determine the purity corresponding to each of the plurality of candidate clusters through a purity recognition network; A de-overlapping module, configured to perform de-overlapping processing on the plurality of candidate clusters according to the purity corresponding to each of the plurality of candidate clusters, so as to obtain a plurality of target clusters; the target clusters are used to determine the motion trajectory of the target in the target scene; The clustering module is specifically used for: Combining multiple candidate clusters obtained by the previous round of clustering processing in pairs to obtain multiple candidate cluster combinations; For each candidate cluster combination, perform the following operations: Determine whether the span time of each candidate cluster in the candidate cluster combination overlaps; the span time of the candidate cluster is a set of timestamps of each trajectory segment included therein; the candidate cluster combination includes a first candidate cluster and a second candidate cluster; If there is no overlap, determine the time interval between the span time of the first candidate clustering cluster and the span time of the second candidate clustering cluster, which is the closest timestamp; determine whether the time interval is less than the time constraint threshold of this round of clustering processing; if so, determine that the candidate clustering clusters in the candidate clustering cluster combination meet the time constraint condition; predict the trajectory of the second candidate clustering cluster over the span time of the first candidate clustering cluster as the predicted trajectory of the first candidate clustering cluster; calculate the average Euclidean distance between the predicted trajectory of the first candidate clustering cluster and the true trajectory as the first distance; predict the first candidate clustering cluster in the span time of the first candidate clustering cluster; The trajectory of the second candidate cluster cluster across time is used as the predicted trajectory of the second candidate cluster cluster; the average Euclidean distance between the predicted trajectory of the second candidate cluster cluster and the true trajectory is calculated as the second distance; the average value of the first distance and the second distance is calculated; it is determined whether the average value is less than the first spatial constraint threshold of this round of clustering processing, and if so, it is determined that the candidate cluster clusters in the candidate cluster cluster combination meet the spatial constraint condition. When the candidate cluster clusters in the candidate cluster cluster combination meet the time constraint condition and the space constraint condition, it is determined that the candidate cluster clusters in the candidate cluster cluster combination meet the spatiotemporal constraint condition; If there is an overlap, the camera index identifiers to which the trajectory segments in the first candidate clustering clusters belong within the overlapping time are combined to obtain a first camera identifier set; the camera index identifiers to which the trajectory segments in the second candidate clustering clusters belong within the overlapping time are combined to obtain a second camera identifier set; if the first camera identifier set and the second camera identifier set have an intersection, it is determined that the candidate clustering clusters in the candidate clustering cluster combination do not meet the time and space constraints; if the first camera identifier set and the second camera identifier set do not have an intersection, the average Euclidean distance between the actual trajectory of the first candidate clustering cluster and the actual trajectory of the second candidate clustering cluster within the overlapping time is determined, and it is judged whether the average Euclidean distance is less than the second spatial constraint threshold of this round of clustering processing. If so, it is determined that the candidate clustering clusters in the candidate clustering cluster combination meet the time and space constraints.
6. A device, characterized in that: The device comprises: a processor and a memory; The memory is used to store computer programs; The processor is used to call the computer program to execute the clustering method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the clustering method according to any one of claims 1 to 4.
