Tomato leaf spot disease identification method and system based on G-CAFNet model
By constructing the G-CAFNet model and combining cross-layer connection and multi-scale feature extraction technology, the problems of time-consuming and labor-intensive manual inspection and deep learning data dependence in tomato leaf spot disease identification were solved, achieving efficient and accurate disease identification results.
Patent Information
- Application Number
- CN202510700910.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-19
AI Technical Summary
Existing methods for identifying tomato leaf spot rely on manual inspection, which is time-consuming, labor-intensive, and easily affected by subjective factors. In addition, methods based on deep learning are highly dependent on the amount of data, resulting in poor recognition results.
The G-CAFNet model is adopted to improve feature expression and recognition accuracy by constructing feature extraction modules and feature classification modules, including Bottleneck module, CAGM module, CAF-Block, DGF module and classifier, combined with cross-layer connection, multi-scale feature extraction, CoordAtt attention mechanism and data enhancement technology.
The recognition accuracy and efficiency of tomato leaf spot disease were improved, efficient and accurate disease identification was achieved, computational complexity was reduced, and the stability and recognition ability of the model were enhanced.
Smart Images

Figure CN120673399A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a tomato leaf spot disease recognition method and system, in particular to a tomato leaf spot disease recognition method and system based on a G-CAFNet model, and belongs to the technical field of computer vision image processing and crop disease recognition. Background Art
[0002] Tomatoes are members of the Solanaceae family, widely cultivated around the world. They are a common cash crop and are known as the "fruit of health" for their nutritious content and versatility. Rich in vitamin C, carotene, and lycopene, tomatoes possess antioxidant and anti-inflammatory properties and are widely used in medicinal applications, such as to alleviate hypertension and cardiovascular disease. However, tomatoes are also susceptible to a variety of diseases during their growth, among which tomato early blight and tomato leaf mold are common. Tomato leaf spot, primarily caused by pathogenic fungi, affects leaf photosynthesis, causing spots and shrinkage on the leaves. In severe cases, it can lead to plant death and yield losses. Therefore, timely and accurate identification of crop diseases, especially in the early stages of disease occurrence, is crucial to reducing disease spread, minimizing economic losses, and ensuring healthy crop growth.
[0003] In modern agricultural production, the identification, prevention, and control of pests and diseases are crucial for ensuring healthy crop growth and increasing crop yields. With the continuous expansion of agricultural cultivation and the increasing demand for refined management, traditional methods of disease monitoring are no longer able to meet the demands of efficient and precise agricultural production. Early disease management methods relied on manual inspection and classification, but this approach was time-consuming and labor-intensive, susceptible to subjective factors, and lacked accuracy and timeliness. In particular, due to the seasonal nature of tomato cultivation, manual diagnosis often fails to fully capture the distribution and development of diseases. In recent years, deep learning-based pest and disease identification methods have made significant progress. Deep learning technology offers significant advantages over traditional disease identification methods. It eliminates the need for extensive human intervention and can autonomously learn and extract key features, enabling efficient and accurate disease identification. Deep learning-based methods also offer superior accuracy compared to manual diagnosis, which is susceptible to subjective factors. However, this method relies heavily on large-scale, high-quality disease image data. If this data is insufficient, the model may not fully learn the characteristics of tomato leaf spot, compromising identification performance. Summary of the Invention
[0004] Purpose of the invention: The purpose of the present invention is to provide a tomato leaf spot disease recognition method and system based on the G-CAFNet model that can improve detection accuracy.
[0005] Technical solution: The present invention provides a method for identifying tomato leaf spot based on the G-CAFNet model, comprising:
[0006] (1) Obtain tomato leaf spot image data for classification and construct a dataset;
[0007] (2) performing image preprocessing on the dataset and dividing the preprocessed dataset into a training set and a test set according to a preset ratio;
[0008] (3) Constructing a tomato leaf spot disease recognition network based on the G-CAFNet model; the tomato leaf spot disease recognition network based on the G-CAFNet model includes a feature extraction module and a feature classification module:
[0009] The feature extraction module includes a Bottleneck module, a CAGM module, and a CAF-Block. The modules in the feature extraction module are connected in a cross-layer manner, with every other module connected, and the feature representation capability is enhanced by stacking the CAGM module and the CAF-Block.
[0010] The feature classification module includes a DGF module and a classifier, and the classifier consists of an average pooling layer, a fully connected layer and a Softmax layer;
[0011] (4) The training set was input into the tomato leaf spot recognition network based on the G-CAFNet model for feature training, and the parameters were iteratively updated through the Adam optimization algorithm to obtain the optimal model weights;
[0012] (5) The optimal model weights are used as pre-training parameters and applied to the verification of the test set to obtain the trained recognition model, which is then used to identify the tomato leaf spot images to be identified.
[0013] Furthermore, the image preprocessing in step (2) is specifically to perform data enhancement on all images in the data set, and the data enhancement includes horizontal flipping, size cropping, color enhancement, image mixing using the Mixup method, and adding noise to the image.
[0014] Furthermore, the CAGM module in step (3) consists of two GMS modules, a 3×3 depth-wise separable convolution and a CoordAtt attention mechanism, wherein the GMS module is a multi-scale Ghost Module.
[0015] Furthermore, the Bottleneck module in step (3) is composed of a 1×1 point convolution PW, a 3×3 depth-separable convolution DW, and a 1×1 point convolution PW in sequence.
[0016] Furthermore, the CAF-Block module in step (3) includes:
[0017] CAF-Block1, consists of three Bottleneck modules, where there is a skip connection between the first and third Bottleneck modules;
[0018] CAF-Block2, consists of three CAGM modules, where there is a skip connection between the first and third CAGM modules;
[0019] CAF-Block3 consists of 1 CAGM module and 2 Bottleneck modules, where there is a skip connection between the first CAGM module and the third Bottleneck module.
[0020] Furthermore, in the DGF module of step (3), the input features are firstly segmented into channels, wherein 1 / 4 of the channels are subjected to dilated convolutions with different expansion rates to extract multi-scale information, and the other 3 / 4 retain the original features. Subsequently, all the channels are concatenated and feature transformed through a 1×1 group of convolutions. Subsequently, a channel is separated from the output of the 1×1 group of convolutions. The separated channel is subjected to a 3×3 depthwise separable convolution and then element-wise multiplication with the output of the 1×1 group of convolutions. Finally, channel mapping is performed through a fully connected layer, and a residual connection is used to retain the original information to enhance the feature learning ability.
[0021] Furthermore, the tomato leaf spot disease recognition network based on the G-CAFNet model in step (3) specifically processes the following steps:
[0022] The feature vector output after the preprocessing operation in step (2) is marked as S0; S0 is taken as input to the first Bottleneck module of CAF-Block1, first undergoes point convolution with kernel_size=1, and then undergoes BatchNormalization and ReLU activation functions in sequence; then performs depth convolution with kernel_size=3, and then undergoes BatchNormalization and ReLU activation functions in sequence; then performs point convolution with kernel_size=1 and undergoes BatchNormalization processing to generate feature vector S11, S11 is residually connected with the original input S0 to enhance information transfer and gradient flow, and forms output feature vector S12; then, S12 passes through two Bottleneck modules in sequence, where the first Bottleneck module is skipped with the third Bottleneck module to enhance feature fusion; finally, the output of the third Bottleneck module is feature vector S13; in addition, the third Bottleneck is also skipped and fused with the first CAGM module of CAF-Block2;
[0023] S13 is input into the CAGM module. First, S13 is passed through a GMS module for feature extraction, followed by a Batch Normalization layer and a ReLU activation function. Then, it is passed through a depthwise separable convolution operation with kernel_size=3, and then through a Batch Normalization layer and a ReLU activation function. The feature expression ability is then enhanced through the CoordAtt attention mechanism. Finally, it is passed through a GMS module for feature transformation and outputs a feature vector S21. S21 is residually connected with the input S13 to form the final output feature vector S22.
[0024] S22 enters the first CAGM module of CAF-Block2 as input, first undergoes feature extraction through the GMS module, and then undergoes Batch Normalization and ReLU activation functions in sequence; then undergoes a deep convolution operation with kernel_size=3, and then undergoes Batch Normalization and ReLU activation functions in sequence; then the feature expression ability is enhanced through the CoordAtt attention mechanism; finally, it undergoes feature transformation through the GMS module and outputs the feature vector S31; at the same time, S31 also inherits the features of the third Bottleneck of CAF-Block1 through a jump connection; S31 is residually connected with the original input S22 to form the output feature vector S32; then, S32 passes through two CAGM modules in sequence, among which the first CAGM module is jump-connected to the third CAGM module to strengthen feature fusion; finally, the output of the third CAGM module is the feature vector S33;
[0025] The feature vector S33 is input to the next CAGM module to obtain the feature vector S41, and then the feature vector S41 is input to the second CAF-Block2 to obtain the feature vector S42, and S42 is input to the next CAGM block to obtain the feature vector S43; at the same time, the third CAGM module of CAF-Block2 establishes a skip connection with the first CAGM module in the second CAF-Block2 to fully integrate the features of different levels; in addition, S42 also inherits the features of the third CAGM of CAF-Block2 through the skip connection;
[0026] S43 is taken as input into the first CAGM module of CAF-Block3, and first undergoes feature extraction through the GMS module, and then undergoes Batch Normalization and ReLU activation functions in sequence; then it undergoes a deep convolution operation with kernel_size=3, and then undergoes Batch Normalization and ReLU activation functions in sequence; then the feature expression ability is enhanced through the CoordAtt attention mechanism; finally, it undergoes feature transformation through the GMS module and outputs the feature vector S51; S51 is residually connected with the original input S43 to form the output feature vector S52; then, S52 passes through two Bottleneck modules in sequence, among which the first CAGM module is skipped with the third Bottleneck module to strengthen feature fusion; finally, the output of the third Bottleneck module is the feature vector S53; at the same time, the third CAGM module of CAF-Block2 establishes a skip connection with the first Bottleneck module of CAF-Block3. In addition, S53 also inherits the features of the third CAGM of CAF-Block2 through the skip connection;
[0027] The input feature S53 passes through two Bottleneck structures in sequence to obtain feature vectors S61 and S62 respectively. Subsequently, S62 is input into the feature classification module, first undergoing feature compression through a convolution with kernel_size=1, and then passing through a Batch Normalization layer and a ReLU activation function in sequence. Next, the feature enters the AvgPool2d layer for global feature aggregation, and finally obtains the feature vector S63.
[0028] After S63 is sent to the DGF module, channel segmentation is first performed, in which 1 / 4 of the channels undergo dilation = 1 and dilation = 2 dilation rates respectively to extract feature information of different scales, while the other 3 / 4 channels retain the original features; then, all channels are re-spliced to obtain the feature vector S71, and feature transformation is performed through a 1×1 group convolution; then, a channel is separated from the output of the 1×1 group convolution, and the channel is further extracted from the local information through a 3×3 depthwise separable convolution to obtain the feature vector S72, and then S72 is element-wise multiplied with the output of the 1×1 group convolution to obtain the feature vector S73, followed by channel mapping through a fully connected layer, and finally the feature vector S74 is obtained; in this process, S74 is residually connected with the input feature S63 to form the final output feature vector S75; finally, S75 is sent to the fully connected layer for feature classification, and the category probability is calculated through the Softmax layer, and the classification result F is output.
[0029] Based on the same inventive concept, the present invention also provides a tomato leaf spot disease recognition system based on the G-CAFNet model, comprising:
[0030] The acquisition module is used to obtain tomato leaf spot disease image data for classification and to construct a data set;
[0031] The preprocessing module is used to perform image preprocessing on the dataset and divide the preprocessed dataset into a training set and a test set according to a preset ratio;
[0032] A model building module is used to build a tomato leaf spot disease recognition network based on the G-CAFNet model; the tomato leaf spot disease recognition network based on the G-CAFNet model includes a feature extraction module and a feature classification module:
[0033] The feature extraction module includes a Bottleneck module, a CAGM module, and a CAF-Block. The modules in the feature extraction module are connected in a cross-layer manner, with every other module connected, and the feature representation capability is enhanced by stacking the CAGM module and the CAF-Block.
[0034] The feature classification module includes a DGF module and a classifier, and the classifier consists of an average pooling layer, a fully connected layer and a Softmax layer;
[0035] The model training module is used to input the training set into the tomato leaf spot recognition network based on the G-CAFNet model for feature training, and iteratively update the parameters through the Adam optimization algorithm to obtain the optimal model weights;
[0036] The recognition module is used to use the optimal model weights as pre-training parameters, apply them to the verification of the test set, obtain the trained recognition model, and use the trained recognition model to identify the tomato leaf spot image to be identified.
[0037] Based on the same inventive concept, the present invention also provides a computing device, comprising: one or more processors, one or more memories, and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the tomato leaf spot disease identification method based on the G-CAFNet model according to any one of the above items are implemented.
[0038] Based on the same inventive concept, the present invention also provides a storage medium storing a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the steps of the tomato leaf spot disease identification method based on the G-CAFNet model according to any one of the above items.
[0039] Beneficial effects: Compared with the existing technology, the present invention has the following significant advantages: 1. The CAGM module proposed in the present invention integrates the multi-scale GMS structure, depth-separable convolution and CoordAtt attention mechanism, so that the model can make full use of the lightweight feature extraction unit to extract lesion information; Among them, GMS effectively improves the feature expression ability, expands the receptive field, and improves the ability to distinguish lesions through the multi-scale feature generation mechanism; 3×3 depth-separable convolution retains key features while reducing the amount of calculation; CoordAtt attention mechanism enhances the attention to the lesion area, so that the model can still accurately identify the disease characteristics under complex backgrounds; 2. The present invention innovatively adopts a cross-layer connection method to establish a connection between every other module, and promotes the characteristics with the optimal strategy. transfer; this strategy can not only effectively improve the feature fusion ability of the model, but also maintain the lightweight parameter scale, ensure efficient calculation and stable gradient flow, so that deep features can act more fully on subsequent calculations, and improve the accuracy of lesion identification; 3. The DGF module proposed in the present invention extracts multi-scale information through channel segmentation combined with void convolution with different expansion rates in the feature classification stage, and uses 1×1 group convolution and 3×3 depth-separable convolution for feature transformation and enhancement, thereby improving the expression ability of lesion features and suppressing background interference; the module uses residual connection to retain key information, and combines with the fully connected layer for channel mapping to improve the accuracy of feature classification; its lightweight design reduces computational complexity and optimizes information flow, so that the model has efficient computing capabilities while ensuring high precision. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0041] Figure 2 Schematic diagram of the network structure of tomato leaf spot recognition based on the G-CAFNet model according to an embodiment of the present invention;
[0042] Figure 3 This is a schematic diagram of the network structure of the CAF-Block module according to an embodiment of the present invention;
[0043] Figure 4 This is a schematic diagram of the network structure of a CAGM module according to an embodiment of the present invention;
[0044] Figure 5 Schematic diagram of the network structure of the DGF module according to an embodiment of the present invention;
[0045] Figure 6 Schematic diagram of the GMS module network structure according to an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0047] As attached Figure 1 As shown, the tomato leaf spot disease recognition method based on the G-CAFNet model of this embodiment includes:
[0048] (1) Obtain tomato leaf spot image data for classification and construct a dataset;
[0049] (2) performing image preprocessing on the dataset and dividing the preprocessed dataset into a training set and a test set according to a preset ratio;
[0050] (3) Constructing a tomato leaf spot disease recognition network based on the G-CAFNet model; the tomato leaf spot disease recognition network based on the G-CAFNet model includes a feature extraction module and a feature classification module:
[0051] The feature extraction module includes a Bottleneck module, a CAGM module, and a CAF-Block. The modules in the feature extraction module are connected in a cross-layer manner, with every other module connected, and the feature representation capability is enhanced by stacking the CAGM module and the CAF-Block.
[0052] The feature classification module includes a DGF module and a classifier, and the classifier consists of an average pooling layer, a fully connected layer and a Softmax layer;
[0053] (4) The training set was input into the tomato leaf spot recognition network based on the G-CAFNet model for feature training, and the parameters were iteratively updated through the Adam optimization algorithm to obtain the optimal model weights;
[0054] (5) The optimal model weights are used as pre-training parameters and applied to the verification of the test set to obtain the trained recognition model, which is then used to identify the tomato leaf spot images to be identified.
[0055] Specifically, in step (1), the pre-acquired tomato leaf spot disease images are divided into ten categories according to the type of lesions, including tomato bacterial spot disease, tomato early blight, tomato late blight, tomato leaf mold, tomato spot disease, tomato red spider lesion disease, tomato target spot disease, tomato mosaic virus, tomato yellow leaf curl virus and healthy tomato leaves, and the data are organized into a data set, which is further divided into a training set and a test set in a ratio of 8:2.
[0056] In step (2), data enhancement is performed on all dataset images, including horizontal flipping, size cropping, color enhancement, image mixing using the Mixup method, and adding noise to the image.
[0057] In step (3), a tomato leaf spot disease recognition network based on the G-CAFNet model is constructed, such as Figure 2 As shown in the figure, the model includes a feature extraction module and a feature classification module. The feature extraction module consists of a Bottleneck module, a CAGM module, and a CAF-Block module. The feature classification module consists of a DGF module and a classifier consisting of an average pooling layer, a fully connected layer, and a softmax layer. In the feature extraction module, cross-layer connections are used between modules, with every other module connected. This allows low-level features to be transferred to higher layers, achieving efficient feature reuse and stable gradient propagation, thereby enhancing the training stability and feature expression capabilities of the deep network. The CAGM block enriches the model's ability to extract detailed information, while the DGF block can extract feature information at more levels and different scales. Furthermore, a complete tomato leaf spot disease recognition network is constructed by stacking CAGM and CAF-Block modules.
[0058] The specific implementation process is as follows:
[0059] (31) The network structure of the feature extraction backbone module is as follows Figure 3As shown in the figure: CAF-Block1 consists of 3 Bottleneck modules, among which there is a skip connection between the first Bottleneck module and the third Bottleneck module; CAF-Block2 consists of 3 CAGM modules, among which there is a skip connection between the first CAGM module and the third CAGM module; CAF-Block3 consists of 1 CAGM module and 2 Bottleneck modules, among which there is a skip connection between the first CAGM module and the third module (Bottleneck module). The input RGB 3-channel tomato leaf image is first preprocessed, and the output feature vector is labeled S0. S0 is then fed into the first Bottleneck module of CAF-Block 1, where it first undergoes a pointwise convolution with kernel_size=1, followed by Batch Normalization and ReLU activation. Next, a depthwise convolution with kernel_size=3 is performed, followed by Batch Normalization and ReLU activation. This is followed by another pointwise convolution with kernel_size=1 and Batch Normalization, generating feature vector S11. S11 is residually connected to the original input S0 to enhance information transfer and gradient flow, resulting in the output feature vector S12. S12 then passes through two Bottleneck modules, with the first one connected to the third via a skip connection to enhance feature fusion. Finally, the output of the third Bottleneck module is feature vector S13. Furthermore, the third Bottleneck module is further connected to the first CAGM module of CAF-Block 2 via a skip connection for feature fusion.
[0060] (32) Feature enhancement module CAGM, such as Figure 4 As shown in Figure 2, it consists of two GMS modules, a 3×3 depth-separable (DW) convolution and a CoordAtt attention mechanism, where the GMS module, such as Figure 6As shown in the figure, it is a multi-scale Ghost Module. S13 is input into the CAGM module. First, S13 is passed through a GMS module for feature extraction, followed by a BatchNormalization layer and a ReLU activation function. Then, it is passed through a depth-wise separable convolution operation with kernel_size=3, followed by a Batch Normalization layer and a ReLU activation function. The feature expression capability is then enhanced through the CoordAtt attention mechanism. Finally, it is passed through a GMS module for feature transformation and outputs the feature vector S21. S21 is residually connected with the input S13 to form the final output feature vector S22.
[0061] S22 enters the first CAGM module of CAF-Block2 as input, first passes through the GMS module for feature extraction, and passes through Batch Normalization and ReLU activation functions in sequence; then passes through a deep convolution operation with kernel_size=3, and then passes through Batch Normalization and ReLU activation functions in sequence; then the feature expression ability is enhanced through the CoordAtt attention mechanism; finally, it passes through the GMS module for feature transformation and outputs the feature vector S31. In addition, S31 not only originates from S22, but also inherits the features of the third Bottleneck of CAF-Block1 through jump connections to further enhance the feature fusion capability. S31 is residually connected with the original input S22 to form the output feature vector S32. Subsequently, S32 passes through two CAGM modules in sequence, among which the first CAGM module is jump-connected to the third CAGM module to strengthen feature fusion. Finally, the output of the third CAGM module is the feature vector S33;
[0062] Feature vector S33 is fed into the next CAGM module to obtain feature vector S41. Feature vector S41 is then fed into the second CAF-Block2 to obtain feature vector S42. S42 is then fed into the next CAGM block to obtain feature vector S43. To enhance cross-block information transfer, a skip connection is established between the third CAGM module of CAF-Block2 and the first CAGM module of the second CAF-Block2 to fully integrate features from different levels. Furthermore, S42 not only originates from S41 but also inherits features from the third CAGM of CAF-Block2 via a skip connection, further enriching the feature representation.
[0063] S43 enters the first CAGM module of CAF-Block3 as input. It first undergoes feature extraction through the GMS module, followed by Batch Normalization and ReLU activation. It then undergoes a depthwise convolution with kernel_size=3, followed by Batch Normalization and ReLU activation. Feature representation is enhanced using the CoordAtt attention mechanism. Finally, it undergoes feature transformation again through the GMS module, outputting a feature vector S51. S51 is residually connected with the original input S43 to form the output feature vector S52. S52 then passes through two Bottleneck modules, with the first CAGM module and the third having a skip connection to enhance feature fusion. Finally, the output of the third Bottleneck module is feature vector S53. To further enhance cross-layer feature flow, the third CAGM module of CAF-Block2 establishes a skip connection with the first Bottleneck module of CAF-Block3, enabling the effective fusion of deep information from different layers and improving feature representation. In addition, S53 not only originates from S43 but also inherits the characteristics of the third CAGM of CAF-Block2 through skip connections;
[0064] The input feature S53 passes through two Bottleneck structures in sequence, obtaining feature vectors S61 and S62, respectively. Subsequently, S62 is input to the feature classification module, where it first undergoes feature compression through a convolution with kernel_size=1, and then passes through a Batch Normalization layer and a ReLU activation function. The feature then enters the AvgPool2d layer for global feature aggregation, ultimately obtaining feature vector S63.
[0065] (33) Multi-scale hole reconstruction module DGF, such as Figure 5As shown, the input features are first segmented into channels. Some channels undergo dilated convolutions with different dilation rates to extract multi-scale information, while others retain their original features. All channels are then concatenated and transformed through a 1×1 group convolution. A channel is separated from the output of the 1×1 group convolution. This channel undergoes a 3×3 depthwise separable convolution and then undergoes element-wise multiplication with the output of the 1×1 group convolution. Finally, channel mapping is performed through a fully connected layer, and residual connections are used to preserve the original information to enhance feature learning capabilities. After the input feature S63 is fed into the DGF module, it is first segmented into channels. Some channels undergo dilated convolutions with dilation rates of dilation = 1 and dilation = 2, respectively, to extract feature information at different scales, while others retain their original features. All channels are then reconcatenated to obtain the feature vector S71, which is then transformed through a 1×1 group convolution. Next, a channel is separated from the output of the 1×1 convolution. This channel is further subjected to a 3×3 depthwise separable convolution to extract local information, resulting in a feature vector S72. Subsequently, S72 is element-wise multiplied with the output of the 1×1 convolution to obtain a feature vector S73. This is then passed through a fully connected layer for channel mapping, ultimately yielding a feature vector S74. During this process, S74 is residually connected to the input feature vector S63 to form the final output feature vector S75. S75 is then fed into a fully connected layer for feature classification, and the class probabilities are calculated using a Softmax layer.
[0066] In step (4), each probability component finally calculated in step (3) corresponds to a class probability corresponding to the training. The loss is calculated using forward propagation, and the gradient is adjusted through backpropagation. The momentum gradient descent algorithm is used to optimize the model parameters, and the weights are iteratively updated until convergence to the optimal state to obtain the best weights.
[0067] In step (5), the best training model weight is used as the pre-training model to verify the data images in the test set, and the performance of the model is evaluated by accuracy.
[0068] The accuracy is calculated as follows:
[0069]
[0070] Among them, TP (True Positives): true positive examples, predicted as positive examples are actually positive examples; FP (False Positives): false positive examples, predicted as positive examples are actually negative examples; FN (false Negatives): false negative examples, predicted as negative examples are actually positive examples; TN (True Negatives): true negative examples, predicted as negative examples are actually negative examples.
[0071] The experimental results of the G-CAFNet model of the present invention are compared with the performance of the traditional model and the lightweight model as shown in Table 1:
[0072] Table 1 Model performance comparison
[0073] Model name Accuracy GoogleNet 97.67% EffcientNet 98.9% ResNet-50 97.93% MobilenetV2 92.8% G-CAFNet 99.5%
[0074] It can be seen that the recognition efficiency of the model proposed in the present invention reaches 99.5%, which has high robustness and practical application value, and has great prospects in the field of crop leaf disease and insect pest identification.
[0075] The description of the variables involved in this embodiment is shown in Table 2.
[0076] Table 2 Variable description table
[0077]
[0078]
[0079] Based on the same inventive concept, the present invention also provides a tomato leaf spot disease recognition system based on the G-CAFNet model, comprising:
[0080] The acquisition module is used to obtain tomato leaf spot disease image data for classification and to construct a data set;
[0081] The preprocessing module is used to perform image preprocessing on the dataset and divide the preprocessed dataset into a training set and a test set according to a preset ratio;
[0082] A model building module is used to build a tomato leaf spot disease recognition network based on the G-CAFNet model; the tomato leaf spot disease recognition network based on the G-CAFNet model includes a feature extraction module and a feature classification module:
[0083] The feature extraction module includes a Bottleneck module, a CAGM module, and a CAF-Block. The modules in the feature extraction module are connected in a cross-layer manner, with every other module connected, and the feature representation capability is enhanced by stacking the CAGM module and the CAF-Block.
[0084] The feature classification module includes a DGF module and a classifier, and the classifier consists of an average pooling layer, a fully connected layer and a Softmax layer;
[0085] The model training module is used to input the training set into the tomato leaf spot recognition network based on the G-CAFNet model for feature training, and iteratively update the parameters through the Adam optimization algorithm to obtain the optimal model weights;
[0086] The recognition module is used to use the optimal model weights as pre-training parameters, apply them to the verification of the test set, obtain the trained recognition model, and use the trained recognition model to identify the tomato leaf spot image to be identified.
[0087] Based on the same inventive concept, the present invention also provides a computing device, comprising: one or more processors, one or more memories, and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the tomato leaf spot disease identification method based on the G-CAFNet model according to any one of the above items are implemented.
[0088] Based on the same inventive concept, the present invention also provides a storage medium storing a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the steps of the tomato leaf spot disease identification method based on the G-CAFNet model according to any one of the above items.
Claims
1. A tomato leaf spot disease recognition method based on the G-CAFNet model, characterized in that: include: (1) Obtain tomato leaf spot image data for classification and construct a dataset; (2) performing image preprocessing on the dataset and dividing the preprocessed dataset into a training set and a test set according to a preset ratio; (3) Constructing a tomato leaf spot disease recognition network based on the G-CAFNet model; the tomato leaf spot disease recognition network based on the G-CAFNet model includes a feature extraction module and a feature classification module: The feature extraction module includes a Bottleneck module, a CAGM module, and a CAF-Block. The modules in the feature extraction module are connected in a cross-layer manner, with every other module connected, and the feature representation capability is enhanced by stacking the CAGM module and the CAF-Block. The feature classification module includes a DGF module and a classifier, and the classifier consists of an average pooling layer, a fully connected layer and a Softmax layer; (4) The training set was input into the tomato leaf spot recognition network based on the G-CAFNet model for feature training, and the parameters were iteratively updated through the Adam optimization algorithm to obtain the optimal model weights; (5) The optimal model weights are used as pre-training parameters and applied to the verification of the test set to obtain the trained recognition model, which is then used to identify the tomato leaf spot images to be identified.
2. The tomato leaf spot disease identification method based on the G-CAFNet model according to claim 1, characterized in that: The image preprocessing in step (2) is specifically to perform data enhancement on all images in the data set, and the data enhancement includes horizontal flipping, size cropping, color enhancement, image mixing using the Mixup method, and adding noise to the image.
3. The tomato leaf spot disease identification method based on the G-CAFNet model according to claim 1, characterized in that: The CAGM module in step (3) consists of two GMS modules, a 3×3 depth-separable convolution and a CoordAtt attention mechanism, where the GMS module is a multi-scale Ghost Module.
4. The tomato leaf spot disease identification method based on the G-CAFNet model according to claim 1, characterized in that: The Bottleneck module in step (3) is composed of a 1×1 point convolution PW, a 3×3 depth-separable convolution DW, and a 1×1 point convolution PW in sequence.
5. The tomato leaf spot disease identification method based on the G-CAFNet model according to claim 1, characterized in that: The CAF-Block module in step (3) includes: CAF-Block1, consists of three Bottleneck modules, where there is a skip connection between the first and third Bottleneck modules; CAF-Block2, consists of three CAGM modules, where there is a skip connection between the first and third CAGM modules; CAF-Block3 consists of 1 CAGM module and 2 Bottleneck modules, where there is a skip connection between the first CAGM module and the third Bottleneck module.
6. The tomato leaf spot disease identification method based on the G-CAFNet model according to claim 1, characterized in that: In the DGF module of step (3), the input features are firstly segmented into channels, wherein 1 / 4 of the channels are subjected to dilated convolutions with different expansion rates to extract multi-scale information, and the other 3 / 4 retain the original features. Then all the channels are spliced and feature transformed by a 1×1 group of convolutions. Then, a channel is separated from the output of the 1×1 group of convolutions. The separated channel is subjected to a 3×3 depthwise separable convolution and then element-wise multiplication with the output of the 1×1 group of convolutions. Finally, channel mapping is performed through a fully connected layer, and a residual connection is used to retain the original information to enhance the feature learning ability.
7. The tomato leaf spot disease identification method based on the G-CAFNet model according to claim 1, characterized in that: The specific processing flow of the tomato leaf spot disease recognition network based on the G-CAFNet model in step (3) includes: The feature vector output after the preprocessing operation in step (2) is marked as S0; S0 is taken as input to the first Bottleneck module of CAF-Block1, first undergoes point convolution with kernel_size=1, and then undergoes BatchNormalization and ReLU activation functions in sequence; then performs depth convolution with kernel_size=3, and then undergoes BatchNormalization and ReLU activation functions in sequence; then performs point convolution with kernel_size=1 and undergoes BatchNormalization processing to generate feature vector S11, S11 is residually connected with the original input S0 to enhance information transfer and gradient flow, and forms output feature vector S12; then, S12 passes through two Bottleneck modules in sequence, where the first Bottleneck module is skipped with the third Bottleneck module to enhance feature fusion; finally, the output of the third Bottleneck module is feature vector S13; in addition, the third Bottleneck is also skipped and fused with the first CAGM module of CAF-Block2; S13 is input into the CAGM module. First, S13 is passed through a GMS module for feature extraction, followed by a BatchNormalization layer and a ReLU activation function. Then, it is passed through a depthwise separable convolution operation with kernel_size=3, followed by a Batch Normalization layer and a ReLU activation function. The feature expression capability is then enhanced through the CoordAtt attention mechanism. Finally, it is passed through a GMS module for feature transformation and outputs a feature vector S21. S21 is residually connected with the input S13 to form the final output feature vector S22. S22 enters the first CAGM module of CAF-Block2 as input, first undergoes feature extraction through the GMS module, and then undergoes Batch Normalization and ReLU activation functions in sequence; then undergoes a deep convolution operation with kernel_size=3, and then undergoes Batch Normalization and ReLU activation functions in sequence; then the feature expression ability is enhanced through the CoordAtt attention mechanism; finally, it undergoes feature transformation through the GMS module and outputs the feature vector S31; at the same time, S31 also inherits the features of the third Bottleneck of CAF-Block1 through a jump connection; S31 is residually connected with the original input S22 to form the output feature vector S32; then, S32 passes through two CAGM modules in sequence, among which the first CAGM module is jump-connected to the third CAGM module to strengthen feature fusion; finally, the output of the third CAGM module is the feature vector S33; The feature vector S33 is input to the next CAGM module to obtain the feature vector S41, and then the feature vector S41 is input to the second CAF-Block2 to obtain the feature vector S42, and S42 is input to the next CAGM block to obtain the feature vector S43; at the same time, the third CAGM module of CAF-Block2 establishes a skip connection with the first CAGM module in the second CAF-Block2 to fully integrate the features of different levels; in addition, S42 also inherits the features of the third CAGM of CAF-Block2 through the skip connection; S43 is taken as input into the first CAGM module of CAF-Block3, and first undergoes feature extraction through the GMS module, and then undergoes Batch Normalization and ReLU activation functions in sequence; then it undergoes a deep convolution operation with kernel_size=3, and then undergoes Batch Normalization and ReLU activation functions in sequence; then the feature expression ability is enhanced through the CoordAtt attention mechanism; finally, it undergoes feature transformation through the GMS module and outputs the feature vector S51; S51 is residually connected with the original input S43 to form the output feature vector S52; then, S52 passes through two Bottleneck modules in sequence, among which the first CAGM module is skipped with the third Bottleneck module to strengthen feature fusion; finally, the output of the third Bottleneck module is the feature vector S53; at the same time, the third CAGM module of CAF-Block2 establishes a skip connection with the first Bottleneck module of CAF-Block3. In addition, S53 also inherits the features of the third CAGM of CAF-Block2 through the skip connection; The input feature S53 passes through two Bottleneck structures in sequence to obtain feature vectors S61 and S62 respectively; then, S62 is input into the feature classification module, first undergoes feature compression through a convolution with kernel_size=1, and then passes through the BatchNormalization layer and the ReLU activation function in sequence; then, the feature enters the AvgPool2d layer for global feature aggregation, and finally obtains the feature vector S63; After S63 is sent to the DGF module, channel segmentation is first performed, in which 1 / 4 of the channels undergo dilation = 1 and dilation = 2 dilation rates respectively to extract feature information of different scales, while the other 3 / 4 channels retain the original features; then, all channels are re-spliced to obtain the feature vector S71, and feature transformation is performed through a 1×1 group convolution; then, a channel is separated from the output of the 1×1 group convolution, and the channel is further extracted from the local information through a 3×3 depthwise separable convolution to obtain the feature vector S72, and then S72 is element-wise multiplied with the output of the 1×1 group convolution to obtain the feature vector S73, followed by channel mapping through a fully connected layer, and finally the feature vector S74 is obtained; in this process, S74 is residually connected with the input feature S63 to form the final output feature vector S75; finally, S75 is sent to the fully connected layer for feature classification, and the category probability is calculated through the Softmax layer, and the classification result F is output.
8. A tomato leaf spot disease recognition system based on the G-CAFNet model, characterized in that: include: The acquisition module is used to obtain tomato leaf spot disease image data for classification and to construct a data set; The preprocessing module is used to perform image preprocessing on the dataset and divide the preprocessed dataset into a training set and a test set according to a preset ratio; A model building module is used to build a tomato leaf spot disease recognition network based on the G-CAFNet model; the tomato leaf spot disease recognition network based on the G-CAFNet model includes a feature extraction module and a feature classification module: The feature extraction module includes a Bottleneck module, a CAGM module, and a CAF-Block. The modules in the feature extraction module are connected in a cross-layer manner, with every other module connected, and the feature representation capability is enhanced by stacking the CAGM module and the CAF-Block. The feature classification module includes a DGF module and a classifier, and the classifier consists of an average pooling layer, a fully connected layer and a Softmax layer; The model training module is used to input the training set into the tomato leaf spot recognition network based on the G-CAFNet model for feature training, and iteratively update the parameters through the Adam optimization algorithm to obtain the optimal model weights; The recognition module is used to use the optimal model weights as pre-training parameters, apply them to the verification of the test set, obtain the trained recognition model, and use the trained recognition model to identify the tomato leaf spot image to be identified.
9. A computing device, characterized in that include: One or more processors, one or more memories, and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the tomato leaf spot identification method based on the G-CAFNet model according to any one of claims 1 to 7 are implemented.
10. A storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the tomato leaf spot disease identification method based on the G-CAFNet model according to any one of claims 1 to 7.