Infrared video multi-target tracking method
Through the improved RFBNet network and DeepSORT algorithm, the problems of low tracking accuracy and overfitting in infrared videos are solved, and efficient multi-target tracking in complex scenes is achieved.
Patent Information
- Application Number
- CN202111048043.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-08
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-09-08
AI Technical Summary
Existing infrared video tracking algorithms have low accuracy in complex scenes, are prone to reduced tracking effects due to model overfitting, and it is difficult to apply deep learning methods in infrared videos.
The improved RFBNet network is used as the target detection network, and the infrared image is equalized by histogram to build a backbone network including the SK attention layer. It is combined with the DeepSORT multi-target tracking algorithm to establish the movement trajectories of people and vehicles.
It improves the accuracy and speed of infrared target detection, reduces the amount of network parameters and the risk of over-fitting, and achieves real-time tracking of multiple targets in complex infrared scenes.
Smart Images

Figure CN113808164B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of computer vision, and in particular relates to an infrared video multi-target tracking method, which can be used for real-time tracking of multiple targets of pedestrians and vehicles in complex infrared scenes. Technical Background
[0002] In recent years, deep learning methods have been mainly used in target recognition and tracking tasks. This method has powerful feature modeling capabilities and is mainly divided into the following two categories:
[0003] The first type is to combine convolutional features with correlation filters. For example, Danelljan et al. proposed the C-COT algorithm, which creates a time-continuous correlation filter by learning in a continuous resolution sequence. Feature maps of different resolutions can be used as filter inputs, allowing traditional features and deep features to be deeply combined. The disadvantage of this type of method is that the tracking speed is slow and training on the tracking data set is prone to overfitting.
[0004] The second type is the method using a twin network. This type of method can greatly increase the tracking speed, make the size of the image to be searched unlimited, and avoid overfitting caused by training on the tracking dataset. However, the tracking template of this type of method is always the tracked target of the previous frame, and there is no prediction of the target features of the tracked frame.
[0005] At present, most infrared video tracking algorithms are based on traditional non-deep learning, such as generative algorithms using template matching, optical flow, and particle filtering, or discriminative algorithms based on cross-correlation filtering. Such algorithms still have a lot of room for improvement in target tracking accuracy in complex infrared scenes. Inspired by the widespread application of deep learning in computer vision, people try to apply deep neural networks to infrared target tracking to improve algorithm performance. Since infrared video is different from color video used in general deep learning, its targets are more easily affected by the surrounding environment, and the appearance of the target often has a large range of changes, mainly manifested in contour changes and grayscale distribution changes, which makes tracking difficult. At the same time, due to the low resolution of infrared video and the small amount of available channel information, the use of neural networks with large parameters and too deep depth can easily lead to model overfitting and reduce tracking effects. Summary of the invention
[0006] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and propose an infrared video multi-target tracking method to improve tracking accuracy and reduce the degree of overfitting.
[0007] The technical idea of the present invention is to obtain all the targets appearing in the video through the target detection network and establish the trajectory tracking target through the matching algorithm.
[0008] According to the above ideas, the infrared video multi-target tracking method of the present invention includes:
[0009] (1) Perform histogram equalization on the infrared images containing people and cars, select the bounding boxes of people and cars in the rectified images, and randomly select 90% of the rectified images and their corresponding labels as the training data set;
[0010] (2) Build target detection network:
[0011] Using the RFBNet network as the basis, modify its backbone network by replacing the second convolutional layer of all convolutional modules of the backbone network with the SK attention layer;
[0012] Two convolution branches are set in the SK attention layer, which are used to perform group convolution operations with convolution kernel sizes of 3*3 and 5*5 and group number of 2 respectively;
[0013] Set the feature compression ratio of the SK attention layer to 1 / 2 of the original number of channels;
[0014] (3) Using the training data set, the target detection network is trained using the gradient descent method to obtain a trained target detection network;
[0015] (4) Input each frame of the infrared video into the trained object detection network and output the detection results of people and vehicles in each frame of the infrared video;
[0016] (5) The DeepSORT multi-target tracking algorithm is used to perform data association on the detection results, establish the motion trajectories of people and vehicles, and obtain the infrared video multi-target tracking results.
[0017] Compared with the prior art, the present invention has the following advantages:
[0018] 1) The present invention has higher target detection accuracy because it uses the improved RFBNet as the target detection network. The simulation results show that under the standard of the COCO dataset, the mAP 0.50:0.95 of infrared target detection is improved by 1.7 compared with the original RFBNet network.
[0019] 2) Since the present invention adopts grouped convolution operation in the SK attention layer, compared with other target detection networks with the same accuracy, it has a lower network parameter amount and faster reasoning speed, and reduces the possibility of network overfitting to data. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flow chart for realizing the present invention;
[0021] Figure 2 SK attention layer structure diagram used in the present invention;
[0022] Figure 3This is a structural diagram of the backbone part of the target detection network constructed in the present invention;
[0023] Figure 4 A simulation result diagram of target detection using the present invention;
[0024] Figure 5 The effect diagram of using the present invention to track people and vehicles in infrared video. DETAILED DESCRIPTION
[0025] The implementation and effects of the present invention are described in detail below in conjunction with the accompanying drawings.
[0026] Reference Figure 1 , the implementation steps of the present invention are as follows:
[0027] Step 1: Obtain infrared images and determine the training data set:
[0028] 1.1) From the URL https: / / www.flir.com / oem / adas / adas-dataset-form / Download the FLIR infrared image dataset from the Internet. The FLIR dataset contains 8862 thermal infrared images and the location labels of people and vehicles in each image.
[0029] 1.2) Each infrared image in the FLIR dataset is subjected to the following histogram equalization process:
[0030] 1.2.1) Count the number of occurrences of each gray value from 0 to 255 in the infrared image to obtain a gray distribution histogram H;
[0031] 1.2.2) According to the grayscale distribution histogram H, calculate the new grayscale value p of each pixel in the infrared image:
[0032]
[0033] Where A is the number of pixels in the infrared image, p' is the original gray value of the pixel, and H(u) represents the value corresponding to gray u in the gray distribution histogram H;
[0034] 1.2.3) Using the above formula, calculate the new grayscale values of all pixels in the infrared image to obtain the infrared image after histogram equalization;
[0035] 1.3) Randomly select 90% of the images after histogram equalization and their corresponding labels as the training set, and the remaining 10% of the images and their corresponding labels as the test set.
[0036] Step 2: Build a target detection network.
[0037] This example builds a target detection network based on the existing RFBNet network. The network includes a backbone network using the VGG16 network, a neck network using receptive field blocks, and a head network. The backbone network contains 6 convolution blocks, the first two convolution blocks have two convolution layers, and the last four convolution blocks have 3 convolution layers. This example makes the following modifications to the backbone network:
[0038] 2.1) Replace the second convolutional layer of each convolutional block in the backbone network with the SK attention layer:
[0039] Reference Figure 2 , the SK attention layer contains several convolution branches, followed by a global average pooling layer and two connection layers; the first fully connected layer performs feature compression, and the second fully connected layer generates a weight vector, which is used to fuse the results output by the convolution branches;
[0040] For the second convolutional layer of each convolutional block in the backbone, replace it as follows:
[0041] 2.1.1) Set up a SK attention layer whose input and output sizes are the same as those of the convolutional layer;
[0042] 2.1.2) Two convolution branches are set in the SK attention layer, which are used to perform group convolution operations with convolution kernel sizes of 3*3 and 5*5 and group number of 2 respectively. The feature compression ratio of the SK attention layer is 1 / 2 of the original number of channels;
[0043] 2.1.3) The input of the convolutional layer to be replaced is used as the input of the SK attention layer, and the output of the SK attention layer is input into the subsequent network structure. The convolutional layer to be replaced is deleted to obtain an improved backbone sub-network;
[0044] 2.2) The improved backbone sub-network is cascaded with the neck sub-network and head sub-network of the existing RFBNet using the receptive field block to obtain the constructed target detection network, such as Figure 3 As shown, Figure 3 The improved backbone subnetwork in the figure contains 6 convolutional modules, each of which is followed by a maximum pooling layer; the first two convolutional blocks contain a convolutional layer and an SK attention layer in turn, and the last four convolutional blocks are composed of a convolutional layer, an SK attention layer, and another convolutional layer. The structural relationship is as follows:
[0045] First convolution layer -> first SK attention layer -> first maximum pooling layer -> second convolution layer -> second SK attention layer -> second maximum pooling layer -> third convolution layer -> third SK attention layer -> fourth convolution layer -> third maximum pooling layer -> fifth convolution layer -> fourth SK attention layer -> sixth convolution layer -> fourth maximum pooling layer -> seventh convolution layer -> fifth SK attention layer -> eighth convolution layer -> fifth maximum pooling layer -> ninth convolution layer -> sixth SK attention layer -> tenth convolution layer -> sixth maximum pooling layer.
[0046] Step 3: Train the target detection network.
[0047] Use the training set constructed in step 1 to train the target detection network using the gradient descent method. The specific implementation is as follows:
[0048] 3.1) Use the SGD stochastic gradient descent method with momentum as the optimizer for training the target detection network. Set the momentum value to 0.9, the initial learning rate of the network to 0.01, and the loss function of the network to use the original loss function of RFBNet;
[0049] 3.2) In one iteration, four images in the training set and their corresponding labels are input into the network. After forward propagation, the network outputs the loss value of this iteration, and the network is back-propagated using this loss value. When all images in the training set have been input into the network once, one epoch of training is completed.
[0050] 3.3) In each iteration of the first 5 epochs of network training, the learning rate lr is dynamically adjusted by the following formula:
[0051]
[0052] Among them, i is the current iteration number, S is the total number of iterations in a period;
[0053] 3.4) In the subsequent training, the learning rate adjusted in the first five epochs is kept unchanged until the epochs are 150, 200, and 250, respectively, and then the learning rate is changed to 1 / 10 of the learning rate in the previous epoch;
[0054] 3.5) Using the momentum and learning rate parameter settings in (3.1), (3.3), and (3.4), repeat the training process of (3.2) in units of one epoch, calculate the average value of the network output loss value in each epoch, until the average loss value stops decreasing, end the training, save the network parameters, and obtain the trained object detection network.
[0055] Step 4: Select DeepSORT as the tracker and train its appearance model.
[0056] The DeepSORT is a multi-target tracking algorithm that can obtain the target's motion trajectory by concatenating the bounding box positions of the target to be tracked in different frames of a video. It consists of two parts: one is the appearance model used to extract the target's appearance features, and the other is the data association algorithm used to generate the motion trajectory. The appearance model needs to be trained before use, and the training method is as follows:
[0057] 4.1) Shoot several infrared videos containing people and cars, crop and scale the people and cars in each frame of the infrared video into 64*128 size images, and then classify the images of the same object into one category to obtain a training image set;
[0058] 4.2) Input the training image set into the existing DeepSORT multi-target tracking algorithm, call the existing appearance model training method in the algorithm, train the appearance model, and obtain the trained DeepSORT appearance model.
[0059] Step 5: Use the trained target detection network to obtain the location labels of people and vehicles in the infrared image.
[0060] Each frame of the infrared video to be tracked is input into the trained target detection network in turn, and the network outputs the position coordinates of all people and cars as well as their confidence and category;
[0061] The non-maximum suppression algorithm is used to eliminate duplicate detection results using the position coordinates, and the detection results are sorted from high to low according to the confidence level. The detection results with low confidence levels are deleted to obtain the position labels of people and vehicles in each frame of infrared image.
[0062] The location label of each person and car object contains five parameters: x, y, w, h, c, where x, y, w, h are the upper left X-axis coordinate, upper left Y-axis coordinate, width and height of the circumscribed rectangle of the object, respectively, and c is the category of the target.
[0063] Step 6: Use the DeepSORT multi-target tracking algorithm to perform data association and obtain the movement trajectories of people and vehicles.
[0064] For all the people and vehicles position labels for each frame obtained by the target detection network, perform the following steps in sequence:
[0065] 6.1) Use the x, y, w, h parameters of the position labels of people and cars in the current frame to crop the images of people and cars in the corresponding video frame, and input the cropped images into the trained appearance model to obtain the appearance features of people and cars in the current frame; calculate the cosine distance matrix M between the appearance features of all people and cars in the current frame and the appearance features of all people and cars in the previous frame a ;
[0066] 6.2) Using the position labels of people and vehicles in each frame before the current frame, use Kalman filtering to predict the position labels of people and vehicles that appeared in the previous frame in the current frame; calculate the Mahalanobis distance matrix M between the predicted position labels of people and vehicles in the current frame and the position labels of people and vehicles in the current frame b ;
[0067] 6.3) Set the threshold t and transform the Mahalanobis distance matrix M b The element b in row i and column j ij Compare with t:
[0068] If b ij >t, then the cosine distance matrix M a The element a in row i and column j ij Set to infinity and get the similarity matrix M s , otherwise, no processing;
[0069] 6.4) Using the similarity matrix M s Using the Hungarian algorithm, the people and vehicles detected in the current frame are matched with those detected in the previous frame, and the matching results of consecutive frames are concatenated in sequence. For each concatenated result, the position label in each frame is the motion trajectory data of the person and vehicle object, thus completing the multi-target tracking of people and vehicles in the infrared video.
[0070] The algorithm effect of the present invention can be further illustrated by the following simulation experiment:
[0071] 1. Simulation environment:
[0072] Operating system: Ubuntu 20.4.0
[0073] CPU: Intel Core i7-10700
[0074] GPU:RTX3080
[0075] Deep Learning Framework: Pytorch
[0076] The test data set of simulation experiment 1 is the 10% test set divided from the FLIR data set in step 1.
[0077] 2. Simulation Content
[0078] Simulation experiment 1, using the target detection network of the present invention to detect the test data set, obtain the position labels of people and vehicles in the infrared image, among which the detection results of three infrared images are as follows Figure 4 shown. Figure 4 (a) shows the four vehicle tags detected in the first infrared image. The outer rectangular box marks the location of the tag, and the tag category is marked as vehicle in the upper right corner of the rectangular box; Figure 4 (b) Two human tags are detected in the second infrared image. The circumscribed rectangle marks the location of the tag, and the tag category is marked as human in the upper right corner of the rectangle; Figure 4 (c) Two human tags are detected in the third infrared image. The circumscribed rectangle marks the location of the tag, and the tag category is marked as human in the upper right corner of the rectangle.
[0079] Depend on Figure 4 It can be concluded that the target detection network of the present invention can detect the position of the human and vehicle objects contained in the infrared image and can give the category of the object.
[0080] The evaluation index is the AP 0.5:0.95 index in the COCO dataset evaluation standard. The accuracy of all the people and car location labels detected by the above test dataset and the people and car location labels provided in the test dataset are evaluated, and compared with the detection accuracy of the original RFBNet network. The results are shown in Table 1:
[0081] Table 1 Comparison of target detection accuracy between RFBNet network and target detection network of the present invention
[0082] Human AP 0.5:0.95 Car AP 0.5:0.95 mAP 0.5:0.95 Original RFBNet network 78.60 83.40 81.00 Target detection network of the present invention 80.40 85.10 82.70
[0083] From the results in Table 1, it can be concluded that the improved target detection network of the present invention has a significant improvement in target detection accuracy compared to the original RFBNet network: the mAP 0.5:0.95 index is improved by 1.7.
[0084] Simulation experiment 2, download the BU-TIV dataset from the website http: / / csr.bu.edu / BU-TIV / BUTIV.html, select three infrared videos containing people and cars and their true trajectories as the tracking test set. Use the infrared multi-target tracking method of the present invention to track the infrared videos in the tracking test set, and the tracking results of the first two videos are as follows: Figure 5 As shown, where:
[0085] Figure 5 (a) shows the tracking effect of the first infrared video, which includes three frames of tracking results extracted from the video. The position of the tracked human target in each frame is marked with an external rectangle, and the category and code of the target are marked above the rectangle. The targets in the rectangles with the same code in different frames are the same tracked target.
[0086] Figure 5(b) lists the tracking effect of the second infrared video, which includes three frames of tracking results extracted from the video. The circumscribed rectangle marks the position of the tracked person and vehicle targets in each frame, and the category and code of the target are marked above the rectangular frame. The targets in the rectangular frames with the same code in different frames are the same tracked targets.
[0087] Depend on Figure 5 It can be concluded that the infrared multi-target tracking algorithm of the present invention can track the human and vehicle targets appearing in the infrared video and obtain the target motion trajectory.
[0088] Using the multi-target tracking evaluation method of the MOT data set, the tracking result trajectory of the present invention using the tracking test set and the human and vehicle trajectories provided in the tracking test set are evaluated for the effect accuracy of infrared multi-target tracking. The results are shown in Table 2:
[0089] Table 2 Tracking accuracy index of infrared multi-target tracking algorithm of the present invention
[0090] Video Sequence IDF1 IDP IDR Rcll GT FP IDs MOTA MOTP 01 52.6% 51.0% 54.2% 62.2% 168 2997 53 17.4% 0.242 02 8.9% 13.3% 6.7% 45.2% 7 1833 189 39.6% 0.285 03 16.3% 18.7% 14.5% 67.2% 7 3481 231 55.8% 0.278 Weighted mean 17.1% 21.3% 14.3% 56.2% 182 8311 471 44.6% 0.277
[0091] In Table 2, IDF1 is the F1 score of the code; IDP is the precision of the code; IDR is the recall of the code; Rcll is the recall of target detection; GT is the total number of trajectories in the true value of the trajectory; FP is the total number of false positive detections; IDs is the total number of incorrect code switching during tracking; MOTA is the accuracy of multi-target tracking; MOTP is the precision of multi-target tracking.
[0092] It can be seen from the results in Table 2 that the infrared target tracking method of the present invention has good tracking accuracy for human and vehicle targets in infrared videos.
Claims
1. A method for multi-target tracking using infrared video. It is characterized in that include: (1) Perform histogram equalization correction on infrared images containing people and cars, select the bounding box labels of people and cars in the corrected images, and randomly select 90% of the corrected images and their corresponding labels as the training data set; the implementation is as follows: (1a) Count the number of occurrences of each grayscale value from 0 to 255 in an infrared image to obtain a grayscale distribution histogram ; (1b) According to the grayscale distribution histogram , calculate the new gray value p of each pixel in the infrared image: In the formula, is the number of pixels of the infrared image, is the original grayscale value of the pixel, Represents the grayscale distribution histogram Medium Gray The corresponding value; (1c) Using the above formula, calculate the new grayscale values of all pixels in the infrared image to obtain the infrared image after histogram equalization; (2) Building a target detection network: Using the RFBNet network as the basis, modify its backbone network, that is, replace the second convolution layer of all convolution modules of the backbone network with the SK attention layer; set two convolution branches in the SK attention layer, which are used to perform convolution with kernel size of and The group convolution operation is performed with a group number of 2; and the feature compression ratio of the SK attention layer is set to 1 / 2 of the original number of channels; The target detection network is obtained, which contains 6 convolutional modules, each of which is followed by a maximum pooling layer; the first two convolutional blocks contain a convolutional layer and an SK attention layer in turn, and the structure of the last four convolutional blocks is a convolutional layer, an SK attention layer, and another convolutional layer; the structural relationship is as follows: 1st convolution layer -> 1st SK attention layer -> 1st max pooling layer -> 2nd convolution layer -> 2nd SK attention layer -> 2nd max pooling layer -> 3rd convolution layer -> 3rd SK attention layer -> 4th convolution layer -> 3rd max pooling layer -> 5th convolution layer -> 4th SK attention layer -> 6th convolution layer -> 4th max pooling layer -> 7th convolution layer -> 5th SK attention layer -> 8th convolution layer -> 5th max pooling layer -> 9th convolution layer -> 6th SK attention layer -> 10th convolution layer -> 6th max pooling layer; (3) Use the training data set and the gradient descent method to train the target detection network to obtain the trained target detection network; the implementation is as follows: (3a) Use the SGD stochastic gradient descent method with momentum as the training optimizer, set the momentum value to 0.9, the initial learning rate of the network to 0.01, and the loss function to use the original loss function of RFBNet; (3b) In one iteration, four training images are input into the network. After forward propagation, the network outputs the loss value of this iteration, and the loss value is used to perform back propagation on the network. (3c) When all images in the training data set have been input into the network once, one epoch of training is completed. In each iteration of the first five epochs of network training, the learning rate is dynamically adjusted using the following formula: : in, is the current iteration number, is the total number of iterations in one period; (3d) After the learning rate is adjusted in the first five epochs, it remains unchanged in the subsequent training until the epochs are 150, 200, and 250, respectively, when the learning rate becomes 1 / 10 of the learning rate in the previous epoch; (3e) Using the momentum and learning rate parameter settings in (3a), (3c), and (3d), repeat the training process of (3b) in units of one epoch, calculate the average value of the network output loss value in each epoch, until the average loss value stops decreasing, end the training, save the network parameters, and obtain the trained object detection network; (4) Input each frame of the infrared video into the trained object detection network and output the detection results of people and vehicles in each frame of the infrared video; (5) The DeepSORT multi-target tracking algorithm is used to perform data association on the detection results, establish the motion trajectories of people and vehicles, and obtain the infrared video multi-target tracking results, which are implemented as follows: (5a) Establishing a training image set: crop and scale the people and vehicles that appear in the infrared video into 64*128 size images, and then classify the images of the same object into one category to obtain a training image set; (5b) Using the image set to train the appearance model in the DeepSORT multi-target tracking algorithm using the gradient descent method to obtain a trained appearance model; (5c) Based on the target detection results, crop the images of people and cars in the current video frame, and input the cropped images into the trained appearance model to obtain the appearance features of people and cars; calculate the cosine distance matrix between the appearance features of all people and cars in the current frame and the appearance features of all people and cars in the previous frame ; (5d) Use Kalman filtering to predict the position of people and cars in the current frame based on the positions of people and cars in each frame before the current frame; calculate the Mahalanobis distance matrix between the predicted positions of people and cars in the current frame and the detection results in the current frame ; (5e) Setting thresholds , the Mahalanobis distance matrix Middle OK Column Elements and Compare: like , then the cosine distance matrix Middle OK Column Elements Set to infinity and get the similarity matrix , otherwise, no processing; (5f) Using the similarity matrix The Hungarian algorithm is used to match the detection result of the current frame with the detection result of the previous frame, and the matching results of consecutive frames are concatenated in sequence to obtain the motion trajectory data of people and vehicles.
