Reliable small sample image recognition and classification methods

By applying evidence fusion mechanisms and Dirichlet distribution, the problem of lack of uncertainty estimation in small sample image recognition and classification is solved, achieving high accuracy and reliability in image recognition and classification.

CN117079017BActive Publication Date: 2025-12-02YUNNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310992882.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-08
Publication Date
2025-12-02
Estimated Expiration
2043-08-08

AI Technical Summary

Technical Problem

Existing small-sample image recognition and classification methods lack uncertainty estimation of prediction results, which makes it impossible for decision-makers to understand the reliability of the model in the recognition process and to accurately judge the confidence level of the prediction results.

Method used

An evidence fusion mechanism is adopted, which combines pre-trained feature vectors and meta-trained feature vectors with Dirichlet distribution and evidence loss optimization function to provide uncertainty quantification for model prediction.

Benefits of technology

While achieving high recognition accuracy, it can reasonably estimate the uncertainty of recognition results, thereby improving the reliability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117079017B_ABST
    Figure CN117079017B_ABST
Patent Text Reader

Abstract

This invention discloses a reliable image recognition and classification method applicable to small-sample scenarios, comprising: a pre-trained evidence acquisition module, which uses a pre-trained convolutional neural network to extract features from the input image, and the features are processed by a pre-trained evidence neural network to obtain pre-trained evidence; a meta-trained evidence acquisition module, which uses meta-transformation parameters obtained from meta-training to adapt the pre-trained model to a task-specific meta-trained convolutional neural network, extracts features from the image, and the features are processed by a meta-trained evidence neural network to obtain meta-trained evidence; and a reliable prediction module based on an evidence fusion mechanism, which weights and fuses the pre-trained evidence and meta-trained evidence, obtains a fused evidence vector through the evidence fusion mechanism, and further obtains the image recognition and classification results and prediction uncertainty based on subjective logic theory and evidence theory. This invention features high image recognition accuracy and good generalization, while also making reasonable uncertainty estimates for the recognition results, making the model prediction results more reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a reliable method for small-sample image recognition and classification. Background Technology

[0002] Image recognition and classification is a crucial problem across various fields. Different applications have an urgent need for accurate image recognition and classification, including but not limited to crop pest and disease monitoring and control. Accurate image identification and classification are of great significance for agricultural production management and control, intelligent monitoring systems, medical diagnosis, and other fields. Therefore, a reliable small-sample image recognition and classification method is essential for improving recognition accuracy and efficiency.

[0003] Traditional image recognition and classification methods mainly rely on a large number of labeled training samples, which still poses certain difficulties for image recognition and classification with small sample sizes. In addition, the complex variations in images and the differences between samples make the recognition difficulty and ambiguity of different images vary, bringing great uncertainty to the classification results of the model.

[0004] In recent years, with the rapid development of computer vision and deep learning technologies, image-based few-sample image recognition and classification methods have received widespread attention. These methods utilize deep learning networks and model ensemble techniques to achieve efficient and accurate image recognition and classification even with limited samples by making full use of training.

[0005] However, existing methods for solving few-sample image recognition and classification problems often lack uncertainty estimation of prediction results, i.e., they lack a measure of the confidence level of the model's predictions. This makes it impossible for decision-makers to understand the reliability of the model during the recognition process and to accurately determine the confidence level of the prediction results. To improve decision-makers' understanding and trust in model predictions, and to enhance the management and application effectiveness of image recognition and classification, it is necessary to propose a reliable few-sample image recognition and classification method that can accurately identify and classify images and provide quantification of the uncertainty of prediction results. Such a method has broad application prospects in various fields. Summary of the Invention

[0006] To address the problems existing in the prior art, the purpose of this invention is to provide a reliable method for image recognition and classification with few samples. This invention can achieve high recognition accuracy in small sample scenarios and provide a measure of model prediction uncertainty, thereby achieving reliable image recognition and classification.

[0007] To achieve the above objectives, the technical solution adopted by this invention is: a reliable small-sample image recognition and classification method, comprising the following steps:

[0008] Step 1: Extract features from the input image to obtain its pre-trained feature vector h.pre Learning feature vector h meta ;

[0009] Step 2: Convert the pre-trained feature vector h into... pre Learning feature vector h meta As pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta The input is the pre-trained evidence vector e. pre The training evidence vector e meta The fused evidence vector e of the image to be identified is obtained through an evidence fusion mechanism, which is used to determine its predicted Dirichlet distribution Dir(p|α). Based on the Dirichlet distribution, an evidence loss optimization function is constructed. The model parameters are then updated with the objective of minimizing the evidence loss optimization function.

[0010] Step 3: For a new image to be identified and classified, use Step 1 to extract different features, and then use Step 2 to obtain the Dirichlet distribution Dir(p|α) corresponding to the image. Perform reliable image recognition and classification, and return the image recognition and classification result and the uncertainty coefficient of the result as output to the user.

[0011] As a further improvement of the present invention, in step 1, feature extraction is performed on the input image to obtain its pre-trained feature vector h. pre Specifically as follows:

[0012] The convolutional neural network (CNN) is pre-trained using a large dataset containing all samples from the meta-training set. Cross-entropy is used as the loss function, and gradient descent is employed to update the parameters within the CNN. The image to be classified is then fed into the pre-trained CNN to obtain the pre-trained feature vector h. pre .

[0013] As a further improvement of the present invention, in step 1, feature extraction is performed on the input image to obtain its meta-training feature vector h. meta Specifically as follows:

[0014] Based on a pre-trained convolutional neural network, two additional lightweight learnable parameters, scaling parameter φ1 and transformation parameter φ2, are introduced. These parameters are directly applied to the convolutional kernels of the pre-trained convolutional neural network, resulting in a task-specific meta-trained convolutional neural network. An image is then fed into this meta-trained convolutional neural network to obtain the meta-trained feature vector h. meta .

[0015] As a further improvement of the present invention, in step 2, the pre-trained evidence vector epre The training evidence vector e meta Each is generated by a pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta We obtain the pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta Both are feedforward neural networks consisting of a single fully connected layer; Softplus is used as the activation function to ensure the pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta The output evidence vector contains all non-negative values, specifically in the following way:

[0016] e pre =Softplus(ω pre (h pre )), e meta =Softplus(ω meta (h meta )).

[0017] As a further improvement of the present invention, in step 2, the fused evidence vector e of the image to be identified is obtained through the evidence fusion mechanism as follows:

[0018] e = μ1e pre +μ2e meta Where μ1 and μ2 are two weight coefficients used to control the pre-trained evidence vector e. pre The training evidence vector e meta The greater the weight coefficient in the fused evidence vector e, the closer the fused evidence vector e will be to the evidence vector corresponding to that weight coefficient.

[0019] As a further improvement of the present invention, in step 2, the fused evidence vector e is used to determine the Dirichlet distribution Dir(p|α) corresponding to the image to be identified, specifically as follows:

[0020] Dir(p|α)=Dir(p|e+1), where 1 is an all-1 vector with the same dimension as the fused evidence vector e; according to subjective logic theory and evidence theory, the probability of an image being identified as class k is described as follows: in, This is referred to as the Dirichlet intensity; the overall uncertainty for predicting this image is described as follows: Here, K represents the K-classification prediction problem.

[0021] As a further improvement of the present invention, in the model training phase of step 2, an evidence loss optimization function is constructed for each image sample to be identified within the training task. KL divergence As a regularization term, it is added to the evidence loss optimization function. In this process, the final loss optimization function is obtained, as follows: in, It is the Dirichlet distribution parameter after removing "non-erroneous evidence" from the original Dirichlet distribution parameter α. y represents the image label in one-hot format; λ t ∈[0,1] is the regularization annealing coefficient, which is used to control the impact of the regularization term on the model.

[0022] As a further improvement of the present invention, in the model parameter update stage of step 2, the loss optimization function is minimized. With the goal of, For the pre-trained evidence neural network ω pre Learnable parameters, meta-trainable evidence neural network ω meta The learnable parameters and two additional lightweight learnable parameters, namely the scaling parameter φ1 and the transformation parameter φ2, are differentiated and updated using the gradient descent algorithm until the model converges or the loss function value decreases to a certain threshold.

[0023] The beneficial effects of this invention are:

[0024] This invention features high image recognition accuracy and good generalization, while also providing reasonable uncertainty estimates for the recognition results, making the model prediction results more reliable. Attached Figure Description

[0025] Figure 1 This is a flowchart of an embodiment of the present invention;

[0026] Figure 2 This is a schematic diagram of the framework of an embodiment of the present invention;

[0027] Figure 3 This is a graph showing the relationship between the recognition accuracy (ACC) of the reliable few-shot image recognition and classification method and the comparison method MEDL in the embodiments of the present invention and the uncertainty threshold under the 5-way 5-shot experimental settings on three few-shot image classification benchmark datasets.

[0028] Figure 4 This is a graph showing the relationship between the recognition accuracy (ACC) of the reliable small-sample image recognition and classification method in this embodiment of the invention and the uncertainty threshold under 5-way 1-shot and 5-way 5-shot experimental settings on two crop pest and disease recognition datasets.

[0029] Figure 5The image shows the performance of the reliable small-sample image recognition and classification method in this invention on two crop pest and disease identification datasets under a 5-way 5-shot experimental setup for detecting in-distribution and out-of-distribution samples. Detailed Implementation

[0030] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0031] Example 1

[0032] like Figure 1 As shown, a reliable few-sample image recognition and classification method includes the following steps:

[0033] (1) Extract features from the input image to obtain its pre-trained feature vector h. pre Learning feature vector h meta .

[0034] (2) Convert the two feature vectors h obtained in step (1) into two vectors h respectively. pre and h meta As a pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta The input is the pre-trained evidence vector e. pre The training evidence vector ω meta The fused evidence vector e of the image to be identified is obtained through an evidence fusion mechanism, which is used to determine its predicted Dirichlet distribution Dir(p|α). Based on this Dirichlet distribution, an evidence loss optimization function is constructed. The model parameters are then updated with the goal of minimizing this function.

[0035] (3) For a new image to be identified and classified, different features are extracted using step (1), and then the Dirichlet distribution Dir(p|α) corresponding to the image is obtained using step (2). A “credible” image recognition and classification is performed, and the recognition and classification result of the image and the uncertainty coefficient of the result are returned to the user as output.

[0036] In step (1), the pre-trained feature vector h of the input image pre This is achieved through the following steps: Pre-training the convolutional neural network using a large dataset containing all meta-training set samples; using cross-entropy as the loss optimization function; and updating the parameters within the convolutional neural network using the gradient descent algorithm. Then, inputting the image into the pre-trained convolutional neural network yields the feature vector h. pre Since this feature is obtained through a pre-trained convolutional neural network, the parameters of this network are not updated during subsequent model training. Therefore, feature h preAlso known as pre-trained feature vectors.

[0037] In step (1), the meta-training feature vector h of the input image meta This is achieved through the following steps: Based on a pre-trained convolutional neural network (CNN), two additional lightweight learnable parameters are introduced: a scaling parameter φ1 and a transformation parameter φ2. These two parameters directly affect the convolutional kernels of the pre-trained CNN, thus obtaining a task-specific meta-trained CNN. By feeding an image as input into this meta-trained CNN, the feature vector h can be obtained. meta Since this feature is obtained from a task-adaptive convolutional neural network, the network's parameters will change as the two learnable parameters mentioned above are updated during the subsequent meta-training process of the model. Therefore, feature h meta Also known as meta-training feature vectors.

[0038] In step (2), the pre-trained evidence vector e pre The training evidence vector e meta Each is generated by a pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta Both evidence neural networks are feedforward neural networks consisting of a single fully connected layer, and Softplus is used as the activation function to ensure that all elements in the output evidence vectors of both neural networks are non-negative. Specifically, e pre =Softplus(ω pre (h pre )), e meta =Softplus(ω meta (h meta )).

[0039] In step (2), an evidence fusion mechanism is used to obtain the fused evidence vector e of the image to be identified. Specifically, e = μ1e pre +μ2e meta Here, μ1 and μ2 are two weight coefficients used to control the pre-trained evidence vector e. pre The training evidence vector e meta The greater the weight coefficient in the fused evidence vector e, the closer the fused evidence vector e will be to the evidence vector corresponding to that weight coefficient.

[0040] In step (2), the fused evidence vector e is used to determine the Dirichlet distribution Dir(p|α) corresponding to the image to be identified. Specifically, Dir(p|α) = Dir(p|e+1), where 1 is an all-1 vector with the same dimension as the fused evidence vector e. According to Subjective Logic Theory and Evidence Theory, the probability that the image is identified as class k is described as follows: in, This is referred to as the Dirichlet intensity; the overall uncertainty of this forecast is described as follows: Here, K represents the K-classification prediction problem.

[0041] In the model training phase of step (2), an evidence loss optimization function is constructed for each image sample to be identified within the training task. Since the optimization objective of this function is to maximize the amount of evidence in the correct category, the amount of evidence in the incorrect category will also increase. To further limit the amount of evidence the model assigns to the incorrect category, this embodiment uses KL divergence. As a regularization term, it is added to the evidence loss optimization function. In this process, the final loss optimization function is obtained, as follows: in, It is the Dirichlet distribution parameter after removing "non-erroneous evidence" from the original Dirichlet distribution parameter α. y represents the image label in one-hot format; λ t ∈[0,1] is the regularization annealing coefficient, which is used to control the impact of the regularization term on the model.

[0042] In the model parameter update phase of step (2), the loss optimization function is minimized. With the goal of, For the pre-trained evidence neural network ω pre Learnable parameters, meta-trainable evidence neural network ω meta The learnable parameters and two additional lightweight learnable parameters, namely the scaling parameter φ1 and the transformation parameter φ2, are differentiated and updated using the gradient descent algorithm until the model converges or the loss function value decreases to a certain threshold.

[0043] Example 2

[0044] like Figure 1 and Figure 2 As shown, a reliable few-sample image recognition and classification method includes the following steps:

[0045] Step (1): Split the dataset D: Based on the category to which the images belong, divide the entire dataset D into three disjoint subsets: the meta-training set D tr Meta-verification set D val Heyuan test set D te The three satisfy the following relationship: D tr ∪D val ∪D te =D.

[0046] Step (2): Obtain the pre-trained convolutional neural network:

[0047] Step (2-1): Randomly initialize the model parameters of the convolutional neural network.

[0048] Step (2-2): Using the meta-training set D obtained in step (1-1) tr The randomly initialized convolutional neural network in step (2-1) is trained using cross-entropy as the loss function and gradient descent algorithm is used to update the model parameters. Training is stopped when the model converges or the loss function reaches a certain threshold. The parameters of the optimal model are saved to obtain the pre-trained convolutional neural network.

[0049] Step (3): Construct a pre-trained feature vector h representing the features of the input image. pre The pre-trained convolutional neural network obtained in step (2-2) is used to extract features from the input image, resulting in a pre-trained feature vector h. pre .

[0050] Step (4): Construct a meta-training feature vector h representing the features of the input image. meta :

[0051] Step (4-1): Initialize the scaling parameter φ1 and the transformation parameter φ2 with all 1s and all 0s respectively.

[0052] Step (4-2): Use the scaling parameter φ1 and transformation parameter φ2 obtained in step (4-1) to update the convolution kernel parameters of the pre-trained convolutional neural network obtained in step (2-2) to obtain the meta-trained convolutional neural network.

[0053] Step (4-3): Use the meta-trained convolutional neural network obtained in step (4-2) to extract features from the input image, and obtain the meta-trained feature vector h. meta .

[0054] Step (5): Obtain the pre-trained evidence vector e pre The training evidence vector ω meta :

[0055] Step (5-1): For the pre-trained evidence neural network ωpre Heyuan trained evidence neural network ω meta Perform random initialization separately.

[0056] Step (5-2): The pre-trained feature vectors ω obtained in steps (3) and (4-3) are... pre The training feature vector ω meta The inputs are fed into the pre-trained evidence neural network ω obtained in step (5-1). pre Heyuan trained evidence neural network ω meta In this process, the pre-trained evidence vector e is obtained. pre The training evidence vector e meta .

[0057] Step (6): Use the pre-trained evidence vector e obtained in step (5-2) pre The training evidence vector e meta Evidence fusion is performed to obtain the final evidence vector e: e = μ1e pre +μ2e meta , where μ1 and μ2 are two fusion coefficients used to control the proportion of the corresponding evidence vector in the final evidence vector.

[0058] Step (7): Use the fused evidence vector e obtained in step (7) to determine the Dirichlet distribution Dir(p|α) corresponding to the image to be identified: Dir(p|α)=Dir(p|e+1), where 1 is an all-1 vector with the same dimension as the fused evidence vector e.

[0059] Step (8): Based on the Dirichlet distribution obtained in step (8), construct the loss optimization function. in, It is the Dirichlet distribution parameter after removing "non-erroneous evidence" from the original Dirichlet distribution parameter α. Image labels in one-hot format; λ t ∈[0,1] is the regularization annealing coefficient, which is used to control the impact of the regularization term on the model.

[0060] Step (9): Minimize the loss optimization function obtained in step (9). For the objective, the scaling parameter φ1, transformation parameter φ2, and pre-trained evidence neural network ω obtained in steps (4-1) and (5-1) are respectively... pre Heyuan trained evidence neural network ω meta The learnable parameters are differentiated, and the gradient descent algorithm is used to update the parameters until the model converges or the loss value gradually decreases to a certain threshold. The model parameters obtained at this time are then saved.

[0061] Step (10): Recognize and classify the new input image, extract image features using steps (3) and (4), transform and fuse features into evidence using steps (5) and (6), make a “credible” prediction for the input image using step (7), and return the recognition and classification results and the uncertainty coefficient of the results as output to the user.

[0062] Example 3

[0063] like Figure 1 and Figure 2 As shown, a reliable few-sample image recognition and classification method is presented, with the detailed process as follows:

[0064] Step (1): The three small-sample benchmark datasets used in this embodiment, miniImageNet, CIFAR-FS, and FC-100, are divided. The statistical information of the three datasets is shown in Table 1. According to the category to which the images belong, the entire dataset D is divided into three disjoint subsets in the proportions of 64:16:20, 64:16:20, and 60:20:20, respectively: the meta-training set D tr Meta-verification set D val Heyuan test set D te The three subsets satisfy the following conditions: D tr ∪D val ∪D te =D.

[0065] Table 1

[0066]

[0067] Step (2): Unify the resolution of the input images: Due to the different shooting devices and classification targets, the resolution of the obtained images varies. In order to facilitate feature extraction, it is necessary to unify the resolution of the input images. In this embodiment, the resolution of all input model images is unified to 84*84.

[0068] Step (3): Obtain the pre-trained convolutional neural network (The specific network structure is shown in Table 2):

[0069] Step (3-1): Randomly initialize the convolutional neural network And the parameters of the classifier ω.

[0070] Step (3-2): From the meta-training set D tr Randomly sample a small batch of data Using the convolutional neural network in step (3-1) respectively Feature extraction is performed with classifier ω: Classification:

[0071] Step (3-3): Use cross-entropy as the loss function: Where N represents the mini-batch size and K represents the classification categories. The gradient descent algorithm is used to process the convolutional neural network. Update the parameters of the classifier ω:

[0072] Step (3-4): Repeat steps (3-2) and (3-3) until the model converges or the loss function value decreases to a certain threshold. Since the classifier ω is irrelevant to subsequent processes, only the optimal pre-trained convolutional neural network is used. Save it.

[0073] Step (4): Extract the meta-training set D obtained in step (1) from each set. tr Meta-verification set D val Heyuan test set D te Task sampling is performed to obtain the corresponding meta-training task set. Meta-verification task set Heyuan Test Task Set Meta-training task set Taking the sampling process as an example, the specific process is as follows:

[0074] Step (4-1): From the meta-training set D tr N random classes are included from all the categories.

[0075] Step (4-2): From the N classes obtained in step (4-1), randomly sample K samples from each class to form the task. Support set Then, randomly sample Q samples from each class to form the task. query set A task Support set and query set Conditions to be met:

[0076] Step (4-3): Repeat steps (4-1) and (4-2) T times to obtain the meta-training task set containing T tasks.

[0077] Step (5): Obtain scaling parameter φ1, transformation parameter φ2, and pre-trained evidence neural network ω. pre Heyuan trained evidence neural network ω meta :

[0078] Step (5-1): Initialize the scaling parameter φ1 and transformation parameter φ2 with all 1s and all 0s respectively, and initialize the pre-trained evidence neural network ω. pre Heyuan trained evidence neural network ω meta Perform random initialization separately.

[0079] Step (5-2): From the meta-training task set Randomly select a meta-training task

[0080] Step (5-3): Use step (2) to unify the resolution of the input image, and use the pre-trained convolutional neural network obtained in step (3). Construct a pre-trained feature vector h representing the features of the input image. pre .

[0081] Step (5-4): Use scaling parameter φ1 and transformation parameter φ2 to train the pre-trained convolutional neural network in step (5-3). The parameters of the convolutional kernel are transformed to obtain the meta-trained convolutional neural network. (with pre-trained convolutional neural networks) (With the same structure, only the convolution kernel parameters are different), similar to step (5-3), construct the meta-training feature vector h representing the features of the input image. meta .

[0082] Step (5-5): The pre-trained feature vector h obtained in steps (5-3) and (5-4) is... pre The training feature vector h meta They are respectively fed as inputs into the pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta In this process, the pre-trained evidence vector e is obtained. pre The training evidence vector e meta :e pre =Softplus(ω pre (h pre )), e meta =Softplus(ω meta (h meta ), where Softplus(x) = log(1 + e x ).

[0083] Step (5-6): Utilize the pre-trained evidence vector m obtained in step (5-5) pre The training evidence vector e meta Evidence fusion is performed to obtain the final evidence vector e: e = μ1e pre +μ2e metaHere, μ1 and μ2 are two fusion coefficients used to control the proportion of the corresponding evidence vector in the final evidence vector. The larger the weight coefficient, the closer the fused evidence vector e will be to the evidence vector corresponding to that weight coefficient. It should be noted that the evidence fusion method used in this embodiment is "addition". In fact, for other specific embodiments, such as "element-by-element multiplication" or "weighted average", other methods can also be used as feature fusion methods.

[0084] Step (5-7): Use the fused evidence vector e obtained in step (5-6) to determine the Dirichlet distribution Dir(p|α) corresponding to the input image: Dir(p|α) = Dir(p|e+1), where 1 is an all-1 vector with the same dimension as the fused evidence vector e. According to Subjective Logic Theory and Evidence Theory, the probability that the input image is identified as class k is described as follows: in, This is referred to as the Dirichlet intensity; the overall uncertainty of this forecast is described as follows: Here, K represents the K-classification prediction problem, where the overall uncertainty of the prediction decreases as the classification evidence vector e obtained from the current input image increases.

[0085] Step (5-8): Based on the Dirichlet distribution obtained in step (5-7), construct the loss optimization function. in, It is the Dirichlet distribution parameter after removing "non-erroneous evidence" from the original Dirichlet distribution parameter α. y represents the image label in one-hot format; λ t ∈[0,1] is the regularization annealing coefficient, which is used to control the impact of the regularization term on the model.

[0086] Step (5-9): The meta-training task obtained in step (5-2) support set in Repeat steps (5-3) to (5-8) to obtain the loss optimization function. For the pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta The parameters are differentiated, and the gradient descent algorithm is used to update the parameters to obtain the adaptive parameters. Where α is the inner loop learning rate.

[0087] Step (5-10): Adapt the task parameters obtained in step (5-9). As initialization parameters, the meta-training task obtained in step (5-2) is... query set Repeat steps (5-3) to (5-8) to obtain the loss optimization function. The scaling parameter φ1 and the transformation parameter φ2, as well as the pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta The parameters are differentiated, and the gradient descent algorithm is used to update the parameters to obtain new model parameters. Where β is the outer loop learning rate.

[0088] Step (5-11): Use the new model parameters obtained in step (5-10) as initialization parameters to initialize the meta-training task set. The model contains a total of T tasks. Steps (5-2) to (5-10) are repeated to continuously update the model parameters.

[0089] Steps (5-12): Repeat steps (4) and (5) until the model converges or the loss value gradually decreases to a certain threshold, to obtain the scaling parameter φ1, transformation parameter φ2, and pre-trained evidence neural network ω. pre Heyuan trained evidence neural network ω meta .

[0090] Step (6): Use the meta-verification task set obtained in step (4) The model parameters obtained in step (5) are (φ1, φ2, ω pre ,ω meta Repeat steps (5-2) to (5-9) to adjust the model hyperparameters, such as the two evidence fusion coefficients μ1 and μ2 in step (5-6) and the regularization annealing coefficient λ in step (5-8). t wait.

[0091] Step (7): The meta-test task set obtained in step (4) Model performance testing was conducted.

[0092] Step (7-1): For the i-th meta-test task Using the model parameters obtained in step (5) and the model hyperparameters obtained in step (6) as initial parameters, their support set is... Repeat steps (5-3) to (5-9) to obtain the adaptive model parameters (φ1, φ2, ω). pre ,ω meta ).

[0093] Step (7-2): Using the model parameters obtained in step (7-1), perform the i-th meta-test task. query set Repeat steps (5-3) to (5-7) to obtain the query set. The recognition results for all images and the corresponding uncertainty values.

[0094] Step (7-3): Test the meta-test task set Repeat steps (7-1) to (7-2) for all tasks to obtain the corresponding output results.

[0095] Table 2

[0096]

[0097] The experiment of the reliable few-sample image recognition and classification method provided in this embodiment is based on the open-source code library PyTorch, and the specific experimental parameter settings are shown in Table 3.

[0098] Table 3

[0099]

[0100] Performance testing:

[0101] The following section evaluates the performance of this embodiment. For the three small-sample benchmark datasets miniImageNet, CIFAR-FS, and FC-100 in this embodiment, the meta-training set D is used. tr Pre-training the convolutional neural network and meta-training the entire model are performed simultaneously using the meta-test set D. val The model hyperparameters were selected, and finally, the results were analyzed on the meta-test set D. te The model performance is then tested. It should be noted that, in this embodiment, the prediction result for a given input image (steps (5-7)) includes not only its corresponding category but also an uncertainty coefficient for the current prediction result. Therefore, this embodiment first uses prediction accuracy (ACC) as the basic classification performance metric and compares it with some classic few-sample image recognition and classification methods, such as MAML, MEDL, and MTL, to demonstrate the effectiveness of this embodiment in few-sample image recognition and classification problems. Furthermore, this embodiment provides a series of experimental results to verify that this embodiment also has good uncertainty quantification capabilities.

[0102] The prediction accuracy (ACC) of the reliable few-shot image recognition and classification method provided in this embodiment, compared with some classic few-shot image recognition and classification methods mentioned above, on the miniImageNet, CIFAR-FS, and FC-100 datasets is shown in Table 4. The highest prediction accuracy (ACC) of different methods under the same dataset and experimental settings is indicated in bold.

[0103] As shown in Table 4, the reliable few-shot image recognition and classification method provided in this embodiment achieves a higher prediction accuracy (ACC) than the other three comparative methods in the 5-way 5-shot experimental setting, improving accuracy by 2.5%, 1.8%, and 2.4% on the miniImageNet, CIFAR-FS, and FC-100 datasets, respectively. While the method provided in this embodiment shows a certain gap in prediction accuracy (ACC) compared to MTL in the 5-way 1-shot experimental setting, the differences of 0.8% on the miniImageNet dataset and 1.1% on the FC-100 dataset are acceptable. These experimental results demonstrate the effectiveness of the reliable few-shot image recognition and classification method provided in this embodiment in solving the few-shot image recognition and classification problem.

[0104] Table 4

[0105]

[0106] Compared to traditional few-shot image recognition and classification methods, this embodiment has the advantage of not only accurately predicting the category of the input image but also providing a quantification of the uncertainty of the prediction result. Traditional few-shot image recognition and classification methods often only provide a deterministic classification result without expressing the model's confidence in its prediction. However, few-shot image recognition and classification tasks present many difficulties and challenges, such as visual similarity between categories, data noise, and labeling errors. These factors can lead to uncertainty in the model's prediction results. This embodiment introduces an evidence fusion mechanism that comprehensively considers pre-training evidence and meta-training evidence and performs weighted fusion. This fusion method not only ensures the accuracy of the prediction but also provides a quantification of the uncertainty of the prediction result.

[0107] The experimental results of a reliable few-shot image recognition and classification method provided in this embodiment, under a 5-way 5-shot setting, are as follows: Figure 3 As shown. First, the meta-test task set is obtained using step (7). The prediction results and uncertainty quantification u of all test tasks. Then, different uncertainty thresholds are used to screen the prediction results. For example, when the uncertainty threshold is set to 0.5, in this embodiment, only the prediction results with uncertainty quantification u < 0.5 among all test tasks are retained. Finally, only the screened prediction results are tested for prediction accuracy.

[0108] After analyzing the Figure 3 experimental results, the following can be observed: As the uncertainty threshold decreases, the accuracy of the screened prediction results shows a gradually increasing trend. For example, the prediction accuracy of the prediction results in the low uncertainty threshold range 0 < u < 0.4 is significantly higher than that of the prediction results in the high uncertainty threshold range 0.6 < u < 1. This observation proves that a reliable few-shot image recognition and classification method proposed in this embodiment can make reasonable uncertainty quantification of the prediction results. By quantifying the uncertainty of the prediction results, users in different fields can more comprehensively understand the prediction results of the model and make corresponding decisions.

[0109] Case study:

[0110] To further verify the feasibility of a reliable few-shot image recognition and classification method proposed in this embodiment in practical application scenarios, multiple experiments were conducted on two actual crop pest and disease recognition datasets, IP102 and PlantVillage. The data statistics of the two crop pest and disease recognition datasets are shown in Table 5.

[0111] Table 5

[0112]

[0113] Similar to the previous experiment, in this embodiment, the prediction accuracy ACC is first used as the basic classification performance measurement index to illustrate the effectiveness of this embodiment in the actual application of crop pest and disease recognition.

[0114] The prediction accuracy (ACC) of the reliable few-shot image recognition and classification method provided in this embodiment on the IP102 and PlantVillage datasets is shown in Table 6. On the IP102 dataset, the average accuracy for 5-way 1-shot prediction using the method provided in this embodiment is 57.67%, with a standard deviation of 0.93. When using 5-way 5-shot prediction, the average accuracy increases to 75.84%, with a standard deviation of 0.69. On the PlantVillage dataset, the average accuracy for 5-way 1-shot prediction using the method provided in this embodiment is 79.45%, with a standard deviation of 0.70. When using 5-way 5-shot prediction, the average accuracy further increases to 91.67%, with a standard deviation of 0.39.

[0115] As shown in Table 6, the reliable few-shot image recognition and classification method provided in this embodiment exhibits reliable prediction accuracy on the IP102 and Plant Village datasets. On the IP102 dataset, the method achieves good prediction results with varying sample sizes, and the prediction accuracy significantly improves with increasing sample size. On the Plant Village dataset, the method performs efficiently in both 1-shot and 5-shot scenarios, with higher prediction accuracy in the 5-shot scenario.

[0116] Table 6

[0117] In addition, this embodiment also conducted the same uncertainty quantification experiments as before on the IP102 and Plant Village datasets to demonstrate the rationality of uncertainty quantification in practical application scenarios for the reliable small-sample image recognition and classification method provided in this embodiment.

[0118] Experimental results of uncertainty quantification are as follows Figure 4 As shown, similar to the conclusions obtained from previous experiments, the accuracy of the selected prediction results gradually increases as the uncertainty threshold decreases. By quantifying the uncertainty of the prediction results, crop growers or agricultural experts can gain a more comprehensive understanding of the model's predictions and make corresponding decisions.

[0119] Finally, this embodiment attempts to use uncertainty as a metric for detecting in-distribution and out-of-distribution samples. The assumption is that the greater the uncertainty in the predicted result of a sample, the higher the probability that the sample belongs to the out-of-distribution sample.

[0120] Figure 5The experimental results of in-distribution and out-of-distribution sample detection are shown. It should be noted that: in the IP102 dataset, it mainly covers pest categories of crops, such as aphids, grubs, etc. While the PlantVillage dataset mainly focuses on disease categories of crops, such as gray mold, powdery mildew, etc. Therefore, these two datasets are out-of-distribution datasets for each other in terms of pest and disease types.

[0121] According to the experimental results, the vast majority of in-distribution samples are located in the low uncertainty interval 0 < u < 0.4, and only a small number of in-distribution samples are located in the high uncertainty interval 0.6 < u < 1. On the contrary, for out-of-distribution samples, most samples fall in the high uncertainty interval 0.6 < u < 1, and only a few out-of-distribution samples are located in the low uncertainty interval 0 < u < 0.4. This experimental result further verifies the hypothesis of this embodiment, that is, the greater the uncertainty of the prediction result, the higher the possibility that the sample belongs to out-of-distribution. In-distribution samples usually have lower uncertainty because they are closer to the data distribution seen by the model during training. While out-of-distribution samples are more likely to cause the model to generate higher uncertainty due to their large differences from the training data. These findings support the effectiveness of the proposed reliable few-shot crop pest and disease image recognition method in this embodiment in quantifying the uncertainty of prediction results, and at the same time provide strong experimental evidence for in-distribution and out-of-distribution sample detection.

[0122] The above-described embodiments only represent the specific implementation manners of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the patent of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention.

Claims

1. A reliable method for small-sample image recognition and classification, characterized in that, Includes the following steps: Step 1: Extract features from the input image to obtain its pre-trained feature vector h. pre Learning feature vector h meta ; Step 2: The pre-trained feature vectors h described in Step 1 are respectively... pre Learning feature vector h meta As pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta The input is the pre-trained evidence vector e. pre The training evidence vector e meta Subsequently, the fused evidence vector e of the image to be identified is obtained through an evidence fusion mechanism, which is used to determine its predicted Dirichlet distribution Dir(p|α); based on the Dirichlet distribution, an evidence loss optimization function is constructed. And with the goal of minimizing this function, the model parameters are updated using the gradient descent algorithm; In step 2, the fused evidence vector e is used to determine the Dirichlet distribution Dir(p|α) corresponding to the image to be identified, specifically as follows: Dir(p|α)=Dir(p|e+1), where 1 is an all-1 vector with the same dimension as the fused evidence vector e; according to subjective logic theory and evidence theory, the probability of an image being identified as class k is described as follows: in, This is referred to as the Dirichlet intensity; the overall uncertainty for predicting this image is described as follows: Where K represents the K-classification prediction problem; In the model training phase of step 2, an evidence loss optimization function is constructed for each image sample to be identified within the training task. KL divergence As a regularization term, it is added to the evidence loss optimization function. In this process, the final loss optimization function is obtained, as follows: in, It is the Dirichlet distribution parameter after removing "non-erroneous evidence" from the original Dirichlet distribution parameter α. Image labels in one-hot format; λ t ∈[0,1] represents the regularization annealing coefficient, used to control the impact of the regularization term on the model; Step 3: For a new image to be identified and classified, use Step 1 to extract different features, and then use Step 2 to obtain the Dirichlet distribution Dir(p|α) corresponding to the image. Perform reliable image recognition and classification, and return the image recognition and classification result and the uncertainty coefficient of the result as output to the user.

2. The reliable few-sample image recognition and classification method according to claim 1, characterized in that, In step 1, feature extraction is performed on the input image to obtain its pre-trained feature vector h. pre The details are as follows: The convolutional neural network (CNN) is pre-trained using a large dataset containing all samples from the meta-training set. Cross-entropy is used as the loss function, and gradient descent is employed to update the parameters within the CNN. The image to be classified is then used as input to the pre-trained CNN to obtain the pre-trained feature vector h. pre .

3. The reliable few-sample image recognition and classification method according to claim 1, characterized in that, In step 1, feature extraction is performed on the input image to obtain its meta-training feature vector h. meta The details are as follows: Based on a pre-trained convolutional neural network, two additional lightweight learnable parameters, scaling parameter φ1 and transformation parameter φ2, are introduced. These parameters are directly applied to the convolutional kernels of the pre-trained convolutional neural network, resulting in a task-specific meta-trained convolutional neural network. An image is then fed into this meta-trained convolutional neural network to obtain the meta-trained feature vector h. meta .

4. A reliable few-sample image recognition and classification method according to claim 1, 2, or 3, characterized in that, In step 2, the pre-trained evidence vector e pre The training evidence vector e meta Each is generated by a pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta We obtain the pre-trained evidence neural network ω pre Heyuan trained evidence neural network ω meta All of them are feedforward neural networks consisting of a single fully connected layer; Softplus is used as a non-linear activation function to ensure the ω of the pre-trained evidence neural network is optimized. pre Heyuan trained evidence neural network ω meta The output evidence vector contains only non-negative elements, specifically e. pre =Softplus(ω pre (h pre )), e meta =Softplus(ω meta (h meta )).

5. The reliable few-sample image recognition and classification method according to claim 4, characterized in that, In step 2, the fused evidence vector e of the image to be identified is obtained through an evidence fusion mechanism, as follows: e = μ1e pre +μ2e meta Where μ1 and μ2 are two weight coefficients used to control the pre-trained evidence vector e. pre The training evidence vector e meta The greater the weight coefficient in the fused evidence vector e, the closer the fused evidence vector e will be to the evidence vector corresponding to that weight coefficient.

6. The reliable few-sample image recognition and classification method according to claim 1 or 3, characterized in that, In the model parameter update phase of step 2, the loss optimization function is minimized. With the goal of, For the pre-trained evidence neural network ω pre Learnable parameters, meta-trainable evidence neural network ω meta The learnable parameters and two additional lightweight learnable parameters, namely the scaling parameter φ1 and the transformation parameter φ2, are differentiated and updated using the gradient descent algorithm until the model converges or the loss function value decreases to a certain threshold.