Target tracking method based on multi-scale feature sharing, storage medium and equipment
By adopting a multi-scale feature sharing method in target tracking and combining shallow and deep feature vectors, the computational efficiency and accuracy are improved, the problems of occlusion and high computational cost in the existing technology are solved, and a more efficient Object tracking and more accurate similarity calculations.
Patent Information
- Application Number
- CN202410923501.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-10
AI Technical Summary
Existing target tracking technology has poor tracking results when there is occlusion or drastic changes in the picture, and the calculation cost is high. Moreover, the utilization rate of color, shape and texture information in the shallow network is low, making it difficult to cope with long-term occlusion.
Using a method based on multi-scale feature sharing, feature atlases of different scales are obtained through the target detection network, divided into shallow feature set groups and deep feature set groups, and corresponding shallow feature vectors and deep feature vectors are generated. According to the differences The value determines which feature vector is used to calculate the similarity of the target, updates the position information through Kalman filtering, and sets the overlap threshold to determine IOU matching or Euclidean distance matching.
It improves the computational efficiency and accuracy of target tracking, enhances the robustness to occlusion, rationally utilizes the shallow features of the image, reduces the amount of calculation, and solves the problem of unreasonable IOU matching in the existing technology.
Smart Images

Figure CN118864533A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of intelligent driving technology, and in particular to the field of target tracking technology. Background Art
[0002] With the rapid development of artificial intelligence, the intelligent development of automobiles is also getting faster and faster. With the maturity of L1 assisted driving, L2 advanced assisted driving is also booming. In particular, advanced assisted driving based on pure visual perception is becoming more and more popular in the industry. Among them, target tracking in visual perception has always been a challenging task in the industry.
[0003] Currently, in intelligent driving, it is necessary to track detected targets to provide reliable data support for planning, control and decision-making in downstream tasks. Common target tracking paradigms can be roughly divided into two categories, TBD (Tracking By Detection) and JDE (Joint-Detection-and-Embedding).
[0004] TBD mainly processes target detection and target tracking separately, which is a serial process at a macro level. The performance and quality of tracking depend on the quality of detection. The motion and appearance information of the target can be applied to the tracking process.
[0005] When tracking relies only on motion information, typical algorithms are sort-related. The biggest advantage of this type of algorithm is its fast speed and good tracking effect without occlusion. Once occlusion occurs or the picture changes drastically, the frequency of target ID jumps increases, which is not conducive to downstream task planning, control and decision-making.
[0006] When motion information and appearance information are used at the same time, the typical algorithm is the DeepSORT algorithm. The biggest advantage of this type of algorithm is that the target that appears again after occlusion can still be tracked by relying on the target's appearance feature vector, and the ID remains unchanged. The disadvantage is that the appearance feature vector needs to be obtained through a neural network separately, and the neural network needs to be trained. This type of algorithm is equivalent to the need to train neural networks separately for target detection and tracking, and the robustness to occlusion is not very high, and can only cope with short-term occlusion.
[0007] JDE mainly outputs target detection results and target feature vectors through a network at the same time. From a macro perspective, it is equivalent to parallel processing of target detection and target tracking. While the efficiency is improved, the robustness to occlusion is also improved. The biggest advantage of this type of algorithm is its high efficiency, and its disadvantage is its high computational cost. In the generation of target feature vectors, high-level semantic information in deeper networks is used, while the color, shape and texture information in shallow networks is less utilized. Summary of the invention
[0008] The present application provides a target tracking method, storage medium and device based on multi-scale feature sharing, which are used to improve the computational efficiency of target tracking and improve the accuracy of similarity calculation of different targets.
[0009] In a first aspect, an embodiment of the present application provides a target tracking method based on multi-scale feature sharing, including: acquiring feature atlases of different scales based on a target detection network, and dividing the feature atlases into a shallow feature set group and a deep feature set group based on feature types; generating shallow feature vectors and deep feature vectors corresponding to the shallow feature set group and the deep feature set group, respectively, based on the position information output by the target detection network; determining whether to use the shallow feature vector or the deep feature vector to calculate the similarity of targets in two frames before and after based on the position information output by the target detection network and the position information predicted by the Kalman filter; matching the position information output by the target detection network with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and updating the position information predicted by the Kalman filter based on the matching result.
[0010] In an implementation of the first aspect, the generating of shallow feature vectors and deep feature vectors corresponding to the shallow feature set group and the deep feature set group respectively based on the position information output by the target detection network includes: obtaining the target position of the feature maps in the shallow feature set group and the deep feature set group based on the target position and mapping coefficient output by the target detection network; wherein, the target position of the feature map = the target position output by the target detection network / mapping coefficient; and calculating each feature map in the shallow feature set group and the deep feature set group respectively based on the target position of the feature maps in the shallow feature set group and the deep feature set group to obtain the corresponding shallow feature vector and deep feature vector.
[0011] In an implementation of the first aspect, each feature map in the shallow feature set group is calculated to obtain a corresponding shallow feature vector, including: calculating each target frame position area in each feature map in each shallow feature set group respectively to obtain a shallow feature matrix corresponding to each shallow feature set group; fusing and splicing each shallow feature matrix to obtain a shallow feature vector.
[0012] In an implementation of the first aspect, calculating each feature map in the deep feature set group to obtain the corresponding deep feature vector includes: upsampling each feature map in the deep feature map set to a uniform size to form feature maps of the same size; calculating each target box position area in each feature map in each of the deep feature set groups to obtain a deep feature vector.
[0013] In an implementation of the first aspect, the determination of whether to use the shallow feature vector or the deep feature vector to calculate the similarity of the targets of the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter includes: calculating the difference value of the targets of the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter; comparing the difference value with a difference threshold: when the difference value is greater than or equal to the difference threshold, determining to use the shallow feature vector to calculate the similarity of the targets of the previous and next frames; when the difference value is less than the difference threshold, determining to use the deep feature vector to calculate the similarity of the targets of the previous and next frames.
[0014] In an implementation manner of the first aspect, the difference value is any one of a difference hash value, a difference mean square error, a difference structural similarity index, a difference peak signal-to-noise ratio, and a difference gradient similarity index.
[0015] In an implementation of the first aspect, matching the position information output by the target detection network with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and updating the position information predicted by the Kalman filter based on the matching result includes: performing cascade matching based on the determined shallow feature vector or the deep feature vector, obtaining the similarity between the target box output by the target detection network and the target box predicted by the Kalman filter, and obtaining a similarity matching result based on the similarity; updating the position information predicted by the Kalman filter based on the similarity matching result.
[0016] In an implementation of the first aspect, the updating of the position information predicted by the Kalman filter based on the matching result also includes: calculating the overlapping area between the target box output by the target detection network and the target box predicted by the Kalman filter; comparing the overlapping area with an overlapping threshold: when the overlapping area is greater than or equal to the overlapping threshold, performing IOU matching on the target box output by the target detection network and the target box predicted by the Kalman filter to obtain an IOU matching result, and updating the position information predicted by the Kalman filter based on the IOU matching result; when the overlapping area is less than the overlapping threshold, performing Euclidean distance matching on the target box output by the target detection network and the target box predicted by the Kalman filter to obtain a Euclidean distance matching result, and updating the position information predicted by the Kalman filter based on the Euclidean distance matching result.
[0017] In a second aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the target tracking method based on multi-scale feature sharing as described in any one of the first aspects of the present application.
[0018] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory; the memory stores program instructions; the processor is used to run the program instructions to execute the target tracking method based on multi-scale feature sharing as described in any one of the first aspects of the present application.
[0019] The target tracking method based on multi-scale feature sharing provided in the embodiment of the present application has the following beneficial effects:
[0020] 1. This application uses the feature set group in the target detection process to obtain feature atlases of different scales, perform multi-scale feature upsampling and fusion, and use it for target feature vector extraction in tracking. Compared with using a single neural network to output the target's feature vector, it is more efficient and accurate, and can effectively improve the computational efficiency of target tracking and improve the accuracy of similarity calculations of different targets.
[0021] 2. In this application, the feature set groups in the target detection process are divided into two groups, shallow and deep, to construct corresponding shallow feature vectors and deep feature vectors, and then the difference between the two frame targets is judged based on the difference value of the target in the previous and next frames. Based on this difference, the cosine distance between the feature vectors can be calculated more reasonably, which reduces the amount of calculation and makes reasonable use of the shallow features of the image.
[0022] 3. In this application, an overlap threshold is set to determine whether IOU matching is needed. If the overlapping area is greater than the overlap threshold, IOU matching is performed. Otherwise, Euclidean distance matching is performed directly. This setting can solve the problem of unreasonable IOU matching in the prior art, thereby improving the target tracking accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 Shown is a flowchart of a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0024] Figure 2 Shown is a flowchart of generating shallow feature vectors and deep feature vectors in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0025] Figure 3 Shown is a schematic diagram of generating a shallow feature vector in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0026] Figure 4 Shown is a schematic diagram of generating a deep feature vector in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0027] Figure 5Shown is a flowchart of selecting a shallow feature vector or a deep feature vector in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0028] Figure 6 Shown is a flowchart of target matching in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0029] Figure 7 Shown is a schematic diagram of an implementation principle of a target tracking method based on multi-scale feature sharing according to an embodiment of the present application.
[0030] Figure 8 Shown is a schematic diagram of the structure of an electronic device in an embodiment of the present application.
[0031] Component number description
[0032] 100 Electronic devices
[0033] 101 Memory
[0034] 102 Processor
[0035] 103 Display
[0036] S100~S400 steps
[0037] Steps S210 to S220
[0038] Steps S310 to S340
[0039] Steps S410 to S460 DETAILED DESCRIPTION
[0040] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0041] The embodiment of the present application provides a target tracking method based on multi-scale feature sharing, which is used to improve the computational efficiency of target tracking and improve the accuracy of similarity calculation of different targets.
[0042] The following will be combined with the attached examples of the present application Figure 1 To Attachment Figure 8, the technical solution in the embodiment of the present application is described in detail, so that those skilled in the art can understand and implement the target tracking method based on multi-scale feature sharing in the present embodiment without creative work.
[0043] Figure 1 The flowchart of the target tracking method based on multi-scale feature sharing in the embodiment of the present application is shown. Figure 1 As shown, the target tracking method based on multi-scale feature sharing provided in the embodiment of the present application includes the following steps S100 to S400.
[0044] Step S100, acquiring feature atlases of different scales based on the target detection network, and dividing the feature atlases into a shallow feature set group and a deep feature set group based on feature types;
[0045] Step S200, generating a shallow feature vector and a deep feature vector corresponding to the shallow feature set group and the deep feature set group respectively based on the position information output by the target detection network;
[0046] Step S300, determining whether to use the shallow feature vector or the deep feature vector to calculate the similarity of the targets in the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter;
[0047] Step S400, matching the position information output by the target detection network with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and updating the position information predicted by the Kalman filter based on the matching result.
[0048] This embodiment uses the feature set group in the target detection process to obtain feature atlases of different scales, performs multi-scale feature upsampling and fusion, and uses them for target feature vector extraction in tracking. Compared with using a single neural network to output the target's feature vector, it is more efficient and accurate, and can achieve more efficient and stable target tracking and global consistency of target feature vectors, which can effectively improve the computational efficiency of target tracking and improve the accuracy of similarity calculations for different targets.
[0049] The above steps S100 to S400 in the target tracking method based on multi-scale feature sharing of this embodiment are described in detail below.
[0050] Step S100, acquiring feature atlases of different scales based on the target detection network, and dividing the feature atlases into a shallow feature set group and a deep feature set group based on feature types.
[0051] This embodiment directly uses different feature sets output by different layers in the target detection network to establish feature set groups, and then divides the feature set groups into shallow feature set groups and deep feature set groups according to the number of network layers. There is no strict distinction between the number of layers in the shallow feature set group and the deep feature set group. In this embodiment, the distinction is made based on the type of features. The shallow features are mainly color, shape and texture. When these features are not obvious or even disappear, deep high-level semantic features will appear. Although there are semantic features in the shallow features, they are not obvious.
[0052] Exemplarily, based on the feature extraction network in the target detection model, an image sequence of size 640x640x3 is input, and feature sets of five scales of 320x320xC1, 160x160xC2, 80x80xC3, 40x40xC4, and 20x20xC5 are output, where C1-C5 is defined as the number of channels of each scale feature. The size of the feature extraction network output is not fixed and can be adjusted according to different convolutional neural networks. Taking the basic framework of YOLOv8 as an example, the feature maps of the two sizes of 320 and 160 still have shallow features, and the latter three shallow features are gone, so the feature sets of 320x320xC1 and 160x160xC2 can be divided into shallow feature set groups, and the feature sets of 80x80xC3, 40x40xC4, and 20x20xC5 can be divided into deep feature set groups.
[0053] This embodiment directly utilizes the feature set group in the target detection process, and then divides the feature set group into a shallow feature set group and a deep feature set group according to the number of network layers. It can perform multi-scale feature upsampling and fusion for target feature vector extraction in tracking, which is more efficient than using a single neural network to output the target's feature vector.
[0054] Step S200, based on the position information output by the target detection network, generate a shallow feature vector and a deep feature vector corresponding to the shallow feature set group and the deep feature set group respectively.
[0055] In this embodiment, based on the position information in the target detection result, a position mapping relationship between the target position in the image in feature set groups of different sizes is established. Based on the position mapping relationship, the features of different sizes in the shallow feature set group and the deep feature set group are upsampled and feature fusion calculated. Finally, the features of different sizes are unified to the same size to generate two groups of feature vector groups.
[0056] Figure 2 The flowchart of generating shallow feature vectors and deep feature vectors in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application is shown. Figure 2As shown, in one implementation of this embodiment, the generation of shallow feature vectors and deep feature vectors corresponding to the shallow feature set group and the deep feature set group respectively based on the position information output by the target detection network includes the following steps S210 to 220.
[0057] Step S210, obtaining the target position of the feature map in the shallow feature set group and the deep feature set group based on the target position and mapping coefficient output by the target detection network; wherein the target position of the feature map = the target position output by the target detection network / mapping coefficient.
[0058] That is, in this embodiment, a position mapping relationship is established between the target position of the feature map in the shallow feature set group and the deep feature set group and the target position output by the target detection network. The mapping coefficient is the ratio of the size of the input image to the size of the feature map in the feature set group. For example, if the input image size is s1×s1, the feature size is s2×s2, and the mapping coefficient is r, then
[0059] In one implementation of this embodiment, before establishing a position mapping relationship, the position information output by the target detection network is converted to the upper left corner and lower right corner of the target box, and then a mapping relationship of the target position information from the original image to the feature map is established to obtain the target position information on the feature map, where the target position of the feature map = the target position output by the target detection network / mapping coefficient.
[0060] Step S220, based on the target positions of the feature maps in the shallow feature set group and the deep feature set group, the feature maps in the shallow feature set group and the deep feature set group are calculated respectively to obtain the corresponding shallow feature vector and deep feature vector. The calculation method includes any one of standard deviation calculation, variance calculation, Frobenius norm calculation and mean calculation (reconstructing each target frame area into a square matrix and then calculating the mean of the feature value). In this embodiment, the variance calculation of each feature map in the shallow feature set group and the deep feature set group is used as an example for explanation.
[0061] Figure 3 The schematic diagram is shown as a schematic diagram of generating shallow feature vectors in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application. Figure 3 As shown, in one implementation of the present embodiment, each feature map in the shallow feature set group is calculated to obtain the corresponding shallow feature vector, including: calculating each target frame position area in each feature map in each shallow feature set group respectively to obtain a shallow feature matrix corresponding to each shallow feature set group; fusing and splicing each shallow feature matrix to obtain a shallow feature vector.
[0062] Exemplarily, in the shallow feature set group, there are C1 feature maps of size 320x320 and C2 feature maps of size 160x160. The standard deviation of the N target box position areas in each feature map is calculated to obtain two matrices Nx1xC1 and Nx1xC2. These two matrices are then fused and concatenated to obtain the shallow feature vector Nx1x(C1+C2) of the target.
[0063] It should be noted that in conventional target detection, the neck in the target detection network can fuse the features extracted from the backbone. Since object detection needs to complete classification and regression (object position, that is, the coordinates of the bounding box) tasks at the same time, the category belongs to the semantic feature and requires the deep features of the network, while the coordinates of the object belong to the shallow feature and require the output of the shallow network, so the extracted features need to be fused. In order to better retain the target feature information such as the shallow feature information, the feature fusion network can be augmented.
[0064] In this embodiment, when the features are fused, the feature set output by the backbone in the target detection network is fused instead of the features output by the neck.
[0065] Figure 4 The schematic diagram is shown as a schematic diagram of generating a deep feature vector in a target tracking method based on multi-scale feature sharing according to an embodiment of the present application. Figure 4 As shown, in one implementation of the present embodiment, each feature map in the deep feature set group is calculated to obtain the corresponding deep feature vector, including: upsampling each feature map in the deep feature map set to a uniform size to form feature maps of the same size; calculating each target frame position area in each feature map in each of the deep feature set groups to obtain a deep feature vector.
[0066] Since the resolution of the feature maps of the last two layers in the deep features is very small, when a small target is mapped to the feature map, the target position error is large. In order to better preserve the high-level semantic information in the deep features, in this embodiment, all deep feature atlases are upsampled to a uniform size, and the size of the shallow feature atlas remains unchanged.
[0067] Exemplarily, in the deep feature set group, all feature maps are 80x80 in size, with a total of C3+C4+C5. Similarly, the standard deviation of the N target box position areas in each feature map is calculated to obtain the deep feature vector Nx1x(C3+C4+C5) of the N targets.
[0068] The shallow feature atlas describes more of the color, shape, and texture information of the target, while the deep feature atlas describes more of the high-level semantic information of the target. However, sometimes the intra-class differences between different targets of the same category are very large. In this case, there is no need for too deep high-level semantic information to describe the target, and the shallow features can well distinguish different targets of the same category. When the intra-class differences are very small, the shallow features cannot distinguish different targets of the same category, and the high-level semantic information in the deep features is needed.
[0069] Step S300, based on the position information output by the target detection network and the position information predicted by the Kalman filter, determine whether to use the shallow feature vector or the deep feature vector to calculate the similarity of the targets in the previous and next frames.
[0070] Figure 5 The flowchart of selecting shallow feature vector or deep feature vector in the target tracking method based on multi-scale feature sharing in one embodiment of the present application is shown. Figure 5 As shown, in one implementation of the present embodiment, determining whether to use the shallow feature vector or the deep feature vector to calculate the similarity of the targets of the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter includes the following steps S310 to S340.
[0071] Step S310, calculating the difference value of the target in the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter;
[0072] Step S320, comparing the difference value with a difference threshold:
[0073] Step S330, when the difference value is greater than or equal to the difference threshold, determining to use the shallow feature vector to calculate the similarity of the objects in the previous and next frames;
[0074] Step S340, when the difference value is less than the difference threshold, determine to use the deep feature vector to calculate the similarity between the previous and next frame targets.
[0075] Step S400, matching the position information output by the target detection network with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and updating the position information predicted by the Kalman filter based on the matching result.
[0076] In one implementation of this embodiment, the difference value is any one of a difference hash value, a difference mean square error, a difference structural similarity index, a difference peak signal-to-noise ratio, and a difference gradient similarity index. When comparing the difference value with a difference threshold, specifically, the Hamming distance of the difference value is compared with the difference threshold.
[0077] In this embodiment, the difference hash value is used as an example for explanation. In this embodiment, for example, the Hamming distance dHash between the difference hash values of the targets is calculated based on the target detection results and the position information in the Kalman prediction, and the difference between the targets is judged based on the dHash value, thereby determining whether to use a shallow feature vector or a deep feature vector in calculating the similarity of the target appearance features.
[0078] Among them, in the specific implementation of this embodiment, when calculating the Hamming distance dHash between the difference hash values, the comparison target is the detection box output by the target detection network and the prediction box output by the Kalman filter prediction. It is a comparison between multiple targets of the same category (local image blocks), rather than the dHash value calculation between the entire image. This can make better use of shallow features and deep features, while reducing the amount of calculation and effectively ensuring tracking accuracy.
[0079] Exemplarily, the Hamming distance dHash of the difference hash values between the original image blocks of the target rectangular frame area of the previous and next frames is calculated. When the dHash value is greater than or equal to 10, it can be considered that the intra-class difference of the target is large, and a shallow feature vector is suitable for describing the target; when the dHash value is less than 10, it can be considered that the intra-class difference of the target is small, and a deep feature vector is suitable for describing the target.
[0080] In this embodiment, the feature set group is divided into two groups, the shallow feature set group and the deep feature set group. According to the position information output by the target detection network, a mapping relationship between the shallow feature set group, the deep feature set group and the target is established to form a feature vector set group. Then, the difference between the targets in the class is judged based on the Hamming distance (dHash) of the difference hash value. According to the difference, the cosine distance between the feature vectors can be calculated more reasonably, which reduces the amount of calculation and reasonably utilizes the shallow features of the image.
[0081] As can be seen from the above, this embodiment uses the target detection network to obtain features of different scales output by different network layers, and then distributes and processes based on these feature sets and the number of network layers, which are divided into shallow feature set groups and deep feature set groups. In order to facilitate the subsequent calculation of cosine distance, features of different sizes are unified to the same size through upsampling and feature fusion. Since the shallow feature set has a small number of channels and the deep feature set has a large number of channels, the shallow feature vector size generated is small and the deep feature vector size is large. These feature vectors are then aggregated into shallow and deep feature vector sets. According to the target position information in the target detection result, the Hamming distance dHash of the difference hash value between the target Kalman prediction trajectory and the target detection result is calculated. The difference between the targets in the class is judged according to the dHash value. When the difference is large, the shallow feature vector set is used to calculate the similarity between the targets; when the difference is small, the deep feature vector set is used to calculate the similarity between the targets. Such separate processing can improve the calculation efficiency and the accuracy of the similarity calculation of different targets in the class, which is conducive to reducing the ID jump frequency of target tracking after occlusion.
[0082] Figure 6 The flowchart of target matching in the target tracking method based on multi-scale feature sharing in one embodiment of the present application is shown. Figure 6 As shown, in one implementation of the present embodiment, matching the position information output by the target detection network with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and updating the position information predicted by the Kalman filter based on the matching result includes at least the following steps S410 and S460.
[0083] Step S410, performing cascade matching based on the determined shallow feature vector or the deep feature vector, obtaining the similarity between the target frame output by the target detection network and the target frame predicted by the Kalman filter, and obtaining a similarity matching result based on the similarity.
[0084] Step S460: updating the position information predicted by the Kalman filter based on the matching result. Specifically, updating the position information predicted by the Kalman filter based on the similarity matching result.
[0085] In this embodiment, in cascade matching, the cosine distance, i.e., similarity, of the feature vectors of two targets is calculated. The similarity value range is generally between [0, 2]. The closer to 0, the more similar the two targets are. Conversely, the closer to 2, the less similar the two targets are.
[0086] like Figure 6 As shown, in an implementation manner of this embodiment, the updating of the position information predicted by the Kalman filter based on the matching result may also include the following steps S420 to S460.
[0087] Step S420, calculating the overlapping area between the target box output by the target detection network and the target box predicted by the Kalman filter;
[0088] Step S430, comparing the overlap area with an overlap threshold:
[0089] Step S440, when the overlapping area is greater than or equal to the overlapping threshold, performing IOU matching on the target frame output by the target detection network and the target frame predicted by the Kalman filter, obtaining an IOU matching result, and updating the position information predicted by the Kalman filter based on the IOU matching result;
[0090] Step S450, when the overlapping area is less than the overlapping threshold, perform Euclidean distance matching on the target frame output by the target detection network and the target frame predicted by the Kalman filter, obtain a Euclidean distance matching result, and update the position information predicted by the Kalman filter based on the Euclidean distance matching result.
[0091] When the relative motion speed between the target and the camera is high, or the ground is bumpy, the frame rate is too low or the target speed is too fast, resulting in a small overlap area between the same target detection frame and the Kalman prediction frame between two adjacent frames in target detection, or even no overlap, resulting in unreasonable calculation of IOU matching under normal procedures. In this embodiment, the overlapping area between the trajectory and the detection frame is calculated, and an overlapping threshold is set to determine whether IOU matching is needed. If the overlapping area is greater than the overlapping threshold, IOU matching is performed, otherwise, Euclidean distance matching is performed directly. This setting avoids the unreasonable IOU matching caused by the above problem, thereby improving the accuracy of target tracking.
[0092] Figure 7 The following is a schematic diagram showing the implementation principle of a target tracking method based on multi-scale feature sharing according to an embodiment of the present application. Figure 7 As shown, first, based on the feature extraction network in the target detection model, an image sequence of size 640x640x3 is input, and feature atlases of five scales of 320x320xC1, 160x160xC2, 80x80xC3, 40x40xC4, and 20x20xC5 are output, where C1-C5 are the number of channels of each scale feature.
[0093] In this embodiment, the features of the multi-scale feature set group are given to the detection head of the target detection model to classify and locate the target, and the position information and category information of the target are obtained, which are used as basic information for subsequent tracking. The target detection information of the first frame is used to initialize the Kalman filter. Considering that the general Kalman filter only tracks people in the tracking algorithm, the state space variable definition in this embodiment is [x, y, a, h, vx, vy, va, vh], where x and y are the coordinates of the center point of the target frame, a is the aspect ratio, h is the height of the frame, and the following four are the speed definitions of the corresponding variables in the state space.
[0094] Because multi-category tracking involves not only people but also other categories, and the motion changes are relatively large, it is not reasonable to use the aspect ratio and simple height as variables. Therefore, in this embodiment, the width and height of the target frame are used as variable definitions at the same time, that is, the initialization state space variable is defined as: [x, y, w, h, vx, vy, vw, vh], and then Kalman filter prediction is performed based on the information of historical frame target detection.
[0095] In this embodiment, illustratively, features of sizes 320x320 and 160x160 are defined as shallow feature set groups, and features of sizes 80x80, 40x40, and 20x20 are defined as deep feature set groups. Based on the target coordinates and category information output by the target detection model, it is assumed that the position information of a certain target frame is [x0, y0, w, h], where x0, y0 are the center point coordinates of the target frame, and w, h are the width and height of the target frame. For subsequent calculations, the position information is converted to the upper left corner and lower right corner of the target frame. The converted position information is [x1, y1, x2, y2]. The target position conversion formula is as follows:
[0096]
[0097] Since the resolution of the feature maps of the last two layers in the deep features is very small, when the small target is mapped to the feature map, the target position error is large. In order to better preserve the high-level semantic information in the deep features, all deep feature atlases are upsampled to a uniform size of 80x80, and the shallow feature atlases remain unchanged. Now establish the mapping relationship between the target position information from the original image to the feature atlas, and obtain the target position information [x1', y1', x2', y2'] on the feature map. Assuming that the input image size is s1xs1, the feature size is s2xs2, and the mapping coefficient is r, the specific mapping formula is as follows:
[0098]
[0099] According to the target position conversion formula on the above feature map, in the shallow feature set, there are C1 feature maps of size 320x320 and C2 feature maps of size 160x160. The standard deviation of the N target frame position areas in each feature map is calculated to obtain two matrices Nx1xC1 and Nx1xC2. These two matrices are then fused and concatenated to obtain the shallow feature vector Nx1x(C1+C2) of the target; in the deep feature set, all are feature maps of size 80x80, with a total of C3+C4+C5. Similarly, the standard deviation of the N target frame position areas in each feature map is calculated to obtain the deep feature vector Nx1x(C3+C4+C5) of the N targets.
[0100] Therefore, for the shallow feature set, there are C1 feature maps of size 320x320 and C2 feature maps of size 160x160. The standard deviation is calculated for each feature map to obtain two matrices 1xC1 and 1xC2. These two matrices are then fused and concatenated to obtain the shallow feature vector 1x(C1+C2) of the target; for the deep feature set, all are feature maps of size 80x80, with a total of C3+C4+C5. The standard deviation is also calculated for each feature map to obtain the deep feature vector 1x(C3+C4+C5) of the target.
[0101] In order to better describe the similarity between targets, in this embodiment, the intra-class difference is first calculated, and the Hamming distance dHash of the difference hash value between the original image blocks of the target rectangular frame area of the previous and next frames is directly calculated. When the dHash value is greater than or equal to 10, it can be considered that the intra-class difference of the target is large, and a shallow feature vector is suitable for describing the target; when the dHash value is less than 10, it can be considered that the intra-class difference of the target is small, and a deep feature vector is suitable for describing the target.
[0102] Then, the position information output by the target detection network is matched with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector. In this embodiment, this step is completed in cascade matching, and the cosine distance, i.e., similarity, of the two target feature vectors is calculated. The value range is generally between [0, 2]. The closer to 0, the more similar the two targets are. Conversely, the closer to 2, the less similar the two targets are.
[0103] Usually, the result of Kalman filter prediction and the result of target detection are used to generate feature vectors, which are then sent to cascade matching for similarity calculation, and then IOU matching is performed. IOU matching refers to the area ratio calculation of two overlapping target frames. In actual situations, due to reasons such as fast target speed, camera freeze, severe ground bumps, etc., the target frames of the same target in the previous frame and the current frame do not overlap. At this time, calculating IOU matching again will appear unreasonable and will cause ID jumps during target tracking. In this embodiment, an overlap threshold β is set. For example, 1 / 4 of the area of the target frame predicted by the Kalman filter is used as the value of the overlap threshold β, and IOU matching is performed with the detection result of the current frame. When the overlapping area between the target frames is greater than β, IOU matching is used; when the overlapping area between the target frames is less than β, Euclidean distance matching is used. The process of Euclidean distance matching is as follows:
[0104] Take the center point and four corner points of the target box, and calculate the coordinate information of the upper right corner (x3, y3) and lower left corner (x4, y4) of the target box according to the above target position conversion formula. The specific calculation formula is as follows:
[0105]
[0106] [(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x0,y0)] These are the five points of target detection. The five points predicted by the Kalman filter are [(x1”,y1”),(x2”,y2”),(x3”,y3”),(x4”,y4”),(x0”,y0”)], and the specific calculation formula is as follows:
[0107]
[0108] Finally, the results of cascade matching, IOU matching and Euclidean distance matching are comprehensively considered, the Kalman filter is updated for the matched and confirmed trajectories, and the unmatched and unconfirmed trajectories are deleted.
[0109] The protection scope of the target tracking method based on multi-scale feature sharing described in the embodiment of the present application is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.
[0110] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the target tracking method based on multi-scale feature sharing provided in any embodiment of the present application is implemented.
[0111] In the embodiment of the present application, any combination of one or more storage media can be used. The storage medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0112] An embodiment of the present application also provides an electronic device. Figure 8 Shown is a schematic diagram of the structure of the electronic device 100 provided in the embodiment of the present application. In some embodiments, the electronic device may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA) and other terminal devices. In addition, the target tracking method based on multi-scale feature sharing provided in the present application can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. The embodiment of the present application does not impose any restrictions on the specific application scenarios of the target tracking method based on multi-scale feature sharing.
[0113] like Figure 8 As shown, the electronic device 100 provided in the embodiment of the present application includes a memory 101 and a processor 102 .
[0114] The memory 101 is used to store computer programs; preferably, the memory 101 includes: ROM, RAM, disk, USB flash drive, memory card or CD-ROM and other media that can store program codes.
[0115] Specifically, the memory 101 may include a computer system readable medium in the form of a volatile memory, such as a random access memory (RAM) and / or a cache memory. The electronic device 100 may further include other removable / non-removable, volatile / non-volatile computer system storage media. The memory 101 may include at least one program product having a set (e.g., at least one) of program modules, which are configured to perform the functions of the various embodiments of the present application.
[0116] The processor 102 is connected to the memory 101 and is used to execute the computer program stored in the memory 101 so that the electronic device 100 executes the target tracking method based on multi-scale feature sharing provided in any embodiment of the present application.
[0117] Optionally, the processor 102 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0118] Optionally, the electronic device 100 in this embodiment may further include a display 103. The display 103 is communicatively connected with the memory 101 and the processor 102, and is used to display a GUI interaction interface related to the target tracking method based on multi-scale feature sharing.
[0119] In summary, the present application utilizes the feature set group in the target detection process to obtain feature atlases of different scales, performs multi-scale feature upsampling and fusion, and uses it as the target feature vector extraction in tracking. Compared with using a neural network alone to output the feature vector of the target, it is more efficient and accurate, and can effectively improve the computational efficiency of target tracking and improve the accuracy of similarity calculation of different targets; in the present application, the feature set group in the target detection process is divided into two groups, shallow and deep, to construct corresponding shallow feature vectors and deep feature vectors, and then the difference between the two frames of targets is judged based on the Hamming distance of the difference value of the target of the previous and next frames. According to this difference, the cosine distance between the feature vectors can be more reasonably calculated, which reduces the amount of calculation and reasonably utilizes the shallow features of the image; in the present application, an overlap threshold is set to determine whether IOU matching is needed. If the overlap area is greater than the overlap threshold, IOU matching is performed, otherwise, Euclidean distance matching is performed directly. Such a setting can solve the problem of unreasonable IOU matching in the prior art, thereby improving the accuracy of target tracking. Therefore, the present application effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.
[0120] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A target tracking method based on multi-scale feature sharing, characterized in that: include: Acquire feature atlases of different scales based on the target detection network, and divide the feature atlases into a shallow feature set group and a deep feature set group based on feature types; Based on the position information output by the target detection network, generate a shallow feature vector and a deep feature vector corresponding to the shallow feature set group and the deep feature set group respectively; Determine whether to use the shallow feature vector or the deep feature vector to calculate the similarity of the targets in the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter; The position information output by the target detection network is matched with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and the position information predicted by the Kalman filter is updated based on the matching result.
2. The target tracking method based on multi-scale feature sharing according to claim 1, characterized in that: The generating of the shallow feature vector and the deep feature vector corresponding to the shallow feature set group and the deep feature set group respectively based on the position information output by the target detection network comprises: The target position of the feature map in the shallow feature set group and the deep feature set group is obtained based on the target position and mapping coefficient output by the target detection network; wherein the target position of the feature map = the target position output by the target detection network / Mapping coefficients; Based on the target positions of the feature maps in the shallow feature set group and the deep feature set group, each feature map in the shallow feature set group and the deep feature set group is calculated to obtain a corresponding shallow feature vector and a deep feature vector.
3. The target tracking method based on multi-scale feature sharing according to claim 2 is characterized in that: Calculating each feature map in the shallow feature set group to obtain the corresponding shallow feature vector includes: Calculating each target frame position area in each feature map in each shallow feature set group respectively to obtain a shallow feature matrix corresponding to each shallow feature set group; The shallow feature matrices are fused and concatenated to obtain shallow feature vectors.
4. The target tracking method based on multi-scale feature sharing according to claim 2, characterized in that: Calculating each feature map in the deep feature set group to obtain a corresponding deep feature vector includes: Upsampling each feature map in the deep feature map set to a uniform size to form feature maps of the same size; Calculate each target frame position area in each feature map in each of the deep feature set groups to obtain a deep feature vector.
5. The target tracking method based on multi-scale feature sharing according to claim 1, characterized in that: The determining whether to use the shallow feature vector or the deep feature vector to calculate the similarity of the targets of the previous and next frames based on the position information output by the target detection network and the position information predicted by the Kalman filter comprises: Calculate the difference between the previous and next frames of the target based on the position information output by the target detection network and the position information predicted by the Kalman filter; Compare the difference value to a difference threshold: When the difference value is greater than or equal to the difference threshold, determining to use the shallow feature vector to calculate the similarity of the objects in the previous and next frames; When the difference value is less than the difference threshold, it is determined to use the deep feature vector to calculate the similarity between the previous and next frame targets.
6. The target tracking method based on multi-scale feature sharing according to claim 5, characterized in that: The difference value is any one of a difference hash value, a difference mean square error, a difference structural similarity index, a difference peak signal-to-noise ratio, and a difference gradient similarity index.
7. The target tracking method based on multi-scale feature sharing according to claim 1, characterized in that: Matching the position information output by the target detection network with the position information predicted by the Kalman filter based on the determined shallow feature vector or the deep feature vector, and updating the position information predicted by the Kalman filter based on the matching result includes: Performing cascade matching based on the determined shallow feature vector or the deep feature vector, obtaining the similarity between the target frame output by the target detection network and the target frame predicted by the Kalman filter, and obtaining a similarity matching result based on the similarity; The position information predicted by the Kalman filter is updated based on the similarity matching result.
8. The target tracking method based on multi-scale feature sharing according to claim 7, characterized in that: The updating of the position information predicted by the Kalman filter based on the matching result also includes: Calculate the overlapping area between the target box output by the target detection network and the target box predicted by the Kalman filter; Compare the overlap area to the overlap threshold: When the overlapping area is greater than or equal to the overlapping threshold, performing IOU matching on the target frame output by the target detection network and the target frame predicted by the Kalman filter, obtaining an IOU matching result, and updating the position information predicted by the Kalman filter based on the IOU matching result; When the overlapping area is smaller than the overlapping threshold, the target frame output by the target detection network and the target frame predicted by the Kalman filter are subjected to Euclidean distance matching to obtain a Euclidean distance matching result, and the position information predicted by the Kalman filter is updated based on the Euclidean distance matching result.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the target tracking method based on multi-scale feature sharing described in any one of claims 1 to 8 is implemented.
10. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The memory stores program instructions; The processor is used to run the program instructions to execute the target tracking method based on multi-scale feature sharing as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Online multi-target tracking method based on multi-feature optimal association
CN109859238A
Target tracking method, device and equipment and storage medium
CN110956646A
Target object detection method and device, computer equipment and storage medium
CN112766244A
Fingertip tracking method based on deep learning and K-curvature method
CN113608663A
Multi-target tracking detection method based on frame difference time sequence motion information
CN114419102A
