Grape leaf disease image recognition method based on machine learning model

Through the combined structure and attention extractor of SingleFormer network, the problem of high computing power and time-consuming of grape leaf disease recognition methods in the prior art is solved, and efficient recognition on edge devices and mobile terminals is achieved, and the recognition accuracy and Evaluate the effect.

CN119273975APending Publication Date: 2025-01-07CHINA AGRI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411314680.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The existing grape leaf disease recognition method based on convolutional neural networks has problems such as high computing power, high memory consumption and high time consumption, which makes it difficult for edge devices and mobile devices to expand applications.

Method used

Using SingleFormer network, by collecting and preprocessing grape leaf images, the combined structure of Patch Embeding layer, convolutional local feature extraction layer, global and local feature enhancement layer, feature dimensionality reduction layer and output layer are combined with the global feature extractor and Token-Fearure attention extractor, performs model training and recognition.

Benefits of technology

This reduces the complexity of model training, improves recognition accuracy and SOTA evaluation effect, and realizes feasibility on edge devices and mobile devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273975A_ABST
    Figure CN119273975A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of agricultural information, and provides a grape leaf disease image recognition method based on a machine learning model, and the method comprises the steps: collection of a to-be-detected grape leaf disease image and recognition of a SingleFormer model, and the construction process of the SingleFormer model comprises the steps: image collection and division, image expansion and enhancement, and SingleFormer network training. According to the SingleFormer network, the complexity of model training is reduced, and the recognition precision and the SOTA evaluation effect of the model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of agricultural information technology, and in particular to a grape leaf disease image recognition method based on a machine learning model. Background Art

[0002] Grape leaf diseases seriously affect the yield and quality of grapes. There are many types of grape diseases. At present, more than 60 pathogens can be identified, and more than ten of them cause great harm to grape growth. Among them, common leaf diseases include: black rot, black measles and leaf blight. The prerequisite for precise application of pesticides to eliminate grape diseases, improve quality and yield, and reduce environmental pollution is to quickly and accurately obtain information on the types of diseases that grapes suffer from, so as to facilitate targeted prevention and control. In recent years, deep learning methods have been widely used in plant disease detection, and provide a tool for plant leaf disease identification with strong scene generalization ability, excellent robustness and high recognition accuracy. At present, many computer vision diagnosis methods for grape leaf diseases mostly use typical heavyweight convolutional neural network methods; compared with traditional image processing methods, convolutional neural network methods have the advantages of high precision and high robustness in distinguishing crop and plant diseases.

[0003] However, most of these heavyweight methods based on convolutional neural networks adopt design ideas with deep layers, many parameters and complex structures, which lead to defects such as high computing power, high memory consumption and high time consumption, making it difficult for edge devices and mobile terminals to expand their applications in the field of grape leaf disease identification. Summary of the invention

[0004] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a grape leaf disease image recognition method based on a machine learning model, which reduces the complexity of model training and improves the recognition accuracy and SOTA evaluation effect of the model through the SingleFormer network.

[0005] To achieve the above object, the present invention provides the following solutions:

[0006] A grape leaf disease image recognition method based on a machine learning model, comprising:

[0007] Collect images of grape leaf diseases to be detected;

[0008] Inputting the grape leaf disease image to be detected into the trained SingleFormer model to obtain a target disease recognition result;

[0009] The training process of the SingleFormer model includes:

[0010] Collecting a number of original grape leaf images, removing backgrounds from all of the original grape leaf images to obtain a preprocessed image set, and dividing the preprocessed image set into an original training set and a test set according to a preset ratio;

[0011] Expanding and enhancing the original training set to obtain an enhanced sample data set, and dividing the enhanced sample data set into an enhanced training set and an enhanced verification set according to a preset ratio;

[0012] The enhanced training set and the enhanced validation set are input as training data into a preset SingleFormer network for training, and the SingleFormer network in the training process is optimized using a cross entropy loss function to obtain the trained SingleFormer model; the SingleFormer network includes: an input layer, a plurality of Patch Embeding layers, a plurality of convolutional local feature extraction layers, a plurality of global and local feature enhancement layers, a plurality of feature dimensionality reduction layers and an output layer.

[0013] Preferably, the SingleFormer network also includes: a global feature extractor, a Token-Fearure attention extractor and a CNN local feature extractor.

[0014] Preferably, it also includes:

[0015] Inputting the test set into the SingleFormer model to obtain a test classification result;

[0016] The accuracy, F1 value, precision and recall are calculated according to the test classification results, and the SingleFormer model is evaluated according to the accuracy, F1 value, precision and recall.

[0017] Preferably, the tools used for expanding and enhancing the original training set include: an unsupervised grape leaf disease image enhancement model, a self-supervised deep grape leaf disease image synthesis model, and a multi-attention Transformer grape leaf disease image super-resolution model.

[0018] Preferably, the original grape leaf images include: images of grape leaves infected with grape black rot, images of grape leaves infected with grape black measles, images of grape leaves infected with grape leaf blight, and images of normal grape leaves.

[0019] Preferably, the calculation formula of the SingleFormer network includes: input = {I healthy ,I disease}、I Tokens =PE(Iinput ), I lf =CFE(I Tokens ), I gf =SingleFormer(I lf ), I downsampling =PM(I gf ) and CLS = FC (AvgPool (I downsampling ));I input is the input of the SingleFormer network; healthy This is an image of a healthy grape leaf; disease is a sample image in the enhanced sample data set; Tokens I is the image block divided by PE(); PE() is the feature filtering operation, normalization processing and image block operation; I lf is low-level feature extraction; CFE() is a combination of 1×1 convolution, BN normalization, and 3×3 separable convolution; I gf is the global feature; SingleFormer() is the global and local feature extraction operation; I downsampling is the feature map after dimensionality reduction; PM() is the dimensionality reduction operation; CLS is the category of grape leaf diseases; AvgPool() is the average pooling operation; FC() is the full connection operation.

[0020] Preferably, the calculation process of the global feature extractor includes:

[0021] The received feature map is input into a 1×1 convolution to extract local detail features and obtain the first feature representation;

[0022] Inputting the first feature representation into BN to perform feature normalization to obtain a normalized feature representation;

[0023] Input the normalized feature representation into a 1×1 convolution to perform inter-channel information weighting to obtain a weighted representation;

[0024] The weight representation and the feature map are fused to obtain an enhanced local feature representation.

[0025] Preferably, the calculation process of the Token-Fearure attention extractor includes:

[0026] The received feature matrix is ​​mapped into a Q matrix of a preset dimension using a linear projection transformation;

[0027] Performing weight calculation on the horizontal dimension of the Q matrix to obtain a first weight;

[0028] Performing weight calculation on the vertical dimension of the Q matrix to obtain a second weight;

[0029] Multiplying the first weight and the second weight by the Q matrix respectively to obtain token-level global attention and feature-level global attention;

[0030] A linear operation and summation are performed on the token-level global attention and the feature-level global attention to obtain the target global attention.

[0031] Preferably, the calculation formula of the Token-Fearure attention extractor includes: Q = XW Q , α=Qw α , TW=∑σ(Q*α), β=Q T w β , TokenAtten = TW*Q, FeatureAtten = FW*Q, and SelfAtten = Proj(TokenAtten) + Proj(FeatureAtten); Q is the Q matrix; X is the received feature matrix; W Q is the mapping matrix; α is the token-level feature extraction; w α is the first learning weight; TW is the first weight; σ is the activation operation; β is the feature-level feature extraction; T is the transposition operation; w β is the learning weight for the first time; FW is the second weight; TokenAtten is the global attention at the token level; FeatureAtten is the global attention at the feature level; SelfAtten is the target global attention; Proj() is the linear projection calculation; To activate the operation.

[0032] The present invention discloses the following technical effects:

[0033] The present invention provides a grape leaf disease image recognition method based on a machine learning model. Through the SingleFormer network, the problems of poor recognition accuracy and SOTA evaluation effect of the existing model are solved, and the complexity of model training is reduced and the model recognition accuracy and SOTA evaluation effect are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0035] Figure 1 A schematic diagram of a grape leaf disease image recognition process based on a machine learning model provided in an embodiment of the present invention;

[0036] Figure 2 A schematic diagram of the SingleFormer network training process provided by an embodiment of the present invention;

[0037] Figure 3 A schematic diagram of the overall structure of the SingleFormer model provided by an embodiment of the present invention;

[0038] Figure 4 Detailed structural diagram of the Token-Fearure addition attention mechanism provided for an embodiment of the present invention. DETAILED DESCRIPTION

[0039] 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.

[0040] The purpose of the present invention is to provide a grape leaf disease image recognition method based on a machine learning model, which reduces the complexity of model training through a SingleFormer network, improves the recognition accuracy of the model and the SOTA (state-of-the-art, a model used to describe the current optimal effect on a task in machine learning) evaluation effect.

[0041] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0042] Figure 1 A schematic diagram of a grape leaf disease image recognition process based on a machine learning model provided in an embodiment of the present invention, Figure 2 A schematic diagram of the SingleFormer network training process provided by an embodiment of the present invention is shown in FIG. Figure 1 and Figure 2 As shown, the present invention provides a method for identifying grape leaf disease images based on a machine learning model, comprising:

[0043] Step 100: Collecting images of grape leaf diseases to be detected;

[0044] Step 200: inputting the grape leaf disease image to be detected into the trained SingleFormer model to obtain a target disease recognition result;

[0045] The training process of the SingleFormer model includes:

[0046] Collecting a number of original grape leaf images, removing backgrounds from all of the original grape leaf images to obtain a preprocessed image set, and dividing the preprocessed image set into an original training set and a test set according to a preset ratio;

[0047] Expanding and enhancing the original training set to obtain an enhanced sample data set, and dividing the enhanced sample data set into an enhanced training set and an enhanced verification set according to a preset ratio;

[0048] The enhanced training set and the enhanced validation set are input as training data into a preset SingleFormer network for training, and the SingleFormer network in the training process is optimized using a cross entropy loss function to obtain the trained SingleFormer model; the SingleFormer network includes: an input layer, a plurality of Patch Embedding layers, a plurality of convolutional local feature extraction layers, a plurality of global and local feature enhancement layers, a plurality of feature dimensionality reduction layers and an output layer (refer to Figure 3 ); among them, from the input layer to the output layer, the Patch Embedding layer, the feature extraction layer, the global and local feature enhancement layer, and the feature dimension reduction layer are progressive and calculated serially.

[0049] Specifically, Figure 3 In the example, H represents the height of the image, W represents the width of the image, and C represents the width of the image. 4 Indicates the number of channels of the image.

[0050] Specifically, the SingleFormer network also includes: a global feature extractor, a Token-Fearure attention extractor and a CNN local feature extractor.

[0051] Furthermore, it also includes:

[0052] Inputting the test set into the SingleFormer model to obtain a test classification result;

[0053] The accuracy, F1 value, precision and recall are calculated according to the test classification results, and the SingleFormer model is evaluated according to the accuracy, F1 value, precision and recall.

[0054] Preferably, the tools used for expanding and enhancing the original training set include: an unsupervised grape leaf disease image enhancement model, a self-supervised deep grape leaf disease image synthesis model, and a multi-attention Transformer grape leaf disease image super-resolution model.

[0055] Optionally, the original grape leaf images include: images of grape leaves infected with grape black rot, images of grape leaves infected with grape black measles, images of grape leaves infected with grape leaf blight, and normal grape leaf images.

[0056] Furthermore, the calculation formula of the SingleFormer network includes: input = {I healthy ,I disease}、I Tokens =PE(I input ), I lf =CFE(I Tokens ), I gf =SingleFormer(I lf ), I downsampling =PM(I gf ) and CLS = FC (AvgPool (I downsampling ));I input is the input of the SingleFormer network; healthy This is an image of a healthy grape leaf; disease is a sample image in the enhanced sample data set; Tokens I is the image block divided by PE(); PE() is the feature filtering operation, normalization processing and image block operation; I lf is low-level feature extraction; CFE() is a combination of 1×1 convolution, BN normalization, and 3×3 separable convolution; I gf is the global feature; SingleFormer() is the global and local feature extraction operation; I downsampling is the feature map after dimensionality reduction; PM() is the dimensionality reduction operation; CLS is the category of grape leaf diseases; AvgPool() is the average pooling operation; FC() is the full connection operation.

[0057] Specifically, the calculation process of the global feature extractor includes:

[0058] The received feature map is input into a 1×1 convolution to extract local detail features and obtain the first feature representation;

[0059] Inputting the first feature representation into BN to perform feature normalization to obtain a normalized feature representation;

[0060] Input the normalized feature representation into a 1×1 convolution to perform inter-channel information weighting to obtain a weighted representation;

[0061] The weight representation and the feature map are fused to obtain an enhanced local feature representation.

[0062] Specifically, Figure 4 In the example, k represents the number of tokens, d represents the dimension of the token, T represents the transposition operation, and a d represents the extracted token-level intermediate process features, σ 3 represents the activation operation, and TW represents the token-level feature. k Represents the intermediate features of the extracted feature layer, represents the activation operation, and FW represents the feature-level feature.

[0063] refer to Figure 4 , the calculation process of the Token-Fearure attention extractor includes:

[0064] The received feature matrix is ​​mapped into a Q matrix of a preset dimension using a linear projection transformation;

[0065] Performing weight calculation on the horizontal dimension of the Q matrix to obtain a first weight;

[0066] Performing weight calculation on the vertical dimension of the Q matrix to obtain a second weight;

[0067] Multiplying the first weight and the second weight by the Q matrix respectively to obtain token-level global attention and feature-level global attention;

[0068] A linear operation and summation are performed on the token-level global attention and the feature-level global attention to obtain the target global attention.

[0069] Specifically, the calculation formula of the Token-Fearure attention extractor includes: Q = XW Q , α=Qw α , TW=∑σ(Q*α), β=Q T w β , TokenAtten = TW*Q, FeatureAtten = FW*Q, and SelfAtten = Proj(TokenAtten) + Proj(FeatureAtten); Q is the Q matrix; X is the received feature matrix; W Q is the mapping matrix; α is the token-level feature extraction; w αis the first learning weight; TW is the first weight; σ is the activation operation; β is the feature-level feature extraction; T is the transposition operation; w β is the learning weight for the first time; FW is the second weight; TokenAtten is the global attention at the token level; FeatureAtten is the global attention at the feature level; SelfAtten is the target global attention; Proj() is the linear projection calculation; To activate the operation.

[0070] Specifically, preprocessing of the data set: grape leaf images are selected from the public data set as basic data. The data of this embodiment comes from the PlantVillage public data set, which contains 39 different plant leaf images, a total of 61,486 images, which are used to study the identification of plant diseases. In order to conduct identification research on grape leaf diseases, grape leaf images are selected as basic data, which include four types of grape leaf images, namely, grape leaf images infected with grape black rot, grape leaf images infected with grape black measles, grape leaf images infected with grape leaf blight, and normal grape leaf images; and the grape leaf images of the basic data are background removed and pre-divided into training set, validation set and test set; and the specific division ratio is (training set, validation set): test set = 8:2;

[0071] Furthermore, the dataset was expanded by using the unsupervised grape leaf disease image enhancement model GrapeGAN, the self-supervised deep grape leaf disease image synthesis model CWAN, and the multi-attention Transformer grape leaf disease image super-resolution model MATSR to enhance the training set and validation set to obtain an enhanced sample dataset, and then the enhanced sample dataset was divided into an enhanced training set and an enhanced validation set; the specific division ratio was enhanced training set: enhanced validation set = 7:3;

[0072] Specifically, the SingleFormer model includes the SingleFormer global feature extractor, the Toke-n Fear attention extractor, and the CNN local feature extractor;

[0073] Among them, the SingleFormer global feature extractor is used to input features into 1×1 convolution to realize information interaction and dimensionality reduction between channels, as follows: the received feature map is input into the separable convolution to extract rich local detail features; then the BN normalized features are used to improve the robustness of the model, and the normalized results are input into the 1×1 convolution to extract the importance of inter-channel information again; finally, the extracted features are fused with the input to enhance the representation of local features, and used for the Token-Fearure structure to extract global features.

[0074] The operation process of the Token-Fearure attention extractor is as follows: first, a linear projection transformation is used to map the input feature X to a Q matrix of a specified dimension; then the Q matrix is ​​horizontally concatenated with the learnable weight w a Perform linear operations to obtain the result α, and multiply the corresponding elements with the Q matrix, perform nonlinear processing of the activation function, and sum the features to obtain the weight TW of the token; the Q matrix is ​​transposed by the T operation and then the weight FW of the vertical dimension is calculated, and the obtained weight TW and weight FW are operated with the Q matrix to extract the global attention at the token and feature levels; finally, the two extracted global attentions are subjected to linear operations and summation methods to obtain the final global attention. Specifically, the feature extraction calculation formula constructed by Token-Fearuree attention is as follows:

[0075] Q=XW Q

[0076] α=Qw α

[0077] TW=∑σ(Q*α)

[0078] β=Q T w β

[0079]

[0080] TokenAtten=TW*Q

[0081] FeatureAtten=FW*Q

[0082] SelfAtten=Proj(TokenAtten)+Proj(FeatureAtten)

[0083] in, k represents the number of tokens, and d represents the dimension of the token.

[0084] Preferably, after the training process reaches stability, the training is stopped and the structure and weights of the SingleFormer model are saved.

[0085] Further, the test set is input into the SingleFormer model, the types of grape leaf diseases are output, and the accuracy, F1 value, precision and recall of the test are calculated. In order to further evaluate the effectiveness of the SingleFormer model, the model is compared with other lightweight recognition methods. The CNN and Transformer lightweight recognition methods used for comparison are EfficientNet, GhostNet, MoblieNetV3, MobileViT and ShuffleNetV2 respectively. The results of grape leaf disease image recognition are evaluated, and the four indicators of accuracy (Accuracy), F1 value (F1-score), precision (precision) and recall (recall) are used for evaluation. With reference to Table 1 and Table 2, the SingleFormer model recognition method proposed in this embodiment is shown by comparing the results. Compared with the above five models, it is more balanced in the classification of four types of leaf disease images, has strong comprehensive classification performance and excellent performance, which shows that the SingleFormer model of this embodiment has a strong recognition ability.

[0086] Table 1

[0087]

[0088] Table 2

[0089]

[0090] The beneficial effects of the present invention are as follows:

[0091] (1) The present invention adopts the SingleFormer model to identify grape leaf disease images, which has high recognition accuracy and SOTA evaluation effect.

[0092] (2) The SingleFormer model constructed by the present invention can effectively extract Token-Fearure features. At the same time, the SingleFormer model constructed by the present invention is deployed by the input layer, Patch Embeding layer, convolutional local feature extraction layer, global and local feature enhancement layer, feature dimension reduction layer and output layer of the model. The quadratic computational complexity brought by the traditional Transformer model is reduced. Compared with the existing Transformer structure, the computational complexity is greatly reduced, and the accuracy of grape leaf disease identification is effectively improved.

[0093] (3) The present invention proposes an additive self-attention mechanism for a single Q matrix, which can interact with features of both feature dimension and token dimension at the same time, and reduce the multiplication complexity of the feature matrix-based attention to a linear calculation.

[0094] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0095] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A grape leaf disease image recognition method based on a machine learning model, characterized in that: include: Collect images of grape leaf diseases to be detected; Inputting the grape leaf disease image to be detected into the trained SingleFormer model to obtain a target disease recognition result; The training process of the SingleFormer model includes: Collecting a number of original grape leaf images, removing backgrounds from all of the original grape leaf images to obtain a preprocessed image set, and dividing the preprocessed image set into an original training set and a test set according to a preset ratio; Expanding and enhancing the original training set to obtain an enhanced sample data set, and dividing the enhanced sample data set into an enhanced training set and an enhanced verification set according to a preset ratio; The enhanced training set and the enhanced validation set are input as training data into a preset SingleFormer network for training, and the SingleFormer network in the training process is optimized using a cross entropy loss function to obtain the trained SingleFormer model; the SingleFormer network includes: an input layer, a plurality of PatchEmbeding layers, a plurality of convolutional local feature extraction layers, a plurality of global and local feature enhancement layers, a plurality of feature dimensionality reduction layers and an output layer.

2. The grape leaf disease image recognition method based on a machine learning model according to claim 1, characterized in that: The SingleFormer network also includes: a global feature extractor, a Token-Fearure attention extractor and a CNN local feature extractor.

3. The grape leaf disease image recognition method based on a machine learning model according to claim 1, characterized in that: Also includes: Inputting the test set into the SingleFormer model to obtain a test classification result; The accuracy, F1 value, precision and recall are calculated according to the test classification results, and the SingleFormer model is evaluated according to the accuracy, F1 value, precision and recall.

4. The grape leaf disease image recognition method based on a machine learning model according to claim 1, characterized in that: The tools used to expand and enhance the original training set include: an unsupervised grape leaf disease image enhancement model, a self-supervised deep grape leaf disease image synthesis model, and a multi-attention Transformer grape leaf disease image super-resolution model.

5. The grape leaf disease image recognition method based on a machine learning model according to claim 1, characterized in that: The original grape leaf images include: grape leaf images infected with grape black rot, grape leaf images infected with grape black measles, grape leaf images infected with grape leaf blight, and normal grape leaf images.

6. The grape leaf disease image recognition method based on a machine learning model according to claim 1, characterized in that: The calculation formula of the SingleFormer network includes: input = {I healthy ,I disease }、I Tokens =PE(I input ), I lf =CFE(I Tokens ), I gf =SingleFormer(I lf ), I downsampling =PM(I gf ) and CLS = FC (AvgPool (I downsampling ));I input is the input of the SingleFormer network; healthy This is an image of a healthy grape leaf; disease is a sample image in the enhanced sample data set; Tokens I is the image block divided by PE(); PE() is the feature filtering operation, normalization processing and image block operation; I lf is low-level feature extraction; CFE() is a combination of 1×1 convolution, BN normalization, and 3×3 separable convolution; I gf is the global feature; SingleFormer() is the global and local feature extraction operation; I downsampling is the feature map after dimensionality reduction; PM() is the dimensionality reduction operation; CLS is the category of grape leaf diseases; AvgPool() is the average pooling operation; FC() is the full connection operation.

7. The method for recognizing grape leaf disease images based on a machine learning model according to claim 2, characterized in that: The calculation process of the global feature extractor includes: The received feature map is input into a 1×1 convolution to extract local detail features and obtain the first feature representation; Inputting the first feature representation into BN to perform feature normalization to obtain a normalized feature representation; Input the normalized feature representation into a 1×1 convolution to perform inter-channel information weighting to obtain a weighted representation; The weight representation and the feature map are fused to obtain an enhanced local feature representation.

8. The grape leaf disease image recognition method based on a machine learning model according to claim 2, characterized in that: The calculation process of the Token-Fearure attention extractor includes: The received feature matrix is ​​mapped into a Q matrix of a preset dimension using a linear projection transformation; Performing weight calculation on the horizontal dimension of the Q matrix to obtain a first weight; Performing weight calculation on the vertical dimension of the Q matrix to obtain a second weight; Multiplying the first weight and the second weight by the Q matrix respectively to obtain token-level global attention and feature-level global attention; A linear operation and summation are performed on the token-level global attention and the feature-level global attention to obtain the target global attention.

9. The method for identifying grape leaf disease images based on a machine learning model according to claim 8, characterized in that: Token-Fearure Attention Extractor Calculation Formula Includes: Q = XW Q , α=Qw α , TW=∑σ(Q*α), β=Q T w β , TokenAtten = TW*Q, FeatureAtten = FW*Q, and SelfAtten = Proj(TokenAtten) + Proj(FeatureAtten); Q is the Q matrix; X is the received feature matrix; W Q is the mapping matrix; α is the token-level feature extraction; w α is the first learning weight; TW is the first weight; σ is the activation operation; β is the feature-level feature extraction; T is the transposition operation; w β is the learning weight for the first time; FW is the second weight; TokenAtten is the global attention at the token level; FeatureAtten is the global attention at the feature level; SelfAtten is the target global attention; Proj() is the linear projection calculation; To activate the operation.