A crop disease recognition method based on FCSA-EfficientNetV2

By introducing the FCSA attention module and label smoothing cross-entropy loss function into EfficientNetV2, the problem of slow reasoning speed and insufficient feature extraction capability of the crop disease identification model is solved, and efficient identification of disease types and degrees is achieved.

CN114863278BActive Publication Date: 2024-10-29HEBEI UNIV OF TECH +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210471953.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2024-10-29
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

Existing crop disease identification models have problems with insufficient feature extraction capabilities due to their large number of parameters, slow inference speed, and difficulty in accurately identifying the degree of disease.

Method used

Design a crop disease identification method based on FCSA-EfficientNetV2, extract enhanced feature maps through the attention module FCSA, change the position of the core module MBConv of the EfficientNetV2 network, reduce the number of network layers, and use cross-entropy and cost-sensitive regularization loss with label smoothing function.

Benefits of technology

It improves the accuracy and reasoning speed of disease identification, reduces the complexity of the model and the number of parameters, enhances the ability to identify the degree of disease, and achieves efficient identification of disease types and degrees.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863278B_ABST
    Figure CN114863278B_ABST
Patent Text Reader

Abstract

The present invention is a crop disease recognition method based on FCSA-EfficientNetV2. The recognition method first pre-processes crop disease image data, then constructs an FCSA-EfficientNetV2 model, then inputs the extracted features into a fully connected layer to obtain a prediction result, and finally uses a loss function combining cross entropy with label smoothing and cost-sensitive regularization to update and save the model parameters; the FCSA-EfficientNetV2 model is based on the EfficientNetV2 network, and replaces the SE attention module of the MBConv module in the EfficientNetV2 network with an attention module FCSA. The attention module FCSA first uses frequency domain attention to obtain the attention of features in different frequency domains, and then uses spatial attention to spatially associate the features of the frequency domain attention to enhance the attention of the positions that need to be paid attention to in the frequency domain features. The FCSA module is constructed by connecting the frequency domain and spatial attention in series, and the feature map enhanced by attention is input into the fully connected layer to realize the recognition of different crop diseases and disease degrees.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The technical solution of the present invention relates to an image recognition technology for plant leaf diseases, specifically an image recognition method for crop diseases based on FCSA-EfficientNetV2 (Frequency Channel Attention and Spatial Attention–EfficientNetV2). Background Art

[0002] Manual spraying of pesticides may lead to problems such as improper use of pesticides, excessive spraying of pesticides, and missing the best time to use pesticides, which may lead to serious losses in crop yields. It is of great significance to understand the specific types and severity of pests and diseases as early as possible and find an efficient and accurate method for pest and disease identification. Therefore, recognition methods based on machine learning are widely used in disease image recognition.

[0003] In the early stage of image-based disease recognition, traditional machine learning methods were used to manually extract features such as shape, texture, edge and color of the disease for classification. However, these feature extraction methods limit the recognition speed and accuracy because they need to be manually designed. Compared with traditional machine learning methods, deep learning can extract the distinguishable features of the image through a series of convolution operations. By inputting the image into the network end-to-end, the probability prediction value of each disease category can be obtained. Due to its powerful semantic information extraction ability, it far exceeds the traditional machine learning method in recognition accuracy and speed. Representative deep learning networks designed based on ImageNet image recognition tasks, such as AlexNet, VGG, GoogleNet, DenseNet, ResNet and ShuffleNet, and EfficientNet, Vision Transformer and ConvNeXt, are used as baseline networks for image-based disease recognition. CN114067313A discloses a leaf disease recognition method of a bilinear residual network, which integrates two feature extraction networks in a bilinear manner to improve the accuracy of disease recognition. The feature dimension obtained by the bilinear method is high, there are redundant features, and the model reasoning time is increased.

[0004] In the study of disease severity identification, most of the network models with high accuracy have the problem of large number of parameters and slow reasoning speed. When identifying the disease severity, lightweight models are difficult to achieve ideal accuracy due to insufficient model feature extraction capabilities. The identification of the degree of crop diseases requires more discriminative features to achieve better results, but the complex network structure will lead to increased computational overhead and reasoning time. Therefore, it is an urgent problem to take into account the feature extraction ability and complexity of the network model to achieve the identification of the type and degree of crop diseases without reducing the model reasoning speed. Summary of the invention

[0005] In view of the fact that the network model in the prior art is too large and the features of each disease degree are missing, the technical problem to be solved by the present invention is: a method for identifying crop diseases based on FCSA-EfficientNetV2 is proposed, in which the attention module FCSA is designed to extract enhanced feature maps. The attention module FCSA first uses frequency domain attention to obtain the attention degree of features in different frequency domains, and then uses spatial attention to spatially associate the features of frequency domain attention to enhance the attention degree of the positions that need to be paid attention to in the frequency domain features. The attention module FCSA is constructed by connecting the frequency domain and spatial attention in series, and the position of FCSA in the core module MBConv (Mobile Inverted BottleneckConvolution) of the EfficientNetV2 network is changed, that is, the position with more channels is moved to the position with fewer channels, and the network model FCSA-EfficientNetV2 is obtained. At the same time, the number of layers for extracting features in the final stage is reduced from 15 layers of EfficientNetV2 to 8 layers, thereby reducing the complexity of the network model. The feature map enhanced by attention is input into the fully connected layer to realize the identification of different crop diseases and disease degrees. A loss function combining cross entropy with label smoothing and cost-sensitive regularization is used to enhance the model's attention to the degree of disease, solving the problem that the network model has difficulty distinguishing the degree of disease.

[0006] The technical solution adopted by the present invention to solve the technical problem is: a method for identifying crop diseases based on FCSA-EfficientNetV2, characterized in that the identification method first pre-processes the crop disease image data, then builds the FCSA-EfficientNetV2 model, then inputs the extracted features into the fully connected layer to obtain the prediction results, and finally uses the loss function combining the cross entropy with label smoothing and cost-sensitive regularization to update the model parameters and save them;

[0007] The FCSA-EfficientNetV2 model is based on the EfficientNetV2 network, and the attention module FCSA replaces the SE attention module of the MBConv module in the EfficientNetV2 network;

[0008] The process of the attention module FCSA is: divide the input feature map into N groups of features, use different frequency components to perform discrete cosine transform calculations on each channel for each group of features, obtain N groups of frequency domain features, and concatenate the obtained N groups of frequency domain features; then use a fully connected layer to reduce the dimension and use a ReLU activation function, then use a fully connected layer to increase the dimension to the number of channels of the original feature and use a sigmoid activation function to obtain the frequency domain attention feature weight;

[0009] Multiply the feature F of the input feature map by the frequency domain attention feature weight to obtain the frequency domain attention feature F FCA , use the average pooling on the channel dimension to process the frequency domain attention feature F FCA , and use the maximum pooling on the channel dimension to process the frequency domain attention feature F FCA , the features after average pooling and maximum pooling are concatenated, and then the number of channels is adjusted to 1 layer using a convolution layer with a convolution kernel size of 7×7. The sigmoid activation function is used to obtain the frequency domain spatial position feature weights, and the frequency domain attention feature F FCA Multiply it with the frequency domain spatial position feature weight to get the output frequency domain spatial feature map F FCSA .

[0010] The FCSA-EfficientNetV2 model includes 23 FCSA-MBConv modules and 10 Fused-MBConv convolution modules. The process of each FCSA-MBConv module is: input features → use a convolution layer with a convolution kernel size of 1×1 to expand the number of channels at a fixed rate → use a depth-wise separable convolution with a convolution kernel size of 3×3 to extract features → use a convolution layer with a convolution kernel size of 1×1 to reduce the number of channels → obtain a feature map → use frequency domain attention to extract frequency domain attention feature weights → multiply the feature map by the frequency domain attention feature weights → obtain frequency domain features → use spatial attention to extract frequency domain spatial position feature weights → multiply the frequency domain features by the frequency domain spatial position feature weights extracted by spatial attention → obtain a frequency domain spatial feature map → perform random inactivation on the features through the Dropout layer → add the obtained features to the original features → obtain the output features.

[0011] A crop disease image recognition method based on FCSA-EfficientNetV2, the specific steps of the recognition method are:

[0012] The first step is to preprocess the crop disease image data:

[0013] Step 1.1, obtain the crop disease dataset:

[0014] Obtain the AI ​​Challenger 2018 crop disease dataset, which contains 10 species, 26 diseases, and three disease levels: healthy, general, and severe. A total of 61 types of diseases are obtained by dividing them into plant species-disease-disease level. Different diseases are represented by labels ranging from 0 to 60. There are only 3 pictures in the 44th and 45th categories. Since the amount of data in these two categories is not enough to support the model to learn relevant features, these two categories are removed, and the disease types are represented by labels ranging from 0 to 58. Divide the dataset into training and test sets;

[0015] In step 1.2, in order to expand the data set, the training set data is preprocessed, including random cropping, random horizontal flipping, image resizing and standardization.

[0016] The second step is to build the FCSA-EfficientNetV2 model:

[0017] In step 2.1, the disease image obtained in step 1.2 is used as the network input. The size of a single image is 224×224×3. A convolution layer with a convolution kernel size of 3×3 and a kernel step size of 2 is used. After a normalized BN layer and SiLU activation function, the output feature map F is obtained. 2.1 , the dimensions are 112×112×24;

[0018] Step 2.2: For the feature map F 2.1 Perform two Fused-MBConv convolution operations, both using a convolution layer with a dilation ratio of 1, a convolution kernel size of 3×3, and a kernel step size of 1, and obtain the output feature map F 2.2 , the dimensions are 112×112×24;

[0019] Step 2.3: For the feature map F 2.2 Four Fused-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4, a convolution kernel size of 3×3, a convolution layer with a size of 1×1, a Dropout layer, and a residual connection. Only in the first Fused-MBConv convolution operation, the 3×3 convolution layer kernel step size is 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.3 , the dimensions are 56×56×48;

[0020] Step 2.4: For the feature map F 2.3Four Fused-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4, a convolution kernel size of 3×3, a convolution layer with a size of 1×1, a Dropout layer, and a residual connection; only the first Fused-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.4 , the dimensions are 28×28×64;

[0021] Step 2.5: For the feature map F 2.4 Six FCSA-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4 and a convolution kernel size of 1×1, a depthwise separable convolution with a convolution kernel size of 3×3, and a convolution layer with a convolution kernel size of 1×1, an attention module FCSA, a Dropout layer, and a residual connection; only the first FCSA-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.5 , the dimensions are 14×14×128;

[0022] Step 2.6: For the feature map F 2.5 Nine FCSA-MBConv convolution operations are performed, all using a convolutional layer with a dilation ratio of 6 and a convolutional kernel size of 1×1, a depthwise separable convolution with a convolutional kernel size of 3×3, and a convolutional layer with a convolutional kernel size of 1×1, an attention module FCSA, a Dropout layer, and a residual connection; the convolutional layer kernel stride is 1, and the output feature map F is obtained. 2.6 , dimensions are 14×14×160;

[0023] Step 2.7: For the feature map F 2.6 Eight FCSA-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 6 and a convolution kernel size of 1×1, a depthwise separable convolution with a convolution kernel size of 3×3, and a convolution layer with a convolution kernel size of 1×1, an attention module FCSA, a Dropout layer, and a residual connection; only the first FCSA-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.7 , the dimension is 7×7×256;

[0024] Step 2.8: For the feature map F 2.7 The convolution layer with a convolution kernel size of 1×1 is used for convolution, and then the output feature map is obtained by normalizing the BN layer and the SiLU activation function. 2.8 , the dimensions are 7×7×1280;

[0025] The specific method of the FCSA-MBConv convolution operation in steps 2.5, 2.6, and 2.7 of the above steps is:

[0026] Input feature F in , it passes through the convolution layer with a convolution kernel size of 1×1, the depth-wise separable convolution with a convolution kernel size of 3×3, the convolution layer with a convolution kernel size of 1×1, the attention module FCSA and the Dropout layer, and finally uses the residual connection to obtain the feature F after one FCSA-MBConv convolution operation. out , as shown in formula (1):

[0027] F out =φ drop (φ fcs a(C1(C dw (C1(F in ))))))+F in (1)

[0028] Among them: C1 is the convolution layer with a convolution kernel size of 1×1, C dw is a depth-wise separable convolutional layer with a convolution kernel size of 3×3, φ fcsa is the attention module FCSA, φ drop It is the Dropout layer;

[0029] Specifically, in formula (1), φ fcsa The specific method is:

[0030] First, construct the frequency domain attention: divide the input feature F into N groups according to the number of channels, and use different frequency components in each group to calculate the sum of the two-dimensional discrete cosine transform frequency components of each channel in the group. The obtained frequency domain components and DCT of the i-th group i , as shown in formula (2):

[0031]

[0032] Among them: H and W represent the height and width of the feature map, h and w represent the coordinates of the height and width of the feature map, respectively, and F i represents the i-th group of features in feature F, u i and v i represents the frequency component combination used by the i-th group;

[0033] The frequency components and DCT calculated for each channel of all groups i For concatenation, the frequency domain attention operation of feature F in the frequency domain is φ fca , as shown in formula (3):

[0034] φ fca =F*(σ(φ fc (r(φ fc (concat([DCT 0 , DCT 1 , ..., DCTN-1 ])))))) (3)

[0035] Where: DCT is the sum of frequency components, φ fc represents the fully connected layer, r represents the ReLU activation function, σ represents the sigmoid activation function; concat() represents channel concatenation;

[0036] Then construct spatial attention: feature F through φ fca Get the frequency domain attention feature F FCA , for the frequency domain attention feature F FCA The maximum pooling and average pooling operations are performed on the channel dimension to obtain two feature maps. After splicing, they pass through a convolution layer with a convolution kernel size of 7×7 and a sigmoid activation function. The frequency domain attention feature F FCA The spatial attention operation in space is φ fcsa As shown in formula (4):

[0037] φ fcsa =F FCA *(σ(φ7(concat([Avg(F FCA ), Max(F FCA )])))) (4)

[0038] Among them: Avg represents the average pooling on the channel, Max represents the maximum pooling on the channel, concat() represents channel concatenation, φ7 represents the convolution layer with a convolution kernel size of 7×7, and σ represents the sigmoid activation function; it realizes the attention operation of feature F in the frequency domain and space;

[0039] Step 2.9, feature map F 2.8 After the adaptive average pooling layer, the output feature map is F 2.9 , with dimensions of 1×1×1280:

[0040] Step 2.10, feature map F 2.9 After a fully connected layer, a Dropout layer, a fully connected layer and a softmax activation function, the output classification result is P Global , as shown in formula (5):

[0041] P Global =softmax(φ fc2 (φ dropout (φ fc1 (F 2.9 )))) (5)

[0042] Where: φ fc1 is a fully connected operation with an output dimension of 512, φ dropout is the random dropout function, φfc2 It is a fully connected operation with an output dimension of 59;

[0043] So far, the FCSA-EfficientNetV2 model is obtained;

[0044] In the third step, the loss function of cross entropy with label smoothing combined with cost-sensitive regularization is used to calculate the loss between the predicted value output in step 2.17 and the true value:

[0045] Step 4: Train the FCSA-EfficientNetV2 model using the loss function constructed in step 3 to obtain the model parameters that give the highest accuracy to the validation set and save them.

[0046] The fifth step is to input the crop disease images to be identified into the trained FCSA-EfficientNetV2 model to realize the identification of the type, disease, and disease severity of the crop disease images.

[0047] Furthermore, in the second step, in step 2.10, a global prediction of the overall 59 types of plant species-diseases-disease severity is obtained, and then a local prediction of the 59 types of plant species-diseases-disease severity is performed, and the global prediction and the local prediction are integrated to obtain the final classification result; at the same time, a local prediction of the 36 types of plant species-diseases-health is performed; the specific process is:

[0048] Step 2.11, feature map F 2.7 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.10 , the dimension is 7×7×256, the feature map F 2.6 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.11 , the dimension is 14×14×256, and the feature map F 2.10 By upsampling, it is enlarged to the same size as the feature map F 2.11 Same size as F 2.11 Add together to get the fusion feature map F 2.12 , the dimension is 14×14×256;

[0049] Step 2.12: fusion feature map F 2.12 A convolution layer with a convolution kernel size of 3×3 is used to reduce the aliasing effect of upsampling, and then a convolution layer with a convolution kernel size of 1×1 is used. After the normalization BN layer and SiLU activation function, the output feature map is obtained as F 2.13 , the dimensions are 14×14×1280;

[0050] Step 2.13, feature map F 2.13After an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 36, and a softmax activation function, the local classification result P is obtained. Local36 ;

[0051] Step 2.14, feature map F 2.5 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.14 , the dimension is 14×14×256, the feature map F 2.14 And the fusion feature map F 2.12 Add together to get the fusion feature map F 2.15 ;

[0052] Step 2.15: fusion feature map F 2.15 A convolution layer with a convolution kernel size of 3×3 is used to reduce the aliasing effect of upsampling, and then a convolution layer with a convolution kernel size of 1×1 is used. After the normalization BN layer and SiLU activation function, the output feature map is obtained as F 2.16 , the dimensions are 14×14×1280;

[0053] Step 2.16, feature map F 2.16 After an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 59, and a softmax activation function, the local classification result P is obtained. Local59 ;

[0054] Step 2.17: The global classification result P obtained in step 2.10 is Global And the local classification result P Local59 The final classification result P of 59 categories is obtained by adding the average value. 59 ;

[0055] The global classification result P Global The prediction results of disease subclasses are added according to plant species-disease-health, so that the dimension is converted from 59 to 36, and then combined with the local classification result P Local36 The final prediction results of 36 categories of plant species, diseases, and health are obtained by adding and averaging. 36 .

[0056] Furthermore, the calculation process of the loss between the predicted value and the true value is:

[0057] (1) The cross entropy function LBCE(y) with label smoothing represents the loss between the class prediction value and the actual value, as shown in formula (6):

[0058]

[0059] in: is the category prediction value, y is the true value corresponding to each category, for the correct class, y c 1, other classes y c is 0, ε is the label smoothing parameter, and C is the number of disease categories;

[0060] (2) Cost-sensitive regularization CS(y) term, which represents the product between the category prediction value and the cost-sensitive matrix, as shown in formula (7):

[0061]

[0062] in: is the category prediction value, y * is the index corresponding to the true value of 1, λ is the weighting factor, and M is the constructed cost-sensitive matrix;

[0063] Construction of the cost-sensitive matrix M: In a disease, it is difficult to distinguish between the general disease degree and the severe disease degree, so the weight is increased to introduce different penalties for each prediction error; when predicting a healthy image of a certain plant, in the constructed cost-sensitive matrix, the weight of the correct prediction is 0, the weight corresponding to the general disease degree is 1, the weight corresponding to the severe disease degree is 2, the weight of the prediction of other diseases of the plant species is 3, and the weight of the prediction of other plant species is 4. This means that the farther the prediction distance from the true value is, the greater the weight. Therefore, for the prediction of 59 types of diseases, M is a two-dimensional matrix of size 59×59, with rows and columns corresponding to 59 types of diseases, M cj It represents the cost-sensitive weight for predicting category c as category j. When calculating formula (7), only the corresponding y in M ​​is calculated for the 59-category classification results. * Line and The scalar product of gets the regularization term;

[0064] (3) Final loss function loss total As shown in formula (8):

[0065]

[0066] Specifically, the smoothing parameter ε of the cross entropy with label smoothing described in the present invention is 0.1, and the weight λ of the cost-sensitive regularization matrix is ​​0.5.

[0067] The above-mentioned crop disease image recognition method based on FCSA-EfficientNetV2, wherein EfficientNetV2 is a well-known algorithm in the technical field.

[0068] Compared with the existing method, the beneficial effects of the present invention are:

[0069] The present invention has excellent performance in terms of accuracy and speed. The present invention proposes a crop disease image recognition method based on FCSA-EfficientNetV2. In the recognition of crop diseases and their disease degrees, compared with other networks that only recognize the types of diseases, the present invention can achieve higher recognition accuracy on the disease degrees that are difficult to distinguish, and at the same time can improve the reasoning speed of the network. Compared with the EfficientNetV2 network, the recognition accuracy and speed are greatly improved. The present invention moves the attention position to the convolution layer that reduces the number of channels, and organically combines the frequency attention and the spatial attention to avoid the problem that the extracted semantic information is insufficient due to the large proportion of the feature biased channel or spatial attention. At the same time, the number of layers for extracting features in the final stage is reduced from 15 layers to 8 layers, so that the number of parameters is reduced by more than 40%, and the reasoning speed is improved. The proposed cost-sensitive regularization can make the model pay more attention to the general and severe mispredictions of the disease degree, and solve the problem that the network model is not easy to distinguish the disease degree. Find an attention module with strong ability to extract disease features and a loss function that pays attention to the disease degree.

[0070] Furthermore, the identification method of the present invention first makes a global prediction of the overall degree of 59 types of diseases, and at the same time adopts a hierarchical classification method, a top-down classification structure is used to make a local prediction of 36 types of diseases, and then a local prediction of the degree of 59 types of diseases is made. The hierarchical classification can also achieve an accuracy rate of more than 98% for identifying 36 types of diseases, which also ensures a balance between accuracy and speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0072] Figure 1 It is an overall flow chart of the crop disease image recognition method based on FCSA-EfficientNetV2 of the present invention.

[0073] Figure 2 It is the FCSA attention module diagram in FCSA-MBConv constructed in the second step of the present invention.

[0074] Figure 3 This is the FCSA-MBConv feature extraction module diagram constructed by the second step of feature extraction in the present invention.

[0075] Figure 4 It is an FCSA-EfficientNetV2 network model constructed by an embodiment of the present invention. DETAILED DESCRIPTION

[0076] Figure 1As shown in the embodiment, the overall process of the crop disease image recognition method based on FCSA-EfficientNetV2 of the present invention is as follows:

[0077] Input the disease image → perform online data enhancement preprocessing → extract features through FCSA-EfficientNetV2 and output the predicted value → use the optimized loss function to calculate the loss between the predicted value and the true value → save the optimal model parameters → input the test set into the FCSA-EfficientNetV2 model for prediction → obtain the classification result.

[0078] Figure 2 As shown in the embodiment, the FCSA attention module process in the FCSA-MBConv constructed by the present invention is as follows:

[0079] Input feature F → Divide the feature map into N groups of features → Perform discrete cosine transform calculations on each channel using different frequency components for each group of features → Concatenate the obtained N groups of frequency domain features → Use a fully connected layer to reduce the dimension and use the ReLU activation function → Use a fully connected layer to increase the dimension to the number of channels of the original feature and use the sigmoid activation function → Get the frequency domain attention feature weight → Multiply the input feature F by the frequency domain attention feature weight → Get the frequency domain attention feature F FCA →Use average pooling on the channel dimension to process the frequency domain feature F FCA , while using the maximum pooling in the channel dimension to process the frequency domain features F FCA → Concatenate the features of average pooling and maximum pooling → Use a convolution layer with a convolution kernel size of 7×7 to adjust the number of channels to 1 layer → Use the sigmoid activation function → Get the frequency domain spatial position feature weights → Use the frequency domain feature F FCA Multiply it with the frequency domain spatial position feature weight → get the output feature map F FCSA .

[0080] Figure 3 As shown in the embodiment, the FCSA-MBConv module process constructed by the present invention is as follows:

[0081] Input feature F → Use a convolution layer with a convolution kernel size of 1×1 to expand the number of channels with a fixed ratio → Use a depth-separable convolution with a convolution kernel size of 3×3 to extract features → Use a convolution layer with a convolution kernel size of 1×1 to reduce the number of channels → Get feature map F MBC →Use frequency domain attention to extract frequency domain attention feature weights →The feature map F MBC Multiply it with the frequency domain attention feature weight → get the frequency domain feature F FCA →Use spatial attention to extract frequency domain spatial position feature weights →The frequency domain feature F FCAMultiply it with the frequency domain spatial position feature weight extracted by spatial attention → get the frequency domain spatial feature map F FCSA →The features are randomly deactivated through the Dropout layer →The obtained features are added to the original features F →The output feature F is obtained FCSAMBC .

[0082] Figure 4 As shown in the embodiment, the FCSA-EfficientNetV2 network model structure constructed by the invention is as follows:

[0083] The overall network model includes 2 convolution modules, 10 Fused-MBConv convolution modules, 23 FCSA-MBConv convolution modules, 1 global average pooling and 2 fully connected layers. Among them, the construction of the FCSA-MBConv convolution module is as follows: Figure 3 As shown in Figure 2, the FCSA attention module in the FCSA-MBConv convolution module is as follows: Figure 2 The specific forward propagation process of the network is as follows Figure 4 As shown, first input the preprocessed image with size 224×224×3,

[0084] The first step is to perform a convolution layer with a kernel size of 3×3 and a stride of 2, a normalized BN layer and a SiLU activation function, and obtain a feature map size of 112×112×24;

[0085] In the second step, two Fused-MBConv convolution modules are used. These two Fused-MBConv convolution modules are composed of a convolution layer with a dilation rate of 1 and a convolution kernel size of 3×3, a convolution layer with a convolution kernel size of 1×1, a Dropout layer, and a residual connection. The feature map size of the second step output is 112×112×24.

[0086] In the third step, four Fused-MBConv convolutional modules are used. These four Fused-MBConv convolutional modules use convolutional layers with a dilation rate of 4 and a convolutional kernel size of 3×3, a convolutional kernel size of 1×1, a Dropout layer, and a residual connection. Only in the first Fused-MBConv convolutional module, the 3×3 convolutional layer uses a kernel step size of 2. The kernel step sizes of all convolutional layers in the remaining Fused-MBConv convolutional modules are 1. The feature map size of the output in the third step is 56×56×48.

[0087] In the fourth step, four Fused-MBConv convolution modules are used. These four Fused-MBConv convolution modules use a convolution layer with a dilation rate of 4 and a convolution kernel size of 3×3, a convolution kernel size of 1×1, a Dropout layer, and a residual connection. Only in the first Fused-MBConv convolution, the 3×3 convolution layer uses a kernel step size of 2. The kernel step sizes of all convolution layers in the remaining Fused-MBConv convolution modules are 1. The feature map size of the output in the fourth step is 28×28×64.

[0088] In the fifth step, six FCSA-MBConv convolutional modules are used, in which the modules are composed of a convolutional layer with a dilation rate of 4 and a convolutional kernel size of 1×1, a depthwise separable convolutional layer with a convolutional kernel size of 3×3, a convolutional layer with a convolutional kernel size of 1×1, an FCSA attention module, a Dropout layer, and a residual connection. Only the depthwise separable convolutional layer of the first FCSA-MBConv convolutional module uses a kernel stride of 2. The kernel stride of all convolutional layers in the remaining FCSA-MBConv convolutional modules (including the depthwise separable convolutional layer of 3×3, the convolutional layer with a convolutional kernel size of 1×1, and the convolutional layer of 7×7) is 1, and the feature map size of the fifth step output is 14×14×128.

[0089] In the sixth step, 9 FCSA-MBConv convolution modules are used, where the modules are composed of a convolution layer with a dilation rate of 6 and a convolution kernel size of 1×1, a depthwise separable convolution layer with a convolution kernel size of 3×3, a convolution layer with a convolution kernel size of 1×1, an FCSA attention module, a Dropout layer, and a residual connection. The feature map size of the sixth step output is 14×14×160; the kernel stride of all convolution layers is 1;

[0090] In the seventh step, eight FCSA-MBConv convolutional modules are used, where the modules are composed of a convolutional layer with a dilation rate of 6 and a convolutional kernel size of 1×1, a depthwise separable convolutional layer with a convolutional kernel size of 3×3, a convolutional layer with a convolutional kernel size of 1×1, an FCSA attention module, a Dropout layer, and a residual connection. Only the kernel stride of the depthwise separable convolutional layer of the first FCSA-MBConv convolutional module is 2, and the kernel stride of all convolutional layers in the remaining FCSA-MBConv convolutional modules is 1. The feature map size of the output in the seventh step is 7×7×256.

[0091] In the eighth step, a convolution layer with a convolution kernel size of 1×1 is performed, a normalized BN layer and a SiLU activation function are used to obtain a feature map size of 7×7×1280;

[0092] In the ninth step, global average pooling GAP is performed, a fully connected layer with an output dimension of 512, a Dropout layer, a fully connected layer with an output dimension of 59, and a softmax activation function are used to obtain the global classification results of 59 diseases.

[0093] In the tenth step, the feature map obtained in the seventh step passes through a convolution layer with a convolution kernel size of 1×1, and is enlarged to 14×14×256 by up-sampling. The feature map obtained in the sixth step passes through a convolution layer with a convolution kernel size of 1×1, and is added to the up-sampled feature map to obtain a fused feature map with a size of 14×14×256.

[0094] In the eleventh step, the fused feature map obtained in the tenth step is passed through a convolution layer with a convolution kernel size of 3×3 to reduce the aliasing effect of upsampling, and then passed through a convolution layer with a convolution kernel size of 1×1, a normalized BN layer and a SiLU activation function to obtain a feature map size of 14×14×1280;

[0095] In the twelfth step, the feature map obtained in the eleventh step is passed through an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 36, and a softmax activation function to obtain the local classification results of 36 diseases;

[0096] In the thirteenth step, the feature map obtained in the fifth step is passed through a convolution layer with a convolution kernel size of 1×1, and is added to the fused feature map obtained in the tenth step to obtain a fused feature map with a size of 14×14×256;

[0097] Step 14: The fused feature map obtained in step 13 is passed through a convolution layer with a convolution kernel size of 3×3, and then through a convolution layer with a convolution kernel size of 1×1, a normalized BN layer and a SiLU activation function to obtain a feature map size of 14×14×1280;

[0098] In the fifteenth step, the feature map obtained in the fourteenth step is passed through an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 59, and a softmax activation function to obtain the local classification results of 59 diseases;

[0099] The global classification results of 59 diseases and the local classification results of 59 diseases are added together to obtain the final classification result of 59 categories P. 59 ; Add the prediction results of the disease subclasses according to plant species-disease-health in the global 59 disease classification results to convert the dimension from 59 to 36, and then add the average value with the local 36 disease classification results to obtain the final 36-category plant species-disease-health prediction result P 36 .

[0100] The images of crops to be tested are input into the trained model to classify the degree of crop diseases. The specific categories are divided into plant species-disease-disease degree, and the type of crop to be tested, the disease, and the degree of disease are output respectively. At the same time, the results of the type of crop to be tested, whether it is healthy, and the type of disease when unhealthy can also be given to realize the identification of the degree of disease.

[0101] Example 1

[0102] The specific steps of the crop disease image recognition method based on FCSA-EfficientNetV2 in this embodiment are as follows:

[0103] The first step is to preprocess the crop disease image data:

[0104] Step 1.1, obtain the crop disease dataset: obtain the AI ​​Challenger 2018 crop disease dataset, which includes 10 species such as apples, grapes, and citrus, 26 diseases such as black spot, black rot, and Huanglongbing, and 3 disease levels: healthy, general, and severe. According to the plant species-disease-disease level classification method, a total of 61 types of diseases are obtained, including 31,721 training sets and 4,540 validation sets. Different diseases are represented by labels from 0 to 60. There are only 3 pictures in the 44th and 45th categories. Since the amount of data in these two categories is not enough to support the model to learn relevant features, these two categories are removed, and the disease types are represented by labels from 0 to 58;

[0105] In step 1.2, in order to expand the data set, the training set data is preprocessed, including random cropping, random horizontal flipping, image resizing and standardization.

[0106] The second step is to build the FCSA-EfficientNetV2 model:

[0107] In step 2.1, the disease image obtained in step 1.2 is used as the network input. The size of a single image is 224×224×3. A convolution layer with a convolution kernel size of 3×3 and a kernel step size of 2 is used. After a normalized BN layer and SiLU activation function, the output feature map F is obtained. 2.1 , the dimensions are 112×112×24;

[0108] Step 2.2: For the feature map F 2.1 Perform two Fused-MBConv convolution operations, both using a convolution layer with a dilation ratio of 1, a convolution kernel size of 3×3, and a kernel step size of 1, and obtain the output feature map F 2.2 , the dimensions are 112×112×24;

[0109] Step 2.3: For the feature map F 2.2Four Fused-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4, a convolution kernel size of 3×3, a convolution layer with a size of 1×1, a Dropout layer, and a residual connection. Only in the first Fused-MBConv convolution operation, the 3×3 convolution layer kernel step size is 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.3 , the dimensions are 56×56×48;

[0110] Step 2.4: For the feature map F 2.3 Four Fused-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4, a convolution kernel size of 3×3, a convolution layer with a size of 1×1, a Dropout layer, and a residual connection. Only the first Fused-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.4 , the dimensions are 28×28×64;

[0111] Step 2.5: For the feature map F 2.4 Six FCSA-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4 and a convolution kernel size of 1×1, a depthwise separable convolution with a convolution kernel size of 3×3, and a convolution layer with a convolution kernel size of 1×1, FCSA attention, Dropout layer and residual connection. Only the first FCSA-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1. The output feature map F is obtained. 2.5 , the dimensions are 14×14×128;

[0112] Step 2.6: For the feature map F 2.5 Perform nine FCSA-MBConv convolution operations, all using a convolutional layer with a dilation ratio of 6 and a convolutional kernel size of 1×1, a depthwise separable convolution with a convolutional kernel size of 3×3, and a convolutional layer with a convolutional kernel size of 1×1, FCSA attention, dropout layers, and residual connections, where the convolutional layer kernel stride is 1, and obtain the output feature map F 2.6 , dimensions are 14×14×160;

[0113] Step 2.7: For the feature map F 2.6 Eight FCSA-MBConv convolution operations are performed, all using a convolutional layer with a dilation ratio of 6 and a convolutional kernel size of 1×1, a depthwise separable convolution with a convolutional kernel size of 3×3, and a convolutional layer with a convolutional kernel size of 1×1, FCSA attention, Dropout layer and residual connection. Only the first FCSA-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolutional layers are all 1. The output feature map F is obtained. 2.7 , the dimension is 7×7×256;

[0114] Step 2.8: For the feature map F 2.7 The convolution layer with a convolution kernel size of 1×1 is used for convolution, and then the output feature map is obtained by normalizing the BN layer and the SiLU activation function. 2.8 , the dimensions are 7×7×1280;

[0115] The specific method of the FCSA-MBConv convolution operation in steps 2.5, 2.6, and 2.7 of the above steps is:

[0116] Input feature F in , it passes through the convolution layer with a convolution kernel size of 1×1, the depth-wise separable convolution with a convolution kernel size of 3×3, the convolution layer with a convolution kernel size of 1×1, the attention module FCSA and the Dropout layer, and finally uses the residual connection to obtain the feature F after one FCSA-MBConv convolution operation. out , as shown in formula (1):

[0117] F out =φ drop (φ fcsa (C1(C dw (C1(F in ))))))+F in (1)

[0118] Among them: C1 is the convolution layer with a convolution kernel size of 1×1, C dw is a depth-wise separable convolutional layer with a convolution kernel size of 3×3, φ fcsa is the attention module FCSA, φ drop It is the Dropout layer;

[0119] Specifically, in formula (1), φ fcsa The specific method is:

[0120] First, construct the frequency domain attention: divide the input feature F into N groups according to the number of channels, and use different frequency components in each group to calculate the sum of the two-dimensional discrete cosine transform frequency components of each channel in the group. The obtained frequency domain components and DCT of the i-th group i , as shown in formula (2):

[0121]

[0122] Among them: H and W represent the height and width of the feature map, h and w represent the coordinates of the height and width of the feature map, respectively, and F i represents the i-th group of features in feature F, u i and v i represents the frequency component combination used by the i-th group;

[0123] The frequency components and DCT calculated for each channel of all groups i After concatenation, the frequency domain attention operation of feature F in the frequency domain is φ fca , as shown in formula (3):

[0124] φ fca =F*(σ(φ fc (r(φ fc (concat([DCT 0 , DCT 1 , ..., DCT N-1 ])))))) (3)

[0125] Where: DCT is the sum of frequency components, φ fc represents the fully connected layer, r represents the ReLU activation function, σ represents the sigmoid activation function; concat() represents channel concatenation;

[0126] Then construct spatial attention: feature F through φ fca Get the frequency domain attention feature F FCA , for the frequency domain attention feature F FCA The maximum pooling and average pooling operations are performed on the channel dimension to obtain two feature maps. After splicing, they pass through a convolution layer with a convolution kernel size of 7×7 and a sigmoid activation function. The frequency domain attention feature F FCA The spatial attention operation in space is φ fcsa As shown in formula (4):

[0127] φ fcsa =F FCA *(σ(φ7(concat([Avg(F FCA ), Max(F FCA )])))) (4)

[0128] Among them: Avg represents the average pooling on the channel, Max represents the maximum pooling on the channel, concat() represents channel concatenation, φ7 represents the convolution layer with a convolution kernel size of 7×7, and σ represents the sigmoid activation function;

[0129] Implement the attention operation of feature F in frequency domain and space;

[0130] Step 2.9, feature map F 2.8 After the adaptive average pooling layer, the output feature map is F 2.9 , the dimension is 1×1×1280;

[0131] Step 2.10, feature map F 2.9After a fully connected layer, a Dropout layer, a fully connected layer and a softmax activation function, the output classification result is P Global , as shown in formula (5):

[0132] P Global =softmax(φ fc2 (φ dropout (φ fc1 (F 2.9 )))) (5)

[0133] Where: φ fc1 is a fully connected operation with an output dimension of 512, φ dropout is the random dropout function, φ fc2 It is a fully connected operation with an output dimension of 59;

[0134] Step 2.11, feature map F 2.7 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.10 , the dimension is 7×7×256, the feature map F 2.6 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.11 , the dimension is 14×14×256, and the feature map F 2.10 By up-sampling, it can be enlarged to the same size as the feature map F. 2.11 Same size as F 2.11 Add together to get the fusion feature map F 2.12 , the dimension is 14×14×256;

[0135] Step 2.12: fusion feature map F 2.12 A convolution layer with a convolution kernel size of 3×3 is used to reduce the aliasing effect of upsampling, and then a convolution layer with a convolution kernel size of 1×1 is used. After the normalization BN layer and SiLU activation function, the output feature map is obtained as F 2.13 , the dimensions are 14×14×1280;

[0136] Step 2.13, feature map F 2.13 After an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 36, and a softmax activation function, the classification result P is obtained. Local36 ;

[0137] Step 2.14, feature map F 2.5 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.14 , the dimension is 14×14×256, the feature map F 2.14 And the fusion feature map F 2.12Add together to get the fusion feature map F 2.15 ;

[0138] Step 2.15: fusion feature map F 2.15 A convolution layer with a convolution kernel size of 3×3 is used to reduce the aliasing effect of upsampling, and then a convolution layer with a convolution kernel size of 1×1 is used. After the normalization BN layer and SiLU activation function, the output feature map is obtained as F 2.16 , the dimensions are 14×14×1280;

[0139] Step 2.16, feature map F 2.16 After an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 59, and a softmax activation function, the local classification result P is obtained. Local59 ;

[0140] Step 2.17: The global classification result P obtained in step 2.10 is Global And the local classification result P Local59 The final classification result P of 59 categories is obtained by adding the average value. 59 ;

[0141] The global classification result P Global The prediction results of disease subclasses are added according to plant species-disease-health, so that the dimension is converted from 59 to 36, and then combined with the local classification result P Local36 The final prediction results of 36 categories of plant species, diseases, and health are obtained by adding and averaging. 36 .

[0142] 36 categories means that the data set is divided according to plant species-disease-whether it is diseased.

[0143] In the third step, the loss function of cross entropy with label smoothing combined with cost-sensitive regularization is used to calculate the loss between the predicted value output in step 2.10 and the true value:

[0144] Step 3.1: From step 1.1, we can know that the disease category labels of the crop disease dataset are 0-58, of which 0-5 are the types and degrees of apple diseases, 6-8 are the types and degrees of cherry diseases, 9-16 are the types and degrees of corn diseases, 17-23 are the types and degrees of grape diseases, 24-26 are the types and degrees of citrus diseases, 27-29 are the types and degrees of peach diseases, 30-32 are the types and degrees of pepper diseases, 33-37 are the types and degrees of potato diseases, 38-40 are the types and degrees of strawberry diseases, and 41-58 are the types and degrees of tomato diseases. The specific 36 types of diseases are shown in Table 1, and the specific 59 types of diseases and their degrees are shown in Table 2.

[0145] Table 1 36 types of diseases

[0146] Label Category Name Label Category Name Label Category Name 0 Apple Health 12 Grape black rot 24 Strawberry Health 1 Apple scab 13 Grape shift disease 25 Strawberry leaf blight 2 Apple gray spot 14 Grape brown spot 26 Tomato Health 3 Apple cedar rust 15 Citrus Health 27 Tomato powdery mildew 4 Cherry Health 16 Citrus Huanglongbing 28 Tomato Early Blight 5 Cherry powdery mildew 17 Peach Health 29 Tomato late blight 6 Corn Health 18 Peach scab 30 Tomato Leaf Mold 7 Corn Gray Spot 19 Chili pepper health 31 Tomato spot 8 Corn rust 20 Pepper scab 32 Tomato leaf spot 9 Corn leaf spot 21 Potato Health 33 Tomato spider mite damage 10 Maize mosaic virus 22 Potato early blight 34 Tomato yellow leaf curl virus 11 Grape Health 23 Potato late blight 35 Tomato mosaic virus

[0147] Table 2 59 types of diseases and their severity

[0148]

[0149]

[0150] Step 3.2, calculate the loss between the predicted value and the true value, including:

[0151] (1) The cross entropy function LBCE(y) with label smoothing represents the loss between the class prediction value and the actual value, as shown in formula (6):

[0152]

[0153] in: is the category prediction value, y is the true value corresponding to each category, for the correct class, y c 1, other classes y c is 0, ε is the label smoothing parameter, and C is the number of disease categories;

[0154] (2) Cost-sensitive regularization CS(y) term, which represents the product between the category prediction value and the cost-sensitive matrix, as shown in formula (7):

[0155]

[0156] in: is the category prediction value, y * is the index corresponding to the true value of 1, λ is the weighting factor, and M is the constructed cost-sensitive matrix;

[0157] (3) The final loss function is shown in formula (8):

[0158]

[0159] in: is the category prediction value, Where y is the true value corresponding to each category. Where y is the index corresponding to the true value of 1;

[0160] Specifically, in step 4.2 of the present invention:

[0161] The construction of the cost-sensitive matrix M in formula (9): In a disease, it is difficult to distinguish between the general disease degree and the severe disease degree, so we use the method of adding weights to introduce different penalties for each prediction error; for example, when predicting a healthy image of a certain plant, in the constructed cost-sensitive matrix, the weight of the correct prediction is 0, the weight corresponding to the general disease degree is 1, the weight corresponding to the severe disease degree is 2, the weight corresponding to other diseases of the plant species is 3, and the weight corresponding to other plant species is 4. This means that the farther the prediction distance from the true value is, the greater the weight. Therefore, for the prediction of 59 types of diseases, M is a two-dimensional matrix of size 59×59, with rows and columns corresponding to 59 types of diseases, M cj represents the cost-sensitive weight for predicting category c as category j. When calculating formula (7), only the corresponding y rows in M ​​and The scalar product of gets the regularization term;

[0162] Step 5: Use the loss function constructed in step 4 to train the FCSA-EfficientNetV2 network constructed in steps 2 and 3, obtain the model parameters that give the highest accuracy to the validation set, and save them;

[0163] Specifically, the training method used in the fifth step of the present invention is:

[0164] During the training of the entire network, the input image size is 224×224, the batch size is 64, the number of iterations is set to 200, the SGD optimizer is used, the initial learning rate is 0.001, the momentum factor is 0.9, and the learning rate decay adopts the cosine annealing method;

[0165] At this point, crop disease image recognition based on FCSA-EfficientNetV2 is completed.

[0166] Specifically, the smoothing parameter ε of the cross entropy with label smoothing in the fourth step of the present invention is 0.1, and the weight λ of the cost-sensitive regularization matrix is ​​0.5.

[0167] The above-mentioned crop disease image recognition method based on FCSA-EfficientNetV2, wherein EfficientNetV2 is a well-known algorithm in the technical field.

[0168] Compared with the existing ResNet-50, EfficientNetV2-S, SwinTransformer-Tiny and ConvNeXt-Tiny structures, the prediction method of this embodiment has significantly improved the accuracy and the reasoning speed, and reduced the number of parameters. The method of this application can take into account the feature extraction capability and complexity of the network model while maintaining a relatively high accuracy.

[0169] The method of the present invention identifies a variety of plant diseases and their degrees, designs an attention enhancement module to change the position of attention at the same time, and reduces the number of convolution layers to improve the EfficientNetV2 algorithm, thereby obtaining FSCA-EfficientNetV2, which can realize the extraction of disease discriminative features and reduce the complexity of the network structure; firstly, a global prediction is made for the overall 59 types of disease degrees, and at the same time, a hierarchical classification method is adopted, and a top-down classification structure is adopted to perform local predictions on 36 types of diseases and 59 types of diseases respectively, and then the local prediction results are correspondingly fused with the global prediction results to obtain the final recognition result; in addition, a loss function combining cross entropy with label smoothing and a cost-sensitive regularization method is introduced to enhance the model's attention to the disease degrees, thereby solving the problems of low disease recognition rate and difficulty in distinguishing disease degrees by the network model.

[0170] Any matters not described in the present invention are applicable to the prior art.

Claims

1. A crop disease recognition method based on FCSA-EfficientNetV2, It is characterized in that The recognition method first preprocesses the crop disease image data, then builds the FCSA-EfficientNetV2 model, then inputs the extracted features into the fully connected layer to obtain the prediction results, and finally uses the loss function combining cross entropy with label smoothing and cost-sensitive regularization to update the model parameters and save them to obtain the trained FCSA-EfficientNetV2 model. The FCSA-EfficientNetV2 model is based on the EfficientNetV2 network, and the attention module FCSA replaces the SE attention module of the MBConv module in the EfficientNetV2 network; The process of the attention module FCSA is: divide the input feature map into N groups of features, use different frequency components to perform discrete cosine transform calculations on each channel for each group of features, obtain N groups of frequency domain features, and concatenate the obtained N groups of frequency domain features; then use a fully connected layer to reduce the dimension and use a ReLU activation function, then use a fully connected layer to increase the dimension to the number of channels of the original feature and use a sigmoid activation function to obtain the frequency domain attention feature weight; Multiply the feature F of the input feature map by the frequency domain attention feature weight to obtain the frequency domain attention feature F FCA , use the average pooling on the channel dimension to process the frequency domain attention feature F FCA , and use the maximum pooling on the channel dimension to process the frequency domain attention feature F FCA , the features after average pooling and maximum pooling are concatenated, and then the number of channels is adjusted to 1 layer using a convolution layer with a convolution kernel size of 7×7. The sigmoid activation function is used to obtain the frequency domain spatial position feature weights, and the frequency domain attention feature F FCA Multiply it with the frequency domain spatial position feature weight to get the output frequency domain spatial feature map F FCSA ; The crop disease images to be identified are input into the trained FCSA-EfficientNetV2 model to realize the identification of the type, disease, and disease severity of the crop disease images.

2. The crop disease identification method based on FCSA-EfficientNetV2 according to claim 1, It is characterized in that The FCSA-EfficientNetV2 model includes 23 FCSA-MBConv modules and 10 Fused-MBConv convolution modules. The process of each FCSA-MBConv module is: input features → use a convolution layer with a convolution kernel size of 1×1 to expand the number of channels at a fixed rate → use a depth-wise separable convolution with a convolution kernel size of 3×3 to extract features → use a convolution layer with a convolution kernel size of 1×1 to reduce the number of channels → obtain a feature map → use frequency domain attention to extract frequency domain attention feature weights → multiply the feature map by the frequency domain attention feature weights → obtain frequency domain features → use spatial attention to extract frequency domain spatial position feature weights → multiply the frequency domain features by the frequency domain spatial position feature weights extracted by spatial attention → obtain a frequency domain spatial feature map → perform random inactivation on the features through the Dropout layer → add the obtained features to the original features → obtain the output features.

3. A crop disease image recognition method based on FCSA-EfficientNetV2, It is characterized in that The specific steps of the identification method are: The first step is to preprocess the crop disease image data: Step 1.1, obtain the crop disease dataset: Obtain the AI ​​Challenger 2018 crop disease dataset, which contains 10 species, 26 diseases, and three disease levels: healthy, general, and severe. A total of 61 types of diseases are obtained by dividing them into plant species-disease-disease level. Different diseases are represented by labels ranging from 0 to 60. There are only 3 pictures in the 44th and 45th categories. Since the amount of data in these two categories is not enough to support the model to learn relevant features, these two categories are removed, and the disease types are represented by labels ranging from 0 to 58. Divide the data set into training set and test set; In step 1.2, in order to expand the data set, the training set data is preprocessed, including random cropping, random horizontal flipping, image resizing and standardization. The second step is to build the FCSA-EfficientNetV2 model: In step 2.1, the disease image obtained in step 1.2 is used as the network input. The size of a single image is 224×224×3. A convolution layer with a convolution kernel size of 3×3 and a kernel step size of 2 is used. After a normalized BN layer and SiLU activation function, the output feature map F is obtained. 2.1 , the dimensions are 112×112×24; Step 2.2: For the feature map F 2.1 Perform two Fused-MBConv convolution operations, both using a convolution layer with a dilation ratio of 1, a convolution kernel size of 3×3, and a kernel step size of 1, and obtain the output feature map F 2.2 , the dimensions are 112×112×24; Step 2.3, for the feature map F 2.2 Four Fused-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4, a convolution kernel size of 3×3, a convolution layer with a size of 1×1, a Dropout layer, and a residual connection. Only in the first Fused-MBConv convolution operation, the 3×3 convolution layer kernel step size is 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.3 , the dimensions are 56×56×48; Step 2.4: For the feature map F 2.3 Four Fused-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4, a convolution kernel size of 3×3, a convolution layer with a size of 1×1, a Dropout layer, and a residual connection; only the first Fused-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.4 , the dimensions are 28×28×64; Step 2.5: For the feature map F 2.4 Six FCSA-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 4 and a convolution kernel size of 1×1, a depthwise separable convolution with a convolution kernel size of 3×3, and a convolution layer with a convolution kernel size of 1×1, an attention module FCSA, a Dropout layer, and a residual connection; only the first FCSA-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.5 , the dimensions are 14×14×128; Step 2.6: For the feature map F 2.5 Nine FCSA-MBConv convolution operations are performed, all using a convolutional layer with a dilation ratio of 6 and a convolutional kernel size of 1×1, a depthwise separable convolution with a convolutional kernel size of 3×3, and a convolutional layer with a convolutional kernel size of 1×1, an attention module FCSA, a Dropout layer, and a residual connection; the convolutional layer kernel stride is 1, and the output feature map F is obtained. 2.6 , dimensions are 14×14×160; Step 2.7: For the feature map F 2.6 Eight FCSA-MBConv convolution operations are performed, all using a convolution layer with a dilation ratio of 6 and a convolution kernel size of 1×1, a depthwise separable convolution with a convolution kernel size of 3×3, and a convolution layer with a convolution kernel size of 1×1, an attention module FCSA, a Dropout layer, and a residual connection; only the first FCSA-MBConv convolution operation has a kernel step size of 2, and the kernel step sizes of the remaining convolution layers are all 1, and the output feature map F is obtained. 2.7 , the dimension is 7×7×256; Step 2.8: For the feature map F 2.7 The convolution layer with a convolution kernel size of 1×1 is used for convolution, and then the output feature map is obtained by normalizing the BN layer and the SiLU activation function. 2.8 , the dimensions are 7×7×1280; The specific method of the FCSA-MBConv convolution operation in steps 2.5, 2.6, and 2.7 of the above steps is: Input feature F in , it passes through the convolution layer with a convolution kernel size of 1×1, the depth-wise separable convolution with a convolution kernel size of 3×3, the convolution layer with a convolution kernel size of 1×1, the attention module FCSA and the Dropout layer, and finally uses the residual connection to obtain the feature F after one FCSA-MBConv convolution operation. out , as shown in formula (1): F out =φ drop (φ fcsa (C 1 (C dw (C 1 (F in )))))+F in (1) Where: C 1 is a convolution layer with a convolution kernel size of 1×1, C dw is a depth-wise separable convolutional layer with a convolution kernel size of 3×3, φ fcsa is the attention module FCSA, φ drop It is the Dropout layer; Specifically, in formula (1), φ fcsa The specific method is: First, construct the frequency domain attention: divide the input feature F into N groups according to the number of channels, and use different frequency components in each group to calculate the sum of the two-dimensional discrete cosine transform frequency components of each channel in the group. The obtained frequency domain components and DCT of the i-th group i , as shown in formula (2): Among them: H and W represent the height and width of the feature map, h and w represent the coordinates of the height and width of the feature map, respectively, and F i represents the i-th group of features in feature F, u i and v i represents the frequency component combination used by the i-th group; The frequency components and DCT calculated for each channel of all groups i For concatenation, the frequency domain attention operation of feature F in the frequency domain is φ fca , as shown in formula (3): φ fca =F*(σ(φ fc (r(φ fc (concat([DCT 0 ,DCT 1 ,…,DCT N-1 ])))))) (3) Where: DCT is the sum of frequency components, φ fc represents the fully connected layer, r represents the ReLU activation function, σ represents the sigmoid activation function; concat() represents channel concatenation; Then construct spatial attention: feature F through φ fca Get the frequency domain attention feature F FCA , for the frequency domain attention feature F FCA The maximum pooling and average pooling operations are performed on the channel dimension to obtain two feature maps. After splicing, they pass through a convolution layer with a convolution kernel size of 7×7 and a sigmoid activation function. The frequency domain attention feature F FCA The spatial attention operation in space is φ fcsa As shown in formula (4): φ fcsa =F FCA *(σ(φ 7 (concat([Avg(F FCA ), Max(F FCA )])))) (4) Among them: Avg represents the average pooling on the channel, Max represents the maximum pooling on the channel, concat () represents channel concatenation, φ7 represents the convolution layer with a convolution kernel size of 7×7, and σ represents the sigmoid activation function; it realizes the attention operation of feature F in the frequency domain and space; Step 2.9, feature map F 2.8 After the adaptive average pooling layer, the output feature map is F 2.9 , the dimension is 1×1×1280; Step 2.10, feature map F 2.9 After a fully connected layer, a Dropout layer, a fully connected layer and a softmax activation function, the output classification result is P Global , as shown in formula (5): P Global =softmax(φ fc2 (f dropout (f fc1 (F 2.9 )))) (5) Where: φ fc1 is a fully connected operation with an output dimension of 512, φ dropout is the random dropout function, φ fc2 It is a fully connected operation with an output dimension of 59; So far, the FCSA-EfficientNetV2 model is obtained; In the third step, the loss function of cross entropy with label smoothing combined with cost-sensitive regularization is used to calculate the loss between the predicted value output in step 2.17 and the true value: Step 4: Train the FCSA-EfficientNetV2 model using the loss function constructed in step 3 to obtain the model parameters that give the highest accuracy to the validation set and save them. The fifth step is to input the crop disease images to be identified into the trained FCSA-EfficientNetV2 model to realize the identification of the type, disease, and disease severity of the crop disease images.

4. The crop disease image recognition method based on FCSA-EfficientNetV2 according to claim 3, It is characterized in that In the second step, in step 2.10, a global prediction of the 59 plant species-disease-disease severity is obtained, and then a local prediction of the 59 plant species-disease-disease severity is performed, and the global prediction and the local prediction are combined to obtain the final classification result; at the same time, a local prediction of the 36 plant species-disease-health is performed; the specific process is: Step 2.11, feature map F 2.7 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.10 , the dimension is 7×7×256, the feature map F 2.6 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.11 , the dimension is 14×14×256, and the feature map F 2.10 By upsampling, it is enlarged to the same size as the feature map F 2.11 Same size as F 2.11 Add together to get the fusion feature map F 2.12 , the dimension is 14×14×256; Step 2.12: fusion feature map F 2.12 A convolution layer with a convolution kernel size of 3×3 is used to reduce the aliasing effect of upsampling, and then a convolution layer with a convolution kernel size of 1×1 is used. After a normalized BN layer and SiLU activation function, the output feature map is F 2.13 , the dimensions are 14×14×1280; Step 2.13, feature map F 2.13 After an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 36, and a softmax activation function, the local classification result P is obtained. Local36 ; No. Step 2.14, feature map F 2.5 After the convolution layer with a convolution kernel size of 1×1, the output feature map is F 2.14 , the dimension is 14×14×256, the feature map F 2.14 And the fusion feature map F 2.12 Add together to get the fusion feature map F 2.15 ; Step 2.15: fusion feature map F 2.15 A convolution layer with a convolution kernel size of 3×3 is used to reduce the aliasing effect of upsampling, and then a convolution layer with a convolution kernel size of 1×1 is used. After a normalized BN layer and SiLU activation function, the output feature map is F 2.16 , the dimensions are 14×14×1280; Step 2.16, feature map F 2.16 After an adaptive average pooling layer, a Dropout layer, a fully connected layer with an output dimension of 59, and a softmax activation function, the local classification result P is obtained. Local59 ; Step 2.17: The global classification result P obtained in step 2.10 is Global And the local classification result P Local59 The final classification result P of 59 categories is obtained by adding the average value. 59 ; The global classification result P Global The prediction results of disease subclasses are added according to plant species-disease-health, so that the dimension is converted from 59 to 36, and then combined with the local classification result P Local36 The final prediction results of 36 categories of plant species, diseases, and health are obtained by adding and averaging. 36 .

5. The crop disease image recognition method based on FCSA-EfficientNetV2 according to claim 3, It is characterized in that In the process of training the FCSA-EfficientNetV2 model, the batch size is 64, the number of iterations is set to 200, the SGD optimizer is used, the initial learning rate is 0.001, the momentum factor is 0.9, and the learning rate decay adopts the cosine annealing method.

6. The crop disease image recognition method based on FCSA-EfficientNetV2 according to claim 3, It is characterized in that The calculation process of the loss between the predicted value and the true value is: (1) The cross entropy function LBCE(y) with label smoothing represents the loss between the class prediction value and the actual value, as shown in formula (6): in: is the category prediction value, y is the true value corresponding to each category, for the correct class, y c 1, other types y c is 0, ε is the label smoothing parameter, and C is the number of disease categories; (2) Cost-sensitive regularization CS(y) term, which represents the product between the category prediction value and the cost-sensitive matrix, as shown in formula (7): in: is the category prediction value, y * is the index corresponding to the true value of 1, λ is the weighting factor, and M is the constructed cost-sensitive matrix; Construction of the cost-sensitive matrix M: In a disease, it is difficult to distinguish between the general disease degree and the severe disease degree, so the weight is increased to introduce different penalties for each prediction error; when predicting a healthy image of a certain plant, in the constructed cost-sensitive matrix, the weight of the correct prediction is 0, the weight corresponding to the general disease degree is 1, the weight corresponding to the severe disease degree is 2, the weight of the prediction of other diseases of the plant species is 3, and the weight of the prediction of other plant species is 4. This means that the farther the prediction distance from the true value is, the greater the weight. Therefore, for the prediction of 59 types of diseases, M is a two-dimensional matrix of size 59×59, with rows and columns corresponding to 59 types of diseases, M cj It represents the cost-sensitive weight for predicting category c as category j. When calculating formula (7), only the corresponding y in M ​​is calculated for the 59-category classification results. * Line and The scalar product of gets the regularization term; (3) Final loss function loss total As shown in formula (8):

7. The crop disease image recognition method based on FCSA-EfficientNetV2 according to claim 6, It is characterized in that The label smoothing parameter ε of the cross entropy with label smoothing is 0.1, and the weighting factor λ in the cost-sensitive regularization is 0.

5.

8. The crop disease image recognition method based on FCSA-EfficientNetV2 according to claim 3, It is characterized in that In the crop disease dataset, the disease category labels are 0-58, of which 0-5 are the types and degrees of apple diseases, 6-8 are the types and degrees of cherry diseases, 9-16 are the types and degrees of corn diseases, 17-23 are the types and degrees of grape diseases, 24-26 are the types and degrees of citrus diseases, 27-29 are the types and degrees of peach diseases, 30-32 are the types and degrees of pepper diseases, 33-37 are the types and degrees of potato diseases, 38-40 are the types and degrees of strawberry diseases, and 41-58 are the types and degrees of tomato diseases.

Citation Information

Patent Citations

  • Crop leaf disease identification method based on bilinear residual network model

    CN114067313A

  • CNN and transfer learning based disease intelligent identification method and system

    AU2020103613A4

  • Deep fake face data identification method

    CN113536990A