Multi-scale perception self-supervised crop disease small sample image classification method and system

By employing a self-supervised method based on multi-scale perception, dynamic perspective synthesis, and feature space decoupling loss, the generalization ability and feature coupling problems of small-sample disease detection models are addressed, thereby improving the robustness of disease identification and feature extraction capabilities.

CN121121318BActive Publication Date: 2026-02-10JIANGXI AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511659292.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-02-10
Estimated Expiration
2045-11-13

AI Technical Summary

Technical Problem

Existing technologies have insufficient generalization ability for disease detection models under small sample conditions, feature representation is easily affected by changes in perspective, feature coupling in multi-task learning leads to performance bottlenecks, and the fixed perception range of traditional convolutional neural networks limits the ability to capture multi-scale features.

Method used

A self-supervised crop disease small sample image classification method with multi-scale perception is adopted. Rotation variants are generated by dynamic perspective synthesis. Combined with a multi-scale hole fusion module and a lightweight feature adjustment module, the convolutional layer parameters are dynamically adjusted, and feature space decoupling loss is introduced to improve feature extraction and generalization capabilities.

Benefits of technology

It significantly improves the model's robust identification ability for unknown disease samples in any posture, enhances the diversity and generalization of the feature space, reduces the risk of overfitting, and improves feature discrimination and anti-overfitting ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121121318B_ABST
    Figure CN121121318B_ABST
Patent Text Reader

Abstract

The application discloses a multi-scale perception self-supervised crop disease small sample image classification method and system. The method comprises the following steps: acquiring image samples from a base class set, performing basic transformation on original images in the image samples, performing a dynamic view angle synthesis operation on the transformed images, generating rotation variants, and constructing an enhanced sample set; inputting images in the enhanced sample set into a multi-scale hollow fusion module, adjusting the convolution layer parameters under different branches of the multi-scale hollow fusion module using a lightweight feature adjustment module based on the different branches of the multi-scale hollow fusion module, extracting spatial information of different scales through each branch, and generating an output feature map; inputting the output feature map into an MDFResNet model, and outputting a feature vector corresponding to the output feature map, a base class, and a view angle direction; calculating a loss function according to the output result; evaluating the MDFResNet model multiple times using a new class set, and statistically calculating an average accuracy rate based on the evaluation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of small sample image classification, specifically to a multi-scale perceptual self-supervised method and system for classifying small sample images of crop diseases. Background Technology

[0002] Image classification is a fundamental and crucial task in computer vision, playing a key role in several research areas, such as object detection, person re-identification, and object tracking. With the rapid development of deep learning, this field has achieved significant breakthroughs in recent years.

[0003] In modern agricultural production, achieving efficient and accurate intelligent diagnosis of crop diseases is of great significance for ensuring food security. Traditional machine learning techniques mainly rely on manually designed feature representations. The effectiveness of these methods largely depends on the quality of the designed features, and they often exhibit poor generalization ability when faced with complex and changing disease symptoms. Furthermore, acquiring large amounts of labeled data in agricultural environments is both time-consuming and expensive, especially for rare diseases, where obtaining sufficient data is even more difficult, further limiting the practicality of such methods. Secondly, although deep learning-based disease detection methods can automatically learn high-level feature representations from data, greatly improving detection accuracy, their insufficient generalization ability under small sample conditions, the susceptibility of feature representations to perspective changes, and performance bottlenecks caused by feature coupling in multi-task learning still severely restrict their widespread application in practical agricultural scenarios.

[0004] Furthermore, current solutions for small sample sizes largely rely on feature representations learned from basic categories, making them inadequate when faced with newly emerging disease types. Moreover, when processing images of different sizes and shapes, the fixed receptive range of traditional convolutional neural networks limits their ability to capture features at multiple scales. This variation can lead to significant performance degradation in specific application scenarios, failing to meet practical needs. Summary of the Invention

[0005] Based on this, the purpose of this invention is to provide a multi-scale perceptual self-supervised crop disease small sample image classification method and system, which aims to solve the problems of insufficient generalization ability of current deep learning-based disease detection methods under the condition of small samples, easy interference of feature representation by viewpoint changes, and performance bottleneck caused by feature coupling in multi-task learning.

[0006] To achieve the above objectives, this invention proposes a multi-scale sensing self-supervised small-sample image classification method for crop diseases, which includes:

[0007] Obtain a training set, a validation set, and a test set, and perform preset size adjustments and image enhancements on the images in the dataset to obtain a base class set, wherein the base class set contains the original images;

[0008] Image samples are obtained from the base class set, basic transformations are performed on the original images in the image samples, dynamic viewpoint synthesis is performed on the transformed images, rotation variants are generated, and an enhanced sample set is constructed.

[0009] The images in the enhanced sample set are input into the multi-scale dilated fusion module. Based on the different branches of the multi-scale dilated fusion module, the convolutional layer parameters under the different branches of the multi-scale dilated fusion module are adjusted using the lightweight feature adjustment module. Spatial information at different scales is extracted through each branch to generate an output feature map.

[0010] The output feature map is input into the MDFResNet model, and the corresponding feature vector, base class, and view direction are output. The loss function is calculated based on the output results.

[0011] The MDFResNet model was evaluated multiple times using a new set of classes, and the average accuracy was calculated based on the evaluation results.

[0012] According to one aspect of the above technical solution, the steps of obtaining image samples, obtaining image samples from the base class set, performing a basic transformation on the original image in the image samples, performing a dynamic viewpoint synthesis operation on the transformed image, generating a rotation variant, and constructing an enhanced sample set include:

[0013] Randomly sample small batches of b-labeled image samples from the base class set. The base class tag is represented as ∈ , It represents the total number of base classes;

[0014] Image samples The original image in Enhanced transformation through basic data Perform the conversion, and denote the converted image as... '= ( );

[0015] For images 'Perform dynamic view composition operations for each viewpoint' 'Randomly generate K rotation angles{ |K=1,2,...,K}, where Independent and uniform sampling from the interval [0°, 360°], for each Apply rotation operation R( ), to obtain the rotational variant. , =R( ()( '), where the value of K is based on the image The complexity metric C( ') Dynamically determined, C( It can be calculated based on the mean of image gradient magnitude or edge density:

[0016]

[0017] in, , , It is the preset maximum complexity threshold;

[0018] For the original sample Its augmented sample set includes: the original augmented image ', tag is ( (0°); K rotational variants , tag is ( , Mini-batch image samples are expanded to contain b * (1 + ... Augmented sample set of 100 samples ,in It is the average value of K within the batch.

[0019] According to one aspect of the above technical solution, the steps of inputting images from the enhanced sample set into a multi-scale dilatation fusion module, adjusting the convolutional layer parameters under different branches of the multi-scale dilatation fusion module using a lightweight feature adjustment module based on different branches of the multi-scale dilatation fusion module, and extracting spatial information at different scales through each branch to generate an output feature map include:

[0020] The enhanced images from the enhanced sample set are input into the five branches of the multi-scale dilated fusion module, and the five branches are used to extract information from the original image.

[0021] Using a 1x1 convolution kernel as the first branch, the channel dimensions are adjusted, and the basic features of the original image are extracted;

[0022] Use a 3x3 convolution kernel as the second branch, set the hole rate of the second branch to 6, and capture the contextual information of the first range;

[0023] A 3x3 convolution kernel is used as the third branch, and the hole ratio of the third branch is set to 12. Contextual information of a second range is captured, wherein the second range is larger than the first range.

[0024] A 3x3 convolution kernel is used as the fourth branch, and the porosity of the third branch is set to 18 to capture the spatial information of the third range, wherein the third range is larger than the second range;

[0025] Global contextual features are extracted through the fifth branch and the average pooling layer;

[0026] The results of capturing or extracting from the five branches are stitched together to form a comprehensive feature map.

[0027] According to one aspect of the above technical solution, a lightweight feature adjustment module is inserted before the five branch convolutional layers of the multi-scale hole fusion module to adjust the parameters of the convolutional layers of different branches:

[0028] First branch: ;

[0029] Second branch: ;

[0030] Third branch: ;

[0031] Fourth branch: ;

[0032] Fifth branch: ;

[0033] in, , , , These are the original convolutional kernel weights for the first branch, second branch, third branch, and fourth branch, respectively. , , , These are the original biases for the first branch, the second branch, the third branch, and the fourth branch, respectively. and These are the learnable parameters of the lightweight feature adjustment module. The product of the weights. The tensor of the original input image. For global average pooling;

[0034] Output results of all branches , , , ,as well as The features are concatenated along the channel dimension to generate a comprehensive feature map. :

[0035] .

[0036] According to one aspect of the above technical solution, after obtaining the comprehensive feature map, the comprehensive feature map is further processed as follows:

[0037] A global average pooling operation is performed on the comprehensive feature map to obtain the global feature representation of each of the five branches. The global features are passed through two fully connected layers, and the channel attention weights of each branch channel are learned. The channel attention weights are multiplied with the comprehensive feature map through the branch channels. The first fully connected layer uses the ReLU activation function, and the second fully connected layer uses the Sigmoid activation function.

[0038] A global average pooling operation is performed on the comprehensive feature map along the channel dimension to generate a spatial feature map. A 1x1 convolutional layer is used to learn the spatial attention weights of each branch channel spatial location. The spatial attention weights are multiplied by the elements on the comprehensive feature map. The 1x1 convolutional layer is connected to the Sigmoid activation function.

[0039] Key feature maps are obtained through global average pooling. The comprehensive feature map and the key feature map are then fused through element-wise addition. Dimensionality reduction and integration are performed through a 1x1 convolutional layer to generate an output feature map.

[0040] According to one aspect of the above technical solution, the step of inputting the output feature map into the MDFResNet model and outputting the feature vector, base class, and viewpoint direction corresponding to the output feature map, and calculating the loss function based on the output result includes:

[0041] The output feature map generated after processing the enhanced sample set by the multi-scale dilation fusion module and the lightweight feature adjustment module still includes the original enhanced image. ', and rotational variants , original enhanced image ', and rotational variants The input is fed into the MDFResNet model, where features are extracted and the classifier is invoked, utilizing the embedding network within the MDFResNet model. Extract the feature vector V and pass it through the base class classifier. Get base class Through the view orientation classifier Obtaining the viewpoint direction ;

[0042] Calculate the base class classification loss :

[0043]

[0044] The outer summation represents traversing the augmented sample set. For all samples (x, y), the inner summation represents the calculation of its loss contribution for all classes c. It is a real label The one-hot encoded value corresponding to category c; if the sample belongs to category c, then... = 1; otherwise = 0, This represents the score corresponding to category c in the unnormalized prediction score output by the MDFResNet model. In the base class classification task, the prediction score of the MDFResNet model for the j-th base class;

[0045] Calculate the classification loss based on the viewpoint orientation. :

[0046]

[0047] The outer summation represents traversing the augmented sample set. In the expression, all samples (x, r) are represented, where x is the input image and r is the corresponding viewpoint orientation label. The inner layer summation represents the calculation of the loss contribution for all viewpoint intervals m, where M is the number of predefined viewpoint intervals. It is the one-hot encoded value of the true label r corresponding to the view interval m. If the sample belongs to the view interval m, then... = 1; otherwise = 0, It is the score corresponding to the viewpoint interval m in the unnormalized prediction score output by the MDFResNet model. It is the prediction score of the MDFResNet model for the nth viewpoint interval in the viewpoint orientation classification task;

[0048] Calculate the feature space decoupling loss :

[0049]

[0050] Where I represents the total number of categories in the base class classification task, and M represents the total number of viewpoint intervals in the viewpoint orientation classification task. Represents the base class classifier weight matrix The row vector corresponding to the i-th class in the matrix. Represents the weight matrix of the viewpoint orientation classifier The row vector corresponding to the m-th view interval is cos(a,b), which represents the cosine similarity between vectors a and b.

[0051] Calculate the total loss function :

[0052]

[0053] in, The weighting coefficients for the viewpoint orientation classification loss are... These are the weighting coefficients for the feature space decoupling loss.

[0054] According to one aspect of the above technical solution, the step of evaluating the MDFResNet model multiple times using a new class set and calculating the average accuracy based on the evaluation results includes:

[0055] Select a new set of classes, and randomly select N classes. For each class, provide K labeled support samples and a set of Q unlabeled query samples.

[0056] Support samples and query samples Input is an embedded network that has already been trained and whose parameters have been frozen. In this context, the feature extraction process is as follows:

[0057]

[0058]

[0059] in, To support the sample feature vector, To query the feature vector of a sample, and They represent the first The first supporting image and the first One query image, Represents the number of classes. and These represent the number of supporting samples and the number of query samples for each category, respectively.

[0060] The extracted feature vectors are normalized to eliminate differences in modulus between different samples, thereby improving the stability and accuracy of the classifier.

[0061]

[0062] in, It is a matrix containing multiple eigenvectors;

[0063] Obtain the standardized support sample feature vector and query sample feature vector Then, use the support sample feature vectors and its corresponding tags Train a logistic regression classifier to process the feature vectors of the query samples. Input a logistic regression classifier to obtain the predicted class label for the query sample. :

[0064]

[0065] Compare the predicted results with the actual results, and calculate the classification accuracy.

[0066] The evaluation was repeated, and the average accuracy and confidence interval were calculated as performance metrics of the MDFResNet model in the evaluation task.

[0067] This invention also proposes a multi-scale sensing self-supervised small sample image classification system for crop diseases. This system is used to implement the aforementioned multi-scale sensing self-supervised small sample image classification method for crop diseases. The system includes:

[0068] An adjustment module is used to obtain a training set, a validation set, and a test set, and to perform preset size adjustments and image enhancements on the images in the dataset to obtain a base class set, wherein the base class set contains the original images;

[0069] The transformation module is used to obtain image samples from the base class set, perform basic transformations on the original images in the image samples, perform dynamic viewpoint synthesis operations on the transformed images, generate rotation variants, and construct an enhanced sample set;

[0070] The output module is used to input the images in the enhanced sample set into the multi-scale dilatation fusion module. Based on the different branches of the multi-scale dilatation fusion module, the lightweight feature adjustment module is used to adjust the convolutional layer parameters under the different branches of the multi-scale dilatation fusion module, and spatial information of different scales is extracted through each branch to generate an output feature map.

[0071] The loss module is used to input the output feature map into the MDFResNet model and output the feature vector, base class and view direction corresponding to the output feature map, and calculate the loss function based on the output results.

[0072] The evaluation module is used to evaluate the MDFResNet model multiple times using a new set of classes and to calculate the average accuracy based on the evaluation results.

[0073] The present invention also proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the multi-scale sensing self-supervised crop disease small sample image classification method as described above.

[0074] The present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the multi-scale perception self-supervised crop disease small sample image classification method as described above.

[0075] In summary, this application proposes a dynamic perspective synthesis strategy. Through this mechanism, the model is exposed to richer and more natural perspective changes during the training phase, significantly improving its robust recognition ability for unknown disease samples in arbitrary poses and effectively enhancing the diversity and generalization of the feature space. This invention designs a feature space decoupling loss, which effectively avoids negative transfer between tasks and improves the feature discrimination power of the main task, especially exhibiting stronger anti-overfitting ability under small sample conditions. Then, a multi-scale dilated fusion attention module is proposed to increase the receptive field of the convolutional layer and extract more multi-scale information. Finally, a lightweight feature adjustment module is introduced to dynamically adjust the parameters of the convolutional layer, enhancing feature extraction ability, improving generalization ability, and reducing the risk of overfitting.

[0076] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0077] Figure 1 This is a flowchart of the multi-scale sensing self-supervised crop disease small sample image classification method in Embodiment 1 of the present invention;

[0078] Figure 2 This is a schematic diagram of the multi-scale void fusion process in Embodiment 1 of the present invention;

[0079] Figure 3 This is a schematic diagram of the structure of the multi-scale sensing self-supervised crop disease small sample image classification system in Embodiment 2 of the present invention;

[0080] Figure 4 This is a structural block diagram of the electronic device in Embodiment 4 of the present invention. Detailed Implementation

[0081] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.

[0082] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.

[0083] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0084] Example 1

[0085] Please see Figure 1 The diagram shows a flowchart of a multi-scale sensing self-supervised crop disease small sample image classification method according to Embodiment 1 of the present invention. Figure 2 This is a schematic diagram of the multi-scale cavity fusion process. The multi-scale perceptual self-supervised crop disease small sample image classification method includes the following steps S01-S05, wherein:

[0086] S01. Obtain the training set, validation set, and test set, and perform preset size adjustments and image enhancements on the images in the dataset to obtain a base class set, wherein the base class set contains the original images.

[0087] The training, validation, and test sets are obtained from existing publicly available datasets. The images in the training, validation, and test sets are resized to specific dimensions, and image enhancement processes are performed, including but not limited to rotation, flipping, and cropping. A base class set is generated to improve data diversity and help the model better understand and classify images.

[0088] S02. Obtain image samples from the base class set, perform basic transformations on the original images in the image samples, perform dynamic viewpoint synthesis operations on the transformed images, generate rotation variants, and construct an enhanced sample set.

[0089] Sample collection is performed by randomly sampling small batches of b-labeled image samples from the base class set. The base class tag is represented as ∈ , It represents the total number of base classes;

[0090] Image samples The original image in Enhanced transformation through a set of basic data Perform the transformation, which includes, but is not limited to, random horizontal and vertical flipping, random cropping and resizing, color dithering, and random grayscale conversion. The transformed image is denoted as... '= ( );

[0091] For images 'Perform dynamic viewpoint compositing, which does not simply apply a fixed-angle rotation, but generates a set of rotation variants randomly sampled over a continuous range of angles. Specifically, for each...' 'Randomly generate K rotation angles{ |K=1,2,...,K}, where Independent and uniform sampling from the interval [0°, 360°], for each Apply rotation operation R( ), to obtain the rotational variant. , =R( ()( '), where K is not a fixed value; the value of K is based on the image. The complexity metric C( ') Dynamically determined, C( It can be calculated based on the mean of image gradient magnitude or edge density:

[0092]

[0093] in, , , It is a preset maximum complexity threshold, which ensures that simple images generate fewer variations, while complex images generate more variations to enhance learning.

[0094] For the original sample Its augmented sample set includes: the original augmented image ', tag is ( ,0°), (0° represents the "original viewpoint"); K rotational variants , tag is ( , ), ( (representing "rotation viewpoint"); therefore, mini-batch image samples are expanded to contain b * (1 + ... Augmented sample set of 100 samples ,in It is the average value of K within the batch.

[0095] S03. Input the images in the enhanced sample set into the multi-scale dilatation fusion module. Based on the different branches of the multi-scale dilatation fusion module, use the lightweight feature adjustment module to adjust the convolutional layer parameters under the different branches of the multi-scale dilatation fusion module, and extract spatial information of different scales through each branch to generate output feature maps.

[0096] The enhanced images from the enhanced sample set are input into the five branches of the multi-scale dilated fusion module, and the five branches are used to extract information from the original image.

[0097] First branch: Using a 1x1 convolution kernel, this step mainly adjusts the channel dimension without changing the spatial size of the image, helping us to directly extract basic features from rotational datasets;

[0098] The second branch uses a 3x3 convolution kernel with a dilation rate of 6. This configuration can appropriately expand the receptive field, allowing us to capture a slightly wider range of contextual information, namely the contextual information within the first range.

[0099] The third branch: It also uses a 3x3 convolution kernel but increases the dilatation rate to 12, further expanding the receptive field so that the model can obtain a larger range of contextual information, namely the contextual information in the second range, which is larger than the first range;

[0100] The fourth branch uses a 3x3 convolution kernel with a dilation rate of 18 to provide the widest receptive field, ensuring that the model can capture the widest possible spatial information, i.e., contextual information within the third range, which is larger than the second range.

[0101] The fifth branch utilizes global average pooling to extract global contextual features, which helps enhance the model's understanding of the overall image layout, especially when it is necessary to understand complex backgrounds or overall structures.

[0102] After each branch works independently, the output feature maps are stitched together along the channel dimension to form a comprehensive feature map, which integrates information at different scales and provides a rich foundation for subsequent processing.

[0103] Simultaneously, an LFA (Lightweight Feature Adjustment) module is inserted before the five branch convolutional layers of the multi-scale dilated fusion module to adjust the parameters of the convolutional layers in different branches:

[0104] First branch:

[0105] Original convolution operation:

[0106] After introducing the LFA module: ;

[0107] Second branch:

[0108] Original convolution operation:

[0109] After introducing the LFA module: ;

[0110] Third branch:

[0111] Original convolution operation:

[0112] After introducing the LFA module: ;

[0113] Fourth branch:

[0114] Original convolution operation:

[0115] After introducing the LFA module: ;

[0116] Fifth branch: ;

[0117] in, , , , These are the original convolutional kernel weights for the first branch, second branch, third branch, and fourth branch, respectively. , , , These are the original biases for the first branch, the second branch, the third branch, and the fourth branch, respectively. and These are the learnable parameters of the lightweight feature adjustment module. The product of the weights. The tensor of the original input image. For global average pooling;

[0118] Output results of all branches , , , ,as well as The features are concatenated along the channel dimension to generate a comprehensive feature map. :

[0119] .

[0120] The LFA module can optimize the weights and biases of convolutional layers by lightweightly adjusting parameters, reducing the number of parameters that need to be updated. This allows the model to better adapt to spatial information at different scales and reduces the risk of overfitting. At the same time, by dynamically adjusting the convolutional layer parameters, the LFA module can more effectively capture spatial information at different scales, thereby improving the quality of feature representation and enhancing feature extraction capabilities. Furthermore, in few-shot learning tasks, the LFA module can help the model adapt to new tasks more quickly and improve its generalization ability to unseen data.

[0121] After obtaining the comprehensive feature map, further processing is performed on the comprehensive feature map:

[0122] A channel attention mechanism is applied to the comprehensive feature map: a global average pooling operation is performed on the comprehensive feature map to obtain the global feature representation of each of the five branches. The global features are passed through two fully connected layers, and the channel attention weights of each branch channel are learned. The channel attention weights are multiplied with the comprehensive feature map through the branch channels to achieve channel-based weighting, thereby highlighting important channel features. The first fully connected layer uses the ReLU activation function, and the second fully connected layer uses the Sigmoid activation function.

[0123] A spatial attention mechanism is applied to the comprehensive feature map: global average pooling is performed on the comprehensive feature map along the channel dimension to generate a spatial feature map. A 1x1 convolutional layer is used to learn the spatial attention weights of each branch channel spatial location. The spatial attention weights are multiplied by the elements on the comprehensive feature map to achieve spatial weighting and emphasize key region features. The 1x1 convolutional layer is connected to the Sigmoid activation function.

[0124] Key feature maps are obtained through global average pooling. The comprehensive feature map and the key feature map are then fused together through element-wise addition to integrate and enhance relevant features. Finally, a 1x1 convolutional layer is used for dimensionality reduction and integration to generate the final output feature map. This process not only improves the expressive power of the features but also provides strong support for subsequent classification tasks.

[0125] S04. Input the output feature map into the MDFResNet model and output the feature vector, base class and view direction corresponding to the output feature map. Calculate the loss function based on the output results.

[0126] In this embodiment, the MDFResNet model consists of three parts: an embedding network, an embedding network, and an embedding network. Base class classifier and view orientation classifier .

[0127] The output feature map generated after processing the enhanced sample set by the multi-scale dilation fusion module and the lightweight feature adjustment module still includes the original enhanced image. ', and rotational variants , original enhanced image ', and rotational variants Input into the MDFResNet model, through the embedding network Extract the feature vector V and pass it through the base class classifier. Get base class Through the view orientation classifier Obtaining the viewpoint direction Specifically:

[0128] Map the input image to a d-dimensional feature vector V: v = (x; ); Mapping the feature vector V to the predictions of I base classes p = (v; ); Mapping the feature vector V to M predefined view intervals for prediction q = (v; Precise rotation angles are no longer predicted here. Instead, it predicts the discretized view interval to which it belongs. The [0°, 360°) region is divided into M intervals (e.g., M=8, each interval 45°), and the true label... express The range index to which it belongs ( ∈{1, 2, ..., M}).

[0129] The output feature map (i.e., the enhanced sample set) generated after processing by the multi-scale hole fusion module and the lightweight feature adjustment module. All images in ) (original enhanced image) ', and rotational variants The input is uniformly applied to the MDFResNet model. Each image outputs a corresponding feature v and a base class. and perspective direction Meanwhile, for enhancing the sample set For each sample in the dataset, the true label for the base class classification task is: (and (Same), the true label for its perspective orientation classification task is ( The label for ' is R=0, indicating the "original" interval).

[0130] Calculate the base class classification loss :

[0131]

[0132] The outer summation represents traversing the augmented sample set. For all samples (x, y), the inner summation represents the calculation of its loss contribution for all classes c. It is a real label The one-hot encoded value corresponding to category c; if the sample belongs to category c, then... = 1; otherwise = 0, This represents the score corresponding to category c in the unnormalized prediction score output by the MDFResNet model. In the base class classification task, the prediction score of the MDFResNet model for the j-th base class;

[0133] Calculate the classification loss based on the viewpoint orientation. :

[0134]

[0135] The outer summation represents traversing the augmented sample set. In the expression, all samples (x, r) are represented, where x is the input image and r is the corresponding viewpoint orientation label. The inner layer summation represents the calculation of the loss contribution for all viewpoint intervals m, where M is the number of predefined viewpoint intervals. It is the one-hot encoded value of the true label r corresponding to the view interval m. If the sample belongs to the view interval m, then... = 1; otherwise = 0, It is the score corresponding to the viewpoint interval m in the unnormalized prediction score output by the MDFResNet model. It is the prediction score of the MDFResNet model for the nth viewpoint interval in the viewpoint orientation classification task;

[0136] Calculate the feature space decoupling loss :

[0137]

[0138] Where I represents the total number of categories in the base class classification task, and M represents the total number of viewpoint intervals in the viewpoint orientation classification task. Represents the base class classifier weight matrix The row vector corresponding to the i-th class in the matrix. Represents the weight matrix of the viewpoint orientation classifier The row vector corresponding to the m-th view interval is cos(a,b), which represents the cosine similarity between vectors a and b.

[0139] Calculate the total loss function :

[0140]

[0141] in, The weighting coefficients for the viewpoint orientation classification loss are... These are the weighting coefficients for the feature space decoupling loss.

[0142] In addition, the optimal combination of hyperparameters is determined on the validation set through grid search. , ), Candidate values: {0.8, 1.0, 1.2, 1.5} The candidate values ​​are: {0.005, 0.01, 0.02, 0.05}. The optimizer Adam is used based on... For all trainable parameters of the model, Perform backpropagation and gradient descent updates.

[0143] This embodiment uses dynamic viewpoint synthesis instead of fixed 90° / 180° / 270° rotations. It employs a dynamic number of rotation variants with continuous angles based on image complexity, and utilizes feature space decoupling loss. The weight matrix, which acts directly on the classifier, forces the model to learn decoupled feature representations by minimizing the correlation between them.

[0144] S05. Use the new class set to evaluate the MDFResNet model multiple times, and calculate the average accuracy based on the evaluation results.

[0145] Select a new set of classes, and randomly select N classes. For each class, provide K labeled support samples and a set of Q unlabeled query samples.

[0146] Support samples and query samples Input is an embedded network that has already been trained and whose parameters have been frozen. In this context, the feature extraction process is as follows:

[0147]

[0148]

[0149] in, To support the sample feature vector, To query the feature vector of a sample, and They represent the first The first supporting image and the first One query image, Represents the number of classes. and These represent the number of supporting samples and the number of query samples for each category, respectively.

[0150] The extracted feature vectors are normalized to eliminate differences in modulus between different samples, thereby improving the stability and accuracy of the classifier.

[0151]

[0152] in, It is a matrix containing multiple eigenvectors;

[0153] Obtain the standardized support sample feature vector and query sample feature vector Then, use the support sample feature vectors and its corresponding tags Train a logistic regression classifier to process the feature vectors of the query samples. Input a logistic regression classifier to obtain the predicted class label for the query sample. :

[0154]

[0155] Compare the predicted results with the actual results, and calculate the classification accuracy.

[0156] The evaluation was repeated, and the average accuracy and confidence interval were calculated as performance metrics of the MDFResNet model under this evaluation task.

[0157] In summary, this application proposes a dynamic perspective synthesis strategy. Through this mechanism, the model is exposed to richer and more natural perspective changes during the training phase, significantly improving its robust recognition ability for unknown disease samples in arbitrary poses and effectively enhancing the diversity and generalization of the feature space. This invention designs a feature space decoupling loss, which effectively avoids negative transfer between tasks and improves the feature discrimination power of the main task, especially exhibiting stronger anti-overfitting ability under small sample conditions. Then, a multi-scale dilated fusion attention module is proposed to increase the receptive field of the convolutional layer and extract more multi-scale information. Finally, a lightweight feature adjustment module is introduced to dynamically adjust the parameters of the convolutional layer, enhancing feature extraction ability, improving generalization ability, and reducing the risk of overfitting.

[0158] Example 2

[0159] Another aspect of this invention provides a multi-scale perceptual self-supervised crop disease small-sample image classification system; please refer to [link / reference needed]. Figure 3 The diagram shown is a schematic representation of the multi-scale sensing self-supervised crop disease small sample image classification system in Embodiment 2 of the present invention. The multi-scale sensing self-supervised crop disease small sample image classification system includes:

[0160] The adjustment module 11 is used to obtain the training set, validation set and test set, and to perform preset size adjustment and image enhancement on the images in the dataset to obtain a base class set, wherein the base class set contains the original images;

[0161] The transformation module 12 is used to obtain image samples from the base class set, perform basic transformations on the original images in the image samples, perform dynamic viewpoint synthesis operations on the transformed images, generate rotation variants, and construct an enhanced sample set;

[0162] Output module 13 is used to input images from the enhanced sample set into the multi-scale dilatation fusion module. Based on different branches of the multi-scale dilatation fusion module, the lightweight feature adjustment module is used to adjust the convolutional layer parameters under different branches of the multi-scale dilatation fusion module, and spatial information at different scales is extracted through each branch to generate an output feature map.

[0163] The loss module 14 is used to input the output feature map into the MDFResNet model and output the feature vector, base class and view direction corresponding to the output feature map, and calculate the loss function based on the output result.

[0164] Evaluation module 15 is used to evaluate the MDFResNet model multiple times using a new set of classes and to calculate the average accuracy based on the evaluation results.

[0165] The training, validation, and test sets are obtained from existing publicly available datasets. The images in the training, validation, and test sets are resized to specific dimensions, and image enhancement processes are performed, including but not limited to rotation, flipping, and cropping. A base class set is generated to improve data diversity and help the model better understand and classify images.

[0166] Sample collection is performed by randomly sampling small batches of b-labeled image samples from the base class set. The base class tag is represented as ∈ , It represents the total number of base classes;

[0167] Image samples The original image in Enhanced transformation through a set of basic data Perform the transformation, which includes, but is not limited to, random horizontal and vertical flipping, random cropping and resizing, color dithering, and random grayscale conversion. The transformed image is denoted as... '= ( );

[0168] For images 'Perform dynamic viewpoint compositing, which does not simply apply a fixed-angle rotation, but generates a set of rotation variants randomly sampled over a continuous range of angles. Specifically, for each...' 'Randomly generate K rotation angles{ |K=1,2,...,K}, where Independent and uniform sampling from the interval [0°, 360°], for each Apply rotation operation R( ), to obtain the rotational variant. , =R( ()( '), where K is not a fixed value; the value of K is based on the image. The complexity metric C( ') Dynamically determined, C( It can be calculated based on the mean of image gradient magnitude or edge density:

[0169]

[0170] in, , , It is a preset maximum complexity threshold, which ensures that simple images generate fewer variations, while complex images generate more variations to enhance learning.

[0171] For the original sample Its augmented sample set includes: the original augmented image ', tag is ( ,0°), (0° represents the "original viewpoint"); K rotational variants , tag is ( , ), ( (representing "rotation viewpoint"); therefore, mini-batch image samples are expanded to contain b * (1 + ... Augmented sample set of 100 samples ,in It is the average value of K within the batch.

[0172] The enhanced images from the enhanced sample set are input into the five branches of the multi-scale dilated fusion module, and the five branches are used to extract information from the original image.

[0173] First branch: Using a 1x1 convolution kernel, this step mainly adjusts the channel dimension without changing the spatial size of the image, helping us to directly extract basic features from rotational datasets;

[0174] The second branch uses a 3x3 convolution kernel with a dilation rate of 6. This configuration can appropriately expand the receptive field, allowing us to capture a slightly wider range of contextual information, namely the contextual information within the first range.

[0175] The third branch: It also uses a 3x3 convolution kernel but increases the dilatation rate to 12, further expanding the receptive field so that the model can obtain a larger range of contextual information, namely the contextual information in the second range, which is larger than the first range;

[0176] The fourth branch uses a 3x3 convolution kernel with a dilation rate of 18 to provide the widest receptive field, ensuring that the model can capture the widest possible spatial information, i.e., contextual information within the third range, which is larger than the second range.

[0177] The fifth branch utilizes global average pooling to extract global contextual features, which helps enhance the model's understanding of the overall image layout, especially when it is necessary to understand complex backgrounds or overall structures.

[0178] After each branch works independently, the output feature maps are stitched together along the channel dimension to form a comprehensive feature map, which integrates information at different scales and provides a rich foundation for subsequent processing.

[0179] Simultaneously, an LFA (Lightweight Feature Adjustment) module is inserted before the five branch convolutional layers of the multi-scale dilated fusion module to adjust the parameters of the convolutional layers in different branches:

[0180] First branch:

[0181] Original convolution operation:

[0182] After introducing the LFA module: ;

[0183] Second branch:

[0184] Original convolution operation:

[0185] After introducing the LFA module: ;

[0186] Third branch:

[0187] Original convolution operation:

[0188] After introducing the LFA module: ;

[0189] Fourth branch:

[0190] Original convolution operation:

[0191] After introducing the LFA module: ;

[0192] Fifth branch: ;

[0193] in, , , , These are the original convolutional kernel weights for the first branch, second branch, third branch, and fourth branch, respectively. , , , These are the original biases for the first branch, the second branch, the third branch, and the fourth branch, respectively. and These are the learnable parameters of the lightweight feature adjustment module. The product of the weights. The tensor of the original input image. For global average pooling;

[0194] Output results of all branches , , , ,as well as The features are concatenated along the channel dimension to generate a comprehensive feature map. :

[0195] .

[0196] The LFA module can optimize the weights and biases of convolutional layers by lightweightly adjusting parameters, reducing the number of parameters that need to be updated. This allows the model to better adapt to spatial information at different scales and reduces the risk of overfitting. At the same time, by dynamically adjusting the convolutional layer parameters, the LFA module can more effectively capture spatial information at different scales, thereby improving the quality of feature representation and enhancing feature extraction capabilities. Furthermore, in few-shot learning tasks, the LFA module can help the model adapt to new tasks more quickly and improve its generalization ability to unseen data.

[0197] After obtaining the comprehensive feature map, further processing is performed on the comprehensive feature map:

[0198] A channel attention mechanism is applied to the comprehensive feature map: a global average pooling operation is performed on the comprehensive feature map to obtain the global feature representation of each of the five branches. The global features are passed through two fully connected layers, and the channel attention weights of each branch channel are learned. The channel attention weights are multiplied with the comprehensive feature map through the branch channels to achieve channel-based weighting, thereby highlighting important channel features. The first fully connected layer uses the ReLU activation function, and the second fully connected layer uses the Sigmoid activation function.

[0199] A spatial attention mechanism is applied to the comprehensive feature map: global average pooling is performed on the comprehensive feature map along the channel dimension to generate a spatial feature map. A 1x1 convolutional layer is used to learn the spatial attention weights of each branch channel spatial location. The spatial attention weights are multiplied by the elements on the comprehensive feature map to achieve spatial weighting and emphasize key region features. The 1x1 convolutional layer is connected to the Sigmoid activation function.

[0200] Key feature maps are obtained through global average pooling. The comprehensive feature map and the key feature map are then fused together through element-wise addition to integrate and enhance relevant features. Finally, a 1x1 convolutional layer is used for dimensionality reduction and integration to generate the final output feature map. This process not only improves the expressive power of the features but also provides strong support for subsequent classification tasks.

[0201] In this embodiment, the MDFResNet model consists of three parts: an embedding network, an embedding network, and an embedding network. Base class classifier and view orientation classifier .

[0202] The output feature map generated after processing the enhanced sample set by the multi-scale dilation fusion module and the lightweight feature adjustment module still includes the original enhanced image. ', and rotational variants , original enhanced image ', and rotational variants Input into the MDFResNet model, through the embedding network Extract the feature vector V and pass it through the base class classifier. Get base class Through the view orientation classifier Obtaining the viewpoint direction Specifically:

[0203] Map the input image to a d-dimensional feature vector V: v = (x; ); Mapping the feature vector V to the predictions of I base classes p = (v; ); Mapping the feature vector V to M predefined view intervals for prediction q = (v; Precise rotation angles are no longer predicted here. Instead, it predicts the discretized view interval to which it belongs. The [0°, 360°) region is divided into M intervals (e.g., M=8, each interval 45°), and the true label... express The range index to which it belongs ( ∈{1, 2, ..., M}).

[0204] The output feature map (i.e., the enhanced sample set) generated after processing by the multi-scale hole fusion module and the lightweight feature adjustment module. All images in ) (original enhanced image) ', and rotational variants The input is uniformly applied to the MDFResNet model. Each image outputs a corresponding feature v and a base class. and perspective direction Meanwhile, for enhancing the sample set For each sample in the dataset, the true label for the base class classification task is: (and (Same), the true label for its perspective orientation classification task is ( The label for ' is R=0, indicating the "original" interval).

[0205] Calculate the base class classification loss :

[0206]

[0207] The outer summation represents traversing the augmented sample set. For all samples (x, y), the inner summation represents the calculation of its loss contribution for all classes c. It is a real label The one-hot encoded value corresponding to category c; if the sample belongs to category c, then... = 1; otherwise = 0, This represents the score corresponding to category c in the unnormalized prediction score output by the MDFResNet model. In the base class classification task, the prediction score of the MDFResNet model for the j-th base class;

[0208] Calculate the classification loss based on the viewpoint orientation. :

[0209]

[0210] The outer summation represents traversing the augmented sample set. In the expression, all samples (x, r) are represented, where x is the input image and r is the corresponding viewpoint orientation label. The inner layer summation represents the calculation of the loss contribution for all viewpoint intervals m, where M is the number of predefined viewpoint intervals. It is the one-hot encoded value of the true label r corresponding to the view interval m. If the sample belongs to the view interval m, then... = 1; otherwise = 0, It is the score corresponding to the viewpoint interval m in the unnormalized prediction score output by the MDFResNet model. It is the prediction score of the MDFResNet model for the nth viewpoint interval in the viewpoint orientation classification task;

[0211] Calculate the feature space decoupling loss :

[0212]

[0213] Where I represents the total number of categories in the base class classification task, and M represents the total number of viewpoint intervals in the viewpoint orientation classification task. Represents the base class classifier weight matrix The row vector corresponding to the i-th class in the matrix. Represents the weight matrix of the viewpoint orientation classifier The row vector corresponding to the m-th view interval is cos(a,b), which represents the cosine similarity between vectors a and b.

[0214] Calculate the total loss function :

[0215]

[0216] in, The weighting coefficients for the viewpoint orientation classification loss are... These are the weighting coefficients for the feature space decoupling loss.

[0217] In addition, the optimal combination of hyperparameters is determined on the validation set through grid search. , ), Candidate values: {0.8, 1.0, 1.2, 1.5} The candidate values ​​are: {0.005, 0.01, 0.02, 0.05}. The optimizer Adam is used based on... For all trainable parameters of the model, Perform backpropagation and gradient descent updates.

[0218] This embodiment uses dynamic viewpoint synthesis instead of fixed 90° / 180° / 270° rotations. It employs a dynamic number of rotation variants with continuous angles based on image complexity, and utilizes feature space decoupling loss. The weight matrix, which acts directly on the classifier, forces the model to learn decoupled feature representations by minimizing the correlation between them.

[0219] Select a new set of classes, and randomly select N classes. For each class, provide K labeled support samples and a set of Q unlabeled query samples.

[0220] Support samples and query samples Input is an embedded network that has already been trained and whose parameters have been frozen. In this context, the feature extraction process is as follows:

[0221]

[0222]

[0223] in, To support the sample feature vector, To query the feature vector of a sample, and They represent the first The first supporting image and the first One query image, Represents the number of classes. and These represent the number of supporting samples and the number of query samples for each category, respectively.

[0224] The extracted feature vectors are normalized to eliminate differences in modulus between different samples, thereby improving the stability and accuracy of the classifier.

[0225]

[0226] in, It is a matrix containing multiple eigenvectors;

[0227] Obtain the standardized support sample feature vector and query sample feature vector Then, use the support sample feature vectors and its corresponding tags Train a logistic regression classifier to process the feature vectors of the query samples. Input a logistic regression classifier to obtain the predicted class label for the query sample. :

[0228]

[0229] Compare the predicted results with the actual results, and calculate the classification accuracy.

[0230] The evaluation was repeated, and the average accuracy and confidence interval were calculated as performance metrics of the MDFResNet model under this evaluation task.

[0231] In summary, this application proposes a dynamic perspective synthesis strategy. Through this mechanism, the model is exposed to richer and more natural perspective changes during the training phase, significantly improving its robust recognition ability for unknown disease samples in arbitrary poses and effectively enhancing the diversity and generalization of the feature space. This invention designs a feature space decoupling loss, which effectively avoids negative transfer between tasks and improves the feature discrimination power of the main task, especially exhibiting stronger anti-overfitting ability under small sample conditions. Then, a multi-scale dilated fusion attention module is proposed to increase the receptive field of the convolutional layer and extract more multi-scale information. Finally, a lightweight feature adjustment module is introduced to dynamically adjust the parameters of the convolutional layer, enhancing feature extraction ability, improving generalization ability, and reducing the risk of overfitting.

[0232] Example 3

[0233] In another aspect, the present invention also proposes a computer-readable storage medium having stored thereon one or more computer programs that, when executed by a processor, implement the above-described multi-scale sensing self-supervised crop disease small sample image classification method.

[0234] Those skilled in the art will understand that the logic or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable storage medium" can mean any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0235] More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable storage media can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0236] Example 4

[0237] Figure 4This is a structural block diagram of an electronic device provided in Embodiment 4. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the multi-scale sensing self-supervised crop disease small sample image classification method described in the above embodiments. Figure 4 The electronic device 30 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0238] like Figure 4 As shown, the electronic device 30 can be manifested as a general-purpose computing device, such as a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including memory 32 and processor 31).

[0239] Bus 33 includes a data bus, an address bus, and a control bus.

[0240] The memory 32 may include volatile memory, such as RAM 321 (random access memory), and / or cache memory 322, and may further include ROM 323 (read-only memory).

[0241] The memory 32 may also include a program tool 325 having a set (at least one) of program modules 324, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0242] The processor 31 executes various functional applications and data processing by running computer programs stored in the memory 32, such as the multi-scale sensing self-supervised crop disease small sample image classification method described above.

[0243] Electronic device 30 can also communicate with one or more external devices 34 (e.g., keyboard, pointing device, etc.). This communication can be performed via I / O interface 35 (input / output interface). Furthermore, the model-generated electronic device 30 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 36. Figure 4 As shown, network adapter 36 communicates with other modules of the model-generated electronic device 30 via bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated electronic device 30, including but not limited to: microcode, device drivers, redundant processors, disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.

[0244] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.

[0245] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0246] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A self-supervised image classification method for crop diseases based on multi-scale perception, characterized in that, The multi-scale sensing self-supervised crop disease small sample image classification method includes: Obtain a training set, a validation set, and a test set, and perform preset size adjustments and image enhancements on the images in the dataset to obtain a base class set, wherein the base class set contains the original images; Randomly sample small batches of b-labeled image samples from the base class set. The base class tag is represented as ∈ , It represents the total number of base classes; Image samples The original image in Enhanced transformation through basic data Perform the conversion, and denote the converted image as... = ( ); For images Perform dynamic view composition operations for each Randomly generate K rotation angles { |K=1,2,...,K}, where Independent and uniform sampling from the interval [0°, 360°], for each Apply rotation operation R( ), to obtain the rotational variant. , =R( ()( ), where the value of K is based on the image. The complexity metric C( ) Dynamically determined, C( It can be calculated based on the mean of image gradient magnitude or edge density: in, , , It is the preset maximum complexity threshold; For the original sample Its augmented sample set includes: the original augmented image , tag is ( (0°); K rotational variants , tag is ( , Mini-batch image samples are expanded to contain b * (1 + ... Augmented sample set of 100 samples ,in It is the average value of K within the batch; The images in the enhanced sample set are input into the multi-scale dilated fusion module. Based on the different branches of the multi-scale dilated fusion module, the convolutional layer parameters under the different branches of the multi-scale dilated fusion module are adjusted using the lightweight feature adjustment module. Spatial information at different scales is extracted through each branch to generate an output feature map. The output feature map is input into the MDFResNet model, and the corresponding feature vector, base class, and view direction are output. The loss function is calculated based on the output results. The MDFResNet model was evaluated multiple times using a new set of classes, and the average accuracy was calculated based on the evaluation results.

2. The multi-scale sensing self-supervised crop disease small sample image classification method according to claim 1, characterized in that, The steps of inputting images from the enhanced sample set into the multi-scale dilatation fusion module, adjusting the convolutional layer parameters of different branches of the multi-scale dilatation fusion module using a lightweight feature adjustment module based on different branches of the multi-scale dilatation fusion module, and extracting spatial information of different scales through each branch to generate an output feature map include: The enhanced images from the enhanced sample set are input into the five branches of the multi-scale dilated fusion module, and the five branches are used to extract information from the original image. Using a 1x1 convolution kernel as the first branch, the channel dimensions are adjusted, and the basic features of the original image are extracted; Use a 3x3 convolution kernel as the second branch, set the hole rate of the second branch to 6, and capture the contextual information of the first range; A 3x3 convolution kernel is used as the third branch, and the hole ratio of the third branch is set to 12. Contextual information of a second range is captured, wherein the second range is larger than the first range. A 3x3 convolution kernel is used as the fourth branch, and the porosity of the third branch is set to 18 to capture the spatial information of the third range, wherein the third range is larger than the second range; Global contextual features are extracted through the fifth branch and the average pooling layer; The results of capturing or extracting from the five branches are stitched together to form a comprehensive feature map.

3. The multi-scale sensing self-supervised crop disease small sample image classification method according to claim 2, characterized in that, A lightweight feature adjustment module is inserted before the five-branch convolutional layers of the multi-scale dilated fusion module to adjust the parameters of the convolutional layers in different branches: First branch: ; Second branch: ; Third branch: ; Fourth branch: ; Fifth branch: ; in, , , , These are the original convolutional kernel weights for the first branch, second branch, third branch, and fourth branch, respectively. , , , These are the original biases for the first branch, the second branch, the third branch, and the fourth branch, respectively. and These are the learnable parameters of the lightweight feature adjustment module. The product of the weights. The tensor of the original input image. For global average pooling; Output results of all branches , , , ,as well as The features are concatenated along the channel dimension to generate a comprehensive feature map. : 。 4. The multi-scale sensing self-supervised crop disease small sample image classification method according to claim 3, characterized in that, After obtaining the comprehensive feature map, further processing is performed on the comprehensive feature map: A global average pooling operation is performed on the comprehensive feature map to obtain the global feature representation of each of the five branches. The global features are passed through two fully connected layers, and the channel attention weights of each branch channel are learned. The channel attention weights are multiplied with the comprehensive feature map through the branch channels. The first fully connected layer uses the ReLU activation function, and the second fully connected layer uses the Sigmoid activation function. A global average pooling operation is performed on the comprehensive feature map along the channel dimension to generate a spatial feature map. A 1x1 convolutional layer is used to learn the spatial attention weights of each branch channel spatial location. The spatial attention weights are multiplied by the elements on the comprehensive feature map. The 1x1 convolutional layer is connected to the Sigmoid activation function. Key feature maps are obtained through global average pooling. The comprehensive feature map and the key feature map are then fused through element-wise addition. Dimensionality reduction and integration are performed through a 1x1 convolutional layer to generate an output feature map.

5. The multi-scale sensing self-supervised crop disease small sample image classification method according to claim 1, characterized in that, The steps of inputting the output feature map into the MDFResNet model and outputting the feature vector, base class, and viewpoint direction corresponding to the output feature map, and calculating the loss function based on the output results include: The output feature map generated after processing the enhanced sample set by the multi-scale dilation fusion module and the lightweight feature adjustment module still includes the original enhanced image. , and rotational variants , original enhanced image , and rotational variants The input is fed into the MDFResNet model, where features are extracted and the classifier is invoked, utilizing the embedding network within the MDFResNet model. Extract the feature vector V and pass it through the base class classifier. Get the base class Through the viewpoint orientation classifier Obtaining the direction of view ; Calculate the base class classification loss : The outer summation represents traversing the augmented sample set. For all samples (x, y), the inner summation represents the calculation of its loss contribution for all classes c. It is a real label The one-hot encoded value corresponding to category c; if the sample belongs to category c, then... = 1; otherwise = 0, This represents the score corresponding to category c in the unnormalized prediction score output by the MDFResNet model. In the base class classification task, the prediction score of the MDFResNet model for the j-th base class; Calculate the classification loss based on the viewpoint orientation. : The outer summation represents traversing the augmented sample set. In the expression, all samples (x, r) are represented, where x is the input image and r is the corresponding viewpoint orientation label. The inner layer summation represents the calculation of the loss contribution for all viewpoint intervals m, where M is the number of predefined viewpoint intervals. It is the one-hot encoded value of the true label r corresponding to the view interval m. If the sample belongs to the view interval m, then... = 1; otherwise = 0, It is the score corresponding to the viewpoint interval m in the unnormalized prediction score output by the MDFResNet model. It is the prediction score of the MDFResNet model for the nth viewpoint interval in the viewpoint orientation classification task; Calculate the feature space decoupling loss : Where I represents the total number of categories in the base class classification task, and M represents the total number of viewpoint intervals in the viewpoint orientation classification task. Represents the base class classifier weight matrix The row vector corresponding to the i-th class in the matrix. Represents the weight matrix of the viewpoint orientation classifier The row vector corresponding to the m-th view interval is cos(a,b), which represents the cosine similarity between vectors a and b. Calculate the total loss function : in, The weighting coefficients for the viewpoint orientation classification loss are... These are the weighting coefficients for the feature space decoupling loss.

6. The multi-scale sensing self-supervised crop disease small sample image classification method according to claim 1, characterized in that, The step of evaluating the MDFResNet model multiple times using a new set of classes and calculating the average accuracy based on the evaluation results includes: Select a new set of classes, and randomly select N classes. For each class, provide K labeled support samples and a set of Q unlabeled query samples. Support samples and query samples Input is an embedded network that has already been trained and whose parameters have been frozen. In this context, the feature extraction process is as follows: in, To support the sample feature vector, To query the feature vector of a sample, and They represent the first The first supporting image and the first One query image, Represents the number of classes. and These represent the number of supporting samples and the number of query samples for each category, respectively. The extracted feature vectors are normalized to eliminate differences in modulus between different samples, thereby improving the stability and accuracy of the classifier. in, It is a matrix containing multiple eigenvectors; Obtain the standardized support sample feature vector and query sample feature vector Then, use the support sample feature vectors and its corresponding tags Train a logistic regression classifier to process the feature vectors of the query samples. Input a logistic regression classifier to obtain the predicted class label for the query sample. : Compare the predicted results with the actual results, and calculate the classification accuracy. The evaluation was repeated, and the average accuracy and confidence interval were calculated as performance metrics of the MDFResNet model in the evaluation task.

7. A self-supervised crop disease small-sample image classification system with multi-scale perception, characterized in that, The multi-scale sensing self-supervised crop disease small sample image classification system is used to implement the multi-scale sensing self-supervised crop disease small sample image classification method according to any one of claims 1-6, the system comprising: An adjustment module is used to obtain a training set, a validation set, and a test set, and to perform preset size adjustments and image enhancements on the images in the dataset to obtain a base class set, wherein the base class set contains the original images; The transformation module is used to randomly sample mini-batches of b-labeled image samples from the base class set. The base class tag is represented as ∈ , It represents the total number of base classes; Image samples The original image in Enhanced transformation through basic data Perform the conversion, and denote the converted image as... = ( ); For images Perform dynamic view composition operations for each Randomly generate K rotation angles { |K=1,2,...,K}, where Independent and uniform sampling from the interval [0°, 360°], for each Apply rotation operation R( ), to obtain the rotational variant. , =R( ()( ), where the value of K is based on the image. The complexity metric C( ) Dynamically determined, C( It can be calculated based on the mean of image gradient magnitude or edge density: in, , , It is the preset maximum complexity threshold; For the original sample Its augmented sample set includes: the original augmented image , tag is ( (0°); K rotational variants , tag is ( , Mini-batch image samples are expanded to contain b * (1 + ... Augmented sample set of 100 samples ,in It is the average value of K within the batch; The output module is used to input the images in the enhanced sample set into the multi-scale dilatation fusion module. Based on the different branches of the multi-scale dilatation fusion module, the lightweight feature adjustment module is used to adjust the convolutional layer parameters under the different branches of the multi-scale dilatation fusion module, and spatial information of different scales is extracted through each branch to generate an output feature map. The loss module is used to input the output feature map into the MDFResNet model and output the feature vector, base class and view direction corresponding to the output feature map, and calculate the loss function based on the output results. The evaluation module is used to evaluate the MDFResNet model multiple times using a new set of classes and to calculate the average accuracy based on the evaluation results.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the multi-scale sensing self-supervised crop disease small sample image classification method as described in any one of claims 1-6.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the multi-scale sensing self-supervised crop disease small sample image classification method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Remote sensing image small sample classification method based on multi-view feature fusion

    CN116543192A

  • Few-shot image incremental classification method and apparatus based on embedding enhancement and adaption

    WO2023137889A1