Bayesian convolution-based uncertainty processing method, apparatus, device, and medium
By introducing a Bayesian convolutional layer into the channel attention module of a convolutional neural network, the problems of numerous parameters and difficulty in providing a good prior distribution in Bayesian convolutional neural network models are solved. This enables effective measurement and prediction of image uncertainty, improving the accuracy and efficiency of image recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-19
- Publication Date
- 2026-03-24
AI Technical Summary
Existing Bayesian convolutional neural network models suffer from problems such as a large number of parameters, difficulty in providing a good prior distribution, and approximate gradient estimation, which makes it difficult to effectively measure the uncertainty of the model in image recognition.
A Bayesian convolutional layer is introduced into the channel attention module of a convolutional neural network. By capturing the uncertainty of local important information through Bayesian convolution, the distribution of parameters is learned to approximate the overall sample distribution. The channel attention mechanism is constructed using the Bayesian convolutional layer to achieve the capture of uncertainty of local important information.
Effectively measuring and predicting the uncertainty of the entire image reduces the number of model parameters and the complexity of gradient approximation estimation, thereby improving the accuracy and efficiency of image recognition.
Smart Images

Figure CN116012597B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of image processing, and in particular to a Bayesian convolution-based uncertainty processing method and device, electronic equipment and a storage medium. BACKGROUND
[0002] A CNN (Convolutional Neural Network) trains a model based on observed data (training samples) through back propagation to obtain optimal point estimation of model parameters, and supports the model to output deterministic results. Such a CNN network trained based on optimal point estimation of parameters can better fit the observed data, but cannot better predict unobserved data (test samples), that is, overfitting to existing training samples occurs. Although existing regularization methods can alleviate overfitting to a certain extent, such as early stopping, weight decay, L1-L2 regularization, dropout, etc., the model itself cannot measure uncertainty. In terms of classification tasks, a softmax function maximizes the output probability score of a given class by compressing the output probability scores of other classes. Such a probability is not the confidence of the model on the output given class.
[0003] To improve the generalization ability of a CNN model and support the model to measure uncertainty, existing research introduces a Bayesian method to obtain a BCNN (Bayesian Convolutional Neural Network) that converts optimal point estimation of model parameters into distribution estimation of model parameters. The BCNN first gives a prior distribution to the parameters, and then performs gradient approximation estimation through a Variational Inference method to learn a posterior distribution of fitting parameters based on observed data (training samples). The learned posterior distribution of parameters from observed data is used to infer unobserved data (test samples).
[0004] The inventors found that although the BCNN model supports uncertainty estimation, there are still problems of too many parameters, difficulty in giving a good prior distribution, and gradient approximation estimation when using the BCNN to construct a network model for image recognition. SUMMARY
[0005] The present application provides a Bayesian convolution-based uncertainty processing method, device, electronic equipment and storage medium to solve the technical problems of too many parameters, difficulty in giving a good prior distribution, and gradient approximation estimation of the existing Bayesian convolutional neural network model.
[0006] In a first aspect, embodiments of the present application provide a Bayesian convolution-based uncertainty processing method, comprising:
[0007] obtaining an image to be recognized;
[0008] inputting the image to be recognized into a pre-trained convolutional neural network model for target recognition, the convolutional neural network model comprising a channel attention module based on a Bayesian convolutional layer, the channel attention module being configured to sequentially perform average pooling and transposition on an input initial multi-dimensional feature to obtain a one-dimensional feature, perform Bayesian convolution on the one-dimensional feature to obtain a convolutional feature, expand the convolutional feature to the same dimension as the initial multi-dimensional feature, and multiply the convolutional feature with the initial multi-dimensional feature to obtain an output multi-dimensional feature of the channel attention module, and the convolutional neural network model performing image recognition on the image to be recognized based on the output multi-dimensional feature;
[0009] outputting a recognition result of the image to be recognized by the convolutional neural network model.
[0010] In a second aspect, an uncertainty processing apparatus based on Bayesian convolution is also provided, comprising:
[0011] an image obtaining unit configured to obtain an image to be recognized;
[0012] an image recognition unit configured to input the image to be recognized into a pre-trained convolutional neural network model for target recognition, the convolutional neural network model comprising a channel attention module based on a Bayesian convolutional layer, the channel attention module being configured to sequentially perform average pooling and transposition on an input initial multi-dimensional feature to obtain a one-dimensional feature, perform Bayesian convolution on the one-dimensional feature to obtain a convolutional feature, expand the convolutional feature to the same dimension as the initial multi-dimensional feature, and multiply the convolutional feature with the initial multi-dimensional feature to obtain an output multi-dimensional feature of the channel attention module, and the convolutional neural network model performing image recognition on the image to be recognized based on the output multi-dimensional feature;
[0013] a result output unit configured to output a recognition result of the image to be recognized by the convolutional neural network model.
[0014] In a third aspect, an electronic device is also provided, comprising:
[0015] one or more processors;
[0016] a memory configured to store one or more programs;
[0017] when the one or more programs are executed by the one or more processors, the electronic device is enabled to implement the uncertainty processing method based on Bayesian convolution as described in the first aspect.
[0018] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the Bayesian convolution-based uncertainty processing method in the first aspect.
[0019] The Bayesian convolution-based uncertainty processing method, device, electronic equipment and storage medium described above, in the method, an image to be recognized is acquired; the image to be recognized is input into a pre-trained convolutional neural network model for target recognition, the convolutional neural network model comprises a channel attention module based on a Bayesian convolution layer, the channel attention module is used for sequentially performing average pooling and transposition on an input initial multi-dimensional feature to obtain a one-dimensional feature, performing Bayesian convolution on the one-dimensional feature to obtain a convolution feature, expanding the convolution feature to the same dimension as the initial multi-dimensional feature and multiplying the convolution feature with the initial multi-dimensional feature to obtain an output multi-dimensional feature of the channel attention module, and the convolutional neural network model performs image recognition on the image to be recognized based on the output multi-dimensional feature; and an identification result of the convolutional neural network model on the image to be recognized is output. By adding the Bayesian convolution layer in the channel attention module of the model, the channel attention mechanism based on Bayesian convolution is constructed in the model, the uncertainty of local important information is captured, and the problems of too many parameters of the existing Bayesian convolutional neural network model, difficulty in giving a good prior distribution and gradient approximation estimation are solved, and the uncertainty of the whole image can be effectively predicted. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 A method flowchart of a Bayesian convolution-based uncertainty processing method provided by the embodiments of the present application is shown in the figure.
[0021] Figure 2 A principle schematic diagram of a channel attention module provided by the embodiments of the present application is shown in the figure.
[0022] Figure 3 A structural schematic diagram of a Bayesian convolution-based uncertainty processing device provided by the embodiments of the present application is shown in the figure.
[0023] Figure 4 A structural schematic diagram of an electronic equipment provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION
[0024] The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are used to explain the present application, rather than limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, rather than all the structures.
[0025] In the field of image recognition processing, uncertainty is an index for measuring the degree of prediction certainty of an image recognition model. In Bayesian models, there are two main types of uncertainty: accidental uncertainty and cognitive uncertainty. Accidental uncertainty is caused by the inherent noise of observed data, and this uncertainty exists in the data collection method, such as sensor noise or motion noise uniformly distributed along the data set, and cannot be eliminated by increasing the data set. Cognitive uncertainty is caused by the model failing to learn enough samples, and this uncertainty is universal because observed data (training samples) cannot completely cover the characteristics of unobserved data (test samples), and this uncertainty can be reduced by increasing the data set.
[0026] For example, an image is taken along an extension direction of a road, and in the taken image, there may be content elements such as vehicles, intersections, sidewalks, traffic lights, pedestrians, trees, and houses. When an image recognition model is used to segment the content elements in the image, there may be segmentation bias. For example, due to different distances and angles of shooting, the label of a vehicle has noise, and this accidental uncertainty will lead to poor segmentation of the vehicle in the image; for another example, due to the fact that sidewalks appear less frequently in the training set, or the image recognition model used to fit the training set is not suitable for the segmentation task, this cognitive uncertainty may lead to poor segmentation of the sidewalk in the image.
[0027] For an image recognition model, accidental uncertainty is inherent and objective, while cognitive uncertainty is subjective and can be eliminated. Generally, to eliminate the uncertainty of an image recognition model, on the one hand, the data set is increased, such as increasing various sidewalks for the image recognition of the image taken in the road scene described above; on the other hand, a model that can better fit the training set is designed, i.e., a model is replaced. In fact, no matter how the number of samples is increased, the observable data is always limited and cannot be exhausted, and the cost of data collection is high; as for replacing the model, only a model that can better fit the observed data (training samples) can be used, and the model uncertainty estimation cannot be supported.
[0028] From the perspective of data distribution, the model uncertainty implied by cognitive uncertainty is actually fitting a distribution of the characteristics of the training set through training, and the characteristics of the test samples to be inferred may not conform to this distribution. In this case, the learned model parameters have great uncertainty for prediction. The introduction of the prior art Bayesian method changes the optimal point estimation of the parameters to distribution estimation when the image recognition model is trained, so that the inference has an uncertain estimation. The parameters of the entire image recognition model are estimated by distribution, which has problems such as many parameters and gradient approximation estimation. Based on this, another uncertainty processing method based on Bayesian convolution is proposed, which only learns the distribution of the parameters of the attention module in the image recognition model, thereby measuring the uncertainty of the local important information, to solve the problems of many parameters, difficulty in giving a good prior distribution, and gradient approximation estimation in the prior art.
[0029] It should be noted that, due to the limitation of the length of the specification, all optional embodiments cannot be enumerated in the specification, and those skilled in the art can think of any combination of technical features as long as the technical features are not contradictory, which can constitute an optional embodiment.
[0030] The embodiments will be described in detail below.
[0031] Figure 1 A method flowchart of a Bayesian convolution-based uncertainty processing method is provided for the embodiments of the application. The Bayesian convolution-based uncertainty processing method is used for electronic devices, as shown in the figure. The Bayesian convolution-based uncertainty processing method includes:
[0032] Step S110: Obtain an image to be recognized.
[0033] The present scheme is used for image recognition, which can be real-time recognition of images, or recognition at any time according to the recognition needs of the user. If it is real-time recognition, the image collected by the image collection device is taken as the image to be recognized, and the subsequent recognition process is performed immediately after collection. Although the recognition result may be slightly delayed compared to the image collection time, it can still be considered as real-time recognition, for example, in the security field, the image collected by the monitoring camera is recognized in real time. If it is recognized according to the recognition needs of the user, the image to be recognized input by the user is obtained, and the image to be recognized is usually an image prepared by the user in advance. After obtaining the image to be recognized, the subsequent recognition process is performed, and the recognition result is output correspondingly, for example, the user needs to search for an image with an intent or search for information with an image.
[0034] Step S120: Input the image to be recognized into a pre-trained convolutional neural network model for target recognition. The convolutional neural network model includes a channel attention module based on a Bayesian convolutional layer. The channel attention module is used to perform average pooling and transpose on the initial multidimensional features of the input sequentially to obtain one-dimensional features. The one-dimensional features are then subjected to Bayesian convolution to obtain convolutional features. The convolutional features are expanded to have the same dimension as the initial multidimensional features and multiplied with the initial multidimensional features to obtain the output multidimensional features of the channel attention module. The convolutional neural network module performs image recognition on the image to be recognized based on the output multidimensional features.
[0035] The channel attention module in the pre-trained convolutional neural network model incorporates Bayesian convolutional layers. Overall, through the Bayesian convolution-based channel attention mechanism, it effectively supports the capture of uncertainties regarding locally important information. Even when the training dataset does not exhaustively contain all "non-target" samples, it can still accurately identify the target from the image to be recognized. Figure 2 As shown, the channel attention module based on Bayesian convolution takes C×H×W dimensional features as input, performs average pooling to obtain C×1 dimensional features, transposes them to 1×C dimensional features, applies the 1×C dimensional features to Bayesian convolution, and then expands them to the same size as the input after passing through the Sigmoid function, multiplies them, and outputs the result. This Bayesian convolution-based channel attention module can be embedded into any existing CNN backbone to learn the probability distribution of locally important information. It should be noted that a complete convolutional neural network model involves more than just the channel attention module; multiple layers work together to complete the image recognition process. The channel attention module in this scheme can be configured according to the selected network structure. The configuration of the channel attention module in the network is relatively common in existing technologies. This scheme does not specifically explain other layers or the way the channel attention module works with other layers.
[0036] Cognitive uncertainty (model uncertainty) is essentially because the observed data (training samples) is always limited, the features learned by the image recognition model are insufficient, so that the image recognition model has uncertainty in predicting unobserved data (test samples). For example, there is an image recognition model based on existing network training to identify "hot dogs" in images, but the image recognition model obtained based on the existing training method has not been trained on "non-hot dog" images. Compared with the image of a real hot dog with ketchup, the existing model may predict a leg with ketchup or a banana with ketchup as a hot dog. In fact, because it is impossible to exhaust "non-hot dog" images, model uncertainty is to be solved from the model itself, rather than simply increasing the data set. The amount of training samples determines the generalization ability of the model. The model based on the Bayesian method has an advantage on small data, that is, a prior distribution is added to each weight and bias parameter of the model, and the posterior distribution is approximated in model training through limited samples, and the posterior distribution more realistically reflects the characteristics of the overall sample. The BCNN model learns the distribution of parameters on limited training samples, so that the parameter distribution of the model approximates the distribution of the overall sample, thereby realizing the uncertainty prediction of unobserved data. In contrast, the definition of a good prior distribution is highly dependent on domain knowledge, and the learning of the parameter distribution of the entire model is also relatively high in efficiency. To solve this high dependence of domain knowledge and efficiency, only the attention module in the model is learned in the present scheme, so that the distribution of local important information in the limited training sample approximates the distribution of the overall sample.
[0037] The attention mechanism guides the computational resources to the part of the input signal with the largest amount of information. In CNN, channel attention selectively enhances features with a large amount of information and suppresses useless features by capturing the dependency relationship between channels. Some existing channel attention modules capture the global dependency relationship between channels through MLP (multilayer perceptron), but the dimension is reduced; some capture the local dependency relationship between channels through convolution, the dimension is not reduced, and the parameters are fewer. In the present scheme, Bayesian convolution is used to capture the local channel relationship. The channel attention module based on Bayesian convolution can be embedded into any existing CNN backbone network to learn the probability distribution of local important information.
[0038] Compared with the traditional convolution that optimizes the value of the parameter based on the training sample, the channel attention module based on Bayesian convolution in the present scheme learns the distribution of the parameter based on the training sample to approximate the distribution of the overall sample, which is a change from point learning of the parameter in the traditional convolution to distribution learning of the parameter. A Bayesian convolution can be equivalent to an infinite number of traditional convolutions with the same distribution, which is determined by the training sample as the distribution approximating the overall sample.
[0039] In the existing Bayesian method-based model, the neural network optimization strategy is divided into MLE (Maximize Likelihood Estimation) and MAP (Maximize A Posteriori Estimation), and the MAP increases the prior distribution of the parameter. The Bayesian convolution layer is regarded as a probability model, that is, p(y|x, ω), y is the output under the condition of input x and parameter ω. The model training is to learn the parameter ω based on the observed data (training sample) (x, y), so that ω can be used to predict the unobserved data. Learning the parameter ω based on the observed data D can be expressed by the relationship between the posterior and the likelihood function and the prior by the Bayesian formula, that is, where p(y|x, ω) is the likelihood function, p(ω) is the prior distribution of the model parameter ω, and the marginal probability in the denominator can be regarded as a normalization constant and can be removed.
[0040] Based on the Bayesian rule, the purpose of model training is to obtain the posterior distribution, the target of the MLE method is to maximize the likelihood function, that is, And the target of the MAP method is to maximize the posterior distribution, that is:
[0041]
[0042] The first term corresponds to the maximization of the likelihood function, and the second term is the regularization term of the parameter. If it is a Gaussian prior, the second term is equivalent to L2 regularization; if it is a Laplace prior, the second term is equivalent to L1 regularization. When the logp(y|x, ω) is differentiable with respect to the parameter ω, the gradient descent (back propagation) can be used to update the parameter. The following takes the mean square error loss as an example to illustrate the MAP method.
[0043] Suppose the likelihood function p(y|x, ω) = N(y|f(x, w), β -1 , which is subject to a Gaussian distribution with mean f(x, w) and variance β -1 . The likelihood function can be understood as a linear regression with equal variance, that is, y = f(x, w) + ε, ε ~ N(0, β -1 ), where ε is the variance of the model prediction result and the true result, which is subject to a Gaussian distribution with mean 0 and variance β -1 . Generally, f(x, w) = x·w in the convolution operation, that is, the matrix multiplication of the input and the parameter weight. Suppose that the prior of the parameter ω is Gaussian, that is, p(ω) = N(0, α -1 , then:
[0044]
[0045] In the loss function, the first term is the classic linear regression, and the second term is the L2 regularization, where is the regularization coefficient. The parameter estimation methods of MLE and MAP are optimal point estimation ideas, while the Bayesian inference method calculates the Bayesian posterior distribution p(ω|x,y) of the parameter on the observed data to predict the labels of unobserved data using expectation . Predicting unobserved data using the expectation of the likelihood function is equivalent to integrating an infinite number of maximized likelihood functions with the same distribution, and then expecting the integral, which makes the model difficult to process.
[0046] In the present solution, the objective function of the channel attention module is to minimize the KL divergence between the distribution of the model parameters and the true Bayesian posterior distribution.
[0047] The training objective of the convolutional neural network model is to learn a distribution of model parameters ω, whose parameters are θ, i.e. p(ω|θ). The KL divergence is used to measure the difference between two distributions, so the objective function is to minimize the KL divergence between the distribution q(ω|θ) of the model parameters ω and the true Bayesian posterior distribution p(ω|x,y). Specifically, the objective function is represented as:
[0048]
[0049] where q(ω|θ) represents the distribution of model parameters ω with respect to parameters θ, p(ω) represents the prior distribution of model parameters ω, p(y|x,ω) represents the probability model corresponding to the Bayesian convolutional layer, and y represents the output under the conditions of input x and minimized model parameters ω. The calculation process of the objective function is as follows:
[0050]
[0051] The purpose of this cost function is to learn the distribution parameters θ so that p(ω|θ) approximates the true Bayesian posterior distribution p(ω|x,y). After derivation, it is transformed into the first term, which is the KL divergence between the distribution to be learned p(ω|θ) and the prior p(ω) of the model parameters ω, and the cost is related to the prior; the second term is the expectation of the likelihood function, and the cost is related to the data.
[0052] To further reduce the computational cost of minimizing the cost function, variational approximation is used to solve it. Under certain conditions, the derivative of the expectation can be represented as the expectation of the derivative, and based on the unbiased Monte Carlo gradient, the objective function can be represented as:
[0053] l(θ)≈log p(ω|θ)-log p(ω)-log p(y|x,ω)
[0054] Where p(ω|θ) denotes the distribution of the minimization model parameters ω with respect to the parameters θ, p(ω) denotes the prior distribution of the model parameters ω, p(y|x, ω) denotes the probability model corresponding to the Bayesian convolution layer, and y denotes the output under the condition of the input x and the minimization model parameters ω.
[0055] The distribution of the minimization model parameters ω with respect to the parameters θ is a diagonal Gaussian distribution, the sampling of the model parameters ω is a standard Gaussian, and the parameters θ=(μ, ρ).
[0056]
[0057] Where λ is a learning rate, and the parameters θ include a mean μ and a standard deviation σ=log(1+exp(ρ)).
[0058] This representation of the objective function based on the unbiased Monte Carlo gradient is an approximate representation of the cost function, assuming that the distribution p(ω|θ) to be learned is a diagonal Gaussian distribution, and the sampling of the model parameters ω can be a standard Gaussian. The diagonal Gaussian distribution parameters θ include a mean μ and a standard deviation σ=log(1+exp(ρ)), and the variational posterior parameters θ=(μ, ρ) to be learned. Therefore, the sampling of the model parameters ω is converted to:
[0059]
[0060] Thus, μ and ρ are updated each time the back propagation is updated, so that the distribution p(ω|θ) continuously approximates the true Bayesian posterior distribution under the training of the observed data. In this way, the parameters μ and ρ of the distribution p(ω|θ) to be learned can be calculated:
[0061]
[0062] Where λ is a learning rate, and the cost function l(θ) is a function of the model parameters ω, and ω is a function of the parameters μ and ρ of the distribution it obeys. Through the variational approximation method, it can be integrated into the general network back propagation to update. The difference is that the traditional convolution layer updates the parameters ω, while the Bayesian convolution layer updates the distribution parameters θ=(μ, ρ).
[0063] The gradient of the cost function l(θ) with respect to θ=(μ, ρ), where the log p(ω) term is given by the prior and is irrelevant to the distribution parameters, and the gradient is 0 when the distribution parameters are updated. This makes the given prior distribution have no constraint effect on the model training, that is, the distribution p(ω|θ) to be learned is data-driven and irrelevant to the prior. Overall, in the scheme, under limited observed data, the training model drives the parameter distribution to approximate the real overall sample distribution.
[0064] Step S130: output the recognition result of the convolutional neural network model on the to-be-identified image.
[0065] In the scheme, target recognition is performed on the to-be-identified image by the pre-trained convolutional neural network model, and then the recognition result is output. Specifically, the region where the recognized target is located can be marked in different ways in the to-be-identified image, or the to-be-identified image can be segmented based on the recognized target. The specific presentation mode is implemented in the prior art, and will not be repeated here.
[0066] Overall, the uncertainty of cognition is caused by the fact that the observed data is always limited, and the limited samples learned by the model cannot completely cover the characteristics of the overall samples. Therefore, the prediction of unobserved data is uncertainty. The method to solve the uncertainty prediction is to introduce the Bayesian parameter estimation method, but due to the parameter expansion, the existing Bayesian-based model has high cost in parameter distribution learning. In the scheme, the Bayesian convolution is applied to the channel attention module in the model, which can guide the model to pay attention to the information with discriminative effect in the local, so as to capture the uncertainty of the local important information, and thus the uncertainty of the whole image can be effectively predicted.
[0067] The above method comprises the following steps: acquiring a to-be-identified image; inputting the to-be-identified image into a pre-trained convolutional neural network model for target recognition, wherein the convolutional neural network model comprises a channel attention module based on a Bayesian convolution layer, the channel attention module is used for sequentially performing average pooling and transposition on an input initial multi-dimensional feature to obtain a one-dimensional feature, performing Bayesian convolution on the one-dimensional feature to obtain a convolution feature, expanding the convolution feature to the same dimension as the initial multi-dimensional feature, and multiplying the convolution feature with the initial multi-dimensional feature to obtain an output multi-dimensional feature of the channel attention module, and the convolutional neural network model performs image recognition on the to-be-identified image based on the output multi-dimensional feature; and outputting a recognition result of the convolutional neural network model on the to-be-identified image. By adding the Bayesian convolution layer to the channel attention module of the model, the channel attention mechanism based on the Bayesian convolution is constructed in the model, the uncertainty of the local important information is captured, and thus the problems of too many parameters in the existing Bayesian convolutional neural network model, difficulty in giving a good prior distribution, and gradient approximation estimation are solved, and the uncertainty of the whole image can be effectively predicted.
[0068] Figure 3 A structure schematic diagram of an uncertainty processing device based on Bayesian convolution provided by the embodiment of the present application is shown in FIG. 2. Figure 3 The uncertainty processing device based on Bayesian convolution comprises an image acquisition unit 210, an image recognition unit 220, and a result output unit 230.
[0069] The image acquisition unit 210 is configured to acquire an image to be recognized; the image recognition unit 220 is configured to input the image to be recognized into a pre-trained convolutional neural network model for target recognition, the convolutional neural network model comprising a channel attention module based on a Bayesian convolutional layer, the channel attention module being configured to sequentially perform average pooling and transposition on an input initial multi-dimensional feature to obtain a one-dimensional feature, perform Bayesian convolution on the one-dimensional feature to obtain a convolutional feature, expand the convolutional feature to the same dimension as the initial multi-dimensional feature, and multiply the convolutional feature with the initial multi-dimensional feature to obtain an output multi-dimensional feature of the channel attention module, and the convolutional neural network model performing image recognition on the image to be recognized based on the output multi-dimensional feature; and the result output unit 230 is configured to output a recognition result of the image to be recognized by the convolutional neural network model.
[0070] On the basis of the above embodiment, a target function of the channel attention module is to minimize the KL divergence between a distribution of model parameters and a real Bayesian posterior distribution.
[0071] On the basis of the above embodiment, the target function is represented as:
[0072]
[0073] wherein q(ω|θ) represents a distribution of model parameters ω with respect to a parameter θ, p(ω) represents a prior distribution of the model parameters ω, p(y|x, ω) represents a probability model corresponding to the Bayesian convolutional layer, and y represents an output under the condition of input x and minimized model parameters ω.
[0074] On the basis of the above embodiment, the target function is represented as:
[0075] l(θ)≈log p(ω|θ)-log p(ω)-log p(y|x,ω)
[0076] wherein p(ω|θ) represents a distribution of model parameters ω with respect to a parameter θ, p(ω) represents a prior distribution of the model parameters ω, p(y|x, ω) represents a probability model corresponding to the Bayesian convolutional layer, and y represents an output under the condition of input x and minimized model parameters ω.
[0077] On the basis of the above embodiment, the distribution of the minimized model parameters ω with respect to the parameter θ is a diagonal Gaussian distribution, the sampling of the model parameters ω is a standard Gaussian, and the parameter θ=(μ, ρ), wherein:
[0078]
[0079] wherein λ is a learning rate, and the parameter θ includes a mean value μ and a standard deviation σ=log(1+exp(ρ)).
[0080] The uncertainty processing apparatus based on Bayesian convolution provided in this embodiment of the invention is included in the electronic device of the device and can be used to execute any of the uncertainty processing methods based on Bayesian convolution provided in the above embodiments, and has corresponding functions and beneficial effects.
[0081] It is worth noting that in the above embodiments of the uncertainty processing device based on Bayesian convolution, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0082] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 4 As shown, the electronic device includes a processor 310, a memory 320, an input device 330, an output device 340, and a communication device 350; the number of processors 310 in the electronic device can be one or more. Figure 4 Taking a processor 310 as an example; the processor 310, memory 320, input device 330, output device 340, and communication device 350 in the electronic device can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.
[0083] The memory 320, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the Bayesian convolution-based uncertainty processing method in this embodiment of the invention (e.g., the image acquisition unit 210, image recognition unit 220, and result output unit 230 in the Bayesian convolution-based uncertainty processing device). The processor 310 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 320, thereby implementing the aforementioned Bayesian convolution-based uncertainty processing method.
[0084] The memory 320 can include a program storage area and a data storage area, where the program storage area can store an operating system, application programs required by at least one function, and the like, and the data storage area can store data created according to the use of the electronic device, and the like. In addition, the memory 320 can include a high-speed random access memory, and can further include a nonvolatile memory such as at least one of a magnetic disk storage device, a flash memory device, or other non-volatile solid state storage device. In some examples, the memory 320 can further include a memory disposed remotely from the processor 310, which can be connected to the electronic device through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0085] The input device 330 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. The output device 340 can include a display device such as a display screen.
[0086] The electronic device described above includes a Bayesian convolution-based uncertainty processing apparatus, which can be used to perform any Bayesian convolution-based uncertainty processing method, and has corresponding functions and advantages.
[0087] The embodiments of the present application also provide a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to perform the related operations in the Bayesian convolution-based uncertainty processing method provided in any embodiment of the present application, and have corresponding functions and advantages.
[0088] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system, or a computer program product.
[0089] Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) having computer usable program code embodied in the medium. The present application is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and a combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions, which are executed via the processor of the computer or other programmable data processing apparatus, generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one flow or a plurality of flows and / or blocksFigure 1 apparatus that performs the specific functions of one or more blocks or a combination of blocks. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 Figure 1 Figure 1 Figure 1
[0090] In one typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory. The memory can include non-persistent memory and / or persistent memory, which can be embodied as random access memory (RAM), read-only memory (ROM), flash memory, or the like. The memory is an example of computer-readable media.
[0091] Computer-readable media includes permanent and non-permanent, removable and non-removable media, which can be implemented using any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
[0092] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0093] Note that the above merely describes preferred embodiments of the present application and the applied technical principles. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, reconfigurations, and substitutions can be made without departing from the scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. An uncertainty handling method based on Bayesian convolution, characterized in that, include: Acquire the image to be recognized; The image to be recognized is input into a pre-trained convolutional neural network model for target recognition. The convolutional neural network model includes a channel attention module based on a Bayesian convolutional layer. The channel attention module is used to perform average pooling and transpose on the initial multidimensional features of the input sequentially to obtain one-dimensional features. The one-dimensional features are then subjected to Bayesian convolution to obtain convolutional features. The convolutional features are expanded to have the same dimension as the initial multidimensional features and multiplied with the initial multidimensional features to obtain the output multidimensional features of the channel attention module. The convolutional neural network module performs image recognition on the image to be recognized based on the output multidimensional features. Output the recognition result of the convolutional neural network model on the image to be recognized.
2. The method according to claim 1, characterized in that, The objective function of the channel attention module is to minimize the distribution of model parameters and the KL divergence of the true Bayesian posterior distribution.
3. The method according to claim 2, characterized in that, The objective function is expressed as: in, Let represent the KL divergence between the distribution p(ω|θ) to be learned and the prior p(ω) of the model parameters ω; q(ω|θ) represents the distribution of the model parameters ω with respect to the parameter θ, p(ω) represents the prior distribution of the model parameters ω, p(y|x,ω) represents the probability model corresponding to the Bayesian convolutional layer, y represents the output under the condition of input x and minimizing the model parameters ω, and E q(ω|θ) [logp(y|x,ω)] represents the expectation of logp(y|x,ω).
4. The method according to claim 2, characterized in that, The objective function is expressed as: Where p(ω|θ) represents minimizing the distribution of model parameter ω with respect to parameter θ, p(ω) represents the prior distribution of model parameter ω, p(y|x,ω) represents the probability model corresponding to the Bayesian convolutional layer, and y represents the output under the conditions of input x and minimizing model parameter ω.
5. The method according to claim 4, characterized in that, The minimized model parameter ω is distributed with respect to parameter θ as a diagonal Gaussian distribution, the sampling of the model parameter ω is standard Gaussian, and the parameter θ = (μ, ρ), where: Where λ is the learning rate, ε is the variance between the model's prediction and the actual result, and the parameter θ includes the mean μ and the standard deviation σ = log(1 + exp(ρ)).
6. An uncertainty processing device based on Bayesian convolution, characterized in that, include: An image acquisition unit is used to acquire the image to be recognized. An image recognition unit is used to input the image to be recognized into a pre-trained convolutional neural network model for target recognition. The convolutional neural network model includes a channel attention module based on a Bayesian convolutional layer. The channel attention module is used to perform average pooling and transpose on the initial multidimensional features of the input sequentially to obtain one-dimensional features, perform Bayesian convolution on the one-dimensional features to obtain convolutional features, expand the convolutional features to the same dimension as the initial multidimensional features, and multiply them with the initial multidimensional features to obtain the output multidimensional features of the channel attention module. The convolutional neural network module performs image recognition on the image to be recognized based on the output multidimensional features. The result output unit is used to output the recognition result of the convolutional neural network model on the image to be recognized.
7. The apparatus according to claim 6, characterized in that, The objective function of the channel attention module is to minimize the distribution of model parameters and the KL divergence of the true Bayesian posterior distribution.
8. The apparatus according to claim 7, characterized in that, The objective function is expressed as: in, Let represent the KL divergence between the distribution p(ω|θ) to be learned and the prior p(ω) of the model parameters ω; q(ω|θ) represents the distribution of the model parameters ω with respect to the parameter θ, p(ω) represents the prior distribution of the model parameters ω, p(y|x,ω) represents the probability model corresponding to the Bayesian convolutional layer, y represents the output under the condition of input x and minimizing the model parameters ω, and E q(ω|θ) [logp(y|x,ω)] represents the expectation of logp(y|x,ω).
9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the electronic device implements the uncertainty handling method based on Bayesian convolution as described in any one of claims 1-5.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the uncertainty handling method based on Bayesian convolution as described in any one of claims 1-5.
Citation Information
Patent Citations
AMD grading system based on macular attention mechanism and uncertainty
CN112446875A
Re-identification method based on domain invariant features and spatial-temporal features
CN112528788A