Cross-camera block pedestrian matching method and device based on spatio-temporal information
By obtaining surveillance video and camera latitude and longitude information, extracting pedestrian feature vectors and using single-camera trajectory tracking and cross-camera trajectory matching algorithms, combined with spatiotemporal information, the accuracy and efficiency issues in cross-camera pedestrian matching are solved, achieving fast and accurate matching effect.
Patent Information
- Application Number
- CN202410738097.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-24
AI Technical Summary
The existing technology has the problems of slow speed, low efficiency, and high error rate in cross-camera pedestrian matching. It is especially difficult to achieve accurate matching under non-overlapping viewing angles, and the calculation speed and generalization are limited.
By obtaining surveillance video and camera latitude and longitude information, pedestrian feature vectors are extracted, single-camera trajectory tracking is implemented using a single-camera trajectory tracking algorithm, global tracking trajectories are generated through a cross-camera trajectory matching algorithm, and cross-camera matching is achieved by combining spatio-temporal information.
It achieves more accurate cross-camera matching in the case of surveillance video and camera latitude and longitude information. It has fast calculation speed, low storage cost and strong generalizability, and can handle large-scale surveillance video matching problems under non-overlapping perspectives.
Smart Images

Figure CN118691648A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer vision, and in particular to a method and device for matching pedestrians across camera blocks based on spatiotemporal information. Background Art
[0002] Accurate and fast tracking of pedestrians through cameras plays a significant role in modern security and other fields. With the rapid development of computer vision, artificial intelligence and other technologies, the accurate matching technology of pedestrians across cameras has also made great progress.
[0003] In related technologies, tracking can be performed manually, or a model can be used through machine learning methods to extract the feature vectors of pedestrians, and objects with similar feature vectors after calculation can be determined to be the same pedestrian.
[0004] However, the human tracking in the related technology is slow and inefficient. When faced with a large number of cameras, the error rate is high, the labor consumption is large and the time is unbearable. In the related technology, the similarity is compared by machine learning. However, due to the huge differences in the perspective, lighting and posture of different cameras, it is difficult to get accurate results simply by comparing similarity. Moreover, most of the current mainstream algorithms are based on cameras with overlapping perspectives, and their applicability is limited in the case of cameras with non-overlapping city scales. Summary of the invention
[0005] The present application provides a method, device, electronic device, storage medium and program for matching pedestrians in cross-camera blocks based on spatiotemporal information. The method can read videos from different surveillance cameras and the longitude and latitude information of the cameras, and can track the trajectory of the input video under a single camera. By outputting possible matching trajectories through the tracked single camera trajectory and the longitude and latitude information of the camera, the cross-camera block pedestrian matching task is realized, achieving a higher accuracy and a faster computing speed.
[0006] The first aspect of the present application provides a method for matching pedestrians in a cross-camera block based on spatiotemporal information, including: obtaining surveillance videos of the block collected by each camera; identifying pedestrians appearing in the surveillance videos of each camera; extracting pedestrian feature vectors in the surveillance videos of each camera; tracking the trajectories of pedestrians in the surveillance videos according to the pedestrian feature vectors; and generating a global tracking trajectory of pedestrians based on the tracking trajectory of each camera, the location information of each camera, and the time-consuming information of pedestrians between any two cameras.
[0007] Optionally, in one embodiment of the present application, tracking the trajectory of pedestrians in a surveillance video based on pedestrian feature vectors includes: identifying the pedestrian feature vector of the current frame of the surveillance video; when the current frame is the first frame, initializing the pedestrian trajectory table; when the current frame is not the first frame, updating the pedestrian trajectory table based on the trajectory tracking result of the previous frame and the feature vector of the current frame; and generating the trajectory of the pedestrian in the surveillance video based on the pedestrian trajectory table.
[0008] Optionally, in one embodiment of the present application, the trajectory table of the pedestrian is updated according to the trajectory tracking result of the previous frame and the feature vector of the current frame, including: identifying each trajectory in the trajectory table; calculating the first distance matrix between the feature vector of the current frame and each trajectory; when the first distance matrix is greater than the distance threshold, generating a new trajectory in the trajectory table, and when the first distance matrix is less than or equal to the distance threshold, updating the corresponding trajectory in the trajectory table.
[0009] Optionally, in one embodiment of the present application, a first distance matrix between a feature vector of a current frame and each trajectory is calculated, including: splicing the feature vector of the last frame of each trajectory to the feature vector of a bounding box tracked by the last frame; identifying the feature vector of the last frame of each trajectory and the feature vectors of all frames, and calculating an average feature vector and an exponentially smoothed feature vector based on the feature vectors of all frames of each trajectory; calculating a first cosine distance between the spliced pedestrian feature vector and the feature vector of the last frame of the trajectory, calculating a second cosine distance between the feature vector of the current frame and the average feature vector, and calculating a third cosine distance between the feature vector of the current frame and the exponentially smoothed feature vector; and generating a first distance matrix based on the first cosine distance, the second cosine distance, and the third cosine distance.
[0010] Optionally, in one embodiment of the present application, a global tracking trajectory of pedestrians is generated based on the tracking trajectory of each camera, the position information of each camera and the pedestrian time information between any two cameras, including: calculating the theoretical time information matrix of each trajectory based on the tracking trajectory of each camera; calculating the real time information matrix of each trajectory based on the sampling parameters of each camera; calculating the cosine distance between the average features of any two tracking trajectories, and generating a second distance matrix based on the cosine distance of the average features between any two tracking trajectories; calculating a third distance matrix based on the theoretical time information matrix, the real time information matrix and the second distance matrix, and generating the global tracking trajectory of pedestrians based on the position information of each camera, the pedestrian time information between any two cameras and the third distance matrix.
[0011] Optionally, in one embodiment of the present application, the pedestrian feature vector includes a human body feature vector and a facial feature vector, and the pedestrian feature vector in the surveillance video of each camera is extracted, including: identifying pedestrian slice images in the surveillance video; inputting the pedestrian slice images into a pedestrian re-identification model, and the pedestrian re-identification model outputs a human body feature vector; inputting the pedestrian slice images into a face detection model, and the face detection model outputs a face feature vector.
[0012] The second aspect of the present application provides a cross-camera block pedestrian matching device based on spatiotemporal information, including: an acquisition module for acquiring surveillance videos of the block collected by each camera; an identification module for identifying pedestrians appearing in the surveillance videos of each camera; an extraction module for extracting pedestrian feature vectors in the surveillance videos of each camera; a tracking module for tracking the trajectories of pedestrians in the surveillance videos according to the pedestrian feature vectors; and a matching module for generating a global tracking trajectory of pedestrians based on the tracking trajectory of each camera, the location information of each camera, and the pedestrian time-consuming information between any two cameras.
[0013] Optionally, in one embodiment of the present application, the tracking module is further used to identify the pedestrian feature vector of the current frame of the surveillance video; when the current frame is the first frame, initialize the pedestrian trajectory table; when the current frame is not the first frame, update the pedestrian trajectory table according to the trajectory tracking result of the previous frame and the feature vector of the current frame; generate the trajectory of the pedestrian in the surveillance video according to the pedestrian trajectory table.
[0014] Optionally, in one embodiment of the present application, the tracking module is further used to identify each trajectory in the trajectory table; calculate the first distance matrix between the feature vector of the current frame and each trajectory; when the first distance matrix is greater than the distance threshold, generate a new trajectory in the trajectory table, and when the first distance matrix is less than or equal to the distance threshold, update the corresponding trajectory in the trajectory table.
[0015] Optionally, in one embodiment of the present application, the tracking module is further used to splice the feature vector of the last frame of each trajectory to the feature vector of the bounding box tracked by the last frame; identify the feature vector of the last frame of each trajectory and the feature vectors of all frames, and calculate the average feature vector and the exponentially smoothed feature vector based on the feature vectors of all frames of each trajectory; calculate the first cosine distance between the spliced pedestrian feature vector and the feature vector of the last frame of the trajectory, calculate the second cosine distance between the feature vector of the current frame and the average feature vector, and calculate the third cosine distance between the feature vector of the current frame and the exponentially smoothed feature vector; and generate a first distance matrix based on the first cosine distance, the second cosine distance, and the third cosine distance.
[0016] Optionally, in one embodiment of the present application, the matching module is further used to calculate the theoretical time consumption information matrix of each trajectory based on the tracking trajectory of each camera; calculate the actual time consumption information matrix of each trajectory based on the sampling parameters of each camera; calculate the cosine distance between the average features of any two tracking trajectories, and generate a second distance matrix based on the cosine distance of the average features between any two tracking trajectories; calculate the third distance matrix based on the theoretical time consumption information matrix, the actual time consumption information matrix and the second distance matrix, and generate the global tracking trajectory of the pedestrian based on the position information of each camera, the pedestrian time consumption information between any two cameras and the third distance matrix.
[0017] Optionally, in one embodiment of the present application, the extraction module is further used to identify pedestrian slice images in the surveillance video; the pedestrian slice images are input into the pedestrian re-identification model, and the pedestrian re-identification model outputs a human feature vector; the pedestrian slice images are input into the face detection model, and the face detection model outputs a face feature vector.
[0018] The third aspect of the present application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a cross-camera block pedestrian matching method based on spatiotemporal information as in the above-mentioned embodiment.
[0019] The fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement a cross-camera block pedestrian matching method based on spatiotemporal information as in the above-mentioned embodiment.
[0020] The fifth aspect of the present application provides a computer program product, including a computer program or instructions. When the computer program is executed, it is used to implement the cross-camera block pedestrian matching method based on spatiotemporal information as in the above-mentioned embodiment.
[0021] Therefore, this application includes the following beneficial effects:
[0022] The embodiments of the present application can effectively solve the problem of tracking pedestrian trajectories across cameras. Pedestrians and their feature vectors appearing in the video are extracted through the target detection model and the pedestrian re-identification model, and single-camera trajectory tracking is realized through the proposed single-camera trajectory tracking algorithm. Cross-camera matching of single-camera trajectories is realized through the proposed cross-camera trajectory matching algorithm, so that more accurate cross-camera matching can be achieved when only the latitude and longitude information of the surveillance video and the camera is input. Compared with other cross-camera matching methods, it can better handle the matching problem of large-scale surveillance videos under non-overlapping perspectives, and has the advantages of fast calculation speed, low storage cost and strong scalability.
[0023] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0025] Figure 1 A flowchart of a method for matching pedestrians across camera blocks based on spatiotemporal information according to an embodiment of the present application;
[0026] Figure 2 A single-camera matching algorithm diagram of a cross-camera block pedestrian matching method based on spatiotemporal information provided according to an embodiment of the present application;
[0027] Figure 3 A specific method flow chart of a method for matching pedestrians across camera blocks based on spatiotemporal information according to an embodiment of the present application;
[0028] Figure 4 An online and offline flow chart of a device for matching pedestrians across camera blocks based on spatiotemporal information according to an embodiment of the present application;
[0029] Figure 5 This is an example diagram of a device for matching pedestrians across camera blocks based on spatiotemporal information according to an embodiment of the present application;
[0030] Figure 6 Schematic diagram of the structure of an electronic device according to an embodiment of the present application.
[0031] Explanation of reference numerals: acquisition module-100, identification module-200, extraction module-300, tracking module-400, matching module-500, memory-601, processor-602 and communication interface-603. DETAILED DESCRIPTION
[0032] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0033] The following describes the cross-camera street pedestrian matching method, device, electronic device, storage medium and program based on spatiotemporal information of the embodiments of the present application with reference to the accompanying drawings. In view of the problems mentioned in the above background technology, the embodiments of the present application can effectively solve the problem of tracking pedestrian trajectories across cameras, extract the feature vectors of pedestrians and pedestrians appearing in the video through the target detection model and the pedestrian re-identification model, and realize single-camera trajectory tracking through the proposed single-camera trajectory tracking algorithm; realize cross-camera matching of single-camera trajectories through the proposed cross-camera trajectory matching algorithm, so that more accurate cross-camera matching can be achieved when only the latitude and longitude information of the surveillance video and the camera is input. Compared with other cross-camera matching methods, it can better handle the matching problem of large-scale surveillance videos under non-overlapping perspectives, and has the advantages of fast calculation speed, low storage cost and strong scalability.
[0034] Specifically, Figure 1 A flowchart of a method for matching pedestrians across camera blocks based on spatiotemporal information is provided in an embodiment of the present application.
[0035] like Figure 1 As shown, the cross-camera block pedestrian matching method based on spatiotemporal information includes the following steps:
[0036] In step S1, the surveillance video of the block captured by each camera is obtained.
[0037] It can be understood that the embodiment of the present application can obtain the surveillance video corresponding to the camera, and the specific acquisition method is not specifically limited.
[0038] In step S2, pedestrians appearing in the surveillance video of each camera are identified.
[0039] It is understandable that the embodiments of the present application can collect surveillance videos and process them into frames, and use the target detection model to detect pedestrians. Specifically: after acquiring the surveillance video frames, the pedestrian data can be extracted; after extracting the pedestrians from the video frames, the sliced images of the pedestrians, the storage path of the original images, the specific frame number of the pedestrians, and other information are saved at the same time. The target detection model can be selected according to the actual situation. In the following embodiments, the YOLO (You Only Look Once, real-time target detection algorithm) model will be used as a choice for explanation.
[0040] Specifically, (1) the embodiment of the present application can also process the image frames after acquiring the surveillance video, such as sampling the surveillance video at intervals, such as sampling one frame every five frames, etc., without specific limitation. The embodiment of the present invention performs sampling at a sampling interval of five frames. Therefore, the present invention has a smaller storage space occupation and a higher computing speed.
[0041] (2) When the image is input into the target detection model, the image is first adaptively scaled to a square image of a specified multiple while keeping the aspect ratio unchanged. The unfilled image is filled with gray (114, 114, 114). The image then enters the Focus module (image slicing operation module). The Focus module samples a value for every other pixel, thereby obtaining four images that are similar to the original image but without information loss, reducing the size of the feature map while increasing the number of channels. The backbone network uses the structure of CSPDarknet53 (Cross Stage Paritial Network, feature extraction network), which is converted into a feature map in this process and enters the Neck network (middle layer network).
[0042] The Neck network uses the structure of FPN (Feature Pyramid Networks) + PAN (Path Aggregation Network, a deep neural network architecture for image semantic segmentation), and adopts the CSP2 structure designed based on CSPNet, and enters the Head network. The Head network obtains the final position of the prediction box by non-maximum suppression.
[0043] In step S3, the pedestrian feature vector in the surveillance video of each camera is extracted.
[0044] It can be understood that the pedestrian feature vector includes a human body feature vector and a facial feature vector. The human body feature vector is also called the appearance feature of the pedestrian. The embodiment of the present application can extract the human body feature vector and the facial feature of the pedestrian.
[0045] In one embodiment of the present application, a pedestrian feature vector is extracted from the surveillance video of each camera, including: identifying pedestrian slice images in the surveillance video; inputting the pedestrian slice images into a pedestrian re-identification model, and the pedestrian re-identification model outputs a human feature vector; inputting the pedestrian slice images into a face detection model, and the face detection model outputs a face feature vector.
[0046] Among them, the basic feature of the pedestrian re-identification model is the human image slice detected by the input target detection model, and the output is a vector that can represent the input image features. The basic structure can be a deep neural network model such as Fast-ReID, ReID Strong Baseline or Spindle Net. The basic feature of the face detection model is the human image slice detected by the input target detection model, and the output is a vector that can represent the facial features of the input human image. The basic structure is based on the Insightface algorithm.
[0047] It can be understood that, for the pedestrian body feature vector, after the pedestrian slice image is obtained from the target detection model, the embodiment of the present application can obtain and save the feature vector corresponding to the pedestrian. The pedestrian re-identification model of the embodiment of the present application can be selected according to the actual situation. In the following embodiments, the pedestrian re-identification model ReID StrongBaseline will be used as an option for explanation. For the pedestrian face feature vector, after the pedestrian slice image is obtained from the target detection model, the embodiment of the present application can obtain and save the feature vector, position, confidence score and other information corresponding to the pedestrian face. The face detection model of the embodiment of the present application can be selected according to the actual situation. In the following embodiments, InsightFace will be used as an option for explanation.
[0048] Specifically, (1) after the image is input into the person re-identification model, it passes through the ResNet50 backbone network pre-trained on ImageNet to be converted into a feature map, and then passes through the GAP (Global Average Pooling) layer to obtain preliminary features. The preliminary features are then passed through the BN (Batch Normalization) layer to obtain the 2048-dimensional final features.
[0049] (2) The embodiment of the present application uses buffalo_l as a specific model. After the pedestrian slice image enters the model, the model can output the detected face position and the corresponding confidence score. If the confidence score is higher than 0.6, it is considered that the slice image contains face information, and the position where the face appears and the corresponding 512-dimensional feature vector are saved.
[0050] In step S4, the trajectory of the pedestrian in the surveillance video is tracked according to the pedestrian feature vector.
[0051] It can be understood that after inputting the corresponding pedestrian body feature vector and pedestrian face feature vector, the embodiment of the present application obtains the trajectory of single camera trajectory tracking through the proposed single camera tracking algorithm. The single camera tracking algorithm will be explained in the following embodiments.
[0052] In one embodiment of the present application, the trajectory of a pedestrian in a surveillance video is tracked based on a pedestrian feature vector, including: identifying a pedestrian feature vector of a current frame of the surveillance video; when the current frame is the first frame, initializing a pedestrian trajectory table; when the current frame is not the first frame, updating the pedestrian trajectory table based on a trajectory tracking result of a previous frame and a feature vector of the current frame; and generating a trajectory of the pedestrian in the surveillance video based on the pedestrian trajectory table.
[0053] It can be understood that the trajectory processing of each frame of the surveillance video in the embodiment of the present application is a single-camera tracking algorithm. The trajectory method of obtaining the trajectory of a single camera through the single-camera tracking algorithm can complete the update of the tracking result when the trajectory tracking result of the previous frame and the feature vector of the human body and face in the current frame are given. After processing all frames, the trajectory tracking result under a single camera is obtained.
[0054] Specifically, the algorithm's initialization trajectory table refers to assigning the kth pedestrian detected in the frame where the pedestrian is detected for the first time to the kth trajectory, and using the kth pedestrian's human feature vector to initialize the last frame human feature vector, average human feature vector, and exponentially smoothed human feature vector of the corresponding trajectory; using the kth pedestrian's facial feature vector to initialize the last frame facial feature vector and average facial feature vector of the corresponding trajectory; using the frame number corresponding to the kth pedestrian to initialize the last frame sequence number of the trajectory; using the bounding box position corresponding to the kth pedestrian to initialize the bounding box position tracked in the last frame of the trajectory; and setting the total number of frames of the corresponding trajectory to 1. If the model does not detect a face in the human slice image, the facial feature vector of the kth pedestrian target is counted as a 512-dimensional 0 vector.
[0055] In one embodiment of the present application, a pedestrian trajectory table is updated according to the trajectory tracking result of the previous frame and the feature vector of the current frame, including: identifying each trajectory in the trajectory table; calculating a first distance matrix between the feature vector of the current frame and each trajectory; when the first distance matrix is greater than a distance threshold, generating a new trajectory in the trajectory table, and when the first distance matrix is less than or equal to the distance threshold, updating the corresponding trajectory in the trajectory table.
[0056] The distance threshold may be set or calibrated according to actual conditions and is not specifically limited.
[0057] It can be understood that the first distance matrix is the similarity calculated by the algorithm, and the trajectory table is updated in the algorithm, such as Figure 2 As shown, perform the following operations on the trajectory table:
[0058] 1. The human feature vector of the last frame of the trajectory is changed to the human feature vector of the latest assigned target.
[0059] 2. The facial feature vector of the last frame of the trajectory is changed to the facial feature vector of the latest assigned target. If there is no corresponding face, it will not be changed.
[0060] 3. The average human feature vector of the trajectory: let the original average human vector be f bp , the newly assigned human average vector is f bn , the total number of frames of the trajectory is n, then the following formula is used for update:
[0061]
[0062] 4. The average facial feature vector of this trajectory: let the original average face vector be f ap , the newly assigned face average vector is f an , the total number of frames of the trajectory is n, then the following formula is used for update:
[0063]
[0064] If there is no corresponding face, it will not be changed. If the original value is a 512-dimensional 0 vector, it will be directly changed to the newly assigned face average vector.
[0065] 5. Let the original human feature vector without exponential smoothing be f be , the newly assigned human feature vector is f bn , the total number of frames of the trajectory is n, then the following formula is used for update:
[0066] f be ←λf be +(1-λ)f bn
[0067] In the embodiment of the present application, λ is set to 0.98.
[0068] 6. The bounding box position tracked in the last frame of the trajectory is changed to the bounding box position of the latest assigned target.
[0069] 7. The last frame number of the trajectory is changed to the frame number of the latest assigned target.
[0070] 8. The total number of frames of the track is changed to the original value plus one.
[0071] 9. The status of the track remains unchanged.
[0072] Among them, in the embodiments of the present application, 0.3, t, 3, p, and 10 are taken.
[0073] In one embodiment of the present application, a first distance matrix between a feature vector of a current frame and each trajectory is calculated, including: splicing the feature vector of the last frame of each trajectory to the feature vector of a bounding box tracked by the last frame; identifying the feature vector of the last frame of each trajectory and the feature vectors of all frames, and calculating an average feature vector and an exponentially smoothed feature vector based on the feature vectors of all frames of each trajectory; calculating a first cosine distance between the spliced pedestrian feature vector and the trajectory feature vector, calculating a second cosine distance between the feature vector of the current frame and the average feature vector, and calculating a third cosine distance between the feature vector of the current frame and the exponentially smoothed feature vector; and generating a first distance matrix based on the first cosine distance, the second cosine distance, and the third cosine distance.
[0074] It is understandable that the embodiment of the present application can be based on the length and width W, H of the monitoring video, and the position of the pedestrian detection frame is W lt ,H lt ,W rb ,H rb , respectively represent the upper left horizontal coordinate and the lower right horizontal coordinate and the vertical coordinate, so that W lt , W rb Divide by W, H lt ,H rb Divide by H. Then expand these four values 64 times each and splice them in order after the pedestrian human feature vector. At the same time, for the trajectory, according to the aforementioned splicing method, splice the human feature vector of the last frame of the trajectory and the bounding box position tracked in the last frame of the trajectory. Calculate the cosine distance D1 between the spliced pedestrian human feature vector and the spliced trajectory feature vector. At the same time, calculate the cosine distance D2 between the original pedestrian feature vector and the average human feature vector of the trajectory, the cosine distance D3 between the original pedestrian human feature vector and the exponentially smoothed human feature vector of the trajectory, the cosine distance D4 between the original pedestrian face feature vector and the face feature vector of the last frame of the trajectory, and the cosine distance D5 between the original pedestrian face feature vector and the average face feature vector of the trajectory. The distance is defined as:
[0075] Dist=W[D1,D2,D3,D4,D5] T
[0076] Among them, W is [0.2, 0.35, 0.25, 0.1, 0.1].
[0077] It should be noted that the first cosine distance is the cosine distance D1, the second cosine distance includes the cosine distance D2 and the cosine distance D4, and the third cosine distance includes the cosine distance D3 and the cosine distance D5.
[0078] The following will explain the single camera tracking algorithm through specific implementation, as follows:
[0079] After inputting the corresponding pedestrian human body feature vector and pedestrian face feature vector, the embodiment of the present application can output the trajectory under a single camera. Among them, the embodiment of the present application adds a category label to the detected pedestrian slice image according to the feature vector information. The algorithm is shown in Table 1, wherein Table 1 is a single camera tracking algorithm table.
[0080]
[0081]
[0082] Each track in the track table maintains: 1. The human feature vector of the last frame of the track. 2. The facial feature vector of the last frame of the track. 3. The average human feature vector of the track. 4. The average facial feature vector of the track. 5. The human feature vector of the track after exponential smoothing. 6. The position of the bounding box tracked in the last frame of the track. 7. The sequence number of the last frame of the track. 8. The total number of frames of the track. 9. The status of the track.
[0083] Furthermore, after the algorithm ends, all the ended trajectories are retained, and the average human feature vector, total number of frames and the last frame are saved. Then, DBSCAN clustering is performed on all trajectory segments. The time series vector is the value of the last frame of the trajectory divided by 3600 and expanded 256 times. The trajectory vector for calculating the distance is the average trajectory splicing time series vector. After calculating the cosine distance between the two, the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering method is used for clustering, and the clustered results are updated, where the total number of frames is the sum of the total number of frames of the trajectories with the same label, the last frame is the maximum value of the trajectories with the same label, and the trajectory feature vector is the weighted sum of the average human vector of each trajectory, and the weight is the ratio of the total number of frames of the trajectory to the total number of frames of the trajectory with the same label. And the clustering result is used as the final result of single-camera trajectory tracking.
[0084] In the embodiment of the present application, the DBSCAN clustering is set to 0.1 and the Minpts is set to 1.
[0085] In step S5, a global tracking trajectory of the pedestrian is generated according to the tracking trajectory of each camera, the position information of each camera, and the pedestrian time information between any two cameras.
[0086] It can be understood that after outputting the single-camera trajectory, the embodiment of the present application can obtain different trajectories belonging to the same person in more than two cross-camera matches, wherein the embodiment of the present application can match the trajectory detected by the single camera through the proposed cross-camera matching algorithm, and the cross-camera matching algorithm is specifically as follows:
[0087] In one embodiment of the present application, a global tracking trajectory of pedestrians is generated based on the tracking trajectory of each camera, the position information of each camera and the pedestrian time information between any two cameras, including: calculating the theoretical time information matrix of each trajectory based on the tracking trajectory of each camera; calculating the real time information matrix of each trajectory based on the sampling parameters of each camera; calculating the cosine distance between the average features of any two tracking trajectories, and generating a second distance matrix based on the cosine distance of the average features between any two tracking trajectories; calculating a third distance matrix based on the theoretical time information matrix, the real time information matrix and the second distance matrix, and generating the global tracking trajectory of pedestrians based on the position information of each camera, the pedestrian time information between any two cameras and the third distance matrix.
[0088] It can be understood that the implementation of the present application can input the results of the single camera trajectory tracking and the camera's location information, obtain the estimated duration of the pedestrian's movement between cameras and the similarity of the pedestrians through the calculation map interface, and output the global tracking trajectory of the pedestrian.
[0089] Specifically, this algorithm first calls the map interface, inputs the latitude and longitude information of the camera, calculates the pedestrian time information between any two cameras, and calculates the theoretical time information matrix Dst for each trajectory. The jth trajectory in the i-th row of the matrix represents the number of seconds of map calculation from the camera recording the i-th trajectory to the camera recording the j-th trajectory divided by 3600 (i.e., the number of hours). At the same time, the real time of each trajectory is calculated by the number of frames appearing in the camera and the corresponding initial time and sampling frequency, and the actual time information matrix Drt for each trajectory is calculated. The jth trajectory in the i-th row of the matrix represents the number of seconds actually used from the camera recording the i-th trajectory to the camera recording the j-th trajectory divided by 3600 (i.e., the number of hours).
[0090] At the same time, the cosine distance between the feature vectors of every two trajectories is calculated, and the distances are combined into a matrix Df. Specifically, the i-th row and j-th column of the matrix represent the cosine distance between the feature vectors of the i-th trajectory and the j-th trajectory. The total distance matrix is defined as
[0091] D=(1-λ)D f +λ|D st -D rt |
[0092] Wherein |·| represents the absolute value of each element of the matrix. In the embodiment of the present application, λ is 0.5.
[0093] Select the non-diagonal lines in D and the threshold value less than t as potential matching pairs, calculate the cosine distance between the feature vectors of a certain trajectory and all potential matching pairs, and use the similarity of the cosine distance as the score of each match. A higher score means a higher probability of possible matching.
[0094] According to the cross-camera street pedestrian matching method based on spatiotemporal information proposed in the embodiment of the present application. The embodiment of the present application can effectively solve the problem of tracking pedestrian trajectories across cameras, extract the pedestrians and pedestrian feature vectors appearing in the video through the target detection model and the pedestrian re-identification model, and realize single-camera trajectory tracking through the proposed single-camera trajectory tracking algorithm; realize cross-camera matching of single-camera trajectories through the proposed cross-camera trajectory matching algorithm, so that more accurate cross-camera matching can be achieved when only the latitude and longitude information of the surveillance video and the camera is input. Compared with other cross-camera matching methods, it can better handle the matching problem of large-scale surveillance videos under non-overlapping perspectives, and has the advantages of fast calculation speed, low storage cost and strong scalability.
[0095] The following will further illustrate the method for matching pedestrians across camera blocks based on spatiotemporal information through specific embodiments. Figure 2 As shown, the specific steps include:
[0096] Step S101, collecting surveillance video and processing it into frames.
[0097] Step S102: Use the target detection model to detect pedestrians.
[0098] Step S103: extracting the appearance features of the pedestrian using the pedestrian re-identification model.
[0099] Step S104: extracting facial features of pedestrians using a face detection model.
[0100] Step S105: obtaining a trajectory of single camera trajectory tracking by using the proposed single camera tracking algorithm.
[0101] Step S106: Match the trajectory detected by a single camera using the proposed cross-camera matching algorithm.
[0102] According to the actual situation, the cross-camera block pedestrian matching method based on spatiotemporal information can be divided into offline stage and online stage. Figure 4As shown, the camera to be used needs to be installed in the offline stage, and it is ensured that the embodiment of the present invention can obtain the surveillance video shot by the camera. Accurately record the latitude and longitude of the camera and perform global calibration on the camera time and longitude and latitude information. Ensure that the embodiment of the present invention can work according to the correct spatial and temporal information. In the online stage, it is necessary to process the acquired surveillance video and obtain the video frames involved in subsequent calculations according to a certain frame sampling interval. Pedestrian information is extracted through the target detection model, and the human body and facial feature vectors of the pedestrian are extracted through the pedestrian re-identification model and the face detection model. Using the feature vector and timing information, a single camera tracking algorithm is used to obtain the single camera tracking trajectory, and finally the matching result is obtained through the cross-camera matching algorithm.
[0103] In summary, the embodiments of the present application have the following advantages:
[0104] 1) It can realize cross-camera tracking fully automatically. By only reading the video data of the surveillance camera, it can search for possible matching results of pedestrians in a certain camera that may appear in other cameras through calculation, and display the possibility of matching results. No additional human participation is required, which can effectively reduce the labor burden of staff and improve security capabilities.
[0105] 2) No excessive consumption of computing resources is required. The embodiment of the present application uses alternate frame sampling and the proposed algorithm to effectively improve the computing speed while achieving a higher accuracy.
[0106] 3) Strong robustness. The embodiment of the present application introduces spatiotemporal information to effectively solve the mismatch caused by camera viewing angle, lighting and other issues when only the appearance information of pedestrians is used for matching. At the same time, the search range is limited by spatiotemporal information, reducing the possibility of misidentification due to similar appearance alone.
[0107] Secondly, the cross-camera block pedestrian matching device based on spatiotemporal information proposed in accordance with an embodiment of the present application is described with reference to the accompanying drawings.
[0108] Figure 5 It is a block diagram of a device for matching pedestrians across camera blocks based on spatiotemporal information according to an embodiment of the present application.
[0109] like Figure 5 As shown, the cross-camera block pedestrian matching device 10 based on spatiotemporal information includes: an acquisition module 100, a recognition module 200, an extraction module 300, a tracking module 400 and a matching module 500.
[0110] Among them, the acquisition module 100 is used to obtain the surveillance video of the block collected by each camera; the recognition module 200 is used to identify the pedestrians appearing in the surveillance video of each camera; the extraction module 300 is used to extract the pedestrian feature vector in the surveillance video of each camera; the tracking module 400 is used to track the trajectory of the pedestrian in the surveillance video according to the pedestrian feature vector; the matching module 500 is used to generate a global tracking trajectory of the pedestrian based on the tracking trajectory of each camera, the location information of each camera and the pedestrian time consumption information between any two cameras.
[0111] In one embodiment of the present application, the tracking module 400 is further used to identify the pedestrian feature vector of the current frame of the surveillance video; when the current frame is the first frame, initialize the pedestrian trajectory table; when the current frame is not the first frame, update the pedestrian trajectory table according to the trajectory tracking result of the previous frame and the feature vector of the current frame; generate the trajectory of the pedestrian in the surveillance video according to the pedestrian trajectory table.
[0112] In one embodiment of the present application, the tracking module 400 is further used to identify each trajectory in the trajectory table; calculate the first distance matrix between the feature vector of the current frame and each trajectory; when the first distance matrix is greater than the distance threshold, generate a new trajectory in the trajectory table, and when the first distance matrix is less than or equal to the distance threshold, update the corresponding trajectory in the trajectory table.
[0113] In one embodiment of the present application, the tracking module 400 is further used to splice the feature vector of the last frame of each trajectory to the feature vector of the bounding box tracked by the last frame; identify the feature vector of the last frame of each trajectory and the feature vectors of all frames, and calculate the average feature vector and the feature vector after exponential smoothing based on the feature vectors of all frames of each trajectory; calculate the first cosine distance between the spliced pedestrian feature vector and the trajectory feature vector, calculate the second cosine distance between the feature vector of the current frame and the average feature vector, and calculate the third cosine distance between the feature vector of the current frame and the feature vector after exponential smoothing; generate a first distance matrix based on the first cosine distance, the second cosine distance and the third cosine distance.
[0114] In one embodiment of the present application, the matching module 500 is further used to calculate the theoretical time-consuming information matrix of each trajectory based on the tracking trajectory of each camera; calculate the actual time-consuming information matrix of each trajectory based on the sampling parameters of each camera; calculate the cosine distance between the average features of any two tracking trajectories, and generate a second distance matrix based on the cosine distance of the average features between any two tracking trajectories; calculate the third distance matrix based on the theoretical time-consuming information matrix, the actual time-consuming information matrix and the second distance matrix, and generate the global tracking trajectory of the pedestrian based on the position information of each camera, the pedestrian time-consuming information between any two cameras and the third distance matrix.
[0115] In one embodiment of the present application, the extraction module 300 is further used to identify pedestrian slice images in the surveillance video; the pedestrian slice images are input into the pedestrian re-identification model, and the pedestrian re-identification model outputs a human feature vector; the pedestrian slice images are input into the face detection model, and the face detection model outputs a face feature vector.
[0116] It should be noted that the aforementioned explanation of the embodiment of the cross-camera block pedestrian matching method based on spatiotemporal information is also applicable to the cross-camera block pedestrian matching device based on spatiotemporal information of this embodiment, and will not be repeated here.
[0117] According to the cross-camera street pedestrian matching device based on spatiotemporal information proposed in the embodiment of the present application, the problem of tracking cross-camera pedestrian trajectories can be effectively solved. The pedestrians and feature vectors appearing in the video are extracted through the target detection model and the pedestrian re-identification model, and the single-camera trajectory tracking is realized through the proposed single-camera trajectory tracking algorithm; the cross-camera matching of the single-camera trajectory is realized through the proposed cross-camera trajectory matching algorithm, so that more accurate cross-camera matching can be achieved when only the latitude and longitude information of the surveillance video and the camera is input. Compared with other cross-camera matching methods, it can better handle the matching problem of large-scale surveillance videos under non-overlapping perspectives, and has the advantages of fast calculation speed, low storage cost and strong generalizability.
[0118] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0119] A memory 601 , a processor 602 , and a computer program stored in the memory 601 and executable on the processor 602 .
[0120] When the processor 602 executes the program, the cross-camera block pedestrian matching method based on spatiotemporal information provided in the above embodiment is implemented.
[0121] Furthermore, the electronic device further comprises:
[0122] The communication interface 603 is used for communication between the memory 601 and the processor 602 .
[0123] The memory 601 is used to store computer programs that can be executed on the processor 602 .
[0124] The memory 601 may include a high-speed RAM (Random Access Memory) memory, and may also include a non-volatile memory, such as at least one disk memory.
[0125] If the memory 601, the processor 602 and the communication interface 603 are implemented independently, the communication interface 603, the memory 601 and the processor 602 can be connected to each other through a bus and communicate with each other. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0126] Optionally, in a specific implementation, if the memory 601, the processor 602 and the communication interface 603 are integrated on a chip, the memory 601, the processor 602 and the communication interface 603 can communicate with each other through an internal interface.
[0127] The processor 602 may be a CPU (Central Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
[0128] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned method for pedestrian matching across camera blocks based on spatiotemporal information.
[0129] An embodiment of the present application provides a computer program product, including a computer program or instructions. When the computer program is executed, it is used to implement the cross-camera block pedestrian matching method based on spatiotemporal information as in the above embodiment.
[0130] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0131] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0132] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0133] It should be understood that the various parts of the present application can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, the steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0134] A person of ordinary skill in the art may understand that all or part of the steps carried by the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the above-mentioned program may be stored in a computer-readable storage medium, which, when executed, includes one of the steps of the method embodiment or a combination thereof.
[0135] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A pedestrian matching method across camera blocks based on spatiotemporal information, characterized in that: The following steps are involved: Obtain surveillance video of each block collected by each camera; Identify pedestrians appearing in the surveillance video of each camera; Extracting pedestrian feature vectors from the surveillance video of each camera; Tracking the trajectory of the pedestrian in the surveillance video according to the pedestrian feature vector; A global tracking trajectory of the pedestrian is generated according to the tracking trajectory of each camera, the position information of each camera and the pedestrian time consumption information between any two cameras.
2. The method for matching pedestrians across camera blocks based on spatiotemporal information according to claim 1 is characterized in that: The step of tracking the trajectory of the pedestrian in the surveillance video according to the pedestrian feature vector includes: Identify a pedestrian feature vector of a current frame of the surveillance video; If the current frame is the first frame, initializing the trajectory table of the pedestrian; If the current frame is not the first frame, updating the pedestrian trajectory table according to the trajectory tracking result of the previous frame and the feature vector of the current frame; The trajectory of the pedestrian in the monitoring video is generated according to the trajectory table of the pedestrian.
3. The method for matching pedestrians across camera blocks based on spatiotemporal information according to claim 2 is characterized in that: The updating of the pedestrian trajectory table according to the trajectory tracking result of the previous frame and the feature vector of the current frame includes: Identifying each track in the track table; Calculate a first distance matrix between the feature vector of the current frame and each trajectory; If the first distance matrix is greater than a distance threshold, a new track is generated in the track table; if the first distance matrix is less than or equal to the distance threshold, the corresponding track in the track table is updated.
4. According to the method for matching pedestrians across camera blocks based on spatiotemporal information in claim 3, the step of calculating the first distance matrix between the feature vector of the current frame and each trajectory comprises: concatenating the feature vector of the last frame of each trajectory to the feature vector of the bounding box tracked in the last frame; Identify the feature vector of the last frame of each trajectory and the feature vectors of all frames, and calculate the average feature vector and the exponentially smoothed feature vector according to the feature vectors of all frames of each trajectory; Calculate the first cosine distance between the spliced pedestrian feature vector and the trajectory feature vector, calculate the second cosine distance between the feature vector of the current frame and the average feature vector, and calculate the third cosine distance between the feature vector of the current frame and the feature vector after exponential smoothing; The first distance matrix is generated according to the first cosine distance, the second cosine distance and the third cosine distance.
5. The method for matching pedestrians across camera blocks based on spatiotemporal information according to claim 1 is characterized in that: The generating of the global tracking trajectory of the pedestrian according to the tracking trajectory of each camera, the position information of each camera and the pedestrian time information between any two cameras comprises: Calculating a theoretical time-consuming information matrix of each trajectory according to the tracking trajectory of each camera; Calculate the real time-consuming information matrix of each trajectory according to the sampling parameters of each camera; Calculate the cosine distance between the average features of any two tracking trajectories, and generate a second distance matrix according to the cosine distance between the average features of any two tracking trajectories; A third distance matrix is calculated according to the theoretical time-consuming information matrix, the actual time-consuming information matrix and the second distance matrix, and a global tracking trajectory of pedestrians is generated according to the position information of each camera, the pedestrian time-consuming information between any two cameras and the third distance matrix.
6. The method for matching pedestrians across camera blocks based on spatiotemporal information according to claim 1 is characterized in that: The pedestrian feature vector includes a human body feature vector and a face feature vector, and the step of extracting the pedestrian feature vector from the surveillance video of each camera includes: Identify pedestrian slice images in the surveillance video; Inputting the pedestrian slice image into a pedestrian re-identification model, and the pedestrian re-identification model outputs the human body feature vector; The pedestrian slice image is input into a face detection model, and the face detection model outputs the face feature vector.
7. A pedestrian matching device across camera blocks based on spatiotemporal information, characterized in that: include: The acquisition module is used to obtain the surveillance video of each camera collecting the block; A recognition module, used to recognize pedestrians appearing in the surveillance video of each camera; An extraction module, used to extract pedestrian feature vectors in the surveillance video of each camera; A tracking module, used for tracking the trajectory of the pedestrian in the monitoring video according to the pedestrian feature vector; The matching module is used to generate a global tracking trajectory of the pedestrian according to the tracking trajectory of each camera, the position information of each camera and the pedestrian time information between any two cameras.
8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the cross-camera block pedestrian matching method based on spatiotemporal information as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed, the method for pedestrian matching across camera blocks based on spatiotemporal information as described in any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed, the method for pedestrian matching across camera blocks based on spatiotemporal information as described in any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Unmanned aerial vehicle monitoring method, system and equipment
CN119964039A
Cross-camera video multi-target cooperative tracking method and device
CN121213619A
A method and device for multi-target cooperative tracking across cameras
CN121213619B
Safety protection management method based on face recognition
CN121415352A
