Strawberry disease and pest recognition method based on improved neural network and storage medium

By improving the neural network SE-CBAM-ResNet50 and combining CBAM and SENet modules, the problems of insufficient feature extraction and low classification accuracy of strawberry disease and pest identification models in complex environments have been solved, achieving higher identification accuracy and robustness, and making it suitable for a variety of complex planting scenarios.

CN116778472BActive Publication Date: 2025-11-04FOSHAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310400671.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2025-11-04
Estimated Expiration
2043-04-14

AI Technical Summary

Technical Problem

Existing strawberry pest and disease identification models are difficult to adapt to different scenarios in complex planting environments, resulting in poor identification performance, insufficient feature extraction, low classification accuracy, and difficulty in meeting practical needs.

Method used

An improved neural network, SE-CBAM-ResNet50, was used, combining the CBAM hybrid attention module and the SENet module to construct a strawberry disease and pest identification model. Image data was collected from the field and the network, preprocessed and augmented to build a rich disease and pest dataset. CBAM and SENet modules were introduced into the ResNet50 network for feature extraction and classification.

Benefits of technology

It improves the recognition accuracy and generalization ability of strawberry pest and disease images, enhances the robustness of the model, and is applicable to pest recognition in a variety of complex planting scenarios. It has good application prospects and high availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116778472B_ABST
    Figure CN116778472B_ABST
Patent Text Reader

Abstract

The application discloses a strawberry disease and pest identification method based on an improved neural network and a storage medium, and the method comprises the following steps: acquiring and preprocessing a strawberry disease and pest image, and constructing a data set; taking ResNet50 as a backbone network, adding CBAM modules and SENet modules connected in sequence at the end of each residual block in the backbone network, and constructing an improved neural network; training the network by using the data set to obtain an identification model; and identifying and classifying the disease and pest area of a to-be-identified strawberry image by using the identification model. The CBAM module and the SENet module are combined and introduced into the ResNet50 network, the CBAM attention module is used to extract comprehensive features, the features are transmitted to the SENet module to extract disease and pest detail feature information, the extraction of key features of the strawberry disease and pest is realized, the identification accuracy, the generalization ability and the robustness of the disease and pest identification model are improved, and the application has high usability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of pest identification, and particularly relates to a strawberry pest identification method based on an improved neural network and a storage medium. BACKGROUND

[0002] Strawberries are very susceptible to pests and diseases during cultivation, and the pests and diseases can spread rapidly, causing great economic losses to fruit farmers. In the traditional cultivation process, the prevention and control of pests and diseases is usually completed by the experience of fruit farmers. With the development of deep learning technology, domestic and foreign scholars have begun to use deep learning technology to realize the automatic identification of strawberry pests and diseases. The core idea of this method is to analyze the leaf images of crops, use machine learning, deep learning and other means to realize accurate identification of pest and disease types.

[0003] However, the strawberry planting environment is often very complex, and the planting environment is variable. Most of the existing strawberry pest and disease identification models are based on laboratory scenarios or the identification of pests and diseases in a certain planting area environment. The model has a high difficulty in migrating and identifying other scenes, and has a low accuracy. It is difficult for the model to adapt to different scenes, especially complex field planting scenes. At the same time, in a complex planting environment, it is difficult to collect strawberry pest and disease images, and the collected images have problems such as large interference and small pest and disease feature area. This causes the existing strawberry pest and disease identification model to be unable to extract more effective features from the images, resulting in poor recognition effect of the model on the pest and disease area of the strawberry, and the classification accuracy of the pest and disease area is difficult to meet the actual use requirements, and the performance of the model needs to be further improved. SUMMARY

[0004] The purpose of the present application is to provide a strawberry pest and disease identification method based on an improved neural network and a storage medium to solve one or more technical problems existing in the prior art, and at least provide a beneficial choice or create conditions.

[0005] The solution to the technical problem of the present application is: in a first aspect, the present application provides a strawberry pest and disease identification method based on an improved neural network, comprising the following steps:

[0006] Obtain a plurality of strawberry pest and disease images and preprocess the plurality of strawberry pest and disease images to construct a strawberry pest and disease dataset;

[0007] Take ResNet50 as the backbone network, add CBAM modules and SENet modules connected in sequence at the end of each residual block in the original ResNet50, and construct an improved neural network;

[0008] Train the improved neural network using the strawberry pest and disease dataset to generate a strawberry pest and disease identification model;

[0009] Collect a to-be-identified strawberry image, the to-be-identified strawberry image contains at least one pest area, and the strawberry pest identification model is used for identification and classification of the pest area of the to-be-identified strawberry image, and a classification result of the pest area is obtained.

[0010] The improved neural network comprises a convolutional input layer, four improved residual layers and a classification layer connected in sequence, a plurality of Bottleneck residual blocks, an nth CBAM module and an nth SEnet module are sequentially arranged in the nth improved residual layer, ; wherein:

[0011] The convolutional input layer is used for adjusting the size of the to-be-identified strawberry image and performing down-sampling operation on the channel number thereof to generate a to-be-processed feature map.

[0012] The nth improved residual layer is used for extracting features from the (n-1)th feature map through the CBAM attention mechanism to generate an nth attention feature map, and performing squeezing, activation and weighting operations on the nth attention feature map to output an nth feature map; wherein when n=1, the (n-1)th feature map is the to-be-processed feature map; when n=4, the nth feature map is a to-be-classified feature map.

[0013] The classification layer is used for calculating the maximum probability of the category to which the pest area belongs according to the to-be-classified feature map, and outputting the classification result of the pest area according to the maximum probability.

[0014] In a second aspect, the present application provides a storage medium having processor-executable instructions stored therein, the processor-executable instructions being used for executing the strawberry pest identification method based on the improved neural network when executed by the processor.

[0015] The present application has the following beneficial effects: the strawberry pest identification method based on the improved neural network and the storage medium are provided, the CBAM mixed attention module and the SEnet module are combined and introduced into the ResNet50 network to construct the improved neural network SE-CBAM-ResNet50, and the improved neural network is used to realize identification and classification of the pest area of the strawberry. The present application uses the CBAM module to extract comprehensive features, the SEnet module re-extracts the features extracted by the CBAM module for pest details feature information, and then extracts the key features of the strawberry pest; and without affecting the operation rate of the model, the present application can effectively reduce the model parameters, while enhancing the feature extraction and selection capability of the network, significantly improving the identification accuracy, generalization capability and robustness of the strawberry pest image model; the present application is suitable for pest identification of different plant species in various complex planting scenes, and has good application prospect and high usability.

[0016] Other features and advantages of the present application will be set forth in the following specification, and in part will be apparent from the description, or can be learned by practice of the application. The objects and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings. BRIEF DESCRIPTION OF DRAWINGS

[0017] Figure 1 A flowchart of the improved neural network-based strawberry disease and pest recognition method provided in the present application is provided;

[0018] Figure 2 A structural diagram of the residual network ResNet50 provided in the present application is provided;

[0019] Figure 3 A structural diagram of the improved neural network SE-CBAM-ResNet50 provided in the present application is provided;

[0020] Figure 4 A structural diagram of the second to fifth layer architecture of the improved neural network provided in the present application is provided;

[0021] Figure 5 A structural diagram of the n SE-CBAM module in the improved neural network provided in the present application is provided;

[0022] Figure 6A An example diagram of strawberry disease and pest images with the category of healthy, whitefly, viral disease, and freeze damage provided in the present application is provided;

[0023] Figure 6B An example diagram of strawberry disease and pest images with the category of leather rot, root rot, yellow wilt, and gray mold provided in the present application is provided;

[0024] Figure 6C An example diagram of strawberry disease and pest images with the category of nutrient deficiency, cabbage moth, leaf spot, poor coloring, and leaf blight provided in the present application is provided;

[0025] Figure 7 A comparison diagram of the model accuracy rate of SE-CBAM-ResNet50, SE-CBAM-VGG19, and SE-CBAM-AlexNet provided in the present application is provided;

[0026] Figure 8 A comparison diagram of the model macro-F1 value of SE-CBAM-ResNet50, SE-CBAM-VGG19, and SE-CBAM-AlexNet provided in the present application is provided;

[0027] Figure 9A model loss function comparison diagram of SE-CBAM-ResNet50, SE-CBAM-VGG19 and SE-CBAM-AlexNet provided for the present application;

[0028] Figure 10 An attention feature heat map of the last convolutional layer of the ResNet50 network, the CBAM-ResNet50 network and the SE-CBAM-ResNet50 provided for the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application is further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application.

[0030] The present application is further described below in combination with the drawings and specific examples of the present application. The described examples should not be considered as limiting the present application, and all other examples obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present application.

[0031] In the following description, "some embodiments" are described, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0032] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0033] In terms of planting, strawberries are artificially hybridized fruits, and the natural environment has a greater impact on them, so most strawberries are currently planted in greenhouses. However, whether planted outdoors or in greenhouses, strawberry plants and fruits are more prone to damage, disease and insect pests. In the traditional planting process, the prevention and control of diseases and insect pests is usually completed by the experience of fruit farmers. With the development of deep learning, deep learning networks such as ResNet50 network, MobileNet network and VGG-16 network are introduced into the classification task of strawberry diseases and insect pests. Deep learning networks can quickly and accurately find the strawberry disease and insect pest area and complete the identification and classification of disease and insect pest species.

[0034] However, the strawberry planting environment is often very complex, and the planting environment is variable. Most of the existing strawberry pest and disease identification models are based on laboratory scenarios or pest and disease identification for a certain planting environment. The model has high difficulty in migrating and identifying other scenes, and low accuracy. It is difficult for the model to adapt to different scenes, especially complex field planting scenes. At the same time, under the complex planting environment, it is difficult to collect strawberry pest and disease images, and the collected images have problems such as large interference and small pest and disease feature area. This causes the existing strawberry pest and disease identification model to be unable to extract more effective features from the image, so that the model has poor recognition effect on the pest and disease area of the strawberry, and the classification accuracy of the pest and disease area is difficult to meet the actual use demand, and the model performance needs to be further improved.

[0035] In order to further improve the accuracy and effect of the strawberry pest and disease area classification, the application proposes an improved neural network model SE-CBAM-ResNet50 with ResNet50 as the backbone network, combined with CBAM (Convolutional block attention module, mixed attention mechanism) and SE (Squeeze-and-Excitation) Net, applied to the identification and classification task of the pest and disease area of the strawberry. In addition, the application also proposes a strawberry pest and disease identification method and storage medium based on SE-CBAM-ResNet50. By constructing the improved neural network SE-CBAM-ResNet50 and training it using the strawberry pest and disease dataset, an identification model for identifying strawberry pests and diseases is obtained, and the identification and classification of the pest and disease area of the strawberry image are realized through the identification model. Referring to Figure 1 , Figure 1 The flowchart of the strawberry pest and disease identification method provided by the embodiment of the application. An embodiment of the application will be described and explained below. The strawberry pest and disease identification method can include but is not limited to the following steps.

[0036] S101, obtaining a plurality of strawberry pest and disease images and preprocessing the plurality of strawberry pest and disease images to construct a strawberry pest and disease dataset;

[0037] S102, taking ResNet50 as the backbone network, adding CBAM module and SENet module connected in sequence at the end of each residual block in the original ResNet50 to construct an improved neural network.

[0038] This step improves the network structure based on the ResNet50 network to obtain an improved neural network. Referring to Figure 2Structure diagram of the shown ResNet50 network. The ResNet50 network structure is composed of 49 main convolutional layers and 1 fully connected layer. According to the internal structure of the network, the internal structure of the entire ResNet50 network can be divided into six stages: the first stage includes normalization processing (Zero Padding) and Stage1, Stage0 is mainly composed of convolutional layers (CONV), batch processing layers (BN), activation function layers (ReLU) and maximum pooling layers (Max Pooling), and the purpose is to complete the preprocessing of the input image. The second to fifth stages correspond to Stage2 to Stage5, which are mainly residual operations, composed of four residual stages, and each residual stage is based on a Bottleneck residual block. Among them, the Bottleneck residual block is the same as the Indentity Block block in the ResNet50 network. The sixth stage corresponds to Stage6, which is the classification stage, mainly composed of average pooling layers (AvgPooling), fully connected layers (Fully Connected Layer, FC). The sixth stage is mainly used to complete the classification according to the output of the last residual stage.

[0039] S103, training the improved neural network using the strawberry disease and pest data set to generate a strawberry disease and pest recognition model;

[0040] S104, collecting a to-be-recognized strawberry image, and using the strawberry disease and pest recognition model to recognize and classify the disease and pest area of the to-be-recognized strawberry image to obtain a classification result of the disease and pest area.

[0041] It should be noted that the to-be-recognized strawberry image contains at least one disease and pest area.

[0042] The present application combines the CBAM mixed attention module with the SENet module and introduces it into the ResNet50 network, uses the CBAM module to extract more comprehensive features, transmits them to the SENet module to extract disease and pest detail feature information, realizes the extraction of key features of strawberry diseases and pests, and reduces the model parameters without affecting the operation rate of the model, enhances the feature extraction and selection ability of the network, and further improves the recognition accuracy, generalization ability and robustness of the strawberry disease and pest image model. The present application is suitable for pest identification in various complex planting scenes, has good application prospect and high usability.

[0043] One embodiment of the present application will be further described and explained below. Step S101 mainly includes two aspects: data acquisition and data processing. Among them, data acquisition is realized by step S1010, and data processing is completed by S1011-S1014. Step S101 can include but is not limited to the following steps.

[0044] S1010, acquire strawberry disease and pest images through field collection and network collection.

[0045] In this step, in order to better industrialize the model and improve the recognition accuracy, robustness and generalization ability of the strawberry disease and pest recognition model in complex planting scenes, the present application acquires different strawberry disease and pest images through field collection and network collection. The data set obtained through field collection is fused with the data set obtained through network collection, so that the strawberry disease and pest data set is more abundant, thereby achieving the effect of improving the robustness and generalization ability of the model.

[0046] Among them, due to the differences in region, time, different growth stages of strawberries, diseases and pests, climate and other factors, it is difficult to collect diverse strawberry disease and pest images, which will lead to problems such as insufficient quantity and single sample of the disease and pest data set. In order to enrich the data set, the present application supplements data collection through network collection to improve the diversity and sample quantity of the strawberry disease and pest images.

[0047] After completing image collection, the collected several strawberry disease and pest images need to be preprocessed, and then a strawberry disease and pest data set is constructed. The preprocessing steps can include but are not limited to the following steps.

[0048] S1011, data cleaning is performed on the strawberry disease and pest images.

[0049] Optionally, the data cleaning method includes deleting images that meet the conditions in the several strawberry disease and pest images. The images that meet the conditions can include but are not limited to images with repeated content, images with damaged format, images without strawberries, images with low resolution, images with small disease and pest areas or strawberry areas, and images with multiple disease types.

[0050] S1012, class labeling processing of diseases and pests in the disease and pest area of the strawberry disease and pest image is performed to obtain a class label corresponding to the disease and pest area.

[0051] It should be noted that the class of diseases and pests includes at least one of healthy, whitefly, viral disease, frost damage, rot disease, root rot disease, yellow wilt disease, gray mold disease, deficiency symptom, looper, leaf spot disease, poor coloring and leaf blight.

[0052] S1013, data augmentation is performed on the strawberry disease and pest images by using a data enhancement method.

[0053] In this step, due to the reasons of data collection and classification, part of the pest data in the strawberry pest data sample is relatively small, and the sample data distribution is uneven. This will cause the trained model to have weight bias, and the weight of the sample with more quantity may be higher, which will affect the pest type with less sample data, and the recognition accuracy of the model may be reduced. Therefore, the sample data also needs to be expanded so that the number of each type of pest is roughly the same. Optionally, the data enhancement method includes one or more of adding Gaussian noise, cutting, random translation scaling, randomly changing image brightness, horizontal flipping, hue adjustment, motion blur, random cropping, and vertical flipping.

[0054] S1014, the strawberry pest image is standardized to keep the resolution of all strawberry pest images consistent, so that the resolution of all strawberry pest images is .

[0055] Referring to Figure 3 , Figure 3 The structure of the improved neural network provided by the embodiment of the application is shown. In one embodiment of the application, the structure and function of the improved neural network will be described and explained below.

[0056] The improved neural network SE-CBAM-ResNet50 has a six-layer architecture, which includes a convolutional input layer, four improved residual layers, and a classification layer connected in sequence. Among them:

[0057] As shown in Figure 3 , the normalization processing (Zero Padding) and Stage1 are the first layer architecture, which corresponds to the first stage of the original ResNet50 network. The first layer architecture is a convolutional input layer, which adjusts the size of the strawberry image to be identified and performs down-sampling operation on the channel number of the strawberry image to be identified to generate a feature map to be processed.

[0058] As shown in Figure 3 , Stage2 to Stage5 are the second to fifth layer architectures, which correspond to the second to fifth stages of the original ResNet50 network, but have improvements, so the second to fifth layer architectures are all improved residual layers. Among them, the nth improved residual layer is sequentially provided with a plurality of Bottleneck residual blocks, an nth CBAM module and an nth SE module, n=1, 2, 3, 4. The function of the nth improved residual layer is to extract features from the (n-1)th feature map through the CBAM attention mechanism to generate the nth attention feature map, and to perform squeezing, activation and weighting operations on the nth attention feature map to output the nth feature map.

[0059] It should be noted that when n = 1, the (n-1)th feature map, i.e., the 0th feature map, is the to-be-processed feature map. When n = 4, the nth feature map, i.e., the 4th feature map, is the to-be-classified feature map.

[0060] As shown in Stage 6 in FIG. 6, the sixth layer architecture is shown. The sixth layer architecture corresponds to the sixth stage of the original ResNet50 network. The sixth layer architecture is a classification layer, which functions to: according to the to-be-classified feature map, calculate the maximum probability of the category to which the pest and disease region belongs, and output the classification result of the pest and disease region in the to-be-identified strawberry image according to the maximum probability. Figure 3

[0061] In this embodiment, the image input into the improved neural network is input into the second layer architecture after a series of operations such as convolution, normalization, activation, and pooling of the first layer architecture. Operations and processing in the residual block are performed in the second layer architecture to the fifth layer architecture. Finally, the fifth layer architecture outputs the feature map to the sixth layer architecture, which performs the last dimension processing and classification on the output, and thus obtains the classification result.

[0062] The composition and functions of the six-layer architecture of SE-CBAM-ResNet50 are described below:

[0063] The first layer architecture: the convolution input layer includes a first convolution layer (CONV1), a batch processing layer (BN), a ReLU layer (ReLU), and a first pooling layer (Max Pooling1) connected in sequence. The to-be-identified strawberry image is normalized and then input into the first convolution layer. Among them:

[0064] The function of the first convolution layer is to perform convolution calculation on the normalized to-be-identified strawberry image to generate an initial feature map.

[0065] Optionally, the convolution kernel of the first convolution layer is The function of the convolution kernel with a size of is to expand the receptive field and retain as much feature information of the input image as possible.

[0066] The function of the batch processing layer is to perform batch processing on the initial feature map.

[0067] The function of the ReLU layer is to perform activation operation on the batch-processed initial feature map through the ReLU activation function. The ReLU activation function can solve the problem of gradient disappearance to some extent and accelerate the convergence speed of the model.

[0068] The first pooling layer is a maximum pooling layer, which functions to perform down-sampling on the initial feature map after the activation operation based on the maximum pooling manner to generate a to-be-processed feature map.

[0069] ​It should be noted that the pooling layer usually has two operation modes: maximum pooling and average pooling. Among them, the maximum pooling takes the maximum value in each pooling window, and the average pooling takes the average value in each pooling window. In addition, when performing the pooling operation, the size of the pooling window and the size of the step are usually set, and the two parameters can determine the size of the feature map after the pooling.

[0070] The pooling layer can positively affect the performance of the convolutional neural network in many aspects. First, it can reduce the parameters and computational complexity of the model, effectively reduce the model complexity, and effectively suppress the model overfitting. The pooling operation reduces the size of the feature map by downsampling, so that the model has certain translation invariance and partial invariance, thereby improving the generalization performance of the model. In addition, the pooling layer can also reduce the size of the input feature map, making the subsequent layer calculation more efficient. Optionally, the size of the first pooling layer is .

[0071] The second layer architecture to the fifth layer architecture: refer to Figure 4 , Figure 4 The four-layer improved residual layer provided by the embodiments of the present application is shown in the schematic diagram, and the four-layer improved residual layer corresponds to the second layer architecture to the fifth layer architecture of the improved neural network.

[0072] The second layer architecture, that is, the first layer improved residual layer, includes three Bottleneck residual blocks, a first CBAM module and a first SENet module connected in sequence. It should be noted that the three Bottleneck residual blocks are also connected in sequence. In this layer architecture, the functions of each module are as follows: the first CBAM module is used to extract the channel and spatial information of the to-be-processed feature map, and outputs a first attention feature map to the first SENet module. The function of the first SENet module is to perform squeezing, activation and weighting operations on the first attention feature map, and output a first feature map to the third layer architecture.

[0073] The third layer architecture, that is, the second layer improved residual layer, includes four Bottleneck residual blocks, a second CBAM module and a second SENet module connected in sequence. It should be noted that the four Bottleneck residual blocks are also connected in sequence. In this layer architecture, the functions of each module are as follows: the second CBAM module is used to extract the channel and spatial information of the first feature map, and outputs a second attention feature map to the second SENet module. The function of the second SENet module is to perform squeezing, activation and weighting operations on the second attention feature map, and output a second feature map to the fourth layer architecture.

[0074] The fourth layer architecture, i.e., the third improved residual layer, includes six Bottleneck residual blocks connected in sequence, a third CBAM module and a third SE-Net module. It should be noted that the six Bottleneck residual blocks are also connected in sequence. In this layer architecture, the functions of each module are as follows: the third CBAM module is used for feature extraction of the channel and spatial information of the second feature map, and outputs a third attention feature map to the third SE-Net module. The third SE-Net module is used for squeezing, activating and weighting operations on the third attention feature map, and outputs a third feature map to the fifth layer architecture;

[0075] The fifth layer architecture, i.e., the fourth improved residual layer, includes three Bottleneck residual blocks connected in sequence, a fourth CBAM module and a fourth SE-Net module. It should be noted that the three Bottleneck residual blocks are also connected in sequence. In this layer architecture, the functions of each module are as follows: the fourth CBAM module is used for feature extraction of the channel and spatial information of the third feature map, and outputs a fourth attention feature map to the fourth SE-Net module. The fourth SE-Net module is used for squeezing, activating and weighting operations on the fourth attention feature map, and outputs a feature map to be classified to the sixth layer architecture, i.e., the classification layer.

[0076] The sixth layer architecture, i.e., the classification layer, includes a second pooling layer, a first full connection layer and a Softmax layer connected in sequence. Among them:

[0077] The second pooling layer is an average pooling layer, and is used for downsampling the feature map to be classified based on an average pooling manner.

[0078] The first full connection layer is used for flattening the downsampling feature map to be classified into a one-dimensional vector, and converting the one-dimensional vector into a number of categories and label values corresponding to the disease and pest area.

[0079] It should be noted that generally, the full connection layer is usually arranged at the end of the network, and two or more full connection layers are usually combined. The first layer receives the features extracted by the convolutional layer and the pooling layer, and then combines these features and maps them to the sample space through the softmax classification, so as to generate the final output.

[0080] The Softmax layer is used for calculating the maximum probability of the category to which the disease and pest area belongs according to the number of categories and label values corresponding to the disease and pest area, and outputting the classification result of the disease and pest area in the strawberry image to be recognized according to the maximum probability.

[0081] Optionally, the maximum probability is in the range of [0, 1].

[0082] Based on the above embodiment, the existing ResNet50 residual network has the problems of inaccurate feature recognition, large feature extraction range, large recognition error and the like, and its performance in the classification task of the strawberry disease and pest area is poor. In order to optimize the existing ResNet50 network, the application introduces a corresponding SE-CBAM module at the end of the residual block in the second layer to the fifth layer architecture of the original ResNet50 network, in order to improve the feature recognition accuracy of the existing network. Referring to Figure 5 , Figure 5 The structure diagram of the nth SE-CBAM module provided by the embodiment of the application is shown in FIGS. 1 to 3. The SE-CBAM module is composed of a CBAM module and an SENet module connected in sequence. The inventive concept of the SE-CBAM module will be described below.

[0083] In the art, the CBAM module is a module based on a hybrid attention mechanism, which combines a channel attention mechanism (CAM) as a front channel and a spatial attention mechanism (SAM) as a rear channel to realize weighting of channel and spatial information of an image, thereby obtaining more accurate feature representation.

[0084] The SENet module mainly builds the dependency relationship between channels through an SE block (Squeeze-and-Excitation Block), calculates the weight for each channel, and learns the feature weight according to the loss, that is, the most important features of the input data can be perceived according to the weight. The SENet module can further focus on the key features of the feature map by learning the feature relationship between channels, calculate the importance of each channel, and assign different weights according to the feature importance to improve the accuracy of the recognition model in identifying key feature information. Moreover, the SENet module can make the model more focused and reduce the parameter amount.

[0085] In the application, since the strawberry leaves, strawberry fruits and picture backgrounds in the strawberry image are irregular and have small features, the feature learning of the strawberry disease and pest features needs to be maintained during feature extraction, and more comprehensive channel features need to be retained as much as possible to reduce the probability of misjudgment. In this regard, the application first introduces a CBAM module with a channel attention mechanism and a spatial attention mechanism in the original ResNet50 network, and combines the CBAM module with the end convolution block of the Bottleneck in the ResNet50 residual block, to improve the extraction effect of the complex features of the strawberry disease and pest.

[0086] Although the ResNet50 with the CBAM module can complete more comprehensive feature extraction, it is still difficult to focus on the smaller features in strawberry diseases and pests. To solve this problem, the SENet network module more suitable for detail feature extraction is connected after the CBAM module in the ResNet50. The CBAM-ResNet50 refined feature map is taken as the basis, and the SENet is introduced to perform secondary feature extraction on the refined feature map, so as to solve the problems of small disease and pest feature regions and difficult disease and pest feature extraction of strawberry diseases and pests in complex planting environments.

[0087] In the present application, since the strawberry disease and pest features in the complex background are relatively not obvious, the original features as a whole need to be extracted first, and more effective features are retained as much as possible. Therefore, after introducing the CBAM hybrid attention module into the ResNet50 backbone network, the input feature map can be extracted from the channel aspect and the spatial aspect. Specifically, the channel aspect first processes the allocation relationship between the feature map channels; then, the attention focusing is performed again in the spatial aspect, the disease and pest features are extracted, and the attention to the disease and pest feature regions is increased. However, there are still some irrelevant information in the feature map, so it is necessary to further focus and locate the disease and pest features. The SENet module is introduced to further process the feature map refined by the CBAM module, refocus the features, capture more disease and pest feature channels, enhance the disease and pest feature information, and reduce the feature information of irrelevant information.

[0088] The present application combines the CBAM module and the SENet module and introduces them into the ResNet50 network, realizes the extraction of the key features of the strawberry diseases and pests, reduces the model parameters without affecting the operation rate of the model, enhances the feature extraction and selection ability of the network, and further improves the recognition accuracy of the strawberry disease and pest image data and the generalization ability of the model.

[0089] Please refer to Figure 5 In an embodiment of the present application, the composition and function of the CBAM module will be described and explained below. The nth CBAM module includes a nth channel attention module (i.e. CAM module) and a nth spatial attention module (i.e. SAM module) connected in sequence, n = 1, 2, 3, 4.

[0090] Firstly, the CAM module is described. In the present application, the function of the nth CAM module is to extract and map the spatial features of the (n-1)th feature map, obtain the channel weight parameters of the (n-1)th feature map, and multiply the channel weight parameters of the (n-1)th feature map with the (n-1)th feature map to generate the nth channel feature map.

[0091] It should be noted that the output of the nth CAM module, i.e., the nth channel feature map, satisfies the following formula:

[0092]

[0093] wherein, denotes the nth channel feature map, and also denotes the output of the nth channel attention module; denotes the (n-1)th feature map, denotes the channel weight parameter of the (n-1)th feature map, denotes a multiplication operation.

[0094] It should be noted that the channel weight parameter of the (n-1)th feature map satisfies the following formula:

[0095]

[0096]

[0097] wherein, denotes a Sigmoid activation function, denotes a average pooling operation, denotes a max pooling operation, and MLP denotes a multi-layer perceptron, denotes the weight of a fully connected layer in the MLP, denotes the weight of an output layer in the MLP; denotes a feature map obtained by performing an average pooling operation on the (n-1)th feature map, denotes a feature map obtained by performing a max pooling operation on the (n-1)th feature map.

[0098] Further, the nth CAM module includes a nth concatenation pooling structure, a nth MLP layer and a nth multiplier connected in sequence. The nth concatenation pooling structure is composed of a max pooling layer and an average pooling layer in concatenation. Wherein:

[0099] The function of the nth concatenation pooling structure is to respectively perform spatial feature mapping on the (n-1)th feature map by average pooling and max pooling. The spatial mapping can be understood as compressing the feature map in its space to obtain two feature descriptors of the (n-1)th feature map. The MLP refers to a multi-layer perceptron. The function of the nth MLP layer is to perform summation and activation operations on the two feature descriptors to generate the channel weight parameter of the (n-1)th feature map. The function of the nth multiplier is to multiply the channel weight parameter of the (n-1)th feature map with the (n-1)th feature map to generate the nth channel feature map.

[0100] In the embodiment, the input size is defined as the feature map Since any channel of the feature map can be regarded as a feature detector, the channel attention can be calculated by using the relationship between the feature channels. To effectively calculate the channel attention, in a single CAM module, the input feature map is first compressed in space by average pooling operation and max pooling operation respectively, to generate two feature descriptors and and . Then, and are transmitted to a perceiver (MLP) with shared weights and only one hidden layer. The features between the weights and in the MLP need to be activated using the ReLU function. After the summation and activation operation by the MLP, and by mapping it to between 0 and 1 through the Sigmoid activation function, the final weight parameter, i.e. the channel weight parameter is generated. Finally, the channel weight parameter and the feature map are multiplied by the multiplier to obtain the feature map refined by the CAM module.

[0101] Then the SAM module is described. The function of the nth SAM module is to extract and map the channel features of the nth channel feature map to obtain the spatial weight parameter of the nth channel feature map, and multiply the spatial weight parameter of the nth channel feature map with the nth channel feature map to obtain the nth attention feature map.

[0102] It should be noted that the output of the nth SAM module, i.e. the nth attention feature map, satisfies the following formula:

[0103]

[0104] wherein, denotes the nth attention feature map, i.e. the output of the nth spatial attention module, denotes the spatial weight parameter of the nth channel feature map, denotes the nth channel feature map;

[0105] It should be noted that the spatial weight parameter of the nth channel feature map satisfies:

[0106]

[0107]

[0108] wherein, denotes the Sigmoid activation function, denotes a convolution kernel size 7 convolution operation, denotes a feature map obtained by averaging pooling the nth channel feature map, denotes a feature map obtained by maximum pooling the nth channel feature map.

[0109] Further, the nth SAM module comprises: an nth serial pooling structure, an nth convolution calculation layer and an nth sub-multiplier connected in sequence, and the nth serial pooling structure is composed of a maximum pooling layer and an average pooling layer connected in sequence. Wherein:

[0110] The function of the nth serial pooling structure is to sequentially map the channel features of the nth channel feature map by maximum pooling and average pooling, to obtain two feature descriptors of the nth channel feature map, and to splice the two feature descriptors. The function of the nth convolution calculation layer is to perform convolution dimension reduction operation on the feature obtained after splicing, and to activate it by Sigmoid activation function to generate the nth spatial weight parameter. The convolution kernel of the nth convolution calculation layer is 7x7. The function of the nth sub-multiplier is to multiply the nth spatial weight parameter with the nth channel feature map to obtain the nth attention feature map.

[0111] In the specific embodiment, the SAM module is a supplement to the CAM module. It should be noted that the feature map input into the SAM module is obtained by element-wise multiplication of the channel weight parameter and the feature map input into the CAM module. In a single SAM module, first, the channel feature map is subjected to maximum pooling operation and average pooling operation along the channel dimension to obtain two feature maps and with a size of , then the two are spliced to generate a feature with a size of . Then, 7x7 convolution operation is performed, which not only expands the receptive field of the feature map, but also reduces the dimension of the feature map to . The feature map is input into the Sigmoid activation function, which is mapped to between 0 and 1, and then the spatial weight parameter is obtained. Finally, the spatial weight parameter is multiplied with the channel feature map to obtain the feature map after the SAM module is strengthened .

[0112] Please refer to Figure 5In the SENet module, the most important three parts are: squeeze operation, excitation operation, and weighting operation. In an embodiment of the present application, the squeeze, excitation, and weighting operations performed by the SE (Squeeze-and-Excitation) Net module will be described and explained below. In the nthSENet module, there are:

[0113] The size of the nth attention feature map is defined as , that is, . Wherein: H' is the height of , W' is the width of , and C' is the number of channels of . The standard convolution conversion operation is performed on .

[0114] In this step, the standard convolution conversion operation belongs to the front-end processing of the SENet, which is used for feature conversion output. Specifically, the feature map with a channel number of C', a height of H', and a width of W' is converted into a new feature map U with a size of by a column of convolution operations. See the following convolution operation formula:

[0115]

[0116] Wherein: , .

[0117] Wherein, represents the nth attention feature map, represents the standard convolution conversion operation, U represents the output of the standard convolution conversion operation, H, W, and C represent the height, width, and channel number of the nth attention feature map after the standard convolution conversion operation, respectively.

[0118] Then, the squeeze operation is performed on the nth attention feature map after the standard convolution conversion operation.

[0119] In this step, the squeeze operation refers to the compression operation along the spatial dimension on the feature map U with a size of after the conversion, that is, using the function to accumulate and then average each channel feature value of the feature map, thereby obtaining a vector output of , that is, the numerical distribution of the C channels can be obtained. The squeeze operation can compress the two-dimensional channel into a real number, and the dimension number of the output also corresponds to the number of channels of the input, so that the global receptive field can also be obtained near the input layer. ​​

[0120] It should be noted that the output of the squeezing operation satisfies:

[0121]

[0122] wherein:

[0123] wherein, denotes the output of the squeezing operation, ; denotes the component on the c-th channel; denotes the squeezing operation, denotes the feature information of the feature map U on the c-th channel, and the size of ; denotes the value at the position .

[0124] After the squeezing operation, the n-th attention feature map is subjected to an activation operation.

[0125] It should be noted that the output of the activation operation satisfies:

[0126]

[0127] wherein, denotes the output of the activation operation, denotes the activation operation, denotes a Sigmoid activation function, denotes a ReLU activation function; , , denotes the component on the c-th channel.

[0128] In this step, the activation operation refers to adaptively learning the weight of each channel so that the channel with more important features obtains more weight, thereby improving the performance of the network. The activation operation enables each feature channel to have a weight value through a parameter W, and the parameter W is used to identify the connectivity between the feature channels. Specifically, after multiplying by , a vector with a dimension of is obtained, wherein the dimension reduction coefficient r is a hyperparameter, and then input to the ReLU layer for calculation to obtain . After multiplying by with a size of , the output is obtained, which is mapped to 0 to 1 through the activation function Sigmoid to obtain the core of the SENet module, i.e., the self-learning weight of the feature map .

[0129] Finally, the nth attention feature map after the activation operation is weighted to obtain the nth feature map.

[0130] In this step, the self-learning weight is calculated and used as the input of the weighting operation to adjust the feature weight of the input on the corresponding channel, excite the core feature, suppress the interference feature, and realize the reweighting of the original feature. Specifically, the weighting operation is to multiply the self-learning weight and the image on the C channels in turn to obtain the output.

[0131] It should be noted that the output of the weighting operation satisfies:

[0132]

[0133] wherein:

[0134] wherein, represents the output of the weighting operation, i.e., the nth feature map; represents the weighting operation, represents the feature information on the channel c, and the size of .

[0135] Based on the above embodiment, please refer to Figure 3 again, and the data flow of the improved neural network SE-CBAM-ResNet50 will be described below taking the classification task of the strawberry pest and disease area as an example. Before inputting the to-be-identified strawberry image into the strawberry pest and disease identification model, the to-be-identified strawberry image needs to be preprocessed to transform the resolution of the image to . The to-be-identified strawberry image is input into the first layer architecture, i.e., the convolution input layer. After the convolution processing, batch processing, activation, maximum pooling, etc. in the first layer architecture, the to-be-processed feature map is generated and input into the second layer architecture, i.e., the first improved residual layer.

[0136] In the first improved residual layer, the to-be-processed feature map with a size of is output by the 3 Bottleneck blocks to obtain the to-be-processed feature map with a size of . The to-be-processed feature map is input into the first CBAM module. The first CAM module and the first SAM module in the first CBAM module perform feature extraction on the to-be-processed feature map , and the first CBAM module outputs the first attention feature map . Then, the first attention feature map The original dimension is kept and input into the first SE-Net module for feature map refinement to obtain a first feature map and output to the second layer improved residual layer.

[0137] In the second layer improved residual layer, the first feature map is output after four Bottleneck block convolutions, and the size of the first feature map is transformed to the second CBAM module. The second CAM module and the second SAM module in the second CBAM module perform feature extraction on the first feature map , and the second CBAM module outputs a second attention feature map . Then, the second attention feature map is input into the second SE-Net module with the original dimension kept for feature map refinement to obtain a second feature map with a size of and output to the third layer improved residual layer.

[0138] In the third layer improved residual layer, the second feature map is output after six Bottleneck block convolutions, and the size of the second feature map is transformed to the third CBAM module. The third SAM module and the third CAM module in the third CBAM module perform feature extraction on the second feature map , and the third CBAM module outputs a third attention feature map . Then, the third attention feature map is input into the third SE-Net module with the original dimension kept for feature map refinement to obtain a third feature map with a size of and output to the fourth layer improved residual layer.

[0139] In the fourth layer improved residual layer, the third feature map is output after three Bottleneck block convolutions, and the size of the third feature map is transformed to the fourth CBAM module. The fourth SAM module and the fourth CAM module in the fourth CBAM module perform feature extraction on the third feature map , and the fourth CBAM module outputs a fourth attention feature map . Then, the fourth attention feature map is input into the fourth SE-Net module with the original dimension kept for feature map refinement to obtain a fourth feature map with a size of The feature map to be classified is output to the sixth layer architecture, i.e., the classification layer. Finally, in the classification layer, through the pooling layer and the fully connected layer, and through the mapping of the Softmax activation function, the recognition and classification of the strawberry disease and pest area are realized.

[0140] Based on the above embodiments, in order to better train and verify the SE-CBAM-ResNet50 of the present application, the effectiveness and stability of the SE-CBAM-ResNet50 of the present application are further proved by the following two embodiments. Before describing the embodiments, first define the evaluation parameters and the data set used for training and verification.

[0141] For the SE-CBAM-ResNet50 trained, among the commonly used related measurement evaluation parameters in the field, the present application selects the accuracy (Accuracy), the cross entropy loss function (Cross Entropy Loss) and the macro-F1 value (macro-F1 score) to evaluate the performance of the SE-CBAM-ResNet50.

[0142] The data set is completed by the data acquisition and data preprocessing of step 101. Specifically, the strawberry disease and pest image is collected by the field collection method and the network collection method, and the image is cleaned, enhanced, normalized and the like, and then the strawberry disease and pest data set is constructed. In this specific embodiment, after the processing of step 101, the finally constructed strawberry disease and pest data set includes 13 kinds of strawberry disease and pest images, 12950. The 13 categories include: the categories of disease and pest include healthy, whitefly, viral disease, freeze injury, soft rot, root rot, yellow wilt, gray mold, deficiency symptom, looper, leaf spot, poor coloring and leaf wilt. The classification data amount of the strawberry disease and pest image is shown in Table 1. In addition, referring to the strawberry disease and pest image category example in the strawberry disease and pest data set shown in Table 1. Among them, Figures 6A to 6C Figure 6A from left to right in the category are healthy, whitefly, viral disease, freeze injury; Figure 6B from left to right in the category are soft rot, root rot, yellow wilt, gray mold; Figure 6C from left to right in the category are deficiency symptom, looper, leaf spot, poor coloring, and leaf wilt.

[0143] Table 1: Classification data amount of strawberry disease and pest image

[0144]

[0145] Example 1:

[0146] ​SE-CBAM module with fusion attention mechanism was constructed, and ResNet50 network was combined to generate strawberry disease and pest recognition algorithm based on fusion attention mechanism, i.e. improved neural network SE-CBAM-ResNet50. At the same time, SE-CBAM-AlexNet and SE-CBAM-VGG19 models based on AlexNet and VGG19 networks were constructed. Comparative analysis of the three improved models was carried out on the above strawberry disease and pest data set.

[0147] In order to make a fair comparison, for the data of strawberry disease and pest data set, the size of the image is reduced to pixels, and the data in the strawberry disease and pest data set is divided into training set and data set according to the ratio of 8:2, 25% of the images in the training set are randomly selected as the validation set, and the data amount ratio of the training set to the test set is 4:1. That is, 10360 pictures are used for model training, and the rest are used to test the model performance. At the same time, the training and verification of SE-CBAM-ResNet50 and the comparison network SE-CBAM-AlexNet, SE-CBAM-VGG19 are carried out in Pytorch environment, and NVIDIA server is used. And SE-CBAM-ResNet50 and the comparison network SE-CBAM-AlexNet, SE-CBAM-VGG19 are trained with the same hyperparameters, the initial training Epochs of the network is 100 rounds, the Batch size is set to 10, and the initial learning rate Learning rate is 0.01.

[0148] After training SE-CBAM-ResNet50 and the comparison network SE-CBAM-AlexNet, SE-CBAM-VGG19, enter the verification stage. The evaluation parameters used in the verification are as described above, and the accuracy (Accuracy), cross entropy loss function (Cross Entropy Loss) and macro-F1 value (macro-F1 score) are used to verify the effectiveness of all models. The verification part is divided into three parts:

[0149] (1) Accuracy and macro-F1 value evaluation. As shown in the following Table 2, the comparison table of model accuracy and macro-F1 value.

[0150] Table 2: Comparison table of model accuracy and macro-F1 value

[0151]

[0152] From Table 2, it can be seen that in the classification task of the strawberry disease and pest data set, the accuracy of the SE-CBAM-ResNet50 algorithm is 89.86%, the macro-F1 value is 0.91, and the comprehensive performance of the model is the best. In addition, the accuracy of SE-CBAM-VGG19 and SE-CBAM-AlexNet algorithms is 83.25% and 79.88% respectively, and the macro-F1 value is 0.8 and 0.79 respectively. Compared with the ResNet50 algorithm, the comprehensive performance of the SE-CBAM-ResNet50 model of the present application is greatly improved.

[0153] (2) Evaluation of accuracy curve and macro-F1 value curve.

[0154] Referring to Figure 7 the model accuracy curve comparison diagram of SE-CBAM-ResNet50, SE-CBAM-VGG19 and SE-CBAM-AlexNet. It can be seen from Figure 7 that the accuracy fluctuation of the SE-CBAM-ResNet50 algorithm of the present application is relatively small, and the model tends to be stable when it is iterated to 180 rounds, indicating that the model is less affected by noise in disease and pest classification. The accuracy of the SE-CBAM-VGG19 algorithm gradually converges when the model is iterated to 160 rounds. The accuracy of the SE-CBAM-AlexNet algorithm fluctuates relatively greatly, and it starts to converge when the model is iterated to 80 rounds.

[0155] Referring to Figure 8 the model macro-F1 value curve comparison diagram of SE-CBAM-ResNet50, SE-CBAM-VGG19 and SE-CBAM-AlexNet. It can be seen from Figure 8 that the macro-F1 values of SE-CBAM-VGG19 algorithm and SE-CBAM-AlexNet algorithm are similar, indicating that the classification performance of the two models is similar, but the stability of SE-CBAM-VGG19 algorithm is better. The macro-F1 value of SE-CBAM-ResNet50 algorithm is relatively high, which is 0.91, indicating that the model has good recognition and classification performance of strawberry diseases and pests under complex background conditions, and the model has strong stability and generalization ability.

[0156] (3) Evaluation of loss function curve.

[0157] Referring to Figure 9 the model loss function comparison diagram of SE-CBAM-ResNet50, SE-CBAM-VGG19 and SE-CBAM-AlexNet. It can be seen from Figure 9It can be seen that the loss function curve of the improved model shows a convergent trend, the SE-CBAM-ResNet50 algorithm starts to converge when the model is iterated to 100 times, the fluctuation range is small, and the model tends to be stable after 160 iterations, indicating that the SE-CBAM-ResNet50 model has good comprehensive performance, and the model is stable and reliable.

[0158] Embodiment 2:

[0159] The application verifies the effectiveness of the SE-CBAM module by comparing the attention feature heat maps of the last convolutional layer of the ResNet50 network, the CBAM-ResNet50 network and the SE-CBAM-ResNet50 network. In the CBAM-ResNet50 network, only the CBAM module is introduced after each residual block in the original ResNet50 network.

[0160] Referring to Figure 10 , Figure 10 The attention feature heat maps of the last convolutional layer of the ResNet50 network, the CBAM-ResNet50 network and the SE-CBAM-ResNet50 are shown. It can be seen that Figure 10 It can be seen that the features extracted by the backbone network ResNet50 are not focused enough, and there are still many interferences. The CBAM-ResNet50 obtained by introducing the CBAM attention mechanism has obvious improvement in feature extraction capability, but it will also be disturbed by other features in the sample image. The SE-CBAM-ResNet50 obtained by introducing the SE-CBAM module has improved feature extraction capability, and the identification of pest and disease characteristics is more accurate, and the anti-interference ability is stronger, which is suitable for precise identification of strawberry pests and diseases in complex planting scenes.

[0161] Through the above two embodiments, it can be proved that compared with the prior art, the improved neural network model SE-CBAM-ResNet50 which fuses the SE-Net network structure and the CBAM module has good pest and disease feature extraction capability, and has higher accuracy, stability and generalization ability in the classification task of strawberry pests and diseases in complex scenes. The application has good application prospect and high usability. It should be noted that the application of the improved neural network is not limited to pest and disease identification in complex environments, but can also be applied to identification of other target objects in other complex environments.

[0162] In addition, the application embodiment also provides a storage medium, wherein the storage medium stores processor-executable instructions, and the processor-executable instructions are used for executing the strawberry pest and disease identification method based on the improved neural network when executed by the processor.

[0163] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of this application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of accomplishing functionalities that are either the same or similar to that of other embodiments of the application. Moreover, the terms "include", "have", and the like, are used in the detailed description and in the claims of this application essentially open- ended and are intended to encompass the items listed thereafter, equivalents thereof, as well as additional items not listed after the comma. Finally, terms of degree such as "substantially", "approximately", and the like, are used herein to convey an intended precision or range of values end points of which are known to be subject to, and can have been determined by, typical measurement and manufacturing tolerances as well as other factors or limitations that are expected to be within the scope of one having ordinary skill in the art. Such terms of degree are not intended to exclude the aforementioned absolute precisions and ranges.

[0164] It should be understood that, in the application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the relationship between associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that there are only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the front and back associated objects. "At least one of the following" or similar expressions means any combination of these items, including single or multiple items in any combination. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0165] In several embodiments provided in the application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the above-described device embodiments are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed objects can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0166] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0167] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0168] When the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in the form of a contribution to the prior art, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and various other media that can store program codes.

[0169] For the step numbers in the above method embodiments, they are set only for the convenience of description and explanation, and the order between the steps is not limited in any way. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

Claims

1. A method for identifying strawberry diseases and pests based on an improved neural network, characterized in that, Includes the following steps: Acquire several images of strawberry diseases and pests and preprocess these images to construct a strawberry disease and pest dataset. Using ResNet50 as the backbone network, sequentially connected CBAM and SENet modules are added to the end of each residual block in the original ResNet50 to construct an improved neural network. The improved neural network is trained using the strawberry pest and disease dataset to generate a strawberry pest and disease identification model; Acquire strawberry images to be identified, wherein the strawberry images to be identified contain at least one diseased or pest-infested area, and use the strawberry disease and pest identification model to identify and classify the diseased or pest-infested area in the strawberry images to be identified, thereby obtaining the classification result of the diseased or pest-infested area; The improved neural network includes a sequentially connected convolutional input layer, four improved residual layers, and a classification layer. The nth improved residual layer contains a plurality of sequentially connected Bottleneck residual blocks, an nth CBAM module, and an nth SENet module. ;in: The convolutional input layer is used to adjust the size of the strawberry image to be identified and downsample its number of channels to generate a feature map to be processed. The nth improved residual layer is used to extract features from the (n-1)th feature map using the CBAM attention mechanism, generating the nth attention feature map, and then performing squeezing, activation, and weighting operations on the nth attention feature map to output the nth feature map; where, when n=1, the (n-1)th feature map is the feature map to be processed; when n=4, the nth feature map is the feature map to be classified; The classification layer is used to calculate the maximum probability of the category to which the pest-affected area belongs based on the feature map to be classified, and output the classification result of the pest-affected area based on the maximum probability.

2. The strawberry disease and pest identification method based on improved neural networks according to claim 1, characterized in that, The step of preprocessing several strawberry disease and pest images to construct a strawberry disease and pest dataset includes: Data cleaning was performed on the strawberry disease and pest images; The disease and pest regions in the strawberry disease and pest images are labeled with disease and pest categories to obtain the category labels corresponding to the disease and pest regions; wherein, the disease and pest categories include at least one of healthy, whitefly, viral disease, frost damage, leather rot, root rot, verticillium wilt, gray mold, nutrient deficiency, beet armyworm, leaf spot, poor coloring, and leaf blight. The strawberry disease and pest images are augmented using data augmentation methods; wherein, the data augmentation methods include one or more of the following: adding Gaussian noise, shearing, random translation and scaling, random change of image brightness, horizontal flipping, hue adjustment, motion blur, random cropping, and vertical flipping. The strawberry disease and pest images are standardized to ensure that all strawberry disease and pest images have the same resolution.

3. The strawberry disease and pest identification method based on improved neural networks according to claim 1, characterized in that, The convolutional input layer comprises a first convolutional layer, a batch processing layer, a ReLU layer, and a first pooling layer connected in sequence. The strawberry image to be recognized is normalized and then input into the first convolutional layer, wherein: The first convolutional layer is used to perform convolution calculations on the normalized strawberry image to be identified, generating an initial feature map. The convolutional kernel of the first convolutional layer has a size of 7. 7; The batch processing layer is used to batch process the initial feature map; The ReLU layer is used to activate the initial feature map after batch processing using the ReLU activation function; The first pooling layer is used to downsample the initial feature map after the activation operation based on the max pooling method to generate the feature map to be processed.

4. The strawberry disease and pest identification method based on improved neural networks according to claim 1, characterized in that, The classification layer comprises a second pooling layer, a first fully connected layer, and a Softmax layer connected in sequence, wherein: The second pooling layer is used to downsample the feature map to be classified based on average pooling. The first fully connected layer is used to flatten the downsampled feature map to be classified into a one-dimensional vector, and convert the one-dimensional vector into the number of species and their label values ​​corresponding to the pest and disease area; The Softmax layer is used to calculate the maximum probability of the category to which the pest and disease area belongs by using the Softmax activation function based on the number of species corresponding to the pest and disease area and their label values, and outputs the classification result of the pest and disease area in the strawberry image to be identified based on the maximum probability. The maximum probability value is in the range of [0,1].

5. The strawberry disease and pest identification method based on improved neural networks according to claim 1, characterized in that, The specific structures of the first to fourth improved residual layers are as follows: The first improved residual layer is provided with three sequentially connected Bottleneck residual blocks, a first CBAM module, and a first SENet module, wherein: the first CBAM module is used to extract features from the channel and spatial information of the feature map to be processed, and generate a first attention feature map; the first SENet module is used to perform squeezing, activation, and weighting operations on the first attention feature map, generate a first feature map, and output it to the second improved residual layer; The second improved residual layer is provided with four sequentially connected Bottleneck residual blocks, a second CBAM module, and a second SENet module, wherein: the second CBAM module is used to extract features from the channel and spatial information of the first feature map to generate a second attention feature map; the second SENet module is used to perform squeezing, activation, and weighting operations on the second attention feature map to generate a second feature map and output it to the third improved residual layer; The third improved residual layer is configured with six sequentially connected Bottleneck residual blocks, a third CBAM module, and a third SENet module, wherein: the third CBAM module is used to extract features from the channel and spatial information of the second feature map to generate a third attention feature map; the third SENet module is used to perform squeezing, activation, and weighting operations on the third attention feature map to generate a third feature map and output it to the fourth improved residual layer; The fourth improved residual layer is configured with three sequentially connected Bottleneck residual blocks, a fourth CBAM module, and a fourth SENet module, wherein: the fourth CBAM module is used to extract features from the channel and spatial information of the third feature map to generate a fourth attention feature map; the fourth SENet module is used to perform squeezing, activation, and weighting operations on the fourth attention feature map to generate a feature map to be classified.

6. The strawberry disease and pest identification method based on improved neural networks according to claim 1, characterized in that, The nth CBAM module includes an nth channel attention module and an nth spatial attention module connected in sequence. ;in: The nth channel attention module is used to extract and map spatial features from the (n-1)th feature map to obtain the channel weight parameters of the (n-1)th feature map, and multiply the channel weight parameters of the (n-1)th feature map with the (n-1)th feature map to generate the nth channel feature map. The nth spatial attention module is used to extract and map the channel features of the nth channel feature map to obtain the spatial weight parameters of the nth channel feature map, and multiply the spatial weight parameters of the nth channel feature map with the nth channel feature map to obtain the nth attention feature map.

7. The strawberry disease and pest identification method based on an improved neural network according to claim 6, characterized in that, The output of the nth channel attention module satisfies: in, This is the feature map of the nth channel, i.e., the output of the attention module of the nth channel; For the (n-1)th feature map, The channel weight parameters are for the (n-1)th feature map. This is a multiplication operation; The channel weight parameters of the (n-1)th feature map satisfy: in, It is the Sigmoid activation function. For tie pooling operations, For max pooling operations, MLP is a multilayer perceptron. , The weights of the MLP; The feature map is obtained by average pooling the (n-1)th feature map. The feature map is obtained by max pooling the (n-1)th feature map.

8. The strawberry disease and pest identification method based on an improved neural network according to claim 7, characterized in that, The output of the nth spatial attention module satisfies: in, This is the nth attention feature map, i.e., the output of the nth spatial attention module. The spatial weight parameters of the feature map of the nth channel are... This is the feature map of the nth channel; The spatial weight parameters of the nth channel feature map satisfy: in, It is the Sigmoid activation function. A convolution kernel with a size of 7 Convolution operation of 7, The feature map is obtained by average pooling the feature map of the nth channel. The feature map is obtained by max pooling the feature map of the nth channel.

9. The strawberry disease and pest identification method based on an improved neural network according to claim 8, characterized in that, The operations of squeezing, activating, and weighting the nth attention feature map include: Define the size of the nth attention feature map as , These represent the height, width, and number of channels of the nth attention feature map, respectively. The following standard convolution transformation operation is performed on the nth attention feature map: in, For the nth attention feature map, , This represents the standard convolution transformation operation, where U is the output of the standard convolution transformation operation. H, W, and C represent the height, width, and number of channels of the nth attention feature map after the standard convolutional transformation operation, respectively. A squeezing operation is performed on the nth attention feature map after standard convolution transformation, and the output of the squeezing operation satisfies: in: in, For the output of the extrusion operation, ; for The components on the c channel; This indicates a squeezing operation. This represents the feature information of feature map U in channel c, and its size is... ; for exist The value at the location; An activation operation is performed on the nth attention feature map after the squeezing operation, and the output of the activation operation satisfies: in, To activate the output of the operation, For activation, It is the Sigmoid activation function. It is the ReLU activation function; , , for The components on the c channel; The nth attention feature map after the activation operation is weighted to obtain the nth feature map; where the output of the weighting operation satisfies: in: in, The output of the weighted operation is the nth feature map; For weighted operations, for The feature information in channel c has a size of .

10. A storage medium storing processor-executable instructions, characterized in that, The processor-executable instructions, when executed by the processor, are used to perform the strawberry pest and disease identification method based on an improved neural network as described in any one of claims 1-9.