Grape leaf disease degree grading prediction method and system based on cross-level feature fusion

Through the cross-level feature fusion method, using the DINOV2 visual large model and multi-scale feature extraction module, the problem of poor generalization ability of the deep learning model in predicting the severity of grape leaf disease is solved, and accurate prediction of the degree of grape leaf disease is achieved. Grading.

CN118710952AActive Publication Date: 2024-09-27YUNNAN AGRICULTURAL UNIVERSITY

Patent Information

Application Number
CN202410713241.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-27
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

Existing deep learning models have poor generalization ability in predicting grape leaf disease severity, and have high requirements on data sources, making it impossible to accurately predict disease severity.

Method used

Using a cross-level feature fusion method, grape leaf images are input into the DINOV2 large visual model, basic features are fused through the attention refinement module and multi-scale feature extraction module, cross-level fusion features are generated, and cross-entropy loss functions are used for training to achieve disease control Segmentation and hierarchical prediction.

Benefits of technology

The accuracy and generalization ability of the model are improved, accurate prediction of the degree of grape leaf disease is achieved, and the accuracy and robustness of segmentation are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710952A
    Figure CN118710952A
Patent Text Reader

Abstract

The invention discloses a cross-level feature fusion grape leaf disease degree grading prediction method and a cross-level feature fusion grape leaf disease degree grading prediction system, relates to the technical field of disease degree prediction, and solves the technical problems that the model generalization ability is poor, the requirement for a data source is very high, and the requirement for accurately predicting the severity of a grape leaf disease still cannot be met. According to the method, a grape leaf disease image is input into a DINOV2 visual large model to obtain four basic features with the same shape from shallow to deep, the obtained basic features are fused by designing a unique cross-level feature fusion mode to obtain cross-level fusion features, a new multi-scale feature extraction module is provided, and the multi-scale feature extraction efficiency is improved. Multi-scale and deep information of the image is better extracted, spatial features of different scales are comprehensively utilized, a large model technology is applied to the field of grape leaf disease degree grading prediction, the precision of the model is greatly improved, the generalization ability of the model is enhanced, and the requirement for accurately predicting the grape leaf disease degree is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of disease degree prediction, and in particular to a method and system for grading and predicting the degree of grape leaf disease by cross-level feature fusion. Background Art

[0002] However, due to the wide variety of grape diseases, the difficulty in identification, and the short disease cycle, it is extremely challenging to predict the degree of grape leaf disease grading. Traditionally, the identification of crop diseases relies on field sampling by professionals and direct observation or analysis of leaf samples to determine the severity of the disease in the leaf samples. In recent years, with the development of artificial intelligence technology, deep learning and computer vision technology have been able to accurately identify crop diseases. By analyzing and processing image data from crop disease datasets, and then building machine learning models, basic features are extracted from these images to achieve accurate and rapid identification. With the maturity of machine learning technology, this method has been successfully applied to the identification of agricultural diseases.

[0003] According to Chinese patent application number CN202210457915.X, a citrus fine-grained disease recognition method based on an attention mechanism and a dual-branch network is disclosed, and specifically includes: S1. Constructing a citrus fine-grained disease and insect pest dataset;

[0004] S2. Improve the pooling layer of ResNet-50 by replacing the original maximum pooling layer of the network with the improved pyramid pooling, and add the CBAM attention mechanism after the fifth convolutional block as the deep branch of the two-branch network to extract features related to citrus pests and diseases;

[0005] S3. construct another shallow branch in the dual-branch network to extract detailed texture information of citrus pests and diseases;

[0006] S4. Fuse the features extracted by the dual-branch network constructed in steps S2 and S3, and add the SE attention mechanism to redistribute the channel weights;

[0007] S5. Use the data set obtained in step S1 to train the attention mechanism-two-branch network model;

[0008] S6. Design fine-grained disease identification criteria;

[0009] S7. Input the citrus disease image to be identified into the model operated in step S5 to obtain the type of citrus disease and its fine-grained disease degree.

[0010] However, most deep learning models are currently widely used for classification and identification of pests and diseases, and have achieved good results, but little work has been done on disease severity detection and prediction. From a practical point of view, reliable, accurate and timely detection of plant disease severity is more important to farmers than disease classification, because disease severity detection helps them make effective decisions and take appropriate measures to prevent plant diseases and reduce losses caused by infection.

[0011] At present, traditional deep learning methods have certain limitations in terms of the severity of agricultural diseases, mainly because they cannot obtain sufficient feature extraction capabilities from limited data, resulting in poor model generalization ability and high requirements for data sources. The model still cannot meet the requirements of accurately predicting the severity of grape leaf diseases. The emergence of large model technology has greatly enhanced the model's feature extraction capabilities and improved the model's generalization. Summary of the invention

[0012] In view of the shortcomings of the prior art, the present invention provides a method and system for grading and predicting the severity of grape leaf diseases by cross-level feature fusion, which solves the problem that the model has poor generalization ability and high requirements for data sources, and the model still cannot meet the requirements for accurately predicting the severity of grape leaf diseases.

[0013] To achieve the above objectives, the present invention is implemented through the following technical solutions: a grape leaf disease degree classification prediction method based on cross-level feature fusion,

[0014] Collect images of diseased grape leaves, use labelme software to annotate the image data, and obtain semantic segmentation label files;

[0015] The labeled diseased grape leaf images were divided into training set and test set in a ratio of 8:2;

[0016] Construct a semantic segmentation model based on cross-scale feature fusion of the DINOV2 large model;

[0017] Put the training set data into the semantic segmentation model for training, freeze the main network parameters of the DINNV2 large visual model, and update other parameters of the semantic segmentation model until the model is gradually fitted to obtain a trained semantic segmentation model;

[0018] The image to be predicted is input into the trained semantic segmentation model to obtain the grape leaf disease segmentation map;

[0019] The number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation map are counted, and the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the leaf disease area is calculated. The severity of the grape leaf disease is graded and predicted based on the calculated ratio.

[0020] The step of inputting the image to be predicted into the trained semantic segmentation model to obtain the grape leaf disease segmentation map comprises:

[0021] Input the image to be predicted into the backbone network of the DINOV2 visual model to obtain four basic features of the same shape from shallow to deep;

[0022] The first two shallow basic features are input into the attention refinement module respectively, and then the shallow fusion features are obtained by element-by-element addition operation.

[0023] Input the deepest level features into the multi-scale feature extraction module to obtain deep multi-scale features;

[0024] The latter two deep basic features are input into the attention refinement module respectively, and then fused with the deep multi-scale features by element-by-element addition operation to obtain the deep fusion features;

[0025] Input shallow fusion features and deep fusion features into the feature fusion module to obtain cross-level fusion features;

[0026] The cross-level fusion features are input into the segmentation head for upsampling operation to obtain the grape leaf disease segmentation map;

[0027] In summary, according to the above-mentioned cross-level feature fusion grape leaf disease degree grading prediction method and system, the image is input into the DINOV2 visual large model to obtain four basic features of the same shape from shallow to deep, and the basic features obtained above are fused by designing a unique special fusion method to obtain cross-level fusion features, which greatly improves the accuracy of the model, enhances the generalization ability of the model, and achieves the requirement of accurately predicting the degree of grape leaf disease. Specifically, the image is input into the pre-trained DINOV2 visual large model to obtain four basic features of the same shape from shallow to deep, and the super feature extraction ability of the large model is used to solve the problem of poor generalization ability of traditional deep learning models caused by training on a single data set. A unique feature fusion method is designed to fuse the basic features obtained above, and the first two shallow basic features are respectively input into the attention refinement module, and then the feature fusion is performed through element-by-element addition operation to obtain shallow fusion features, and then the deepest level features are input into the multi-scale feature extraction module to obtain deep multi-scale features. The above multi-scale feature extraction module includes six branches, namely, convolution, dilated convolution, global average pooling, and residual. By performing element-by-element addition operation on each branch and the previous branch, the multi-scale and deep information of the image can be better extracted. The comprehensive use of spatial features of different scales helps to clearly depict the edge of the object, thereby significantly improving the accuracy of segmentation. Then, the last two deep basic features are respectively input into the attention refinement module, and then the deep multi-scale features are fused by element-by-element addition operation to obtain the deep fusion features. Finally, the shallow fusion features and the deep fusion features are input into the feature fusion module. The cross-level fusion feature is obtained by capturing this series of complex semantic levels, providing a deep visual understanding for the model and ensuring the comprehensiveness and robustness in the semantic segmentation task. The cross-level fusion feature is input into two convolutional layers, and then up-sampled to obtain a feature map with the same width and height as the input image and the number of channels as the number of categories. The feature map is divided into H×W one-dimensional vectors along the width and height directions, and the one-dimensional vector is input into the recognition classifier. The one-dimensional feature vector is mapped to the probability distribution of different categories through the softmax function, and then minimized by the cross entropy loss function. The difference between the probability distribution of the model output and the probability distribution of the true label is calculated to obtain the category with the highest probability. Then, the feature map is visualized to obtain the grape leaf disease segmentation map. The number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation map are counted, and the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area is calculated. The severity of grape leaf disease is graded and predicted by the calculated ratio, which greatly improves the accuracy of the model, enhances the generalization ability of the model, and realizes the accurate prediction of the degree of grape leaf disease.

[0028] Furthermore, the step of inputting the image to be predicted into the DINNV2 visual large model backbone network to obtain four basic features of the same shape from shallow to deep includes:

[0029] The collected grape leaf disease images to be predicted are input into the convolution layer for downsampling operation;

[0030] The downsampled features are input into 40 consecutive multi-head self-attention mechanism modules, and the output features of the 9th and 19th layers are taken as shallow basic features, and the output features of the 29th and 39th layers are taken as deep basic features.

[0031] Furthermore, the step of inputting the first two shallow basic features into the attention refinement module respectively, and then fusing the features by element-by-element addition operation to obtain shallow fused features includes:

[0032] Input the shallow features output by the 9th layer into the attention refinement module, and then input the obtained features into the convolution layer;

[0033] The shallow features output by the 19th layer are input into the attention refinement module, and are fused with the features obtained in the above step by element-by-element addition operation;

[0034] The fused features obtained in the above steps are upsampled and then input into the convolutional layer to obtain shallow fused features.

[0035] Furthermore, the step of inputting the shallow features output by the 9th layer into the attention refinement module and then inputting the obtained features into the convolution layer includes:

[0036] Input the shallow features output by the 9th layer into the convolution layer to reduce the number of special channels;

[0037] The features obtained in the above steps are input into the SE attention mechanism module and then into the convolutional layer;

[0038] Furthermore, the step of inputting the deepest level features into the multi-scale feature extraction module to obtain deep multi-scale features includes:

[0039] Inputting the deep features output by the 39th layer into six branches respectively, wherein the six branches are, from one to six, a convolution branch, a dilated convolution branch with a dilation coefficient of 6, a dilated convolution branch with a dilation coefficient of 12, a dilated convolution branch with a dilation coefficient of 18, a global average pooling branch, and a residual branch;

[0040] Perform element-by-element addition operations on the features output by the first branch and the features output by the second to fifth branches respectively;

[0041] Concatenate the features obtained in the above steps and input them into the group convolution layer;

[0042] Concatenate the features output by the first branch with the features obtained in the above steps and input them into the convolutional layer;

[0043] Add the features output by the sixth branch to the features obtained in the above steps element by element to obtain deep multi-scale features;

[0044] Furthermore, the step of inputting the latter two deep basic features into the attention refinement module respectively, and then fusing the features with the deep multi-scale features by element-by-element addition operation to obtain the deep fusion features includes:

[0045] Input the deep features output by the 39th layer into the attention refinement module, and then perform an element-by-element addition operation with the deep multi-scale features;

[0046] Input the features obtained in the above steps into the convolutional layer;

[0047] The deep features output by the 29th layer are input into the attention refinement module, and then the feature rows obtained in the above step are added element by element;

[0048] The features obtained in the above steps are upsampled and then input into the convolution layer to obtain deep fusion features;

[0049] Furthermore, the step of inputting the shallow fusion features and the deep fusion features into the feature fusion module to obtain the cross-level fusion features includes:

[0050] The shallow fusion features are concatenated with the deep fusion features, and then input into the convolution layer;

[0051] The features obtained in the above steps are input into the SE attention mechanism module and added element by element with the original features to obtain cross-level fusion features;

[0052] Furthermore, the step of inputting the cross-level fusion features into the segmentation head for upsampling operation to obtain the grape leaf disease segmentation map includes:

[0053] The cross-level fusion features are input into two convolutional layers, and then up-sampled to obtain a feature map with the same width and height as the input image and the same number of channels as the number of categories;

[0054] The feature map obtained in the above steps is divided into H×W one-dimensional vectors along the width and height directions, and the one-dimensional vector is input into the recognition classifier. The one-dimensional feature vector is mapped to the probability distribution of different categories through the softmax function, and then the cross entropy loss function is used to minimize the difference between the probability distribution of the model output and the probability distribution of the true label to obtain the category with the highest probability. Then, the feature map is visualized to obtain the grape leaf disease segmentation map.

[0055] The present invention proposes a grape leaf disease degree classification prediction system based on cross-level feature fusion, comprising:

[0056] An image acquisition module, used for acquiring grape leaf images;

[0057] A feature extraction module, used for inputting the collected image to be predicted into a pre-trained model to obtain cross-level basic features of grape leaves, wherein the unit for inputting the collected image to be predicted into the pre-trained model to obtain cross-level basic features of grape leaves comprises: inputting the collected image to be predicted into the DINOV2 visual large model backbone network to obtain four basic features of the same shape from shallow to deep at the 9th layer, the 19th layer, the 29th layer and the 39th layer;

[0058] A feature fusion module, used for fusing the cross-level basic features obtained by the feature extraction module to obtain a cross-level fusion feature, wherein the unit for fusing the cross-level basic features obtained by the feature extraction module to obtain a cross-level fusion feature comprises: inputting the first two shallow basic features into the attention refinement module respectively, and then performing feature fusion by element-by-element addition operation to obtain shallow fusion features, inputting the deepest level features into the multi-scale feature extraction module to obtain deep multi-scale features, inputting the last two deep basic features into the attention refinement module respectively, and then performing feature fusion with the deep multi-scale features by element-by-element addition operation to obtain deep fusion features, and inputting the shallow fusion features and the deep fusion features into the feature fusion module to obtain cross-level fusion features;

[0059] An image segmentation module, used for inputting the cross-level fusion features into a segmentation head to obtain a grape leaf disease segmentation map;

[0060] The hierarchical prediction module is used to count the number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation map, calculate the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area, and classify and predict the severity of grape leaf diseases based on the calculated ratio.

[0061] The present invention provides a method and system for predicting the degree of grape leaf disease by grading based on cross-level feature fusion. Compared with the prior art, it has the following beneficial effects:

[0062] The present invention inputs the grape leaf disease image into the DINOV2 visual large model to obtain four basic features of the same shape from shallow to deep, fuses the basic features obtained above by designing a unique cross-level feature fusion method, obtains cross-level fusion features, and proposes a new multi-scale feature extraction module to better extract multi-scale and deep-level information of the image, comprehensively utilizes spatial features of different scales, and applies the large model technology to the field of grape leaf disease degree classification prediction, which greatly improves the accuracy of the model, enhances the generalization ability of the model, and achieves the requirement of accurately predicting the degree of grape leaf disease. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 This is a flow chart of a method for grading and predicting the degree of grape leaf disease by cross-level feature fusion proposed by the present invention;

[0064] Figure 2 This is a structural diagram of the injection model in a grape leaf disease degree classification prediction method based on cross-level feature fusion proposed by the present invention;

[0065] Figure 3 This is a structural diagram of the attention refinement module in the grape leaf disease degree classification prediction method based on cross-level feature fusion proposed by the present invention;

[0066] Figure 4 This is a structural diagram of a feature fusion module in a grape leaf disease severity classification prediction method based on cross-level feature fusion proposed by the present invention;

[0067] Figure 5 This is a structural diagram of a multi-scale feature extraction module in a grape leaf disease severity classification prediction method based on cross-level feature fusion proposed by the present invention;

[0068] Figure 6 This is a flow chart of a grape leaf disease severity classification prediction system based on cross-level feature fusion proposed by the present invention;

[0069] In the figure: 10, image acquisition module; 101, image acquisition unit; 20, feature extraction module; 201, feature extraction unit; 30, feature fusion module; 301, feature fusion unit; 40, image segmentation module; 401, image segmentation unit; 50, hierarchical prediction module; 501, hierarchical prediction unit. DETAILED DESCRIPTION

[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0071] For example, see Figures 1 to 5 The present application provides a grape leaf disease severity classification prediction method based on cross-level feature fusion. The grape leaf disease severity classification prediction method based on cross-level feature fusion includes steps S01 to S06, wherein:

[0072] Step S01: Collect images of diseased grape leaves, use labelme software to label the image data, and obtain a semantic segmentation label file;

[0073] It should be noted that, in this embodiment, the collected grape disease leaf images use the Plant Village dataset. This dataset is an important resource for studying leaf disease identification algorithms. It is developed through the cooperation of Cornell University and the Plantation Village project and contains a collection of various plant disease images from different regions around the world. The dataset includes 54,305 carefully sorted high-quality images, including 14 different plant diseases and health conditions, each of which has been strictly verified and labeled by experienced plant pathologists to ensure high accuracy and reliability. In addition, the dataset also includes valuable metadata for each image, such as plant type, disease type, and geographic location. Grape leaf disease images in the Plant Village dataset are selected, and the image data are annotated using the Labelme software. The grape disease images are annotated into three categories: background, leaf, and disease spot. The leaf category represents the other healthy parts of the leaf except the disease spot, and a semantic segmentation label file is obtained.

[0074] Step S02: dividing the labeled grape disease leaf image data into a training set and a test set in a ratio of 8:2;

[0075] Step S03: constructing a semantic segmentation model based on cross-level feature fusion;

[0076] It should be noted that, in this embodiment, the semantic segmentation model constructed based on cross-level feature fusion includes three parts: feature extraction, feature fusion, and image segmentation. The image is input into the pre-trained DINOV2 visual model to obtain four basic features of the same shape from shallow to deep, and a unique feature fusion method is designed to fuse the basic features obtained above. The first two shallow basic features are respectively input into the attention refinement module, and then the features are fused by element-by-element addition operation to obtain shallow fusion features, and then the deepest level features are input into the multi-scale feature extraction module to obtain deep multi-scale features. The multi-scale feature extraction module includes six branches, namely convolution, dilated convolution, global average pooling, and residual. By performing element-by-element addition operation on each branch and the previous branch, the multi-scale and deep information of the image can be better extracted, and the spatial features of different scales are comprehensively utilized. Then, the last two The deep basic features are input into the attention refinement module respectively, and then fused with the deep multi-scale features by element-by-element addition operation to obtain the deep fusion features. Finally, the shallow fusion features and the deep fusion features are input into the feature fusion module to obtain the cross-level fusion features. The cross-level fusion features are input into two convolutional layers, and then up-sampled to obtain a feature map with the same width and height as the input image and the number of channels as the number of categories. The feature map is divided into H×W one-dimensional vectors along the width and height directions, and the one-dimensional vector is input into the recognition classifier. The one-dimensional feature vector is mapped to the probability distribution of different categories through the softmax function, and then the cross entropy loss function is used to minimize the difference between the probability distribution of the model output and the probability distribution of the true label to obtain the category with the highest probability. Then the feature map is visualized to obtain the grape leaf disease segmentation map. For the specific structure of the model, please refer to Figure 2 :

[0077] The structure of the semantic segmentation model based on cross-level feature fusion is defined as follows:

[0078]

[0079] Among them, i represents the number of layers of the multi-head self-attention mechanism in the backbone network of the DINOV2 large model in the feature extraction module, and X i represents the basic features of the output of the i-th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module, Y represents the segmentation map finally output by the model, and M represents the various modules that constitute the model, where M dino represents the feature extraction module DINOV2 large model backbone network, M up Represents the upsampling module, M ff represents the feature fusion module, M att represents the attention refinement module, M mfe Represents the multi-feature extraction module;

[0080] DINOv2 is a large-scale model for self-supervised learning, which aims to pre-train neural networks through large-scale unlabeled data to extract useful features from the data. The basic model of DINOv2 is VisionTransformer (ViT), which is a method of applying Transformer to computer vision tasks. Transformer is a powerful neural network architecture that is particularly suitable for processing sequence data such as text and time series, but can also be applied to other fields such as image processing. By dividing the image into a series of small blocks and flattening them, ViT can convert image data into sequence data, so that Transformer can process images. In short, DINOv2 is a large-scale model for self-supervised learning. It is pre-trained on large-scale unlabeled data through cross-scale contrast learning tasks, so as to learn rich feature representations in images. This embodiment uses the backbone network of the DINOV2 large model to extract features from images of diseased grape leaves and obtain rich cross-level basic features.

[0081] The present invention proposes a unique cross-level feature fusion method, which first fuses shallow features to obtain shallow fusion features, then fuses deep features to obtain deep fusion features, and finally uses a feature fusion module to fuse shallow fusion features and deep fusion features into cross-level fusion features. The cross-level feature fusion method is defined as follows:

[0082]

[0083] Among them, i represents the number of layers of the multi-head self-attention mechanism in the backbone network of the DINOV2 large model in the feature extraction module, and X i represents the basic features of the output of the i-th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module, X s represents shallow fusion features, X d represents the deep fusion feature, X f represents cross-level fusion features, and M represents the modules that constitute the model. dino represents the feature extraction module DINOV2 large model backbone network, M up represents the upsampling module, M ff represents the feature fusion module, M att represents the attention refinement module, M mfe represents a multi-feature extraction module, and CONV represents a convolutional layer.

[0084] Input the shallow features output by the 9th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module to the attention refinement module, and then input the obtained features to the convolution layer, input the shallow features output by the 19th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module to the attention refinement module, and perform feature fusion with the features obtained in the above steps through element-by-element addition operation, perform upsampling operation on the fused features obtained in the above steps, and then input them to the convolution layer to obtain shallow fusion features;

[0085] Input the shallow features output by the 39th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module into the multi-scale feature extraction module to obtain deep multi-scale features, input the 39th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module into the attention refinement module, and perform feature fusion with the deep multi-scale features through element-by-element addition operation, and then input the obtained features into the convolution layer, input the shallow features output by the 29th layer of the multi-head self-attention mechanism layer in the DINOV2 large model in the feature extraction module into the attention refinement module, and perform feature fusion with the features obtained in the above steps through element-by-element addition operation, perform upsampling operation on the fused features obtained in the above steps, and then input them into the convolution layer to obtain deep fused features;

[0086] The shallow fusion features and deep fusion features obtained above are input into the feature fusion module to obtain cross-level fusion features;

[0087] The convolution layer consists of a convolution operation, a batch normalization layer (BN layer), and a Relu activation function, and is defined as:

[0088] Y=CONV(X)=Relu(BN(Conv(X)))

[0089] Among them, X represents the input features of the convolution layer, Y represents the output features of the convolution layer, CONV represents the convolution layer, Conv represents the convolution operation, BN represents the batch normalization layer, and Relu represents the Relu activation function;

[0090] Convolution refers to the process of sliding a fixed-size window (called a convolution kernel or filter) over the input data to perform weighted summation on the local area of ​​the input data. The convolution operation is usually used to extract the features of the input data. A key advantage of the convolution operation is its parameter sharing, that is, the convolution kernel shares parameters over the entire input data, which can greatly reduce the number of parameters that need to be learned, thereby reducing the complexity of the model and making the model easier to train. The definition of the convolution operation is:

[0091]

[0092] Where K is the convolution kernel, its subscript represents the spatial dimension and number of channels of the convolution kernel, Y represents the output of the convolution operation, X represents the input of the convolution operation, and the subscripts X and Y represent the size and number of channels of the feature map;

[0093] The general operation of the BN layer includes normalizing the mean and variance of each batch of data, and then adjusting the data through learnable scaling and translation parameters, so that the network can converge faster during training and train more stably. In deep neural networks, as the number of network layers increases, the data distribution may change, leading to problems such as gradient disappearance or explosion, thereby affecting the training effect of the model. The BN layer normalizes the input of each mini-batch to make the input data distribution of each layer relatively stable, which helps to accelerate convergence and reduce the problem of gradient disappearance or explosion. The definition of the BN layer is:

[0094]

[0095]

[0096]

[0097]

[0098] Among them, m represents the batch size, x i represents the BN layer input feature, y i represents the output feature of the BN layer, μ represents the mean of the batch feature, σ 2 Represents the variance of batch features, ∈ is a small number used to prevent division by zero, γ and β are learnable parameters used to scale and translate data respectively;

[0099] The Relu activation function is a nonlinear function that can help the neural network model learn complex nonlinear relationships, making the model more flexible and expressive. The definition of the Relu activation function is:

[0100] y=max(0,x)

[0101] Among them, x represents the input feature of the Relu activation function, y represents the output feature of the Relu activation function, when the input x is greater than or equal to 0, the Relu function returns x; when the input x is less than 0, the Relu function returns 0;

[0102] The attention refinement module includes global feature encoding and attention mechanism. The global feature encoding is implemented by a global average pooling layer. The global average pooling layer is used to perform global pooling operation on the input feature map. The feature map on each channel of the feature map is averaged and pooled to obtain the global feature representation of the entire feature map. The attention mechanism generates attention weights based on the global feature encoding to dynamically adjust the importance of different regions of the input feature map. For the specific structure of the module, please refer to Figure 3 , the attention refinement module is defined as:

[0103]

[0104] Where X represents the input features of the attention refinement module, Y represents the output features of the attention refinement module, CONV represents the convolution layer, Conv represents the convolution operation, BN represents the batch normalization layer, Sigmoid represents the Sigmoid activation function, GP represents the global average pooling, X C Represents the features after the convolution layer;

[0105] The basic features are input into the convolution layer, and then through the global average pooling operation, input into the convolution layer and BN layer, and through the Sigmoid activation function, the attention weight is obtained, and the attention weight is multiplied element by element with the features through the convolution layer to obtain the output features;

[0106] The global average pooling operation averages the feature values ​​of each channel of the input feature map to obtain a global feature representation of the entire feature map. The definition of global average pooling is:

[0107]

[0108] Among them, Y represents the feature of the global average pooling operation output, x i,j,c Represents the input feature of the global average pooling operation, W represents the width of the input feature, H represents the height of the input feature, and C represents the number of channels of the input feature;

[0109] The Sigmoid function is a nonlinear function that can introduce nonlinear transformations, thereby increasing the expressive power of the neural network and enabling it to learn more complex patterns and relationships. The Sigmoid activation function is defined as:

[0110]

[0111] Among them, x represents the input feature of the Sigmoid activation function, y represents the output feature of the Sigmoid activation function, e represents the natural constant, and the output range of the Sigmoid function is between 0 and 1. When the input tends to positive infinity, the output of the Sigmoid function tends to 1; when the input tends to negative infinity, the output of the Sigmoid function tends to 0;

[0112] The function of the feature fusion module is to integrate and fuse features at different levels to enhance the expressiveness and performance of the model, including feature concatenation, weight calculation and element-by-element multiplication. For the specific structure of the module, please refer to Figure 4 , the feature fusion module is defined as:

[0113]

[0114] Where X represents the input feature of the attention refinement module, Y represents the output feature of the attention refinement module, CONV represents the convolution layer, Conv represents the convolution operation, Relu represents the Relu activation function, Sigmoid represents the Sigmoid activation function, GP represents the global average pooling, X C Represents the features after the convolution layer;

[0115] The shallow fusion features and the deep fusion features are concatenated and input into the convolution layer. After the global average pooling operation, they are input into the convolution layer and the Relu activation function. Then, they are input into the convolution layer and the Sigmoid activation function to obtain the attention weight. The attention weight is multiplied element-by-element with the features passing through the convolution layer, and then added element-by-element with the features passing through the convolution layer to obtain the output features.

[0116] The multi-scale feature extraction module proposed in this invention helps to clearly depict the edges of objects by comprehensively utilizing spatial features of different scales, thereby significantly improving the accuracy of segmentation. The module can effectively process objects of various scales and optimize the segmentation results. By capturing this series of complex semantic levels, it provides a deep visual understanding for the model and ensures the comprehensiveness and robustness in the semantic segmentation task. For the specific structure of the module, please refer to Figure 5 , the multi-scale feature extraction module is defined as:

[0117]

[0118] Among them, X represents the input features of the multi-scale feature extraction module, Y represents the output features of the multi-scale feature extraction module, Conv represents the convolution operation, GP represents the global average pooling, X0-X4 represents the features of each branch, DConv represents the dilation convolution operation, i represents the dilation coefficient, and Gconv represents the group convolution operation;

[0119] The features are input into each branch respectively. The first branch is a convolution branch, including a convolution operation. The second branch is a dilated convolution branch, including a dilated convolution with a dilation coefficient of 6. The third branch is a dilated convolution branch, including a dilated convolution with a dilation coefficient of 12. The fourth branch is a dilated convolution branch, including a dilated convolution with a dilation coefficient of 18. The fifth branch is a global average pooling branch, including a global average pooling and a convolution operation. The sixth branch is a residual branch, including a convolution operation. The features output by the first branch are respectively added element-by-element with the features output by the second to fifth branches, and the above features are concatenated and input into the group convolution layer. The features output by the first branch are concatenated with the above features and input into the convolution layer. The features output by the sixth branch are added element-by-element with the above features to obtain deep multi-scale features.

[0120] Step S04: Put the training set data into the semantic segmentation model for training, freeze the main network parameters of the DINNV2 visual large model, and update other parameters of the semantic segmentation model until the model is gradually fitted to obtain a trained semantic segmentation model;

[0121] It should be noted that the experimental platform of this embodiment selects Linux x86_64 server as the basic hardware platform, and the operating system adopts the stable and widely supported Ubuntu 20.04.6LTS version. In terms of hardware selection, the CPU adopts the high-performance Intel(R)Xeon(R)Silver 4210R CPU with a frequency of 2.40GHz to support complex computing tasks. The GPU uses the NVIDIA GeForce RTX 3090GPU, which has 24G video memory, ensuring the efficiency of large-scale data processing and model training. In terms of software environment, the PyTorch framework, version 2.0.0, is used to build and train deep learning models. The Python version is 3.9 and the CUDA version is 11.7.

[0122] In the model training stage of this embodiment, the batch size is set to 8. In order to further enhance the generalization ability of the model, a data augmentation strategy of random scale scaling is implemented, and the scale ranges from 0.75 to 2. The image is randomly cropped to a resolution of 504×504 to meet the requirements of the model input. The training of the model will undergo 80,000 iterations. In terms of parameter optimization, stochastic gradient descent (SGD) is used as the optimization algorithm. The initial learning rate is set to 0.01. Combined with the momentum parameter 0.9 and the weight decay rate 5e-4, the model can converge smoothly and efficiently during the learning process. In addition, a polynomial learning rate decay strategy is applied, and the decay exponent is set to 0.9. In order to obtain a more stable update step in the early stage of training, an exponential warm-up learning rate strategy is also adopted, in which the warm-up period is the first 1,000 iterations, and the initial learning rate warm-up ratio is 0.1. During the entire training process, all the backbone network parameters of the DINOV2 large model are frozen, which greatly shortens the training time. The definition of the learning rate is:

[0123]

[0124] Among them, α represents the ratio of the current number of iterations to the total number of iterations, power is the exponent of the specified polynomial decay, warmupratio represents the initial warm-up learning rate ratio, and ratio represents the learning rate ratio.

[0125] Step S05: input the image to be predicted into the trained semantic segmentation model to obtain a grape leaf disease segmentation map;

[0126] Step S06: Count the number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation image, calculate the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area, and use the calculated ratio to predict the severity of the grape leaf disease.

[0127] In summary, a method and system for grading and predicting the degree of grape leaf disease by cross-level feature fusion is proposed. The image is input into the DINOV2 visual large model to obtain four basic features of the same shape from shallow to deep. The basic features obtained above are fused by designing a unique special fusion method to obtain cross-level fusion features, which greatly improves the accuracy of the model and enhances the generalization ability of the model. The requirement of accurately predicting the degree of grape leaf disease is achieved. A multi-scale feature extraction module is proposed, including six branches such as convolution, dilated convolution, global average pooling, and residual. By performing element-by-element addition operations on each branch and the previous branch, the multi-scale and deep-level information of the image can be better extracted. The comprehensive use of spatial features of different scales is helpful to clearly describe the object. The edge of the model is obtained, which significantly improves the accuracy of segmentation. The cross entropy loss function is used to minimize the difference between the probability distribution of the model output and the probability distribution of the true label, and the category with the highest probability is obtained. Then the feature map is visualized to obtain the grape leaf disease segmentation map. The number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation map are counted, and the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area is calculated. The calculated ratio is used to classify and predict the severity of grape leaf diseases. The large model technology is applied to the prediction of the degree of grape leaf disease, which greatly improves the accuracy of the model, enhances the generalization ability of the model, and realizes the accurate prediction of the degree of grape leaf disease.

[0128] See also Figure 6 , which is a schematic diagram of the structure of a grape leaf disease degree classification prediction system based on cross-level feature fusion proposed in the second embodiment of the present invention, and the system comprises:

[0129] An image acquisition module 10 is used to collect diseased grape leaves;

[0130] Furthermore, the image acquisition module 10 includes:

[0131] An image acquisition unit 101 is used to collect diseased grape leaves;

[0132] The feature extraction module 20 is used to input the grape leaf disease picture to be predicted into the DINOV2 large model backbone network to obtain four basic features with the same shape from shallow to deep;

[0133] Furthermore, the feature extraction module 20 includes:

[0134] The feature extraction unit 201 is used to input the grape leaf disease picture to be predicted into the DINOV2 large model backbone network to obtain four basic features with the same shape from shallow to deep.

[0135] A feature fusion module 30 is used to obtain cross-level fusion features by fusing the basic features obtained above;

[0136] Furthermore, the feature fusion module 30 includes:

[0137] The feature fusion module unit 301 is used to obtain cross-level fusion features by fusing the basic features obtained above.

[0138] An image segmentation module 40 is used to upsample the cross-level fusion features obtained above to obtain a grape leaf segmentation image;

[0139] Furthermore, the image segmentation module 40 includes:

[0140] The image segmentation module unit 401 is used to upsample the cross-level fusion features obtained above to obtain a grape leaf segmentation image.

[0141] The graded prediction module 50 is used to count the number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation image, calculate the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area, and grade the severity of the grape leaf disease according to the calculated ratio.

[0142] Furthermore, the hierarchical prediction module 50 includes:

[0143] The hierarchical prediction module unit 501 is used to count the number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation image, calculate the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area, and make a hierarchical prediction of the severity of the grape leaf disease based on the calculated ratio.

[0144] On the other hand, the present invention further provides a computer storage medium on which one or more programs are stored, and when the program is executed by a processor, the above-mentioned grape leaf disease degree grading prediction method based on cross-level feature fusion is implemented.

[0145] On the other hand, the present invention also proposes a computer device, including a memory and a processor, wherein the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory to implement the above-mentioned cross-level feature fusion grape leaf disease degree grading prediction method.

[0146] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0147] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0148] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0149] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0150] Some of the data in the above formulas are dimensionless and numerically calculated. Meanwhile, the contents not described in detail in this specification belong to the prior art known to those skilled in the art.

[0151] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.

Claims

1. A grape leaf disease severity classification prediction method based on cross-level feature fusion, characterized in that: The method comprises the following steps: Step S01: Collect images of diseased grape leaves, use labelme software to label the image data, and obtain a semantic segmentation label file; Step S02: dividing the labeled grape disease leaf image data into a training set and a test set in a ratio of 8:2; Step S03: constructing a semantic segmentation model based on the DINOV2 large visual model and multi-scale feature fusion; Step S04: Put the training set data into the semantic segmentation model for training, freeze the main network parameters of the DINNV2 visual large model, and update other parameters of the semantic segmentation model until the model is gradually fitted to obtain a trained semantic segmentation model; Step S05: input the image to be predicted into the trained semantic segmentation model to obtain a grape leaf disease segmentation map; Step S06: Count the number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation image, calculate the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area, and use the calculated ratio to predict the severity of the grape leaf disease.

2. The grape leaf disease severity classification prediction method based on cross-level feature fusion according to claim 1 is characterized in that: The specific method of processing the image to be predicted in step S05 to obtain the grape leaf disease segmentation map is: The image to be predicted is input into the backbone network of the DINOV2 visual model to obtain four basic features of the same shape from shallow to deep. The first two shallow basic features are input into the attention refinement module respectively, and then the features are fused by element-by-element addition operation to obtain shallow fusion features. The deepest level features are input into the multi-scale feature extraction module to obtain deep multi-scale features, and the last two deep basic features are input into the attention refinement module respectively, and then fused with the deep multi-scale features through element-by-element addition operation to obtain deep fusion features; The shallow fusion features and the deep fusion features are input into the feature fusion module to obtain the cross-level fusion features, and the cross-level fusion features are input into the segmentation head for upsampling operation to obtain the grape leaf disease segmentation map; The predicted image is input into the DINNV2 visual model backbone network, and the specific method of obtaining four basic features with the same shape from shallow to deep is as follows: The collected grape leaf disease images to be predicted are input into the convolutional layer for downsampling, and the downsampled features are input into 40 consecutive multi-head self-attention mechanism modules. The output features of the 9th and 19th layers are taken as shallow basic features, and the output features of the 29th and 39th layers are taken as deep basic features.

3. The grape leaf disease degree classification prediction method based on cross-level feature fusion according to claim 2 is characterized in that: The specific method of inputting the first two shallow basic features into the attention refinement module respectively and fusing the features by element-by-element addition operation to obtain the shallow fusion features is: S1: Input the shallow features output by the 9th layer into the attention refinement module, and then input the obtained features into the convolution layer. The specific processing method is: input the shallow features output by the 9th layer into the convolution layer, reduce the number of feature channels, input the obtained features into the SE attention mechanism module, and then input into the convolution layer; S2: Input the shallow features output by the 19th layer into the attention refinement module, and perform feature fusion with the features processed by the 9th layer through element-by-element addition operation to obtain the fused features; S3: Upsample the fused features obtained in S2 and input them into the convolutional layer to obtain shallow fused features.

4. The grape leaf disease degree classification prediction method based on cross-level feature fusion according to claim 2 is characterized in that: The specific method of inputting the deepest level features into the multi-scale feature extraction module to obtain the deep multi-scale features is: A1: The deep features output from the 39th layer are input into six branches respectively, and the six branches from one to six are convolution branch, dilated convolution branch with dilation coefficient of 6, dilated convolution branch with dilation coefficient of 12, dilated convolution branch with dilation coefficient of 18, global average pooling branch, and residual branch; A2: Add the features output by the first branch to the features output by the second to fifth branches element by element, concatenate the obtained features, and input them into the group convolution layer; A3: Concatenate the features output by the first branch with the features obtained in A1 and input them into the convolutional layer. Perform element-by-element addition operation on the features output by the sixth branch and the features obtained in A1 to obtain deep multi-scale features.

5. The grape leaf disease severity classification prediction method based on cross-level feature fusion according to claim 2 is characterized in that: The specific method of inputting the latter two deep basic features into the attention refinement module respectively and then fusing them with the deep multi-scale features by element-by-element addition operation to obtain the deep fusion features is: The deep features output from the 39th layer are input to the attention refinement module, and are element-wise added to the deep multi-scale features, and the obtained features are input to the convolution layer; The deep features output by the 29th layer are input into the attention refinement module and added element by element with the feature rows obtained by the 39th layer. At the same time, the obtained features are upsampled and input into the convolution layer to obtain the deep fusion features.

6. The grape leaf disease severity classification prediction method based on cross-level feature fusion according to claim 2 is characterized in that: The specific method of inputting the shallow fusion features and the deep fusion features into the feature fusion module to obtain the cross-level fusion features is: The shallow fusion features are concatenated with the deep fusion features and then input into the convolutional layer. At the same time, the obtained features are input into the SE attention mechanism module and added element by element with the original features to obtain cross-level fusion features.

7. The grape leaf disease severity classification prediction method based on cross-level feature fusion according to claim 2 is characterized in that: The specific method of inputting the cross-level fusion features into the segmentation head for upsampling operation to obtain the grape leaf disease segmentation map is as follows: The cross-level fusion features are input into two convolutional layers and upsampled to obtain a feature map. The feature map has the same width and height as the input image, and the number of channels is the number of categories. The feature map is divided into H×W one-dimensional vectors along the width and height directions, and the one-dimensional vector is input into the recognition classifier. The one-dimensional feature vector is mapped to the probability distribution of different categories through the softmax function. The cross entropy loss function is then used to minimize the difference between the probability distribution of the model output and the probability distribution of the true label, and the category with the highest probability is obtained. The feature map is then visualized to obtain the grape leaf disease segmentation map.

8. The grape leaf disease severity grading prediction system based on cross-level feature fusion is applied to the grape leaf disease severity grading prediction method based on cross-level feature fusion as claimed in any one of claims 1 to 7, characterized in that: include: An image acquisition module is used to acquire grape leaf images and record them as images to be predicted, and transmit the images to be predicted to a feature extraction module; The feature extraction module is used to input the collected image to be predicted into the pre-trained model to obtain cross-level basic features, and transmit the obtained cross-level basic features to the feature fusion module; A feature fusion module is used to fuse the obtained cross-level basic features to obtain cross-level fused features, input the first two shallow basic features into the attention refinement module respectively, and then perform feature fusion by element-by-element addition operation to obtain shallow fused features, input the deepest level features into the multi-scale feature extraction module to obtain deep multi-scale features, input the last two deep basic features into the attention refinement module respectively, and then perform feature fusion with the deep multi-scale features by element-by-element addition operation to obtain deep fused features, input the shallow fused features and the deep fused features into the feature fusion module to obtain cross-level fused features, and transmit the cross-level fused features to the image segmentation module at the same time; An image segmentation module is used to input the cross-level fusion features into a segmentation head to obtain a grape leaf disease segmentation map, and transmit the grape leaf disease segmentation map to a hierarchical prediction module; The hierarchical prediction module is used to count the number of pixels in the normal leaf area and the number of pixels in the leaf disease area in the grape leaf segmentation map, calculate the ratio of the number of pixels in the leaf disease area to the total number of pixels in the normal leaf area and the number of pixels in the leaf disease area, and classify and predict the severity of grape leaf diseases based on the calculated ratio.

9. A storage medium, characterized in that: include: The storage medium stores one or more programs, and when the programs are executed by the processor, the grape leaf disease degree grading prediction method based on cross-level feature fusion as described in any one of claims 1 to 7 is implemented.

10. A computer device, characterized in that: The computer device comprises a memory and a processor, wherein: The memory is used to store computer programs; When the processor is used to execute the computer program stored in the memory, the method for predicting the degree of grape leaf disease by grading based on cross-level feature fusion as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Vegetable leaf disease severity detection method and device

    CN114399480A

  • Grape disease identification method and device, electronic equipment and storage medium

    CN114494828A

  • Method for carrying out disease detection on grapes based on image segmentation and registration fusion

    CN115170987A

  • Systems for performing semantic segmentation and methods thereof

    US20180253622A1

Cited By

  • Grape downy mildew spore detection method, system and device based on image analysis

    CN119380337A

  • Lightweight beef quality evaluation method based on unsupervised feature learning

    CN119418330A

  • Apple leaf disease classification method based on regional perception and lightweight hybrid Transform network

    CN119810560A

  • Plant leaf scab segmentation method and system based on RGB-D cross-modal fusion

    CN120374650A