Network depth dynamic adjustment method, device, computer equipment and storage medium
By embedding the feature encoder and Gaussian mixture model in the target tracking network, and using the mutual information estimation function to dynamically adjust the depth, the problem of waste of computing resources and low efficiency of the traditional target tracking network under different inputs is solved, and it is realized on the edge computing platform. Efficient target tracking.
Patent Information
- Application Number
- CN202210669443.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-14
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-06-14
AI Technical Summary
Traditional target tracking deep neural networks waste computing resources and are inefficient when processing different inputs. Especially on edge computing platforms with high real-time and economic requirements, they are difficult to deploy.
Embed feature encoders, feature decoders and pre-trained Gaussian mixture models in each deep output layer of the target tracking network, train the feature encoders and decoders through mutual information estimation functions and training sets, and dynamically adjust the network depth to adapt to the input The complexity of the video frame enables fast tracking of the output of the target position.
Without additional supervision data, the target tracking network obtains the ability to estimate complexity distribution through mutual information estimation, dynamically adjusts the calculation depth, takes into account calculation efficiency and prediction accuracy, and quickly outputs target tracking results.
Smart Images

Figure CN114997373B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of data processing technology and deep learning technology, and in particular to a method, device, computer equipment and storage medium for dynamic adjustment of network depth. Background Art
[0002] Deep Neural Networks (DNN) have greatly promoted the research progress of target tracking. Although the increase in network depth has improved the network's feature expression ability, not all inputs require the same deep network structure to process. When input samples are input into traditional target tracking deep neural networks for inference calculations, all inputs are calculated using computing modules of the same depth. When simple data (such as images with very simple backgrounds) are input into a particularly deep target tracking network, it will not only cause a waste of computing resources, but also reduce the computing efficiency of the target tracking network, which is not conducive to the deployment of the model on platforms with high requirements for real-time and economy, such as edge computing platforms. The traditional mainstream target tracking method based on deep neural networks has a large model structure and a long calculation time, which greatly reduces the output efficiency of the target tracking results. Summary of the invention
[0003] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for dynamically adjusting network depth to solve the low efficiency of target tracking in response to the above technical problems.
[0004] A method for dynamically adjusting network depth, the method comprising:
[0005] A feature encoder, a feature decoder and a pre-trained Gaussian mixture model are embedded in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network;
[0006] Obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction to obtain original features, and construct a training set according to the original features corresponding to each target video frame;
[0007] Inputting the original feature into the feature encoder to obtain a complexity feature, constructing a first mutual information estimation function between sample complexity and the complexity feature, constructing a second mutual information estimation function between the original feature and the complexity feature, and constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function;
[0008] The feature encoder and the feature decoder are trained according to the objective function and the training set, and the original features corresponding to the target video frame to be tracked are input into the trained feature encoder and feature decoder to obtain the optimal complexity features corresponding to the target video frame to be tracked;
[0009] The optimal complexity feature is input into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer.
[0010] In one of the embodiments, the method further includes: when the Gaussian distribution probability of complex samples in the complexity distribution is lower than the Gaussian distribution probability of simple samples, outputting the tracking target position in the target video frame to be tracked in the current depth output layer.
[0011] In one of the embodiments, it also includes: training the feature encoder and the feature decoder according to the objective function and the training set, maximizing the objective function by maximizing the first mutual information estimation function and minimizing the second mutual information estimation function, and obtaining the trained feature encoder and feature decoder when the objective function is maximized.
[0012] In one embodiment, the method further includes: performing variational estimation on the posterior distribution of the sample complexity with respect to the complexity feature in the first mutual information estimation function, approximating the lower bound of the first mutual information estimation function as the correlation between the complexity feature and the sample task loss, and obtaining the lower bound of the first mutual information estimation function; the lower bound of the first mutual information estimation function is:
[0013] MI(γ,z)≥E z~p(z│x) logq(γ│z)
[0014] E z~p(z│x) logq(γ|z)≈E z~p(z│x) ||π(L|z)-L||
[0015] Among them, MI(γ,z) represents the first mutual information estimation function, γ represents sample complexity, z represents complexity features, E represents expectation operation, z~p(z|x) represents sampling complexity features from the posterior distribution of complexity features with respect to original features, p(z|x) represents the posterior distribution of complexity features with respect to original features, acts as a feature encoder in the multi-exit target tracking network, p(γ|z) represents the posterior distribution of sample complexity with respect to complexity features, q(γ|z) represents the variational estimate of p(γ|z), π(L|z) is the feature decoder, L represents the sample task loss, ||·|| represents the norm; the first mutual information estimation function is maximized by maximizing the lower bound of the first mutual information estimation function.
[0016] In one embodiment, the method further includes: calculating the posterior distribution of the complexity feature with respect to the original feature, and calculating the relative entropy between the posterior distribution and the prior distribution of the complexity feature, so that the upper bound of the second mutual information estimation function is obtained as follows:
[0017] MI(x,z)≤KL(p(z|x)||r(z))
[0018] Among them, MI(x,z) represents the second mutual information estimation function, z represents the complexity feature, x represents the original feature, MI represents mutual information, KL represents relative entropy, and r(z) represents the prior distribution of the complexity feature; the second mutual information estimation function is minimized by minimizing the upper bound of the second mutual information estimation function.
[0019] In one embodiment, the method further includes: constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function:
[0020] J=MI(γ,z)-βMI(x,z)=E z~p(z│x) ||π(L|z)-L||-βKL(p(z|x)||r(z))
[0021] Wherein, J represents the objective function, MI(γ,z) represents the first mutual information estimation function, and MI(x,z) represents the second mutual information estimation function.
[0022] In one of the embodiments, it also includes: constructing a Gaussian mixture model training set based on multiple optimal complexity features; training Gaussian mixture model parameters based on the Gaussian mixture model training set and the maximum expectation algorithm to obtain a trained Gaussian mixture model.
[0023] A network depth dynamic adjustment device, the device comprising:
[0024] A network building module is used to embed feature encoders, feature decoders and pre-trained Gaussian mixture models in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network;
[0025] A training set construction module is used to obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction to obtain original features, and construct a training set according to the original features corresponding to each target video frame;
[0026] An objective function construction module, used for inputting the original feature into the feature encoder to obtain a complexity feature, constructing a first mutual information estimation function between sample complexity and the complexity feature, constructing a second mutual information estimation function between the original feature and the complexity feature, and constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function;
[0027] A network training module, used for training the feature encoder and the feature decoder according to the objective function and the training set, inputting the original features corresponding to the target video frame to be tracked into the trained feature encoder and feature decoder, and obtaining the optimal complexity features corresponding to the target video frame to be tracked;
[0028] The result output module is used to input the optimal complexity feature into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, output the tracking target position in the target video frame to be tracked in the current depth output layer.
[0029] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0030] A feature encoder, a feature decoder and a pre-trained Gaussian mixture model are embedded in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network;
[0031] Obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction to obtain original features, and construct a training set according to the original features corresponding to each target video frame;
[0032] Inputting the original feature into the feature encoder to obtain a complexity feature, constructing a first mutual information estimation function between sample complexity and the complexity feature, constructing a second mutual information estimation function between the original feature and the complexity feature, and constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function;
[0033] The feature encoder and the feature decoder are trained according to the objective function and the training set, and the original features corresponding to the target video frame to be tracked are input into the trained feature encoder and feature decoder to obtain the optimal complexity features corresponding to the target video frame to be tracked;
[0034] The optimal complexity feature is input into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer.
[0035] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0036] A feature encoder, a feature decoder and a pre-trained Gaussian mixture model are embedded in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network;
[0037] Obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction to obtain original features, and construct a training set according to the original features corresponding to each target video frame;
[0038] Inputting the original feature into the feature encoder to obtain a complexity feature, constructing a first mutual information estimation function between sample complexity and the complexity feature, constructing a second mutual information estimation function between the original feature and the complexity feature, and constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function;
[0039] The feature encoder and the feature decoder are trained according to the objective function and the training set, and the original features corresponding to the target video frame to be tracked are input into the trained feature encoder and feature decoder to obtain the optimal complexity features corresponding to the target video frame to be tracked;
[0040] The optimal complexity feature is input into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer.
[0041] The above-mentioned network depth dynamic adjustment method, device, computer equipment and storage medium can estimate the complexity distribution of the input target video frame by embedding a feature encoder, a feature decoder and a pre-trained Gaussian mixture model in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network, so as to quickly output the target tracking result. Specifically, the original features in the target video frame sequence are extracted through the target tracking network, a training set is constructed according to the original features, and the feature encoder and feature decoder are trained by the objective function estimated by mutual information and the training set, so that the original features corresponding to the target video frame to be tracked are input into the trained feature encoder and feature decoder, and the target video frame to be tracked can be obtained. The optimal complexity feature, wherein the objective function is constructed according to the first mutual information estimation function and the second mutual information estimation function, the complexity feature that can correctly reflect the sample complexity is obtained through the first mutual information estimation function between the sample complexity and the complexity feature, the redundant information in the original feature can be obtained through the second mutual information estimation function between the complexity feature and the original feature, the optimal complexity feature is obtained by maximizing the objective function, and then the optimal complexity feature is input into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer of the multi-exit target tracking network. In the embodiment of the present invention, the multi-exit target tracking network obtains the estimation capability of the complexity distribution of the target video frame to be tracked through mutual information estimation without the need for additional supervision data, can dynamically adjust the calculation depth of the target video frame to be tracked according to the complexity distribution of the target video frame to be tracked, reasonably allocates the corresponding calculation amount according to the complexity of the target video frame to be tracked, can better balance the calculation efficiency and prediction accuracy, and quickly output the target tracking result. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A flowchart of a method for dynamically adjusting network depth in one embodiment;
[0043] Figure 2 It is a flowchart of a method for dynamically adjusting network depth in a specific embodiment;
[0044] Figure 3 A schematic diagram of a network structure of a multi-exit target tracking network in one embodiment;
[0045] Figure 4 It is a schematic diagram of the output results of a deep adaptive target tracking algorithm for samples of different complexity in a specific embodiment;
[0046] Figure 5 It is a structural block diagram of a network depth dynamic adjustment device in one embodiment;
[0047] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clear, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. The method of the present invention estimates the complexity of the sample by constructing a Gaussian mixture model, and dynamically adjusts the depth of the network according to the result of the complexity estimation.
[0049] In one embodiment, Figure 1 As shown, a method for dynamic adjustment of network depth is provided, comprising the following steps:
[0050] Step 102, embedding a feature encoder, a feature decoder and a pre-trained Gaussian mixture model in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network.
[0051] Visual target tracking is an important research direction in computer vision and can be applied to video surveillance, human-computer interaction, unmanned driving and other fields. The target tracking task is to give a target position to be tracked at the initial moment of the video frame. The tracking model needs to continuously track the position changes of the initial target at subsequent moments and output the latest position of the target to be tracked. The method of the present invention can also be applied to task networks. The task network includes a target tracking network, which refers to a deep neural network that can handle related perception tasks such as target detection, target classification, and tracking. The input of the task network can be samples in the form of images such as video frames. By applying the method of the present invention to the task network, a multi-exit task network can be obtained. The reasoning depth of the network is dynamically adjusted according to the complexity of the input or task. A shallow sub-model is used for simple samples, and a deeper model is used for complex samples to meet the extraction requirements of complex features. This efficient and scalable computing model is more similar to the human perception system. It not only takes into account both the reasoning efficiency and the expressiveness of the model, but is also more interpretable.
[0052] Step 104, obtain a target video frame sequence, input each target video frame in the target video frame sequence into a target tracking network for feature extraction, obtain original features, and construct a training set according to the original features corresponding to each target video frame.
[0053] The original features of each target video frame in the target video frame sequence are extracted through a pre-trained target tracking network to construct a training set for training a feature encoder and a feature decoder.
[0054] Step 106, input the original features into the feature encoder to obtain complexity features, construct a first mutual information estimation function between sample complexity and complexity features, construct a second mutual information estimation function between the original features and complexity features, and construct an objective function based on the first mutual information estimation function and the second mutual information estimation function.
[0055] In probability theory and information theory, the mutual information (MI) between two random variables is a measure of the mutual dependence between variables. Mutual information can measure the correlation between two sets of events. Unlike the correlation coefficient, mutual information is not limited to real-valued random variables. It is more general and determines the similarity of the product of the joint distribution and the decomposed marginal distribution.
[0056] The first mutual information estimation function represents the mutual information between the complexity feature and the sample complexity. The purpose of constructing the first mutual information estimation function is to make the correlation between the complexity feature and the sample complexity as large as possible, so as to obtain the sample feature that can correctly reflect the sample complexity, that is, the optimal complexity feature. The second mutual information estimation function represents the mutual information between the complexity feature and the original feature. The purpose of constructing the second mutual information estimation function is to make the mutual information between the complexity feature and the original feature as small as possible, so as to obtain redundant information that is irrelevant to the target tracking network and the retrograde tracking task. The objective function is maximized by maximizing the first mutual information estimation function and minimizing the second mutual information estimation function.
[0057] Step 108, training the feature encoder and feature decoder according to the objective function and the training set, inputting the original features corresponding to the target video frame to be tracked into the trained feature encoder and feature decoder, and obtaining the optimal complexity features corresponding to the target video frame to be tracked.
[0058] By maximizing the objective function, the complexity feature can correctly reflect the sample complexity. Therefore, by maximizing the objective function, a feature encoder and feature decoder that can extract the optimal complexity feature can be obtained, which is convenient for subsequent learning.
[0059] Step 110, input the optimal complexity feature into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, output the tracking target position in the target video frame to be tracked in the current depth output layer.
[0060] The Gaussian Mixture Model (GMM) can distinguish simple samples from complex samples. It defines that the distribution of simple samples and complex samples obeys two Gaussian distributions: (θ1, θ2), then the marginal probability distribution of the sample is:
[0061]
[0062] Among them, x is the original feature, F is the feature encoder, p(θ i ) is the prior probability of Gaussian distribution, p(F(x)|θ i ) is the Gaussian density function, μ is the data mean, σ is the data standard deviation, and the predicted complexity distribution z~(μ,σ). In the actual calculation process, the data mean of the predicted distribution is used as the complexity feature. The probability that the sample belongs to the simple category is the simple sample Gaussian distribution probability P(x,θ1), and the probability that the sample belongs to the complex category is the complex sample Gaussian distribution probability P(x,θ2). The simple sample Gaussian distribution probability and the complex sample Gaussian distribution probability are both joint probabilities. By exploring the mutual information between the complexity feature F(x) and the sample complexity, a Gaussian mixture model that can reflect the sample complexity is estimated / trained. The complexity distribution of the target video frame to be tracked is estimated through the trained Gaussian mixture model. When the target video frame to be tracked is judged as a simple sample according to the preset conditions, the result is output at the current depth of the multi-exit target tracking network, thereby realizing the control of the calculation depth of the simple sample and improving the calculation efficiency of the multi-exit target tracking network.
[0063] In the above-mentioned network depth dynamic adjustment method, by embedding a feature encoder, a feature decoder and a pre-trained Gaussian mixture model in the output layer of each depth of the target tracking network, a multi-exit target tracking network is obtained, and the complexity distribution of the input target video frame can be estimated, so as to quickly output the target tracking result. Specifically, the original features in the target video frame sequence are extracted through the target tracking network, a training set is constructed according to the original features, and the feature encoder and feature decoder are trained by the objective function estimated by mutual information and the training set, so that the original features corresponding to the target video frame to be tracked are input into the trained feature encoder and feature decoder, and the optimal complexity features corresponding to the target video frame to be tracked can be obtained. Characteristic, wherein the objective function is constructed according to the first mutual information estimation function and the second mutual information estimation function, through the first mutual information estimation function between the sample complexity and the complexity feature, the complexity feature that can correctly reflect the sample complexity is obtained, through the second mutual information estimation function between the complexity feature and the original feature, the redundant information in the original feature can be obtained, and the optimal complexity feature is obtained by maximizing the objective function, and then the optimal complexity feature is input into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer of the multi-exit target tracking network. In the embodiment of the present invention, without the need for additional supervisory data, the multi-exit target tracking network obtains the ability to estimate the complexity distribution of the target video frame to be tracked through mutual information estimation, can dynamically adjust the calculation depth of the target video frame to be tracked according to the complexity distribution of the target video frame to be tracked, reasonably allocates the corresponding calculation amount according to the complexity of the target video frame to be tracked, can better balance the calculation efficiency and prediction accuracy, and quickly output the target tracking result.
[0064] In one embodiment, Figure 2As shown, a flow chart of a network depth dynamic adjustment method is provided. When the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer, including: when the Gaussian distribution probability of complex samples in the complexity distribution is lower than the Gaussian distribution probability of simple samples, the tracking target position in the target video frame to be tracked is output in the current depth output layer. In this embodiment, the Gaussian distribution probability of a simple sample is the probability of belonging to a simple category, represented by P(x, θ1), and the Gaussian distribution probability of a complex sample is the probability of belonging to a complex category, represented by P(x, θ2). The target video frame to be tracked is input into the multi-exit target tracking network. When the multi-exit target tracking network model is inferred to the Nth layer network, the complexity distribution of the target video frame to be tracked is obtained through the encoder, decoder and Gaussian mixture model in the current depth output layer according to the original features extracted by the target tracking network. When the probability of belonging to a complex category is higher than the probability of belonging to a simple category, let N=N+1, and continue to use a deeper network to calculate the complex target video frame to be tracked. When the probability of belonging to a complex category is lower than the probability of belonging to a simple category, the inference is terminated and the position of the target to be tracked is output. In this embodiment, a simple sample can output the position of the target to be tracked in the shallow sub-model of the multi-exit target tracking network, and a complex sample must undergo a deeper calculation to output the corresponding position of the target to be tracked.
[0065] In one embodiment, the step of training the feature encoder and the feature decoder according to the objective function and the training set includes: training the feature encoder and the feature decoder according to the objective function and the training set, maximizing the objective function by maximizing the first mutual information estimation function and minimizing the second mutual information estimation function, and obtaining the trained feature encoder and feature decoder when the objective function is maximized.
[0066] In this embodiment, in order to obtain a Gaussian model that can estimate the sample complexity distribution, the first problem to be solved is to obtain a complexity feature that can correctly reflect the sample complexity distribution. The sample complexity of the sample is defined to obey a certain unknown joint distribution p(γ,x), and the complexity feature of the sample after being encoded by the feature encoder is defined as z=F(x). According to the information compression theory, the joint probability density function of the three is:
[0067] p(γ,x,z)=p(z)p(γ|z)p(x|z)
[0068] Among them, γ is the sample complexity, x is the input sample, and z is the complexity feature. The present invention uses the complexity feature as the feature of estimating Gaussian distribution. In order to make the sample feature reflect the complexity information of the sample itself as much as possible, it is necessary to maximize the mutual information between the sample feature and the sample complexity. At the same time, the original feature contains a lot of redundant information, so it is necessary to compress the mutual information between the original feature and the complexity feature within a certain range, then:
[0069] J = MI(γ,z) - βMI(x,z)
[0070] Among them, J is the objective function, MI(γ,z) represents the mutual information between sample features and sample complexity, that is, the first mutual information estimation function, MI(x,z) represents the mutual information between input samples and sample features, that is, the second mutual information estimation function, and β is the weight coefficient.
[0071] In one embodiment, the step of maximizing the first mutual information estimation function includes:
[0072] The variational estimation is performed on the posterior distribution of the sample complexity with respect to the complexity feature in the first mutual information estimation function, and the lower bound of the first mutual information estimation function is approximated as the correlation between the complexity feature and the sample task loss, and the lower bound of the first mutual information estimation function is obtained; the lower bound of the first mutual information estimation function is:
[0073] MI(γ,z)≥E z~p(z│x) logq(γ│z)
[0074] E z~p(z│x) logq(γ|z)≈E z~p(z│x) ||π(L|z)-L||
[0075] Among them, MI(γ,z) represents the first mutual information estimation function, γ represents sample complexity, z represents complexity features, E represents expectation operation, z~p(z|x) represents sampling complexity features from the posterior distribution of complexity features with respect to original features, p(z|x) represents the posterior distribution of complexity features with respect to original features, acts as a feature encoder in the multi-exit target tracking network, p(γ|z) represents the posterior distribution of sample complexity with respect to complexity features, q(γ|z) represents the variational estimate of p(γ|z), π(L|z) is the feature decoder, L represents the sample task loss, and ||·|| represents the norm; the first mutual information estimation function is maximized by maximizing the lower bound of the first mutual information estimation function.
[0076] The specific derivation process of obtaining the lower bound of the first mutual information estimation function is as follows:
[0077] S10: performing variational estimation on the posterior distribution of the sample complexity with respect to the complexity feature in the first mutual information estimation function.
[0078]
[0079] Among them, H(γ) represents the information entropy of the sample complexity of the data set. H(γ) is an inherent attribute of the data set and can be considered as a constant value. Therefore, the above optimization objective can be simplified as:
[0080]
[0081] In the actual calculation process, p(x)p(γ|x)=p(x,γ) is the statistical property of the data set and can be ignored. Data sampling is used to replace the joint distribution p(x,γ). q(γ|z) is the variational estimate of p(γ|z), which is specifically represented by a small neural network, namely the feature decoder. The above formula can be simplified to optimization:
[0082] MI(γ,z)≥E z~p(z│x) logq(γ│z)
[0083] E represents the expected operation, z~p(z|x) represents sampling the complexity feature from the posterior distribution of the complexity feature with respect to the sample. Since the distribution of the complexity feature with respect to the original feature is not known before, the feature encoder is used as p(z|x), and the feature encoder is learned through training. Maximizing MI(γ,z) is equivalent to maximizing its lower bound E. z~p(z│x) logq(γ│z).
[0084] S12: Approximate the lower bound of the first mutual information estimation function as the correlation between the complexity feature and the sample task loss.
[0085] Maximize E z~p(z│x) logq(γ│z), that is, maximizing the expectation of q(γ│z), q(γ│z) represents the prediction of sample complexity based on complexity characteristics. In actual calculation, the following formula is used for calculation:
[0086] E z~p(z│x) logq(γ|z)≈E z~p(z│x) ||π(L|z)-L||
[0087] Among them, π(L|z) is the feature decoder, which means the loss of predicting samples based on complexity features. The more complex the sample, the higher the loss of the sample. The variational estimation q(γ|z) should make the obtained complexity features estimate the complexity of the sample as accurately as possible. However, since there are no true value samples of sample complexity, the calculation of MI(γ,z) is approximated by maximizing the correlation between sample task loss and complexity features. Sample task loss includes prediction accuracy and regression accuracy.
[0088] In one embodiment, the step of minimizing the second mutual information estimation function includes: calculating the posterior distribution of the complexity feature with respect to the sample, and calculating the relative entropy between the posterior distribution and the prior distribution of the complexity feature, and obtaining the upper bound of the second mutual information estimation function as follows:
[0089] MI(x,z)≤KL(p(z|x)||r(z))
[0090] Among them, MI(x,z) represents the second mutual information estimation function, z represents the complexity feature, x represents the original feature of the sample, MI represents mutual information, KL represents relative entropy, and r(z) represents the prior distribution of the complexity feature; the second mutual information estimation function is minimized by minimizing the upper bound of the second mutual information estimation function.
[0091] The specific derivation process of obtaining the upper bound of the second mutual information estimation function is as follows:
[0092]
[0093] Among them, r(z) is the prior distribution of the complexity feature. r(z) is defined as a standard Gaussian distribution. Minimizing the mutual information between the original feature and the complexity feature is equivalent to minimizing the KL divergence between p(z|x) and the assumed prior distribution.
[0094] In one embodiment, constructing the objective function according to the first mutual information estimation function and the second mutual information estimation function includes: constructing the objective function according to the first mutual information estimation function and the second mutual information estimation function as follows:
[0095] J=MI(γ,z)-βMI(x,z)=E z~p(z│x) ||π(L|z)-L||-βKL(p(z|x)||r(z))
[0096] Wherein, J represents the objective function, MI(γ,z) represents the first mutual information estimation function, and MI(x,z) represents the second mutual information estimation function. In this embodiment, β is a constant, specifically 0.001.
[0097] In one embodiment, the step of training the Gaussian mixture model includes: constructing a Gaussian mixture model training set according to multiple optimal complexity features; training Gaussian mixture model parameters according to the Gaussian mixture model training set and a maximum expectation algorithm to obtain a trained Gaussian mixture model.
[0098] In this embodiment, the Expectation Maximization (EM) algorithm is an iterative algorithm for estimating a probability parameter model containing latent variables, and the Gaussian mixture model is represented by: (θ1, θ2), where θ1 represents a simple sample Gaussian distribution and θ2 represents a complex sample Gaussian distribution. After the feature encoder is trained by maximizing the objective function, the optimal complexity features output by the trained feature encoder will obey two Gaussian distributions, one Gaussian distribution represents the distribution of simple samples, and the other Gaussian distribution represents the distribution of complex samples. A Gaussian mixture model training set is constructed through multiple optimal complexity features, so as to train the Gaussian mixture model so that the trained Gaussian mixture model can output the complexity distribution of the target video frame to be tracked when the optimal complexity features of the target video frame to be tracked are input.
[0099] In a specific embodiment, Figure 3 As shown in FIG. 1 , a schematic diagram of the network structure of a multi-exit target tracking network is provided. Figure 3 In , "input x" means "input original feature", each depth of the multi-exit target tracking network contains an output branch, which is used to output the prediction result of the multi-exit target tracking network at the end of the current depth reasoning, p(z|x) represents the posterior distribution between the complexity feature and the sample, represented by the feature encoder, and the complexity feature can be output by inputting the original feature. q(γ|z) represents the variational estimate of p(γ|z), and p(γ|z) represents the posterior distribution between the sample complexity and the complexity feature, represented by the feature decoder. The feature encoder and feature decoder are trained by the objective function to obtain the feature encoder and feature decoder that can correctly reflect the sample complexity, thereby obtaining the optimal complexity feature. The optimal complexity feature is represented by Z, which can be used to estimate the Gaussian mixture model of the sample complexity distribution. By exploring the mutual information between the complexity feature and the sample complexity, the Gaussian mixture model that can reflect the sample complexity is estimated, and an effective network early exit mechanism is realized, thereby regulating the depth of the network.
[0100] In a specific embodiment, Figure 4 As shown in Figure 1, a schematic diagram of the output results of a deep adaptive target tracking algorithm is provided. Figure 4In the figure, p(γ|z) represents the conditional distribution between sample complexity and complexity features, C represents the Gaussian distribution of complex categories, and E represents the Gaussian distribution of simple categories. The background of the left figure is complex and there is interference. At the first output branch, it is determined that the complexity feature z belongs to the Gaussian distribution of the complex category, and a deeper network is needed for reasoning; the input background of the right figure is simpler, so it exits at the first output branch. In this embodiment, in the reasoning stage, the estimate of sample complexity is obtained according to the joint distribution probability of the optimal complexity feature Z and the Gaussian mixture model, and then the depth of the network is adjusted, which can effectively take into account the prediction accuracy of the task network and the computational storage efficiency.
[0101] It should be understood that although Figure 1-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0102] In one embodiment, Figure 5 As shown, a network depth dynamic adjustment device is provided, including: a network construction module 502, a training set construction module 504, an objective function construction module 506, a network training module 508 and a result output module 510, wherein:
[0103] A network construction module 502 is used to embed a feature encoder, a feature decoder and a pre-trained Gaussian mixture model in an output layer of each depth of the target tracking network to obtain a multi-exit target tracking network;
[0104] The training set construction module 504 is used to obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction, obtain original features, and construct a training set according to the original features corresponding to each target video frame;
[0105] An objective function construction module 506 is used to input the original feature into the feature encoder to obtain the complexity feature, construct a first mutual information estimation function between the sample complexity and the complexity feature, construct a second mutual information estimation function between the original feature and the complexity feature, and construct an objective function according to the first mutual information estimation function and the second mutual information estimation function;
[0106] The network training module 508 is used to train the feature encoder and the feature decoder according to the objective function and the training set, input the original features corresponding to the target video frame to be tracked into the trained feature encoder and the feature decoder, and obtain the optimal complexity features corresponding to the target video frame to be tracked;
[0107] The result output module 510 is used to input the optimal complexity feature into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked. When the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer.
[0108] In one of the embodiments, the result output module 510 is further configured to output the tracking target position in the target video frame to be tracked at the current depth output layer when the Gaussian distribution probability of the complex samples in the complexity distribution is lower than the Gaussian distribution probability of the simple samples.
[0109] In one embodiment, the network training module 508 is also used to train the feature encoder and feature decoder according to the objective function and the training set, by maximizing the first mutual information estimation function and minimizing the second mutual information estimation function to maximize the objective function. When the objective function is maximized, the trained feature encoder and feature decoder are obtained.
[0110] In one embodiment, the objective function construction module 506 is further used to perform variational estimation on the posterior distribution of the sample complexity with respect to the complexity feature in the first mutual information estimation function, and approximate the lower bound of the first mutual information estimation function as the correlation between the complexity feature and the sample task loss, thereby obtaining the lower bound of the first mutual information estimation function; the lower bound of the first mutual information estimation function is:
[0111] MI(γ,z)≥E z~p(z│x) logq(γ│z)
[0112] E z~p(z│x) logq(γ|z)≈E z~p(z│x) ||π(L|z)-L||
[0113] Among them, MI(γ,z) represents the first mutual information estimation function, γ represents sample complexity, z represents complexity features, E represents expectation operation, z~p(z|x) represents sampling complexity features from the posterior distribution of complexity features with respect to original features, p(z|x) represents the posterior distribution of complexity features with respect to original features, acts as a feature encoder in the multi-exit target tracking network, p(γ|z) represents the posterior distribution of sample complexity with respect to complexity features, q(γ|z) represents the variational estimate of p(γ|z), π(L|z) is the feature decoder, L represents the sample task loss, and ||·|| represents the norm; the first mutual information estimation function is maximized by maximizing the lower bound of the first mutual information estimation function.
[0114] In one embodiment, the objective function construction module 506 is further used to calculate the posterior distribution of the complexity feature with respect to the original feature, and calculate the relative entropy between the posterior distribution and the prior distribution of the complexity feature, and obtain the upper bound of the second mutual information estimation function as follows:
[0115] MI(x,z)≤KL(p(z|x)||r(z))
[0116] Among them, MI(x,z) represents the second mutual information estimation function, z represents the complexity feature, x represents the original feature, MI represents mutual information, KL represents relative entropy, and r(z) represents the prior distribution of the complexity feature; the second mutual information estimation function is minimized by minimizing the upper bound of the second mutual information estimation function.
[0117] In one embodiment, the objective function construction module 506 is further configured to construct an objective function according to the first mutual information estimation function and the second mutual information estimation function:
[0118] J=MI(γ,z)-βMI(x,z)=E z~p(z│x) ||π(L|z)-L||-βKL(p(z|x)||r(z))
[0119] Wherein, J represents the objective function, MI(γ,z) represents the first mutual information estimation function, and MI(x,z) represents the second mutual information estimation function.
[0120] In one of the embodiments, the result output module 510 is further used to construct a Gaussian mixture model training set according to multiple optimal complexity features; train the Gaussian mixture model parameters according to the Gaussian mixture model training set and the maximum expectation algorithm to obtain a trained Gaussian mixture model.
[0121] For the specific limitations of the network depth dynamic adjustment device, please refer to the limitations of the network depth dynamic adjustment method above, which will not be repeated here. Each module in the above-mentioned network depth dynamic adjustment device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0122] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for dynamic adjustment of network depth is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0123] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0124] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in the above embodiment when executing the computer program.
[0125] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0127] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0128] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for dynamic adjustment of network depth, It is characterized in that The method comprises: A feature encoder, a feature decoder and a pre-trained Gaussian mixture model are embedded in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network; Obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction to obtain original features, and construct a training set according to the original features corresponding to each target video frame; Inputting the original feature into the feature encoder to obtain a complexity feature, constructing a first mutual information estimation function between sample complexity and the complexity feature, constructing a second mutual information estimation function between the original feature and the complexity feature, and constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function; The feature encoder and the feature decoder are trained according to the objective function and the training set, and the original features corresponding to the target video frame to be tracked are input into the trained feature encoder and feature decoder to obtain the optimal complexity features corresponding to the target video frame to be tracked; The optimal complexity feature is input into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, the tracking target position in the target video frame to be tracked is output in the current depth output layer.
2. The method according to claim 1, It is characterized in that When the complexity distribution satisfies a preset condition, outputting the tracking target position in the target video frame to be tracked in the current depth output layer includes: When the Gaussian distribution probability of complex samples in the complexity distribution is lower than the Gaussian distribution probability of simple samples, the tracking target position in the target video frame to be tracked is output at the current depth output layer.
3. The method according to claim 1, It is characterized in that The step of training the feature encoder and the feature decoder according to the objective function and the training set comprises: The feature encoder and the feature decoder are trained according to the objective function and the training set, and the objective function is maximized by maximizing the first mutual information estimation function and minimizing the second mutual information estimation function. When the objective function is maximized, a trained feature encoder and feature decoder are obtained.
4. The method according to claim 3, It is characterized in that The step of maximizing the first mutual information estimation function comprises: The posterior distribution of the sample complexity with respect to the complexity feature in the first mutual information estimation function is subjected to variational estimation, and the lower bound of the first mutual information estimation function is approximated as the correlation between the complexity feature and the sample task loss, thereby obtaining the lower bound of the first mutual information estimation function; the lower bound of the first mutual information estimation function is: MI(γ,z)≥E z~p(z|x) logq(γ|z) E z~p(z|x) logq(γ|z)≈E z~p(z|x) ||π(L|z)-L|| Among them, MI(γ, z) represents the first mutual information estimation function, γ represents sample complexity, z represents complexity features, E represents expectation operation, z~p(z|x) represents sampling complexity features from the posterior distribution of complexity features with respect to original features, p(z|x) represents the posterior distribution of complexity features with respect to original features, and acts as a feature encoder in the multi-exit target tracking network, p(γ|z) represents the posterior distribution of sample complexity with respect to complexity features, q(γ|z) represents the variational estimate of p(γ|z), π(L|z) is the feature decoder, L represents the sample task loss, and ||·|| represents the norm; The first mutual information estimation function is maximized by maximizing a lower bound of the first mutual information estimation function.
5. The method according to claim 3, It is characterized in that The step of minimizing the second mutual information estimation function comprises: The posterior distribution of the complexity feature with respect to the original feature is calculated, and the relative entropy between the posterior distribution and the prior distribution of the complexity feature is calculated, and the upper bound of the second mutual information estimation function is obtained as follows: MI(x, z)≤KL(p(z|x)||r(z)) Among them, MI(x, z) represents the second mutual information estimation function, z represents the complexity feature, x represents the original feature, MI represents the mutual information, KL represents the relative entropy, and r(z) represents the prior distribution of the complexity feature; The second mutual information estimation function is minimized by minimizing an upper bound of the second mutual information estimation function.
6. The method according to any one of claims 1, 3, 4 or 5, It is characterized in that The constructing the objective function according to the first mutual information estimation function and the second mutual information estimation function comprises: According to the first mutual information estimation function and the second mutual information estimation function, an objective function is constructed as: J=MI(γ,z)-βMI(x,z)=E z~p(z|x) ||π(L|z)-L||-βKL(p(z|x)||r(z)) Wherein, J represents the objective function, MI(γ, z) represents the first mutual information estimation function, and MI(x, z) represents the second mutual information estimation function.
7. The method according to claim 1, It is characterized in that The step of training the Gaussian mixture model comprises: Constructing a Gaussian mixture model training set according to the multiple optimal complexity features; The Gaussian mixture model parameters are trained according to the Gaussian mixture model training set and the maximum expectation algorithm to obtain a trained Gaussian mixture model.
8. A network depth dynamic adjustment device, It is characterized in that The device comprises: A network building module is used to embed feature encoders, feature decoders and pre-trained Gaussian mixture models in the output layer of each depth of the target tracking network to obtain a multi-exit target tracking network; A training set construction module is used to obtain a target video frame sequence, input each target video frame in the target video frame sequence into the target tracking network for feature extraction to obtain original features, and construct a training set according to the original features corresponding to each target video frame; An objective function construction module, used for inputting the original feature into the feature encoder to obtain a complexity feature, constructing a first mutual information estimation function between sample complexity and the complexity feature, constructing a second mutual information estimation function between the original feature and the complexity feature, and constructing an objective function according to the first mutual information estimation function and the second mutual information estimation function; A network training module, used for training the feature encoder and the feature decoder according to the objective function and the training set, inputting the original features corresponding to the target video frame to be tracked into the trained feature encoder and feature decoder, and obtaining the optimal complexity features corresponding to the target video frame to be tracked; The result output module is used to input the optimal complexity feature into the pre-trained Gaussian mixture model to obtain the complexity distribution of the target video frame to be tracked, and when the complexity distribution meets the preset conditions, output the tracking target position in the target video frame to be tracked in the current depth output layer.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
