A method and device for tracking specific pedestrians across borders

Through the pedestrian posture discrimination network and trajectory fusion strategy, the problem of low recognition efficiency and occlusion in cross-border specific pedestrian tracking is solved, the accuracy and efficiency of pedestrian tracking are improved, and the spatial positioning accuracy under multiple cameras is ensured.

CN114639117BActive Publication Date: 2024-09-06XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210244393.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-14
Publication Date
2024-09-06
Estimated Expiration
2042-03-14

AI Technical Summary

Technical Problem

Existing cross-border specific pedestrian tracking technology has low recognition efficiency in complex environments, unresolved pedestrian occlusion problems, and large spatial positioning errors during multi-camera tracking, making it difficult to achieve accurate tracking.

Method used

By using the pedestrian posture discrimination network, pedestrian skeleton information is extracted, and the lightweight pedestrian detection model YOLOv5 is designed. Combined with the trajectory fusion strategy, pedestrian re-identification and tracking are implemented, occlusion situations are handled, and pixel coordinates are converted to world coordinates.

Benefits of technology

It improves pedestrian re-identification accuracy and tracking efficiency, solves pedestrian occlusion problems, and ensures precise positioning of the same pedestrian target space under multiple cameras.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114639117B
    Figure CN114639117B
Patent Text Reader

Abstract

The present invention discloses a method and device for tracking specific pedestrians across borders. The method obtains multiple images of specific pedestrians, and determines the posture of the pedestrian by extracting the skeleton information of the pedestrian in the image so that the pedestrian re-identification model can locate the specific pedestrian; when the tracked object is determined in the video, the tracking model is enabled for tracking, and the threshold set in the tracking model is used to determine whether the object has left the camera or is blocked, thereby effectively and accurately tracking. After the object leaves all monitoring areas, a trajectory map of the target in the entire area is drawn based on the target pixel coordinates obtained in all videos. Cross-border specific pedestrian tracking is achieved, the accuracy of pedestrian re-identification is improved through the pedestrian posture discrimination network, the pedestrian walking direction and position are used to solve the problem of pedestrian occlusion, thereby improving the tracking accuracy and efficiency, and a trajectory fusion strategy is designed to achieve precise spatial positioning of the same pedestrian target under multiple cameras.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of smart communities based on artificial intelligence, and specifically relates to a method and device for tracking specific pedestrians across borders. Background Art

[0002] Cross-border specific pedestrian tracking technology is a hot topic in the field of computer vision research. It mainly solves the problem of continuous identification and tracking of pedestrian targets across cameras and scenes. This technology identifies pedestrians based on their appearance information such as clothing, body shape, hairstyle, etc. Pedestrian re-identification is widely used in smart security, smart search systems, large shopping malls and unmanned supermarkets. At present, this technology has achieved amazing accuracy in major data sets, including Market1501 and DukeMTMC. However, in actual application, due to the complexity of the actual situation and interference between people, the existing algorithms have not achieved good results.

[0003] Since the research on cross-border tracking in an open environment has important application value and commercial value, domestic and foreign scholars have conducted a lot of research on this. The existing technology mainly consists of pedestrian detection, pedestrian re-identification, and tracking technology, mainly including the following parts:

[0004] (1) Pedestrian Detection

[0005] The technology of pedestrian detection focuses on handling complex situations, and improving detection efficiency by reducing the impact of lighting, shadows, and moving objects. The motion detection method obtains a background model by learning the previous frames of the video, and compares the current frame with the background frame to obtain the moving target. This method can only detect moving targets and cannot process static targets. If multiple targets are stuck together, they cannot be processed. The deep learning-based method has made great progress in this technology. Mainstream frame detection frameworks such as SSD, FPN, YOLO, etc., especially YOLO5, have been widely used in tracking with their excellent detection capabilities and efficiency.

[0006] (2) Person Re-ID

[0007] After detecting pedestrians, how to extract and match features from images is an important research topic. Pedestrian re-identification has been studied in academia for many years, but it was not until the development of deep learning in recent years that great breakthroughs were made. For pedestrian feature extraction and matching, some people proposed to divide pedestrians into three parts: upper, middle and lower parts for feature extraction, and fuse the features of these three parts with the global features of pedestrians at the end of the network; some people proposed to extract the skeleton information of pedestrians, extract the features of each key point and fuse them; some people proposed to divide pedestrians into head, arms, torso and legs according to biology, and extract and fuse features separately. In the above studies, various visual features and matching strategies of pedestrians are fully considered, but complex structures will reduce recognition efficiency, and in practical applications, due to complex environmental changes and pedestrian mobility, the re-identification effect is seriously affected.

[0008] (3) Pedestrian tracking

[0009] Through pedestrian detection and pedestrian re-identification, the tracked target can be determined. How to stably and effectively track pedestrians is an important research topic. Target tracking generally consists of feature extraction, motion model, appearance model and online update mechanism. Filter-based methods and deep learning-based methods are currently the most effective tracking methods. The filter benefits from the fast calculation of the frequency domain. The speed of the MOOSE tracker has reached 615FPS. Its ultra-high operating speed makes it possible for embedded devices to track targets. Although the tracking algorithm based on deep learning does not have a high processing speed, its excellent feature extraction ability improves the tracking accuracy. However, there is little research on the problem of pedestrian occlusion, and this problem has not been solved.

[0010] Research on cross-camera specific pedestrian tracking technology in public areas has made great progress, but with the change of environment and the continuous deepening of research, some new challenges have emerged, as follows:

[0011] 1. Considering the efficiency of program operation, increasing the network depth and extracting complex features will affect the recognition efficiency. The first challenge is to design a more lightweight pedestrian re-identification model that takes into account both accuracy and efficiency.

[0012] 2. Considering cross-border pedestrian tracking, for example, pedestrians have different postures when they first enter the monitoring area, and when pedestrians wearing similar clothes appear, it is easy to misidentify them. The second challenge is to use pedestrian posture information to accurately match features.

[0013] 3. Considering the complex situations in practical applications, such as when the tracked target is blocked or leaves the monitoring area, the third challenge is to design a strategy to identify pedestrian blockage and continue tracking.

[0014] 4. Considering that in a multi-camera tracking scenario, there may be multiple cameras tracking the same target, there will be errors in the spatial positioning coordinates converted between different cameras. The fourth challenge is to design a new trajectory fusion strategy to ensure the accuracy of the world coordinates. Summary of the invention

[0015] In order to solve the defects or shortcomings of the above-mentioned prior art problems, the purpose of the present invention is to provide a method and device for tracking specific pedestrians across borders to improve the recognition accuracy and speed.

[0016] In order to achieve the above tasks, the present invention adopts the following technical solutions:

[0017] A method for tracking a specific pedestrian across borders, characterized in that it specifically comprises the following steps:

[0018] Step 1: Select multiple pedestrian images to be tracked from the video surveillance, select pedestrian images with different postures as templates for the person re-identification model, and use the pedestrian detection model to extract the pedestrians in each frame of the surveillance video, perform skeleton extraction operations, and use the preset network to determine the posture of each pedestrian for use by the pedestrian re-identification model;

[0019] Step 2: inputting a pedestrian re-identification model into a pedestrian posture and a template image corresponding to the same posture to obtain a feature vector, and locating the tracked pedestrian when the feature distance between the pedestrian image feature vector and the template feature vector meets a preset condition;

[0020] Step 3: Based on the located pedestrian, enable the tracking model to continuously track the pedestrian. When the target score changes dramatically, use the preset algorithm to determine whether the target is blocked or leaves the monitoring area. Different solutions are used according to the two different situations. During the tracking process, the center pixel coordinates of the tracked target in each frame are recorded.

[0021] Step 4: According to the obtained center pixel coordinates of the target in each frame and the pre-calibrated camera intrinsic and extrinsic parameters, the center pixel coordinates of the tracked target are converted into the world coordinates of the target, thereby drawing the target trajectory.

[0022] According to the present invention, in step 1, pedestrians in a video stream are detected based on images of different postures of specific pedestrians as templates and their postures are determined, and their postures are determined using the same method. Images with the same posture as the template are input into a pedestrian re-identification model to determine whether they belong to the object to be tracked; the posture of the pedestrian is determined by extracting the skeleton information of the pedestrian in the image, and the posture includes four different orientations of the pedestrian, specifically the front, left, right and back of the pedestrian; pedestrians in the video stream are detected by Yolov5 and the posture of each pedestrian is determined, and pedestrians with the same posture as the template are input into the pedestrian re-identification model, specifically including:

[0023] Input the extracted pedestrian image into the Alopose skeleton extraction model;

[0024] The skeleton information graph obtained by the skeleton extraction model of the pedestrian image is input into the network for judging the human posture to obtain the posture of the pedestrian;

[0025] After all the postures of pedestrians in the video stream are obtained, the postures of different pedestrians in the video stream and their corresponding template images are input into the pedestrian re-identification model for comparison.

[0026] Specifically, before using person re-identification for pedestrian matching, the pedestrian skeleton information is extracted, and the designed posture judgment network is used to make full use of the posture information to judge the pedestrian's orientation. The detected pedestrian and the template with the same orientation are input into the re-identification network. Through pedestrian re-identification, the template image feature vector and the query image feature vector are obtained, and the cosine similarity of the template image feature vector and the query image feature vector is calculated as:

[0027]

[0028] Where θ is the cosine similarity between the template image feature vector and the query image feature vector, X is the template image feature vector, Y is the query image feature vector, and T represents the transposition operation;

[0029] When the cosine similarity is less than a preset threshold, the pedestrian to be queried is determined as the target to be tracked.

[0030] Specifically, when the target is lost due to occlusion during tracking, a preset algorithm is used to determine whether the target is blocked or leaves the camera, including:

[0031] Whether the target has changed dramatically is determined by whether the score of the tracked object in each frame is less than half of the average score;

[0032] Determine the target moving direction based on the coordinates of the central pixel point of the tracking object in each frame;

[0033] According to the pixel coordinates of the target that have changed dramatically and the target's moving direction, it is judged that the target is blocked or leaves the monitoring area;

[0034] Furthermore, when the target is occluded, the tracking model is stopped from being updated, and the person re-identification model is used again, which includes:

[0035] Locate the obscured position of the target and set it as the current position of the target;

[0036] Perform pedestrian detection and determine the posture of the detected pedestrian for use by the pedestrian re-identification model;

[0037] When the cosine similarity between the template image feature vector and the query image feature vector is less than a preset threshold, the tracked target reappears;

[0038] Initialize the tracking target, give the bounding box of the tracked object in the video, and continue tracking.

[0039] When the target leaves the monitoring area, the tracking model is stopped, including:

[0040] The target moving direction is determined based on the coordinates of the central pixel point of the tracked object. If the pixel coordinates where the target changes dramatically are at the edge of the image, and the target moves from the other edge to this edge before the dramatic change, the target is determined to have moved out of the monitoring area.

[0041] Stop model tracking and end the algorithm;

[0042] After the object leaves all monitoring areas, the trajectory map of the target in all monitoring areas is drawn according to the target pixel coordinates obtained in each video, including:

[0043] The camera internal parameters are determined by Zhang Zhengyou calibration method, and the camera external parameters are determined by PnP method;

[0044] The pixel coordinates of the target are converted into spatial positioning coordinates through the internal and external parameters of the camera;

[0045] Through the trajectory fusion algorithm, the coordinate points are connected and their motion trajectories are drawn.

[0046] The device for implementing the above-mentioned cross-border specific pedestrian tracking method is characterized by comprising:

[0047] The template capture module is used to obtain pedestrian images from several monitoring perspectives as template images;

[0048] Pedestrian detection module, used to obtain pedestrians from videos;

[0049] The skeleton extraction module is used to extract the skeleton of pedestrians in the pedestrian detection module;

[0050] The pedestrian posture judgment module is used to judge the four directions of the pedestrian based on the pedestrian skeleton information, including the front, left, right and back of the pedestrian;

[0051] The pedestrian re-identification module is used to compare the pedestrian's posture with the feature vector of the template image belonging to the same posture to obtain the pedestrian re-identification result;

[0052] The tracking module is used to continuously track the target based on the pedestrian re-identification results and use a preset algorithm to determine whether the target is blocked or leaves the camera;

[0053] The trajectory drawing module is used to draw the trajectory of the target in the monitoring area according to the pixel coordinates of the target in each monitoring video obtained by the above process.

[0054] Also included is a monitoring device, a processor, a GPU, a memory, and a computer program in the memory and configured to be executed by the processor.

[0055] The method and device for cross-border specific pedestrian tracking of the present invention realize cross-border specific pedestrian tracking, improve the accuracy of pedestrian re-identification through a pedestrian posture recognition network, solve the problem of pedestrian occlusion by using the walking direction and position of pedestrians, thereby improving tracking accuracy and efficiency, and designing a trajectory fusion strategy to achieve precise spatial positioning of the same pedestrian target under multiple cameras. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 is a schematic diagram of the steps of cross-border pedestrian tracking of the present invention;

[0057] Figure 2 This is a schematic diagram of pedestrian key point extraction;

[0058] Figure 3 is the posture discrimination network diagram;

[0059] Figure 4 It is a pedestrian tracking flowchart;

[0060] Figure 5 It is a schematic diagram of trajectory fusion;

[0061] Figure 6 It is a schematic diagram of the structure of the memory in the device for tracking specific pedestrians across borders.

[0062] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. DETAILED DESCRIPTION

[0063] In order to enable the public to have a comprehensive understanding of the present invention, specific details are described in detail in the following selected embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details.

[0064] The specific design ideas of the cross-border specific pedestrian tracking method of the present invention are as follows:

[0065] First, pedestrian target images with different postures are given and used as template images for the pedestrian re-identification model. The pedestrian detection model is used to extract pedestrian targets in the surveillance video, perform skeleton extraction operations, and use the posture discrimination network to determine the posture of each pedestrian for pedestrian re-identification.

[0066] Then, according to the pedestrians identified by the re-identification network, they are continuously tracked. When the target changes dramatically, the preset algorithm is used to determine whether the target is blocked or leaves the monitoring area, and different solutions are adopted according to the two different situations. During the tracking process, the center pixel coordinates of the tracked target in each frame are recorded. According to the internal and external parameters of the camera and the obtained pixel coordinates, a pixel-to-space positioning coordinate transformation model is established to achieve real-time spatial positioning of the tracked target, thereby drawing the target trajectory.

[0067] like Figure 1 As shown, this embodiment provides a method for tracking a specific cross-border pedestrian, which specifically includes the following steps:

[0068] Step 1: Select multiple pedestrian images to be tracked from the video surveillance, select pedestrian images with different postures as templates for the person re-identification model, and use the pedestrian detection model to extract the pedestrians in each frame of the surveillance video, perform skeleton extraction operations, and use the preset network to determine the posture of each pedestrian for use by the pedestrian re-identification model;

[0069] Step 2: inputting a pedestrian re-identification model into a pedestrian posture and a template image corresponding to the same posture to obtain a feature vector, and locating the tracked pedestrian when the feature distance between the pedestrian image feature vector and the template feature vector meets a preset condition;

[0070] Step 3: Based on the located pedestrian, enable the tracking model to continuously track the pedestrian. When the target score changes dramatically, use the preset algorithm to determine whether the target is blocked or leaves the monitoring area. Different solutions are used according to the two different situations. During the tracking process, the center pixel coordinates of the tracked target in each frame are recorded.

[0071] Step 4: According to the obtained center pixel coordinates of the target in each frame and the pre-calibrated camera intrinsic and extrinsic parameters, the center pixel coordinates of the tracked target are converted into the world coordinates of the target, thereby drawing the target trajectory.

[0072] In this embodiment, in step 1, pedestrians in the video stream are detected based on images of different postures of specific pedestrians as templates and their postures are determined. The same method is used to determine their postures, and images with the same posture as the template are input into the pedestrian re-identification model to determine whether they belong to the object to be tracked; the posture of the pedestrian is determined by extracting the skeleton information of the pedestrian in the image, and the posture includes four different directions of the pedestrian, specifically the front, left, right and back of the pedestrian; pedestrians in the video stream are detected by Yolov5 and the posture of each pedestrian is determined, and pedestrians with the same posture as the template are input into the pedestrian re-identification model, specifically including:

[0073] Input the extracted pedestrian image into the Alopose skeleton extraction model;

[0074] The skeleton information graph obtained by the skeleton extraction model of the pedestrian image is input into the network for judging the human posture to obtain the posture of the pedestrian;

[0075] After all the postures of pedestrians in the video stream are obtained, the postures of different pedestrians in the video stream and their corresponding template images are input into the pedestrian re-identification model for comparison.

[0076] In this embodiment, the YOLOv5 pedestrian detection model is used to select pedestrians from the surveillance video. YOLOv5 has a lightweight model size of only 27MB and achieves fast detection of 140FPS on TelsaP100. At the same time, its accuracy is comparable to the YOLOv4 benchmark. Considering the program running efficiency and the real-time performance of pedestrian tracking, YOLOv5 is used for pedestrian detection.

[0077] Before using person re-identification for pedestrian matching, extract the pedestrian skeleton information, use the designed posture judgment network to make full use of the posture information, judge the pedestrian's orientation, input the detected pedestrian and its template with the same orientation into the re-identification network, and obtain the template image feature vector and the query image feature vector through pedestrian re-identification, and calculate the cosine similarity between the two:

[0078]

[0079] Wherein, θ is the cosine similarity between the template image feature vector and the query image feature vector, X is the template image feature vector, Y is the query image feature vector, and T represents the transposition operation.

[0080] When the cosine similarity is less than a preset threshold, the pedestrian to be queried is determined as the target to be tracked.

[0081] In this embodiment, many training methods are added in the process of training the pedestrian re-identification network, which does not cause overfitting or complexity of the network, thereby affecting the reasoning speed. Under the premise of extracting only the global features of the image, 95.4% and 91% of Rank 1 are obtained in the two major datasets of Market1501 and DukeMTMC respectively, which ensures both the re-identification speed and accuracy, including:

[0082] In the early stage of network training, a gradually increasing learning rate is used to initialize the network, gradually initializing it to a better search space;

[0083] Randomly select an area in the image, add noise, perform data augmentation, and reduce the overfitting degree of the model;

[0084] Use label smoothing to suppress the overfitting of the network;

[0085] The larger feature graph of the re-ID network can extract more fine-grained features, and the convolution step size of the last layer of the network is reduced from 2 to 1, improving the model performance;

[0086] Concatenate the triplet loss of the features passed through the global pooling layer, and concatenate the identity verification loss with the features obtained through the batch normalization layer;

[0087] Since the triplet loss only considers the relative distance, the loss size has nothing to do with the absolute distance of the positive sample pair. Therefore, the center loss is added to the network to improve the network clustering performance.

[0088] In the process of tracking the target, the target is predicted to be blocked or leave the monitoring area. When the target is blocked, the preset algorithm is used to process it to ensure accurate tracking of the target, including:

[0089] Determine the moving direction of the target based on the target center pixel coordinates recorded in each frame;

[0090] According to the moving direction of the target and the position where the target changes dramatically, it is judged that the target is blocked or leaves the monitoring area;

[0091] If the target is blocked, stop updating the tracking model, locate the position where the target is lost, re-enable the pedestrian re-identification model, and continue tracking after the target is recognized;

[0092] If the target leaves the monitoring area, the tracking ends.

[0093] In a multi-camera tracking scenario, the trajectories of multiple cameras tracking the same target are fused during the trajectory drawing process, including:

[0094] The distance between the target and the camera is predicted based on the target depth. The farther the distance, the greater the error of the converted target space positioning coordinates. The space positioning coordinates generated by different cameras need to be given corresponding weights based on the distance.

[0095] When target tracking is lost, if only a single camera tracks the target, only the coordinates tracked by the camera are retained. If no camera tracks the target, frames are skipped until the target appears again and the coordinates are converted again.

[0096] To perform coordinate fusion, it is necessary to ensure that the spatial positioning coordinates corresponding to the two targets are within a certain range. If the coordinate ranges are too far apart, fusion will not be performed, and the coordinates generated by the closest camera will be selected as the final spatial positioning coordinates.

[0097] The device for the above cross-border specific pedestrian tracking method includes:

[0098] The template capture module is used to obtain pedestrian images from several monitoring perspectives as template images;

[0099] Pedestrian detection module, used to detect pedestrians in surveillance videos;

[0100] The skeleton extraction module is used to extract the detected pedestrian skeleton information for use by the posture judgment module;

[0101] The posture judgment module is used to judge the posture of the pedestrian based on the extracted skeleton information, including the front, left, right and back of the pedestrian;

[0102] A pedestrian re-identification module, used to re-identify the pedestrian to be identified with the same posture according to the pedestrian posture, and obtain the pedestrian re-identification result;

[0103] The tracking module initializes the model based on the results of pedestrian re-identification and tracks specific pedestrians;

[0104] The trajectory drawing module fuses the trajectories according to the pixel coordinates of pedestrians in each surveillance video and draws the target's activity trajectory in the surveillance area.

[0105] The system also includes a monitoring device, a processor, a GPU, a memory, and a computer program stored in the memory and executed by the processor, wherein the computer program is executed by the processor to track specific pedestrians across borders. Figure 6 shown.

[0106] The following are the specific implementation steps given by the inventor:

[0107] 1) Pedestrian detection:

[0108] By loading the pedestrian detection model, pedestrian images are framed from surveillance videos for use by the pedestrian re-identification model.

[0109] 2) Person Re-identification:

[0110] a. Since the same pedestrian has different postures under different camera angles, when pedestrians with similar clothing appear, the accuracy of re-identification will be seriously affected. Therefore, a pedestrian posture estimation model is designed based on the extracted pedestrian key points. First, the local data set is annotated to divide pedestrians into four different postures, namely the front, left, right and back of the pedestrian; secondly, a convolutional neural network and loss function are designed for model training; finally, the model is tested on the test set.

[0111] b. Design a person re-identification network using a higher baseline, add a series of training techniques and use triplet loss and identity loss to train the network, achieving a test set accuracy of more than 95% using only global features.

[0112] 3) Pedestrian tracking:

[0113] a. Use the pedestrians located by the pedestrian re-identification model to initialize the model, so as to continuously track the target.

[0114] b. When the target changes dramatically, the target state is judged based on the target's temporal and spatial information. If the target is blocked, the model update is stopped and the tracked target is retrieved. If the target leaves the monitoring area, the algorithm is stopped.

[0115] 4) Spatial positioning:

[0116] During pedestrian tracking, the central pixel coordinates of the tracked target in each frame are recorded and converted into spatial positioning coordinates. During the conversion process, multiple cameras may track the same target, and there may be errors in the target spatial positioning coordinates obtained by conversion between different cameras. A new trajectory fusion strategy is used to ensure the accuracy of the target spatial positioning coordinates.

[0117] In this embodiment, more specific steps are described as follows:

[0118] Person Re-ID:

[0119] In the process of cross-border pedestrian tracking, the accuracy of re-identification directly affects the effectiveness of the tracking results. Therefore, pedestrians need to be pre-processed (pedestrian posture identification) before pedestrian re-identification. The main purpose of pedestrian posture identification is to reduce the difference in viewing angles of pedestrians under cameras at different angles, enhance the detectability of relevant information, minimize the differences between the same pedestrians, and increase the reliability of re-identification. Traditional re-identification methods mainly include pedestrian horizontal segmentation and semantic segmentation, which do not fully exploit pedestrian posture information. In addition, traditional re-identification models are difficult to apply in actual scenarios because they pursue recognition accuracy under public data sets, have complex model design and large parameters.

[0120] In this embodiment, the applicant's research team uses the following method to perform pedestrian re-identification.

[0121] (1) Posture discrimination model

[0122] Use open source keypoint estimation models such as Figure 2 As shown in the figure, download the pedestrian re-identification dataset and extract 18 key points of pedestrians, build a posture discrimination deep learning network, and initialize the network parameters.

[0123] The posture discrimination network as a whole is composed of three convolutional layers and two fully connected layers. The first convolutional layer has 64 feature maps, and the convolution kernel size of each feature map is 3×3 pixels, and the step size and padding are 1 pixel; the second convolutional layer has 128 feature maps, and the convolution kernel size of each feature map is 3×3 pixels, and the step size and padding are 1 pixel; the third convolutional layer has 256 feature maps, and the convolution kernel size of each feature map is 3×3 pixels, and the step size and padding are 1 pixel; and each convolutional layer has a BN layer and a maximum pooling layer. The activation functions used in the convolutional layer and the fully connected layer are both ReLU functions.

[0124] The network adopts a stochastic gradient descent method, and the network is trained multiple times to obtain a trained pedestrian posture discrimination network.

[0125] The steps of the gradient descent method are as follows:

[0126] In the first step, the parameters are initialized. The convolution layer is set to a normally distributed number with a mean of 0 and a variance of 1. The weights of the BN layer are all set to 1, and the deviations are all set to 0. The fully connected layer is set to a normally distributed number with a mean of 0 and a variance of 0.01. The learning rate is set to 0.001. The optimizer selects Adam, the weight decay is 0.00005, the learning rate decrease interval is 50, and the learning rate adjustment multiple is 0.1.

[0127] In the second step, 1519 training images are selected from the training set of the image-based person re-identification dataset for key point extraction, and the pedestrian postures are annotated and input into the posture discrimination network.

[0128] Step 3: Use the following loss function calculation formula to calculate the average loss value of all selected samples:

[0129]

[0130] Among them, p(x) represents the true distribution of the sample, and q(x) represents the distribution predicted by the model.

[0131] Step 3: Input the training images into the network, obtain the parameters after 100 iterations, and save the model.

[0132] (2) Re-ID Model

[0133] a. The standard baseline uses a step-down learning rate with an initial learning rate of 3.5e-4. A total of 120 epochs are trained, and the learning rate is decreased at the 40th and 70th epochs. Initializing the network with a large learning rate may cause the network to oscillate to a suboptimal space due to excessive initial gradients. The Warmup learning rate is to initialize the network with a gradually increasing learning rate, so that the network gradually initializes a better search space. The specific formula is as follows:

[0134]

[0135] b. Traditional classification tasks use cross entropy loss, while supervision labels use one-hot vectors. In order to ease the constraints of labels on the network, the following formula is used to smooth the labels:

[0136]

[0137] After label smoothing, the overfitting degree of the network can be effectively suppressed.

[0138] c. The last convolution layer of each module in the ResNet50 backbone network has a downsampling process, that is, the convolution step size of the last layer is 2. Normally, a 256×128 image is input, and the network will output an 8×4 feature map. Increasing the size of the feature map can generally improve network performance. A simple operation is to set the downsampling step size of the last convolution layer to 1, which will increase the output feature map size to 16×8 without changing any parameters. Larger feature maps can extract more fine-grained features, thus improving model performance.

[0139] d. Download the Market1501 public re-ID dataset and use the triplet loss and ID loss for joint training. The specific loss function formula is as follows:

[0140]

[0141] Among them, n represents the number of samples in each batch training, and the input image x i and its category label y i , after softmax classification, x i Identified as y i The predicted probability of the class is denoted by p.

[0142] L tri (i,j,k)=max(ρ+d ij -d ik ,0)

[0143] Among them, d ij It represents the Euclidean distance between the selected samples and the positive samples and negative samples respectively, and ρ is a hyperparameter.

[0144] Pedestrian Tracking:

[0145] The pedestrian tracking process is as follows Figure 4 As shown, when the tracking target is blocked, the model is incorrectly updated, resulting in an incorrect tracking result. This embodiment uses the temporal and spatial information of pedestrians and combines pedestrian re-identification to stop model updating and retrieve the tracked target when the target is blocked.

[0146] (1) Occlusion judgment

[0147] In this embodiment, a twin network is used to track the target, and the score (similarity) of the tracked target in each frame is recorded. 30% of the average score is set as a threshold. When the target score is lower than this threshold, it is considered that the target has changed drastically, and the target is judged to be occluded or leave the monitoring area based on the target's spatiotemporal information.

[0148] During the target tracking process, the center pixel coordinates of the pedestrian in the fifty frames before the target was lost and the center pixel coordinates when the target was lost were recorded.

[0149] The walking direction of the pedestrian is judged according to the pixel coordinates of the pedestrian. If the target changes drastically outside the 50 pixel points of the video edge, the target is considered to be blocked; if the target changes drastically within 50 pixel points of the video edge, and the target walking direction is from this edge to the other edge, the target is considered to be blocked; if the target changes drastically within 50 pixel points of the video edge, and the target walking direction is from the other edge to this edge, the target is lost, that is, it leaves the monitoring area.

[0150] (2) Pedestrian Relocation

[0151] When the target is determined to be occluded, the model update is stopped and the re-identification module is re-enabled to search for the target. At this time, the bounding box is placed at the position where the target is lost. When the target is determined to be lost, the algorithm is stopped and tracking is ended until the target appears again.

[0152] Pedestrian target spatial precise positioning:

[0153] The camera internal parameters are determined by Zhang Zhengyou calibration method, and the camera external parameters are determined by PnP method. The pixel coordinates of the target are converted into spatial positioning coordinates. The conversion formula is as follows:

[0154]

[0155] Design a trajectory fusion strategy to achieve precise spatial positioning of pedestrian targets. The specific steps are as follows:

[0156] The first step is to predict the distance between the target and the camera based on the obtained Zc (depth information) and give a corresponding weight (the corresponding weight when coordinates are fused is equivalent to the confidence level).

[0157] Step 2: If the video data is not tracked, no frame skipping is performed. All frames are retained. The pixel coordinates corresponding to each target are read each time → world coordinates. If they exist, coordinate fusion is performed based on the weight. If only the current camera is tracking, only the coordinates tracked by the camera are retained.

[0158] Step 3: During the fusion process, it is necessary to ensure that the world coordinates of the two targets are within a certain range. If the ranges are too far apart, fusion will not be performed.

[0159] A person of ordinary skill in the art can understand and implement all or part of the processes in the above-mentioned embodiment method, which can be completed by computer program instructions related to hardware, and the program can be stored in a computer-readable storage medium.

[0160] It should be pointed out that the embodiments listed above are preferred examples, and the present invention is not limited to these embodiments. Ordinary technicians in the field can add or replace technical features in the above technical scheme without departing from the above technical scheme, which should all fall within the protection scope of the present invention.

Claims

1. A method for tracking specific pedestrians across borders, characterized in that: The specific steps include: Step 1: Select multiple pedestrian images to be tracked from the video surveillance, select pedestrian images with different postures as templates for the pedestrian re-identification model, and use the pedestrian detection model to extract the pedestrians in each frame of the surveillance video, perform skeleton extraction operations, and use the preset network to determine the posture of each pedestrian for use by the pedestrian re-identification model; Step 2: inputting a pedestrian re-identification model into a pedestrian posture and a template image corresponding to the same posture to obtain a feature vector, and locating the tracked pedestrian when the feature distance between the pedestrian image feature vector and the template feature vector meets a preset condition; Step 3: Based on the located pedestrian, enable the tracking model to continuously track the pedestrian. When the target score changes dramatically, use the preset algorithm to determine whether the target is blocked or leaves the monitoring area. Different solutions are used according to the two different situations. During the tracking process, the center pixel coordinates of the tracked target in each frame are recorded. Step 4: According to the obtained center pixel coordinates of the target in each frame, the camera intrinsic parameters and extrinsic parameters calibrated in advance, the center pixel coordinates of the tracked target are converted into the world coordinates of the target, so as to draw the target trajectory; After locating the target in the video, use the tracking network to track it, including: Initialize the tracking target and give the bounding box coordinates of the tracked object in the video; Using a preset tracking algorithm, a similarity score of each pedestrian in the surveillance video as a tracking object is calculated, and the pedestrian with the highest score is determined as the tracking object; The tracking object of the current frame is predicted based on the tracking object area predicted in the previous frame of the video, and the pedestrian with the highest score is determined as the tracking object; When tracking a target, if the target is lost due to occlusion, a preset algorithm is used to determine whether the target is blocked or leaves the camera, including: Whether the target has changed dramatically is determined by whether the score of the tracked object in each frame is less than half of the average score; Determine the target moving direction based on the coordinates of the central pixel point of the tracking object in each frame; According to the pixel coordinates of the target that have changed dramatically and the target's moving direction, it is judged that the target is blocked or leaves the monitoring area; When the target is occluded, stop updating the tracking model and use the pedestrian re-identification model again, including: Locate the obscured position of the target and set it as the current position of the target; Perform pedestrian detection and determine the posture of the detected pedestrian for use by the pedestrian re-identification model; When the cosine similarity between the template image feature vector and the query image feature vector is less than a preset threshold, the tracked target reappears; Initialize the tracking target, give the bounding box of the tracked object in the video, and continue tracking; When the target leaves the monitoring area, the tracking model is stopped, including: The target moving direction is determined based on the coordinates of the central pixel point of the tracked object. If the pixel coordinates where the target changes dramatically are at the edge of the image, and the target moves from the other edge to this edge before the dramatic change, the target is determined to have moved out of the monitoring area. Stop model tracking and end the algorithm.

2. The method according to claim 1, characterized in that In step 1, pedestrians in the video stream are detected based on images of specific pedestrians in different postures as templates and their postures are determined. The same method is used to determine their postures, and images with the same posture as the template are input into the pedestrian re-identification model to determine whether they belong to the object to be tracked; the posture of the pedestrian is determined by extracting the skeleton information of the pedestrian in the image, and the posture includes four different directions of the pedestrian, specifically the front, left, right and back of the pedestrian; Yolov5 is used to detect pedestrians in the video stream and determine the posture of each pedestrian. Pedestrians with the same posture as the template are input into the pedestrian re-identification model, which includes: Input the extracted pedestrian image into the Alopose skeleton extraction model; The skeleton information graph obtained by the skeleton extraction model of the pedestrian image is input into the network for judging the human posture to obtain the posture of the pedestrian; After all the postures of pedestrians in the video stream are obtained, the postures of different pedestrians in the video stream and their corresponding template images are input into the pedestrian re-identification model for comparison.

3. The method according to claim 1, characterized in that: Before using pedestrian re-identification for pedestrian matching, the pedestrian skeleton information is extracted, and the designed posture judgment network is used to make full use of the posture information to judge the pedestrian's orientation. The detected pedestrian and the template with the same orientation are input into the re-identification network. Through pedestrian re-identification, the template image feature vector and the query image feature vector are obtained, and the cosine similarity of the template image feature vector and the query image feature vector is calculated as: ; in, θ is the cosine similarity between the template image feature vector and the query image feature vector, X is the template image feature vector, Y is the feature vector of the image to be queried, T Represents a transpose operation; When the cosine similarity is less than a preset threshold, the pedestrian to be queried is determined as the target to be tracked.

4. The method according to claim 1, characterized in that After the object leaves all monitoring areas, the trajectory map of the target in all monitoring areas is drawn according to the target pixel coordinates obtained in each video, including: The camera internal parameters are determined by Zhang Zhengyou calibration method, and the camera external parameters are determined by PnP method; The pixel coordinates of the target are converted into spatial positioning coordinates through the internal and external parameters of the camera; Through the trajectory fusion algorithm, the coordinate points are connected and their motion trajectories are drawn.

5. A device for implementing the cross-border specific pedestrian tracking method according to any one of claims 1 to 4, characterized in that: include: The template capture module is used to obtain pedestrian images under several monitoring angles as template images; Pedestrian detection module, used to obtain pedestrians from videos; The skeleton extraction module is used to extract the skeleton of the pedestrian obtained in the pedestrian detection module; The pedestrian posture judgment module is used to judge the four directions of the pedestrian based on the pedestrian skeleton information, including the front, left, right and back of the pedestrian; The pedestrian re-identification module is used to compare the pedestrian's posture with the feature vector of the template image belonging to the same posture to obtain the pedestrian re-identification result; The tracking module is used to continuously track the target based on the pedestrian re-identification results and use a preset algorithm to determine whether the target is blocked or leaves the camera; The trajectory drawing module is used to draw the trajectory of the target in the monitoring area according to the pixel coordinates of the target in each monitoring video obtained by the above module.

6. The device according to claim 5, characterized in that: Also included is a monitoring device, a processor, a GPU, a memory, and a computer program in the memory and configured to be executed by the processor.