A Pedestrian Tracking Method Based on Siamese Neural Network

Through the pedestrian tracking method based on the twin neural network, video input and the twin neural network are used to generate pedestrian trajectories, combined with appearance similarity and motion affinity, to solve the problem of pedestrian tracking accuracy in the existing technology and achieve high accuracy and stability. Pedestrian tracking effect.

CN111814604BActive Publication Date: 2024-08-27ZHEJIANG SCI-TECH UNIV
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202010584083.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-23
Publication Date
2024-08-27
Estimated Expiration
2040-06-23

AI Technical Summary

Technical Problem

Existing pedestrian tracking technology is difficult to achieve accurate tracking when faced with changes in pedestrian posture, lighting changes, noise and other factors, and traditional methods no longer meet modern needs.

Method used

The pedestrian tracking method based on Siamese neural network is used to generate short trajectories of pedestrians and merge them into long trajectories through video input, pedestrian detection, spatiotemporal group splitting, twin neural network training and correlation matrix solving, combined with appearance similarity and motion affinity. Fusion, using the sigmoid function to achieve information fusion and classification.

Benefits of technology

It improves the accuracy of pedestrian tracking, reduces the impact of factors such as illumination changes, posture changes, and noise, and ensures the accuracy and stability of pedestrian tracking, especially in occlusion situations to effectively avoid tracking failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111814604B
    Figure CN111814604B
Patent Text Reader

Abstract

The present invention belongs to the field of computer vision, and in particular to a pedestrian tracking method based on a twin neural network, which comprises the following steps: video input; pedestrian marking; obtaining a pedestrian spatiotemporal group; establishing and training a twin neural network, and saving the trained twin neural network; obtaining a pedestrian short trajectory; and obtaining a pedestrian long trajectory. The method is used to track pedestrians, which effectively improves the accuracy of pedestrian tracking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision, and in particular relates to a pedestrian tracking method based on a twin neural network. Background Art

[0002] With the development of artificial intelligence technology, computer vision has been widely used in human daily life such as smart home, video surveillance and intelligent transportation. Pedestrian tracking is one of the key issues in these fields. Since pedestrian targets may change in posture, size, appearance and pedestrian occlusion during movement, it is very difficult to accurately track pedestrians.

[0003] Early target tracking algorithms were mainly based on target modeling or tracking target features. The main methods are: (1) Feature matching method, first extract target features, and then find the most similar features in subsequent frames to locate the target; (2) Search-based method, people add prediction algorithms to tracking, search for targets near the predicted values, and reduce the search range. However, these methods no longer meet the current needs of pedestrian tracking, and some new methods are urgently needed to replace them; and traditional methods are greatly affected by factors such as image illumination changes, pedestrian posture changes, and image noise. With the rapid development of deep learning, it has also played an important role in the field of pedestrian tracking. Among them, the twin neural network is a model that can determine whether two input patterns are similar. It can be used in the field of pedestrian tracking to determine whether pedestrians have similar appearances. Therefore, it is necessary to improve the existing technology. Summary of the invention

[0004] The problem to be solved by the present invention is to provide a method for calculating the motion trajectory of pedestrians based on a twin neural network, which is used to track pedestrians and effectively improves the accuracy of pedestrian tracking.

[0005] To solve the above problems, the present invention provides a pedestrian tracking method based on a twin neural network, comprising the following steps:

[0006] Step 1. Video input:

[0007] The monitoring equipment (camera and other monitoring equipment) collects video files outdoors or indoors, and inputs the collected video files into a computer, including each frame of video images in the video sequence;

[0008] Step 2: Pedestrian marking:

[0009] For each frame of video image input in step 1, the DPM pedestrian detection technology is used to detect and mark the position of pedestrians on each frame of video image, thereby obtaining a video sequence with pedestrian position marks;

[0010] Step 3: Get the pedestrian spatiotemporal group:

[0011] The video sequence with pedestrian position marks in step 2 is split into n segments with a time length of 1 second, each segment is a video image i; for each video image i, a hierarchical clustering method is used to obtain the pedestrian spatiotemporal group Where n is a positive integer, i≤n, and j represents the temporal and spatial group number in the i-th video image;

[0012] Step 4: Establish and train the twin neural network, and save the trained twin neural network;

[0013] Step 5: Get the pedestrian short trajectory:

[0014] Step 5-1: For each spatiotemporal group in each video image i obtained in step 3 The pedestrians in the image are combined into pairs, and each combination consists of two images of size 128*64*3 containing pedestrians;

[0015] Step 5-2: Stack the two 128*64*3 images of pedestrians in each combination obtained in step 5-1 into a 128*64*6 format and input them into the twin neural network trained in step 4 to obtain the image of each spatiotemporal group. The appearance similarity P of each pair of pedestrians in AS ;

[0016] Step 5-3: Calculate pedestrian movement speed

[0017] For the pedestrian position p in the tth frame, find the detection p closest to p by calculating the distance in the adjacent frames k , k is the index of the frame, and each spatiotemporal group is calculated as follows Pedestrian movement speed v pedestrian :

[0018]

[0019] Step 5-4: Calculate motion affinity

[0020] Use the pedestrian movement speed obtained in step 5-2 to calculate the following formula for each spatiotemporal group The motion affinity P of each pair of pedestrians in MA :

[0021] P MA =max(1-β*e(P1,P2),0),

[0022] e(P1,P2)=min(e forward (P1,P2),e backward (P1,P2)),

[0023]

[0024]

[0025] Where P1 and P2 are two pedestrians, β is a parameter for adjustment, and e Xforward ,e Yforward ,e Xbackward and e Ybackward is the forward error and reverse error of pedestrian motion in the X and Y directions, e forward and e bac k ward are the forward error and reverse error of pedestrian motion, P 1x ,P 1y ,P 2x and P 2y are the X and Y coordinates of the two pedestrian positions, t1 and t2 are the frame indices of the two pedestrians, and v obtained in step 5-3 pedestrian Decomposed into the movement speed in the X direction and the Y direction, v 1x ,v 1y ,v 2x and v 2y are the movement speeds of the two pedestrians in the X and Y directions respectively;

[0026] Step 5-5: Establish pedestrian correlation matrix

[0027] Use the sigmoid function to transform each spatiotemporal group obtained in step 5-2 The appearance similarity P of each team of pedestrians AS And each spatiotemporal group obtained in step 5-4 The motion affinity P of each pair of pedestrians in MA The pedestrian correlation matrix PeC is fused as follows:

[0028] Among them, λ and μ are parameters for adjustment;

[0029] Steps 5-6: Solve the classification

[0030] Use the maximum correlation principle to calculate each spatiotemporal group obtained in step 5-5. The pedestrian correlation matrix PeC in the image is solved and classified, and each category obtained represents pedestrians with the same identity; there is a graph G = (V, E, W), where the vertex V represents each pedestrian detection, E represents the edge connected by pedestrian detection, and W represents the correlation between two pedestrians. The maximum correlation principle is as follows:

[0031]

[0032]

[0033]

[0034] Where v1, v2, v3 represent pedestrian detection in V, w represents the correlation between pedestrians, and x is 0 or 1;

[0035] Step 5-7: Obtain the short trajectory of the pedestrian

[0036] Merge the pedestrians in each category obtained in steps 5-6 to obtain the short trajectory of the pedestrian in each video image i;

[0037] Step 6: Obtain pedestrian long trajectory

[0038] Step 6-1: Select key pedestrians

[0039] In the sliding time window, the short trajectories of pedestrians in each video image i obtained in step 5-5 are processed. For all short trajectories in a sliding time window, the key pedestrians in the short trajectories in each video image i are selected by using the appearance similarity of pedestrians, and these key pedestrians are used to represent a short trajectory;

[0040] Step 6-2: Pairwise combination of key pedestrians between short trajectories

[0041] In a sliding time window, the key pedestrians of each short track in a certain video image i selected in step 6-1 are combined with the key pedestrians of each short track in other video images j in pairs, and each combination is two pictures of size 128*64*3 containing the key pedestrians;

[0042] Step 6-3: Calculate the similarity of short trajectories

[0043] Input two images of size 128*64*3 containing key pedestrians into the twin neural network trained in step 4, and the output result is the appearance similarity of the key pedestrians in the two short trajectories. , and then perform the calculation according to the following formula to output the similarity of the two short trajectories:

[0044]

[0045] in, Represents the appearance similarity of the key pedestrians in two short trajectories, and N represents the condition that K AS Set, n represents the number of elements in N;

[0046] Step 6-4: Calculate the velocity v of each short trajectory trac k et

[0047] The motion speed of each short trajectory is calculated as follows:

[0048]

[0049] P S represents the starting point of a short trajectory, P e represents the end point of a short trajectory, T S Indicates the starting frame of a short trajectory, T e represents the end frame of a short trajectory;

[0050] Step 6-5: Calculate the motion affinity Tr between short trajectories MA

[0051] T MA =max(1-β*e(Tr1,Tr2),0)

[0052] e(Tr1,Tr2)=e forward (Tr1,Tr2)+e backward (Tr1,Tr2)

[0053]

[0054]

[0055] Where P1 and P2 are two short trajectories, β is a parameter for adjustment, and e Xforward ,e Yforward ,e Xbackward and e Ybackward is the forward error and reverse error of the short track in the X and Y directions, e forward and e backward are the forward and reverse errors for short-trajectory motion, and is the coordinate of the end point of a short trajectory, and is the starting coordinate of another short trajectory, t1 and t2 are the frame index of the end coordinate of one short trajectory and the frame index of the starting coordinate of another short trajectory, and v obtained in S0604 is trac k et Decomposed into the movement speed in the X direction and the Y direction, v 1x ,v 1y ,v 2x and v 2y are the movement speeds of the two short trajectories in the X and Y directions respectively;

[0056] Step 6-6: Establish short trajectory correlation matrix

[0057] Use the sigmoid function to convert the similarity Tr of the short trajectory obtained in step 6-3 sand the motion affinity Tr of the short trajectory obtained in step 6-5 MA Fusion into short trajectory correlation matrix TrC:

[0058] Among them, λ and μ are parameters for adjustment;

[0059] Steps 6-7: Solve the classification

[0060] The short trajectory correlation matrix TrC obtained in step 6-6 is solved and classified using the maximum correlation principle. Each category obtained represents short trajectories with the same identity. The maximum correlation principle is as follows: Suppose there is a graph G = (V, E, W), where the vertex V represents each short trajectory, E represents the edge connecting the short trajectories, and W represents the correlation between two short trajectories:

[0061]

[0062]

[0063]

[0064] Where v1, v2, v3 represent short trajectories in V, w represents the correlation between short trajectories, and x is 0 or 1;

[0065] Steps 6-8: Merge growth tracks

[0066] The short trajectories of each category obtained by solving the classification in steps 6-7 are merged, so that the short trajectories of pedestrians with the same identity are merged into new trajectories; as the sliding time window goes on, the complete long trajectories of all pedestrians are finally obtained.

[0067] As an improvement of the pedestrian tracking method based on a twin neural network of the present invention: the establishment and training of the twin neural network in step 4 includes the following steps:

[0068] Step 4-1. Create a twin neural network

[0069] The twin neural network is built using the Pytorch framework. The structure is as follows: two 128*64*3 pedestrian pictures are stacked into 128*64*6 and used as the input of the twin neural network. After three convolution layers, the convolution kernel size of the first layer is 9*9*12, the convolution kernel size of the second layer is 5*5*16, and the convolution kernel size of the third layer is 5*5*24; each layer of convolution contains batch normalization, relu activation function, and 2*2 pooling; the output of the three-layer convolution is one-dimensionalized to obtain a 1*1152 vector, which is then passed through two fully connected layers of size 1*150 and 1*2. The final output result is the appearance similarity of the two pedestrian pictures;

[0070] Step 4-2: Train the twin neural network

[0071] Dataset setting: Download the CUHK02 pedestrian tracking dataset from the Internet. The dataset contains 1816 pedestrian identities. Each pedestrian is photographed from two camera angles, and each camera angle has two photos. The first 80% of pedestrians are taken as the training set, and the remaining pedestrians are taken as the test set.

[0072] Training process: The twin neural network established in step 4-1 is trained for two rounds. In the first round, the training data is the pictures of the pedestrians in the training set taken from the first camera angle. During the training process, the sample combination is randomly generated, and the ratio of positive samples to negative samples is controlled at about 1:1. The positive samples are two pedestrians with the same identity, and the negative samples are two pedestrians with different identities. In the second round, the pictures of the pedestrians in the training set taken from the second camera angle are used as training data, and the generation method of positive samples and negative samples is the same as the first round.

[0073] Training and testing: After the training is completed, the trained twin neural network is tested using the test set. The output of the twin neural network is the appearance similarity of the two pedestrians. When the appearance similarity of two pedestrians with the same identity is greater than or equal to 0.5, it is considered correct; conversely, when the appearance similarity of two pedestrians with different identities is less than or equal to 0.5, it is considered correct; the final test result has an accuracy rate of more than 98%, and the trained twin neural network is saved.

[0074] The present invention has the following technical advantages:

[0075] 1. The present invention uses a twin neural network to obtain the appearance similarity between pedestrians, which is less affected by factors such as image illumination changes, pedestrian posture changes, image noise, etc., and can still accurately track pedestrians when encountering these problems;

[0076] 2. The present invention realizes pedestrian tracking in a layered manner: first, pedestrian detection is used to generate a short trajectory, and then the short trajectory is used to generate a long trajectory. In both steps, the twin neural network is used to realize the generation of short and long trajectories;

[0077] 3. The present invention fuses pedestrian information based on the sigmoid function. This method fuses pedestrian (short trajectory) similarity and motion affinity based on the twin neural network into pedestrian relevance (short trajectory relevance);

[0078] 4. The present invention fully considers the appearance similarity and motion affinity of pedestrians when generating short trajectories of pedestrians, and fully considers the similarity and motion affinity of short trajectories when generating long trajectories of pedestrians. Comprehensive consideration of both aspects in each step can effectively avoid tracking failure caused by occlusion of pedestrians. In addition, each step is solved and classified according to the maximum correlation principle to ensure the correct tracking of pedestrians.

[0079] This invention is funded by the following funds: Natural Science Foundation of Zhejiang Province (LQ19F030014), Zhejiang Sci-Tech University Youth Innovation Project (2019Q035). BRIEF DESCRIPTION OF THE DRAWINGS

[0080] The specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings:

[0081] Figure 1 It is a schematic diagram of the algorithm flow of a pedestrian tracking method based on a twin neural network;

[0082] Figure 2 It is the pedestrian position image in the PETS2009-S2L1 dataset detected by the DPM detector in step 2 of Experiment 1;

[0083] Figure 3 It is the pedestrian position image in the Town Center dataset detected by the DPM detector in step 2 of Experiment 1;

[0084] Figure 4 This is a schematic diagram of the error between the trajectory of the pedestrian in the PETS2009-S2L1 dataset obtained in step 5 of Experiment 1 and the trajectory marked in the groundtruth file;

[0085] Figure 5 This is a schematic diagram of the error between the trajectory of pedestrians in the Town Center dataset obtained in step 5 of Experiment 1 and the trajectory marked in the groundtruth file;

[0086] Figure 6 This is the experimental effect diagram of the pedestrian trajectory of the PETS2009-S2L1 dataset obtained in step 5 of Experiment 1;

[0087] Figure 7 This is the experimental effect diagram of the pedestrian trajectory of the Town Center dataset obtained in step 5 of Experiment 1. DETAILED DESCRIPTION

[0088] The present invention is further described below in conjunction with specific embodiments, but the protection scope of the present invention is not limited thereto.

[0089] Embodiment 1: A pedestrian tracking method based on a twin neural network, such as Figure 1 , including the following steps:

[0090] S01, Video Input

[0091] Input the video file containing the object to be tracked into the computer. The video file includes each frame of video image. The video file is collected by a camera or other monitoring equipment outdoors or indoors.

[0092] S02, Pedestrian marking:

[0093] For each frame of video image input by S01, the DPM pedestrian detection technology is used to detect and mark the position of pedestrians on each frame of video image, and a video sequence with pedestrian position marks is obtained;

[0094] The DPM pedestrian detection technology is a conventional technology. For example, reference may be made to the DPM pedestrian detection algorithm published by Felzenszwalb et al. in IEEE Transactions on Pattern Analysis & Machine Intelligence, 2010.

[0095] S03. Obtain pedestrian spatiotemporal group:

[0096] The video sequence with pedestrian position marks in S02 is split into n segments with a time length of 1 second, each segment is a video image i;

[0097] For each video image i, a hierarchical clustering method is used to obtain several pedestrian spatiotemporal groups according to the pedestrian position. Where n is a positive integer, i≤n, and j represents the temporal and spatial group number in the i-th video image;

[0098] S04. Create and train a twin neural network

[0099] S0401. Create a twin neural network:

[0100] The twin neural network is built using the Pytorch framework. The structure is as follows: two 128*64*3 pedestrian pictures are stacked into 128*64*6 and used as the input of the twin neural network. After three convolution layers, the convolution kernel size of the first layer is 9*9*12, the convolution kernel size of the second layer is 5*5*16, and the convolution kernel size of the third layer is 5*5*24. Each convolution layer contains batch normalization, relu activation function, and 2*2 pooling; the output of the three-layer convolution is one-dimensionalized to obtain a 1*1152 vector, which is then passed through two fully connected layers of size 1*150 and 1*2. The final output result is the appearance similarity of the two pedestrian pictures;

[0101] S0402. Training twin neural networks

[0102] Dataset setting: Download the CUHK02 pedestrian tracking dataset from the Internet. The dataset contains 1816 pedestrian identities. Each pedestrian is photographed from two camera angles, and each camera angle has two photos. The first 80% of pedestrians are taken as the training set, and the remaining pedestrians are taken as the test set.

[0103] Training process: The twin neural network established by S0401 is trained for two rounds. In the first round, the training data is the pictures of the pedestrians in the training set taken from the first camera angle. During the training process, the sample combination is randomly generated, and the ratio of positive samples to negative samples is controlled at about 1:1. The positive samples are two pedestrians with the same identity, and the negative samples are two pedestrians with different identities. In the second round, the pictures of the pedestrians in the training set taken from the second camera angle are used as training data, and the generation method of positive and negative samples is the same as the first round.

[0104] Training and testing: After training, the trained twin neural network is tested using the test set. The output of the twin neural network is the appearance similarity of two pedestrians. When the appearance similarity of two pedestrians with the same identity is greater than or equal to 0.5, it is considered correct; conversely, when the appearance similarity of two pedestrians with different identities is less than or equal to 0.5, it is considered correct. The accuracy of the final test result reaches more than 98%, and the trained twin neural network is saved;

[0105] S05. Obtaining pedestrian short trajectory

[0106] For each video image i obtained in S03 and the pedestrian spatiotemporal group Perform the following processing:

[0107] S0501, each space-time group The pedestrians in the image are combined into pairs, and each combination consists of two images of size 128*64*3 containing pedestrians;

[0108] S0502: stack the two 128*64*3 images of pedestrians in each combination obtained in S0501 into a 128*64*6 format and input them into the twin neural network trained in S0402 to obtain the image of each spatiotemporal group. The appearance similarity P of each pair of pedestrians in AS ;

[0109] S0503. Calculate pedestrian movement speed:

[0110] The pedestrian position in the tth frame is p. In the adjacent frames, the distance is calculated to find several detections p that are closest to p. k (k is the index of the frame), each spatiotemporal group Pedestrian movement speed v pedestrian Calculate as follows:

[0111]

[0112] S0504, Calculate sports affinity

[0113] The pedestrian movement speed v obtained using S0502 pedestrian Calculate each space-time group according to the following formula The motion affinity P of each pair of pedestrians in MA :

[0114] P MA =max(1-β*e(P1,P2),0),

[0115] e(P1,P2)=min(e forward (P1,P2),e backward (P1,P2)),

[0116]

[0117]

[0118] Where P1 and P2 are two pedestrians, β is an adjustable parameter, and e Xforward ,e Yforward ,e Xbackward and e Ybackward is the forward error and reverse error of pedestrian motion in the X and Y directions, e forward and e backward are the forward error and reverse error of pedestrian motion, P 1x ,P 1y ,P 2x and P 2y are the X and Y coordinates of the two pedestrian positions, t1 and t2 are the frame indexes of the two pedestrians, and v obtained in S0503 pedestrian It can be decomposed into the movement speed in the X direction and the Y direction, v 1x ,v 1y ,v 2x and v 2y are the movement speeds of the two pedestrians in the X and Y directions respectively;

[0119] S0505. Establish pedestrian correlation matrix

[0120] Use the sigmoid function to transform each spatiotemporal group obtained by S0502 The appearance similarity P of each team of pedestrians AS Each spatiotemporal group obtained by S0504 The motion affinity P of each pair of pedestrians in MA The pedestrian correlation matrix PeC is fused as follows:

[0121] Among them, λ and μ are adjustable parameters;

[0122] S0506, Solve Classification

[0123] Each spatiotemporal group obtained by S0505 was analyzed using the maximum correlation principle. The pedestrian correlation matrix PeC in the image is solved and classified, and each class obtained represents pedestrians with the same identity; there is a graph G = (V, E, W), where the vertex V represents each pedestrian detection, E represents the edge connected by pedestrian detection, and W represents the correlation between two pedestrians. The maximum correlation principle is as follows:

[0124]

[0125]

[0126]

[0127] Where v1, v2, v3 represent pedestrian detection in V, w represents the correlation between pedestrians, and x is 0 or 1;

[0128] S0507, obtain short trajectory

[0129] The pedestrians in each category obtained in S0506 are merged, that is, the short trajectory of the pedestrian is obtained in each video image i;

[0130] S06. Obtaining the long trajectory of pedestrians

[0131] In the sliding time window, the short trajectory of the pedestrian in each video image i obtained in S0507 is processed:

[0132] S0601. Select key pedestrians

[0133] For all short trajectories in a sliding time window, the key pedestrians in the short trajectory in each image video i are selected by using the pedestrian appearance similarity, and these key pedestrians are used to represent a short trajectory;

[0134] S0602, Pairwise Combination of Key Pedestrians Between Short Trajectories

[0135] In a sliding time window, the key pedestrians of each short track in a certain video image i selected in S0601 are combined with the key pedestrians of each short track in other video images j in pairs, and each combination is two pictures of size 128*64*3 containing the key pedestrians;

[0136] S0603. Calculate the similarity of short trajectories

[0137] The two images of size 128*64*3 containing key pedestrians are input into the twin neural network trained by S0402 in the same way as S0502, and the output result is the appearance similarity of the key pedestrians in the two short trajectories. Further calculation is performed according to the following formula to output the similarity Tr of the two short trajectories s :

[0138]

[0139] in, Represents the appearance similarity of the key pedestrians in two short trajectories, and N represents the condition that K AS Set, n represents the number of elements in N;

[0140] S0604. Calculate the movement speed v of the short trajectory tracklet

[0141] The motion speed of each short trajectory is calculated as follows:

[0142]

[0143] P S represents the starting point of a short trajectory, P e represents the end point of a short trajectory, T S Indicates the starting frame of a short trajectory, T e represents the end frame of a short trajectory;

[0144] S0605. Calculate short trajectory motion affinity Tr MA

[0145] The movement affinity Tr between short trajectories was calculated using the movement velocity of the short trajectories obtained by S0604 according to the following formula: MA

[0146] T MA =max(1-β*e(Tr1,Tr2),0)

[0147] e(Tr1,Tr2)=e forward (Tr1,Tr2)+e backward (Tr1,Tr2)

[0148]

[0149]

[0150] Where P1 and P2 are two short trajectories, β is an adjustable parameter, and e Xforward ,e Yforward ,e Xbackward and eYbackward is the forward error and reverse error of the short track in the X and Y directions, e forward and e backward are the forward and reverse errors for short-trajectory motion, and is the coordinate of the end point of a short trajectory, and is the starting coordinate of another short trajectory, t1 and t2 are the frame index of the end coordinate of one short trajectory and the frame index of the starting coordinate of another short trajectory, and v obtained in S0604 is tracklet It can be decomposed into the movement speed in the X direction and the Y direction, v 1x ,v 1y ,v 2x and v 2y are the movement speeds of the two short trajectories in the X and Y directions respectively;

[0151] S0606. Establish short trajectory correlation matrix

[0152] The sigmoid function is used to convert the similarity Tr of the short trajectory obtained by S0603 s The motor affinity of the short trajectory obtained by S0605 Tr MA Fusion into short trajectory correlation matrix TrC:

[0153]

[0154] Among them, λ and μ are adjustable parameters;

[0155] S0607, Solve Classification

[0156] The short trajectory correlation matrix TrC obtained by S0606 is solved and classified using the maximum correlation principle. Each category obtained represents the short trajectory of the same pedestrian. There is a graph G = (V, E, W), where the vertex V represents each short trajectory, E represents the edge connecting the short trajectories, and W represents the correlation between two short trajectories. The maximum correlation principle is as follows:

[0157]

[0158]

[0159]

[0160] Where v1, v2, v3 represent short trajectories in V, w represents the correlation between short trajectories, and x is 0 or 1;

[0161] S0608, Merger Growth Trajectory

[0162] The short trajectories of each category obtained by solving the classification in S0607 are merged, that is, the short trajectories of pedestrians with the same identity are merged into new trajectories; as the sliding time window goes on, the complete long trajectories of all pedestrians are finally obtained.

[0163] Experiment 1: Use the pedestrian tracking method based on twin neural network established in Example 1 to perform online tracking:

[0164] Step 1. Video input

[0165] Select the video dataset file of the object to be tracked and input it into the computer, including each frame of the video sequence and the groundtruth file. The groundtruth file contains the manually annotated pedestrian trajectories.

[0166] Step 2: Pedestrian marking:

[0167] For each frame of video image input in step 1, the DPM pedestrian detector is used to detect and mark the position of pedestrians on each frame of video image, such as Figure 2 and Figure 3 , obtained the video sequences with pedestrian position marks in the PETS2009-S2L1 dataset and the Town Center dataset;

[0168] Step 3: Get the pedestrian spatiotemporal group:

[0169] The video sequence with pedestrian position marks in step 2 is split into n segments with a time length of 1 second, each segment is a video image i; for each video image i, a hierarchical clustering method is used to obtain several pedestrian spatiotemporal groups according to the pedestrian position. Where n is a positive integer, i≤n, and j represents the temporal and spatial group number in the i-th video image;

[0170] Step 4: Obtain pedestrian short trajectory

[0171] Step 4-1: For each spatiotemporal group in each video image i obtained in step 3 The pedestrians in each space-time group are combined into two groups, each group consists of two 128*64*3 images containing pedestrians. The two 128*64*3 pedestrian images in each group are stacked into a 128*64*6 form and input into the twin neural network trained in Example 1 to obtain each spatiotemporal group. The appearance similarity P of each pair of pedestrians in AS ;

[0172] Step 4-2: Calculate pedestrian movement speed:

[0173] For the pedestrian position p in the tth frame, find several detections p closest to p by calculating the distance in the adjacent framesk (k is the index of the frame), the pedestrian movement speed v in each spatiotemporal group is calculated as follows pedestrian :

[0174]

[0175] Step 4-3. Calculate the motion affinity

[0176] Use the pedestrian movement speed obtained in step 4-2 to calculate the following formula for each spatiotemporal group The motion affinity P of each pair of pedestrians in MA :

[0177] P MA =max(1-β*e(P1,P2),0)

[0178] e(P1,P2)=min(e forward (P1,P2),e backward (P1,P2)

[0179]

[0180]

[0181] Step 4-4: Establish pedestrian correlation matrix

[0182] Use the sigmoid function to transform each spatiotemporal group obtained in step 4-1 The appearance similarity P of each team of pedestrians AS And each spatiotemporal group obtained in step 4-3 The motion affinity P of each pair of pedestrians in MA The pedestrian correlation matrix PeC is fused as follows:

[0183]

[0184] Step 4-5: Solve the classification

[0185] Use the maximum correlation principle to calculate each spatiotemporal group obtained in step 4-4. The pedestrian correlation matrix PeC in the image is solved and classified, and each category obtained represents pedestrians with the same identity; there is a graph G = (V, E, W), where the vertex V represents each pedestrian detection, E represents the edge connected by pedestrian detection, and W represents the correlation between two pedestrians. The maximum correlation principle is as follows:

[0186]

[0187]

[0188]

[0189] Step 4-6: Obtain the short trajectory of the pedestrian

[0190] Pedestrians in each category are merged, and the short trajectory of pedestrians is obtained in each video image i;

[0191] Step 5: Obtain pedestrian long trajectory

[0192] Step 5-1: Select key pedestrians

[0193] For all short trajectories in a sliding time window, the key pedestrians in the short trajectory in each image video i are selected by using the pedestrian appearance similarity, and these pedestrians are used to represent a short trajectory;

[0194] Step 5-2: Key pedestrians in short trajectories are combined in pairs

[0195] In a sliding time window, the key pedestrians of each short track in a certain video image i selected in step 5-1 are combined with the key pedestrians of each short track in other video images j in pairs, and each combination is two pictures of size 128*64*3 containing the key pedestrians;

[0196] Step 5-3: Calculate the similarity of short trajectories

[0197] Two images of size 128*64*3 containing key pedestrians are input into the trained twin neural network in Example 1. The output result of the trained twin neural network is the appearance similarity of the key pedestrians in the two short trajectories. Then the similarity Tr of the two short trajectories is further calculated as follows: s :

[0198]

[0199] Step 5-4: Calculate the velocity v of each short trajectory trac k et

[0200] The motion speed of each short trajectory is calculated as follows:

[0201]

[0202] Step 5-5: Calculate the motion affinity Tr between short trajectories MA

[0203] The movement affinity Tr between short trajectories is calculated using the movement speed of the short trajectories obtained in step 5-4 according to the following formula: MA

[0204] T MA=max(1-β*e(Tr1,Tr2),0)

[0205] e(Tr1,Tr2)=e forward (Tr1,Tr2)+e backward (Tr1,Tr2)

[0206]

[0207]

[0208] Step 5-6: Establish short trajectory correlation matrix

[0209] Use the sigmoid function to convert the similarity Tr of the short trajectory obtained in step 5-3 s and the motion affinity Tr of the short trajectory obtained in step 5-5 MA Fusion into short trajectory correlation matrix TrC:

[0210]

[0211] Steps 5-7: Solve the classification

[0212] The short trajectory correlation matrix TrC obtained in step 5-6 is solved and classified using the maximum correlation principle. Each category obtained represents short trajectories with the same identity. The maximum correlation principle is as follows: Suppose there is a graph G = (V, E, W), where the vertex V represents each short trajectory, E represents the edge connecting the short trajectories, and W represents the correlation between two short trajectories:

[0213]

[0214]

[0215]

[0216] Step 5-8: Merge the short trajectories in each category obtained by solving the classification in step 5-7, that is, merge the short trajectories of pedestrians with the same identity into a new trajectory; Figure 6 and Figure 7 ,As the sliding time window goes on, the complete long trajectories of all pedestrians will eventually be obtained.

[0217] The complete long trajectory of the pedestrian obtained in Experiment 1 is compared with the pedestrian trajectory manually annotated in the groundtruth file to obtain the final experimental error and experimental effect, as shown in Figure 4 and Figure 5, indicating that the algorithm can accurately and quickly mark the movement trajectory of pedestrians and highly overlap with the actual trajectory. The pedestrian tracking accuracy of the PETS2009-S2L1 dataset reached 93.23%, and the pedestrian tracking accuracy of the Town Center dataset reached 78.85%. Similarly, the present invention uses the steps of Experiment 1 above to verify batch data, and the results are equally effective. Therefore, the steps of Experiment 1 also verify that the same steps are also applicable to other online tracking.

[0218] Finally, it should be noted that the above examples are only some specific embodiments of the present invention. Obviously, the present invention is not limited to the above embodiments, and there are many variations. All variations that can be directly derived or associated with the content disclosed by a person skilled in the art should be considered as the protection scope of the present invention.

Claims

1. A pedestrian tracking method based on a twin neural network, characterized in that The following steps are involved: Step 1. Video input: The monitoring equipment collects video files outdoors or indoors, and inputs the collected video files into a computer, including each frame of video images in the video sequence; Step 2: Pedestrian marking: For each frame of video image input in step 1, the DPM pedestrian detection technology is used to detect and mark the position of pedestrians on each frame of video image, thereby obtaining a video sequence with pedestrian position marks; Step 3: Get the pedestrian spatiotemporal group: The video sequence with pedestrian position marks in step 2 is split into n segments with a time length of 1 second, each segment is a video image i; for each video image i, a hierarchical clustering method is used to obtain the pedestrian spatiotemporal group Where n is a positive integer, i<=n, and j represents the temporal and spatial group number in the i-th video image; Step 4: Establish and train the twin neural network, and save the trained twin neural network; Step 5: Obtain the pedestrian short trajectory, including the following steps: Step 5-1: For each spatiotemporal group in each video image i obtained in step 3 The pedestrians in the image are combined into pairs, and each combination consists of two images of size 128*64*3 containing pedestrians; Step 5-2: Stack the two 128*64*3 images of pedestrians in each combination obtained in step 5-1 into a 128*64*6 format and input them into the twin neural network trained in step 4 to obtain the image of each spatiotemporal group. The appearance similarity P of each pair of pedestrians in AS ; Step 5-3: Calculate pedestrian movement speed For the pedestrian position p in the tth frame, find the detection p closest to p by calculating the distance in the adjacent frames k , k is the index of the frame, and each spatiotemporal group is calculated as follows Pedestrian movement speed v pedestrian : Step 5-4: Calculate motion affinity Use the pedestrian movement speed obtained in step 5-3 to calculate the following formula for each spatiotemporal group The motion affinity P of each pair of pedestrians in MA : P MA =max(1-b*e(P1,P2),0), e(P1,P2)=min(e forward (P1,P2),e backward (P1,P2)), Where P1 and P2 are two pedestrians, β is a parameter for adjustment, and e Xforward ,e Yforward ,e Xbackward and e Ybackward is the forward error and reverse error of pedestrian motion in the X and Y directions, e forward and e backward are the forward error and reverse error of pedestrian motion, P 1x ,P 1y ,P 2x and P 2y are the X and Y coordinates of the two pedestrian positions, t1 and t2 are the frame indices of the two pedestrians, and v obtained in step 5-3 pedestrian Decomposed into the movement speed in the X direction and the Y direction, v 1x ,v 1y ,v 2x and v 2y are the movement speeds of the two pedestrians in the X and Y directions respectively; Step 5-5: Establish pedestrian correlation matrix Use the sigmoid function to transform each spatiotemporal group obtained in step 5-2 The appearance similarity P of each team of pedestrians AS And each spatiotemporal group obtained in step 5-4 The motion affinity P of each pair of pedestrians in MA The pedestrian correlation matrix PeC is fused as follows: Among them, λ and μ are parameters for adjustment; Steps 5-6: Solve the classification Use the maximum correlation principle to calculate each spatiotemporal group obtained in step 5-5. The pedestrian correlation matrix PeC in the image is solved and classified, and each category obtained represents pedestrians with the same identity; there is a graph G = (V, E, W), where the vertex V represents each pedestrian detection, E represents the edge connected by pedestrian detection, and W represents the correlation between two pedestrians. The maximum correlation principle is as follows: Where v1, v2, v3 represent pedestrian detection in V, w represents the correlation between pedestrians, and x is 0 or 1; Step 5-7: Obtain the short trajectory of the pedestrian Merge the pedestrians in each category obtained in steps 5-6 to obtain the short trajectory of the pedestrian in each video image i; Step 6: Obtain the pedestrian's long trajectory, including the following steps: Step 6-1: Select key pedestrians In the sliding time window, the short trajectories of pedestrians in each video image i obtained in steps 5-7 are processed. For all short trajectories in a sliding time window, the key pedestrians in the short trajectories in each video image i are selected by using the appearance similarity of pedestrians, and the key pedestrians are used to represent a short trajectory; Step 6-2: Pairwise combination of key pedestrians between short trajectories In a sliding time window, the key pedestrians of each short track in a certain video image i selected in step 6-1 are combined with the key pedestrians of each short track in other video images j in pairs, and each combination is two pictures of size 128*64*3 containing the key pedestrians; Step 6-3: Calculate the similarity of short trajectories Input two images of size 128*64*3 containing key pedestrians into the twin neural network trained in step 4, and the output result is the appearance similarity of the key pedestrians in the two short trajectories. Then perform the calculation according to the following formula to output the similarity of the two short trajectories: in, Represents the appearance similarity of the key pedestrians in two short trajectories, and N represents the condition that K AS Set, n represents the number of elements in N; Step 6-4: Calculate the velocity v of each short trajectory tracklet The motion speed of each short trajectory is calculated as follows: P S represents the starting point of a short trajectory, P e represents the end point of a short trajectory, T S Indicates the starting frame of a short trajectory, T e represents the end frame of a short trajectory; Step 6-5: Calculate the motion affinity Tr between short trajectories MA Tr MA =max(1-b*e(Tr1,Tr2),0) e(Tr1,Tr2)=e forward (Tr1,Tr2)+e backward (Tr1,Tr2) Where P1 and P2 are two short trajectories, β is a parameter for adjustment, and e Xforward ,e Yforward ,e Xbackward and e Ybackward is the forward error and reverse error of the short track in the X and Y directions, e forward and e backward are the forward and reverse errors for short-trajectory motion, and is the coordinate of the end point of a short trajectory, and is the starting coordinate of another short trajectory, t1 and t2 are the frame index of the end coordinate of one short trajectory and the frame index of the starting coordinate of another short trajectory, and v obtained in S0604 is tracklet Decomposed into the movement speed in the X direction and the Y direction, v 1x ,v 1y ,v 2x and v 2y are the movement speeds of the two short trajectories in the X and Y directions respectively; Step 6-6: Establish short trajectory correlation matrix Use the sigmoid function to convert the similarity Tr of the short trajectory obtained in step 6-3 s and the motion affinity Tr of the short trajectory obtained in step 6-5 MA Fusion into short trajectory correlation matrix TrC: Among them, λ and μ are parameters for adjustment; Steps 6-7: Solve the classification The short trajectory correlation matrix TrC obtained in step 6-6 is solved and classified using the maximum correlation principle. Each category obtained represents short trajectories with the same identity. The maximum correlation principle is as follows: Suppose there is a graph G = (V, E, W), where the vertex V represents each short trajectory, E represents the edge connecting the short trajectories, and W represents the correlation between two short trajectories: Where v1, v2, v3 represent short trajectories in V, w represents the correlation between short trajectories, and x is 0 or 1; Steps 6-8: Merge growth tracks The short trajectories of each category obtained by solving the classification in steps 6-7 are merged, so that the short trajectories of pedestrians with the same identity are merged into new trajectories; as the sliding time window goes on, the complete long trajectories of all pedestrians are finally obtained.

2. The pedestrian tracking method based on a twin neural network according to claim 1 is further characterized by: Step 4 of establishing and training the twin neural network includes the following steps: Step 4-1. Create a twin neural network The twin neural network is built using the Pytorch framework. The structure is as follows: two 128*64*3 pedestrian pictures are stacked into 128*64*6 and used as the input of the twin neural network. After three convolution layers, the convolution kernel size of the first layer is 9*9*12, the convolution kernel size of the second layer is 5*5*16, and the convolution kernel size of the third layer is 5*5*24; each layer of convolution contains batch normalization, relu activation function, and 2*2 pooling; the output of the three-layer convolution is one-dimensionalized to obtain a 1*1152 vector, which is then passed through two fully connected layers of size 1*150 and 1*2. The final output result is the appearance similarity of the two pedestrian pictures; Step 4-2: Train the twin neural network Dataset setting: Download the CUHK02 pedestrian tracking dataset from the Internet. The dataset contains 1816 pedestrian identities. Each pedestrian is photographed from two camera angles, and each camera angle has two photos. The first 80% of pedestrians are taken as the training set, and the remaining pedestrians are taken as the test set. Training process: The twin neural network established in step 4-1 is trained for two rounds. In the first round, the training data is the pictures of the pedestrians in the training set taken from the first camera angle. During the training process, the sample combination is randomly generated, and the ratio of positive samples to negative samples is controlled at 1:

1. The positive samples are two pedestrians with the same identity, and the negative samples are two pedestrians with different identities. In the second round, the pictures of the pedestrians in the training set taken from the second camera angle are used as training data, and the generation method of positive samples and negative samples is the same as the first round. Training and testing: After the training is completed, the trained twin neural network is tested using the test set. The output of the twin neural network is the appearance similarity of the two pedestrians. When the appearance similarity of two pedestrians with the same identity is greater than or equal to 0.5, it is considered correct; conversely, when the appearance similarity of two pedestrians with different identities is less than or equal to 0.5, it is considered correct; the final test result has an accuracy rate of more than 98%, and the trained twin neural network is saved.

Citation Information

Patent Citations

  • Fast vehicle detection using augmented dataset based on RetinaNet

    AU2019101133A4

  • Visual target tracking method based on verification and error correction mechanism and intelligent robot

    CN109784155A

  • Multi-target tracking method based on depth track prediction

    CN110135314A

  • Target tracking method based on triple twin hash network learning

    CN110298404A

  • Target tracking method and device fusing optical flow information and Siamese framework

    CN110619655A