Tea disease identification method based on improved ResNet18 model

By improving the ResNet18 model, using 3×3 convolution and ECA attention mechanism, combining the wavelet downsampling module, and using the ten-fold cross-validation method, the problem of low accuracy of the tea disease recognition model is solved, and the tea disease image classification is significantly improved and the robustness of the model.

CN119107633AActive Publication Date: 2024-12-10ZHEJIANG UNIV OF TECH

Patent Information

Application Number
CN202411101369.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-12-10
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

There is still room for improvement in the accuracy of the tea disease recognition model, especially in the case of small sample data sets, which are difficult to obtain good training results. The traditional methods are inefficient and inaccurate.

Method used

Improve the ResNet18 model, optimize the feature extraction and characterization capabilities by replacing 7×7 convolution with 3×3 convolution, combining ECA attention mechanism and wavelet downsampling module, and adopting ten-fold cross-validation method to improve the generalization of the model Ability and robustness.

Benefits of technology

It significantly improves the accuracy of tea disease image classification, enhances the feature characterization and robustness of the model, reduces the risk of overfitting, and improves the ability to identify tea diseases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119107633A_ABST
    Figure CN119107633A_ABST
Patent Text Reader

Abstract

The invention discloses a tea disease identification method based on an improved ResNet18 model, and belongs to the technical field of image processing. The tea disease identification method based on the improved ResNet18 model comprises the following steps: S1, acquiring a tea disease image data set, preprocessing the tea disease image data set, and randomly dividing the tea disease image data set into M subsets; s2, an improved ResNet18 model is established; s3, carrying out training and verification on the improved ResNet18 model by adopting the M subsets after random division, and obtaining an optimal improved ResNet18 model; and S4, detecting a tea disease image to be identified by using the optimal improved ResNet18 model to obtain a detection result. According to the method, the model precision is greatly improved, so that the accuracy of tea disease image classification is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to a tea disease recognition method based on an improved ResNet18 model. Background Art

[0002] Tea is not only one of the most popular drinks in the world, but also an important cash crop. However, tea diseases such as algal leaf spot directly affect the quality and yield of tea, thereby reducing tea sales. Rapid and accurate tea disease detection has become an important means to prevent the spread of tea diseases. Traditionally, the identification of tea diseases mainly relies on experienced tea farmers and field experts to do it in person. This identification method is not only inefficient, but also cannot guarantee accuracy.

[0003] In recent years, the development of deep learning technology has provided new possibilities for crop disease identification. Convolutional neural network (CNN) is an important technology in deep learning, and has achieved remarkable results in image recognition, speech recognition and other fields. The disease recognition method based on CNN can automatically extract image features, avoiding the complex process of manual design and feature selection in traditional methods, greatly improving the efficiency and accuracy of recognition. Therefore, for crop disease identification, more and more scholars have also adopted deep learning methods to solve the problem. In particular, the advent of residual network (ResNet) solves the problem of gradient disappearance in traditional convolutional neural networks.

[0004] As research in the field of tea disease identification continues to deepen at home and abroad, it has become a consensus to use deep learning technology to improve the efficiency and accuracy of disease identification. Although deep learning has achieved many results in tea disease identification, there are still some challenges. First, the accuracy of the tea disease identification model still needs to be improved. Second, how to achieve good training results with a small sample data set is still one of the important technical issues. Summary of the invention

[0005] The purpose of the present invention is to address the above problems and propose a tea disease recognition method based on an improved ResNet18 model, which greatly improves the model accuracy and thus improves the accuracy of tea disease image classification.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] The present invention proposes a tea disease identification method based on an improved ResNet18 model, comprising the following steps:

[0008] S1. Obtain a tea disease image dataset, and pre-process the tea disease image dataset and randomly divide it into M subsets;

[0009] S2. Establish an improved ResNet18 model, which includes a first feature extraction module, a maximum pooling layer, a first residual module, a second residual module, a third residual module, a fourth residual module, an average pooling layer, a discard layer, a fully connected layer, and a first activation function layer connected in sequence, wherein:

[0010] The first feature extraction module includes a first convolution layer, a second convolution layer, and a third convolution layer connected in sequence, and the convolution kernel sizes of the first convolution layer, the second convolution layer, and the third convolution layer are all 3×3;

[0011] The first residual module includes two second feature extraction modules connected in series, the second feature extraction module includes a fourth convolutional layer, a first BN layer, a fifth convolutional layer, a second BN layer, a first ECA attention mechanism module, a first addition operation, and a second activation function layer connected in sequence, the first addition operation is used to add the input features of the fourth convolutional layer and the output features of the first ECA attention mechanism module;

[0012] The second residual module, the third residual module and the fourth residual module all include two third feature extraction modules connected in series, the third feature extraction module includes a sixth convolution layer, a third BN layer, and a wavelet downsampling module, a seventh convolution layer, a fourth BN layer, an eighth convolution layer, a fifth BN layer, a second ECA attention mechanism module, a second addition operation and a third activation function layer connected in sequence, the input features of the wavelet downsampling module are sequentially passed through the sixth convolution layer and the third BN layer to form a first extraction feature, and the second addition operation is used to add the first extraction feature and the output feature of the second ECA attention mechanism module;

[0013] The wavelet downsampling module includes a lossless feature encoding block and a feature representation learning block connected in sequence, the lossless feature encoding block uses wavelet transform to convert input features into second extracted features, and the feature representation learning block includes a ninth convolution layer, a batch normalization layer, and a fourth activation function layer connected in sequence;

[0014] S3, use the randomly divided M subsets to train and verify the improved ResNet18 model to obtain the optimal improved ResNet18 model;

[0015] S4. Use the optimal improved ResNet18 model to detect the tea disease images to be identified and obtain the detection results.

[0016] Preferably, the preprocessing is to perform cropping processing and data enhancement processing in sequence.

[0017] Preferably, the cropping process is to unify the resolutions of the tea disease images in the tea disease image dataset into the same size.

[0018] Preferably, the data enhancement processing is to randomly take at least one of blurring, scaling, rotating, brightening, darkening, and adding noise to perform data enhancement on the tea disease images in the tea disease image dataset until the sample size of each type of tea disease images is consistent.

[0019] Preferably, the types of tea disease images in the tea disease image dataset include algal spot disease images, cloud leaf blight disease images, ring spot disease images, brown spot disease images, red leaf spot disease images and healthy tea images.

[0020] Preferably, the first activation function layer is a Softmax activation function, the second activation function layer, the third activation function layer and the fourth activation function layer are all ReLu activation functions, and the convolution kernel size of the ninth convolution layer is 1×1.

[0021] Preferably, the data is randomly divided into M subsets, as follows:

[0022] S11, using a random number generator to disrupt the order of tea disease images in the pre-processed tea disease image dataset;

[0023] S12, dividing the shuffled tea disease image dataset into M subsets.

[0024] Preferably, the randomly divided M subsets are used to train and verify the improved ResNet18 model to obtain the optimal improved ResNet18 model, as follows:

[0025] S31. Initialize the hyperparameters of the improved ResNet18 model, train and verify the improved ResNet18 model using the M subsets after random division, and record the results.

[0026] S32. Adjust the hyperparameters, use the randomly divided M subsets again to train and verify the improved ResNet18 model, and record the results;

[0027] S33. Obtain the optimal improved ResNet18 model based on all recorded results.

[0028] Preferably, the hyperparameters include batch size and learning rate, and the recorded results include four evaluation indicators: accuracy, precision, recall and F1 score.

[0029] Preferably, the improved ResNet18 model is trained and verified using a ten-fold cross-validation method, and the loss function during the training and verification process is a cross-entropy loss function.

[0030] Compared with the prior art, the present invention has the following beneficial effects:

[0031] The present invention improves the ResNet18 model, replaces the 7×7 convolution in the feature extraction module of the original ResNet18 model with 3×3 convolution, and improves the nonlinear expression ability of the model while keeping the receptive field unchanged. It also improves each residual module by combining the ECA attention mechanism, which not only avoids unnecessary dimensionality reduction, but also effectively enhances the feature representation ability of the model by capturing the interaction between channels. In addition, by introducing a wavelet downsampling module, the feature information is retained to the maximum extent while the spatial resolution is reduced, thereby optimizing the model performance. It also preprocesses the acquired tea disease image data set and trains and verifies the model using a ten-fold cross-validation method, which helps to improve the generalization ability and robustness of the model, reduce the risk of overfitting, greatly improve the model accuracy, and thus improve the accuracy of tea disease image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a flow chart of the tea disease identification method based on the improved ResNet18 model of the present invention;

[0033] Figure 2 This is a schematic diagram of the structure of the improved ResNet18 model of the present invention;

[0034] Figure 3 Schematic diagram of the structure of each ECA attention mechanism module of the present invention;

[0035] Figure 4 It is a structural schematic diagram of the wavelet down-sampling module of the present invention. DETAILED DESCRIPTION

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

[0037] It should be noted that when a component is referred to as being "connected" to another component, it may be directly connected to the other component or there may be an intermediate component. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art in the technical field of this application. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.

[0038] like Figure 1-4 As shown, a tea disease identification method based on an improved ResNet18 model includes the following steps:

[0039] S1. Obtain a tea disease image dataset, and randomly divide the tea disease image dataset into M subsets after preprocessing.

[0040] In one embodiment, the preprocessing is to perform cropping processing and data enhancement processing in sequence.

[0041] In one embodiment, the cropping process is to unify the resolutions of the tea disease images in the tea disease image dataset into the same size.

[0042] In one embodiment, the data enhancement processing is to randomly take at least one of blurring, scaling, rotating, brightening, darkening, and adding noise to perform data enhancement on the tea disease images in the tea disease image dataset until the sample size of each type of tea disease images is consistent.

[0043] In one embodiment, the types of tea disease images in the tea disease image dataset include algal spot disease images, cloud leaf blight disease images, ring spot disease images, brown spot disease images, red leaf spot disease images, and healthy tea images.

[0044] In one embodiment, the random division into M subsets is as follows:

[0045] S11, using a random number generator to disrupt the order of tea disease images in the pre-processed tea disease image dataset;

[0046] S12, dividing the shuffled tea disease image dataset into M subsets.

[0047] The tea disease image dataset (hereinafter referred to as the dataset) used in this embodiment is a self-built dataset. The types of tea disease images (hereinafter referred to as images) in the dataset include algal spot disease, cloud leaf blight disease, ring spot disease, brown spot disease, red leaf spot disease and healthy tea leaves, such as Figure 2 As shown, they correspond to Y1 to Y6 in sequence. In order to reduce the interference of complex background feature extraction, improve the generalization ability of the model and prevent overfitting of training, the samples in the data set were cropped, that is, the bounding rectangle of the target was intercepted from the image, the image width and height were made consistent by cutting and filling 0 pixel values, and finally all the image sizes were unified to 256×256×3. Due to the small amount of image data, in order to improve the robustness of the subsequent model, the image was enhanced by the following five operations: blurring, scaling, rotating, brightening, darkening, and adding noise until the sample size of each type of image was consistent.

[0048] After the image is subjected to data enhancement processing, the preprocessed data set needs to be randomly divided into M subsets, where M is preferably equal to 10. Specifically, the data set needs to be disrupted to ensure that each subset can represent the distribution of the entire data set. This embodiment uses a random number generator to disrupt the data set. This can avoid deviations caused by the sequentiality of the data. Then, the data set is divided into 10 subsets of roughly equal size. Assuming there is a data set of N samples, the size of each subset can be calculated to be N / 10. If the data set is not divisible by 10, the sizes of some subsets may be slightly different. This embodiment uses the numpy library, which can easily perform the above operations and randomly divide the data set into 10 equal (or as equal as possible) parts.

[0049] S2. Establish an improved ResNet18 model, which includes a first feature extraction module, a maximum pooling layer, a first residual module, a second residual module, a third residual module, a fourth residual module, an average pooling layer, a discard layer, a fully connected layer, and a first activation function layer connected in sequence, wherein:

[0050] The first feature extraction module includes a first convolution layer, a second convolution layer, and a third convolution layer connected in sequence, and the convolution kernel sizes of the first convolution layer, the second convolution layer, and the third convolution layer are all 3×3;

[0051] The first residual module includes two second feature extraction modules connected in series, the second feature extraction module includes a fourth convolutional layer, a first BN layer, a fifth convolutional layer, a second BN layer, a first ECA attention mechanism module, a first addition operation, and a second activation function layer connected in sequence, the first addition operation is used to add the input features of the fourth convolutional layer and the output features of the first ECA attention mechanism module;

[0052] The second residual module, the third residual module and the fourth residual module all include two third feature extraction modules connected in series, the third feature extraction module includes a sixth convolution layer, a third BN layer, and a wavelet downsampling module, a seventh convolution layer, a fourth BN layer, an eighth convolution layer, a fifth BN layer, a second ECA attention mechanism module, a second addition operation and a third activation function layer connected in sequence, the input features of the wavelet downsampling module are sequentially passed through the sixth convolution layer and the third BN layer to form a first extraction feature, and the second addition operation is used to add the first extraction feature and the output feature of the second ECA attention mechanism module;

[0053] The wavelet downsampling module includes a lossless feature encoding block and a feature representation learning block connected in sequence. The lossless feature encoding block uses wavelet transform to convert input features into second extracted features. The feature representation learning block includes a ninth convolutional layer, a batch normalization layer and a fourth activation function layer connected in sequence.

[0054] In one embodiment, the first activation function layer is a Softmax activation function, the second activation function layer, the third activation function layer, and the fourth activation function layer are all ReLu activation functions, and the convolution kernel size of the ninth convolution layer is 1×1.

[0055] In order to consider more details and background features in the image pixels in the initial feature extraction stage, the present invention improves the feature extraction module in the ResNet18 model by using three 3×3 convolutions instead of 7×7 convolutions. This can increase the nonlinear expression ability of the network while maintaining the size of the receptive field, thereby improving the model accuracy.

[0056] Although the traditional channel attention mechanism can improve performance, it also inevitably increases the complexity of the model. In order to resolve the contradiction between performance and complexity, the present invention combines the ECA attention mechanism to improve the residual module in the original ResNet18 model. The residual module of the present invention effectively improves the performance of deep CNN by omitting unnecessary dimensionality reduction steps and adaptively determining the scope of interaction between local channels. The core idea of ​​the ECA attention module is to introduce a channel attention mechanism in the convolution operation to capture the relationship between different channels, thereby improving the ability of feature representation. The goal of the channel attention mechanism is to adaptively adjust the weights of channel features so that the network can better focus on important features and suppress unimportant features. Through this mechanism, the model can effectively enhance the representation ability of the network without adding too many parameters and computational costs.

[0057] like Figure 3 As shown in Figure 1, the core component of the ECA attention mechanism module is the channel attention module, which aims to adaptively adjust the weights of channel features according to the relationship between channels. Specifically: First, the global average of each channel is obtained through global average pooling (GAP). This step converts the original input feature map X of the ECA attention mechanism module into a channel vector z c , as shown in formula (1). Where X c,i,j represents the value of the original input feature map X of the ECA attention mechanism module at the C channel (i, j) position, i = 1 ~ H, j = 1 ~ W, H is the height of the original input feature map X of the ECA attention mechanism module, W is the width of the original input feature map X of the ECA attention mechanism module, and C is the number of channels of the original input feature map X of the ECA attention mechanism module. Then, the obtained channel vector z cPerform a one-dimensional convolution operation. The ECA attention mechanism module does not use a fully connected layer, but instead adaptively captures cross-channel interaction information through a one-dimensional convolution. The convolution kernel size k (or ψ(C)) is adaptively determined based on the number of channels C, as shown in formula (2), where b is a constant used to adjust the size of the convolution kernel, and |.| indicates rounding. After the convolution operation, the sigmoid function is used for normalization to ensure that the weight is between (0, 1), and the attention weight a of each channel is obtained. c , as shown in formula (3), σ represents the Sigmoid function, and Conv1D represents the one-dimensional convolution operation. Finally, X c,i,j With attention weight a c Multiply to get the enhanced feature map X c ' ,i,j , as shown in formula (4).

[0058]

[0059] a c =σ(Conv1D(z c )) (3)

[0060] X′ c,i,j =a c ·X c,i,j (4)

[0061] The existing ResNet18 model downsamples through strided convolution to aggregate local features, expand the receptive field, and minimize computational overhead. However, traditional feature pooling may lead to loss of spatial information. To this end, the present invention introduces a wavelet downsampling module (HWD) to solve this problem. The core idea of ​​HWD is to use wavelet transform to reduce the spatial resolution of feature maps while retaining as much feature map information as possible, thereby improving the accuracy of the model.

[0062] like Figure 4As shown in FIG. 1 , the wavelet downsampling module consists of two main parts, a lossless feature encoding block and a feature representation learning block. The lossless feature encoding block is responsible for using wavelet transform to transform the feature map and reduce its spatial resolution while retaining all information. Wavelet transform is a method that can effectively reduce the resolution of feature maps while retaining all information of the image, which enables subsequent layers to extract representative features from the transformed components. Specifically, firstly, the input feature map Z of the wavelet downsampling module is subjected to wavelet transform (Haar), and each row is horizontally filtered to obtain horizontal low-frequency components and horizontal high-frequency components; then each column of the image is vertically filtered to obtain four components: approximate components, horizontal detail components, vertical detail components, and diagonal detail components, which are well known to those skilled in the art and will not be described in detail here; after the above operations, the input feature map Z of the wavelet downsampling module is decomposed into four components, each of which has a width and height of half of the original image, and then these four components are superimposed in the channel dimension, so that a new feature map is obtained, the width and height of this feature map are half of the original, but the number of channels becomes four times the original. The feature representation learning block consists of a standard 1×1 convolution layer, a batch normalization layer, and a ReLu activation function. The purpose is to adjust the number of channels of the feature map through 1×1 convolution and filter out redundant information as much as possible, so that subsequent layers can learn representative features more effectively. Figure 4 In , H' is the height of the input feature map Z of the wavelet downsampling module, W' is the width of the input feature map Z of the wavelet downsampling module, and C' is the number of channels of the input feature map Z of the wavelet downsampling module.

[0063] like Figure 2 As shown in the figure, the present invention replaces the 7×7 convolution in the original feature extraction module of the ResNet18 model with three 3×3 convolutions, which improves the nonlinear expression ability of the model while keeping the receptive field unchanged. Then, each residual module is improved in combination with the ECA attention mechanism, which not only avoids unnecessary dimensionality reduction, but also effectively enhances the feature representation ability of the model by capturing the interaction between channels. Finally, the wavelet downsampling module (HWD) is introduced. The wavelet downsampling module maximizes the retention of feature information while reducing the spatial resolution through wavelet transform, thereby optimizing the model performance.

[0064] Specifically, a 256×256 pixel RGB image (such as a tea disease image) is input into the improved ResNet18 model. The image features are first extracted and reduced in dimension through three 3×3 convolutional layers and a maximum pooling layer (MAX-Pool) to obtain a 56×56 pixel feature map, which is then further extracted through four residual modules (the first to fourth residual modules correspond to Res1, Res2, Res3, and Res4, respectively). Figure 2n represents the number of repetitions of the feature extraction module of this layer. After entering Res1, two 3×3 convolutions and BN layers are first used to further extract features, and then the ECA attention mechanism module is entered to capture the relationship between different channels, adaptively adjust the weights of channel features, suppress unimportant features, and focus on important features. When entering Res2, Res3, and Res4, wavelet downsampling is first performed to retain as much feature information as possible while reducing the resolution of the feature map. Four features are obtained after four residual modules, namely 64×56×56, 128×28×28, 256×14×14, and 512×7×7. After passing through four residual modules in sequence, the output feature map of the fourth residual module enters the average pooling layer (Avg-Pool) to perform pooling operations in the global spatial dimension to reduce the size of the feature map and provide a fixed-size input for the classification layer (Softmax). Next is the operation of the dropout layer, which randomly discards some neurons in the network in each iteration, thereby reducing the interdependence between neurons and improving the generalization ability of the model. Finally, the final classification result is obtained through the fully connected layer (FC) and the Softmax activation function (Softmax).

[0065] S3. Use the randomly divided M subsets to train and verify the improved ResNet18 model to obtain the optimal improved ResNet18 model.

[0066] In one embodiment, the randomly divided M subsets are used to train and verify the improved ResNet18 model to obtain the optimal improved ResNet18 model, as follows:

[0067] S31. Initialize the hyperparameters of the improved ResNet18 model, train and verify the improved ResNet18 model using the M subsets after random division, and record the results.

[0068] S32. Adjust the hyperparameters, use the randomly divided M subsets again to train and verify the improved ResNet18 model, and record the results;

[0069] S33. Obtain the optimal improved ResNet18 model based on all recorded results.

[0070] In one embodiment, the hyperparameters include batch size and learning rate, and the recorded results include four evaluation indicators: accuracy, precision, recall and F1 score.

[0071] In one embodiment, the improved ResNet18 model is trained and validated using a ten-fold cross validation method, and the loss function during the training and validation process is a cross entropy loss function.

[0072] This embodiment uses the cross-entropy loss function (Cross-Entropy Loss) to optimize the model, and the Adam optimizer updates the parameters. The initial batch size is 16, the learning rate is 0.01, and the number of iterations is 100. The cross-entropy loss function provides rich gradient information, and the Adam optimizer can quickly adjust parameters through adaptive learning rate and momentum mechanism, thereby accelerating the convergence process of the model. The Adam optimizer has good stability when dealing with high-frequency noise and sparse gradients, while the cross-entropy loss function can provide accurate classification indicators, which makes the model more stable and robust during training. Therefore, the combination of the cross-entropy loss function and the Adam optimizer performs well in processing large-scale data and complex models, and can effectively improve the performance of the model.

[0073] K-fold cross-validation is used for model training and validation. One of the ten subsets is selected as the validation set, and the remaining nine subsets are combined as the training set for training. The benefits of using K-fold cross-validation are: all data will be used as validation data, so that the entire data set is more fully utilized; small sample data sets are prone to overfitting, that is, the model performs well on the training data but performs poorly on the validation data. Through the K-fold cross-validation method, each model is trained and validated on different training sets and validation sets, which helps to detect the generalization ability of the model and reduce the risk of overfitting; due to the large randomness of small sample data sets, the training and validation results of a single division may be unstable. The K-fold cross-validation method obtains ten groups of data through multiple divisions and training, and then calculates the average of the 10 groups of data to provide a more stable and reliable model performance evaluation; the K-fold cross-validation method can better select model parameters and features. For example, different hyperparameter combinations can be tried in each cross-validation, and the parameters that perform best in all compromises can be selected to improve the performance of the model in small sample conditions.

[0074] After each training and verification, the results need to be recorded. The evaluation indicators include accuracy (ACC), precision (PRE), recall (Recall) and F1 score (F1-score). Each evaluation indicator corresponds to formula (11) to (14) in turn. After ten training and verifications, the average accuracy, average precision, average recall and average F1 score need to be recorded.

[0075]

[0076]

[0077] Among them, T P is a true positive sample, which means the number of samples that are judged as positive samples by the model and are actually positive samples; TN is a true negative example, which means that it is judged as a negative sample by the model and is actually the number of negative samples; F P is a false positive example, which indicates the number of negative samples judged as positive samples by the model; F N is a false negative example, indicating that the number of samples that are actually positive samples but detected as negative samples, X ACC represents the accuracy, X PRE represents the precision rate, X RECALL represents the recall rate, X F1-score Denotes the F1 score.

[0078] In order to find an improved ResNet18 model, you need to adjust the hyperparameters and continue to use the ten-fold cross-validation method and record the results. The method is the same as above and will not be repeated here.

[0079] S4. Use the optimal improved ResNet18 model to detect the tea disease images to be identified and obtain the detection results.

[0080] According to the results obtained in this embodiment, the improved ResNet18 model has the best training effect when the learning rate is 0.0001, the batch size is 32, and the iteration cycle is 100. The results are shown in the following table, where Mean represents the mean and SD represents the standard deviation.

[0081]

[0082] The same environment and evaluation method are used for ablation experiments. The ablation experiment design is as follows: ResNet18 basic model, denoted as ResNet18 (1) ; ResNet18 (1) The 7×7 convolution in the feature extraction module is replaced by 3×3 convolution, denoted as ResNet18 (2) ; In ResNet18 (2) The ECA attention mechanism is introduced in ResNet18 (3) ; Finally, in ResNet18 (3) The downsampling module is replaced by the wavelet downsampling module (HDW), denoted as ResNet18 (4) , which is the model of the present invention. The results are shown in the following table.

[0083]

[0084] It can be seen from ResNet18 (2) To ResNet18 (3) , the improvement combined with the ECA attention mechanism has greatly improved the accuracy, up 2.04 percentage points. (1) To ResNet18 (2)And ResNet18 (3) To ResNet18 (4) , the improvement of the feature extraction module and the improvement of the downsampling module also improve the model accuracy, which are 1.11 percentage points and 0.4 percentage points respectively. From the comparison, it can be seen that the detection result accuracy of the model of the present invention is significantly improved, which can be improved by 3.55 percentage points compared with the ResNet18 basic model. By inputting the tea disease image into the optimal improved ResNet18 model, the disease features of the tea disease image can be obtained, and the output classification result can be obtained.

[0085] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0086] The above-described embodiments only express the more specific and detailed embodiments described in this application, but they cannot be understood as limiting the scope of the patent application. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of this application, which all belong to the protection scope of this application. Therefore, the protection scope of the patent application shall be based on the attached claims.

Claims

1. A tea disease identification method based on an improved ResNet18 model, characterized in that: The tea disease identification method based on the improved ResNet18 model includes the following steps: S1. Obtain a tea disease image dataset, and pre-process the tea disease image dataset and randomly divide it into M subsets; S2. Establish an improved ResNet18 model, wherein the improved ResNet18 model includes a first feature extraction module, a maximum pooling layer, a first residual module, a second residual module, a third residual module, a fourth residual module, an average pooling layer, a discard layer, a fully connected layer, and a first activation function layer connected in sequence, wherein: The first feature extraction module includes a first convolution layer, a second convolution layer, and a third convolution layer connected in sequence, and the convolution kernel sizes of the first convolution layer, the second convolution layer, and the third convolution layer are all 3×3; The first residual module includes two second feature extraction modules connected in series, the second feature extraction module includes a fourth convolutional layer, a first BN layer, a fifth convolutional layer, a second BN layer, a first ECA attention mechanism module, a first addition operation, and a second activation function layer connected in sequence, and the first addition operation is used to add the input features of the fourth convolutional layer and the output features of the first ECA attention mechanism module; The second residual module, the third residual module and the fourth residual module each include two third feature extraction modules connected in series, the third feature extraction module includes a sixth convolutional layer, a third BN layer, and a wavelet downsampling module, a seventh convolutional layer, a fourth BN layer, an eighth convolutional layer, a fifth BN layer, a second ECA attention mechanism module, a second addition operation and a third activation function layer connected in sequence, the input features of the wavelet downsampling module are sequentially passed through the sixth convolutional layer and the third BN layer to form a first extraction feature, and the second addition operation is used to add the first extraction feature and the output feature of the second ECA attention mechanism module; The wavelet downsampling module includes a lossless feature encoding block and a feature representation learning block connected in sequence, wherein the lossless feature encoding block uses wavelet transform to convert input features into second extracted features, and the feature representation learning block includes a ninth convolutional layer, a batch normalization layer, and a fourth activation function layer connected in sequence; S3, use the randomly divided M subsets to train and verify the improved ResNet18 model to obtain the optimal improved ResNet18 model; S4. Use the optimal improved ResNet18 model to detect the tea disease images to be identified and obtain the detection results.

2. The tea disease identification method based on the improved ResNet18 model according to claim 1, characterized in that: The preprocessing includes performing cropping processing and data enhancement processing in sequence.

3. The tea disease identification method based on the improved ResNet18 model as claimed in claim 2, characterized in that: The cropping process is to unify the resolution of the tea disease images in the tea disease image dataset into the same size.

4. The tea disease identification method based on the improved ResNet18 model as claimed in claim 2, characterized in that: The data enhancement processing is to randomly take at least one of blurring, scaling, rotating, brightening, darkening, and adding noise to perform data enhancement on the tea disease images in the tea disease image dataset until the sample size of each type of tea disease images is consistent.

5. The tea disease identification method based on the improved ResNet18 model as claimed in claim 4, characterized in that: The types of tea disease images in the tea disease image dataset include algal spot disease images, cloud leaf blight disease images, ring spot disease images, brown spot disease images, red leaf spot disease images and healthy tea images.

6. The tea disease identification method based on the improved ResNet18 model according to claim 1, characterized in that: The first activation function layer is a Softmax activation function, the second activation function layer, the third activation function layer and the fourth activation function layer are all ReLu activation functions, and the convolution kernel size of the ninth convolution layer is 1×1.

7. The tea disease identification method based on the improved ResNet18 model according to claim 1, characterized in that: The random division into M subsets is as follows: S11, using a random number generator to disrupt the order of tea disease images in the pre-processed tea disease image dataset; S12, dividing the shuffled tea disease image dataset into M subsets.

8. The tea disease identification method based on the improved ResNet18 model according to claim 1, characterized in that: The improved ResNet18 model is trained and verified by using the randomly divided M subsets to obtain the optimal improved ResNet18 model, as follows: S31. Initialize the hyperparameters of the improved ResNet18 model, train and verify the improved ResNet18 model using the M subsets after random division, and record the results. S32. Adjust the hyperparameters, use the randomly divided M subsets again to train and verify the improved ResNet18 model, and record the results; S33. Obtain the optimal improved ResNet18 model based on all recorded results.

9. The tea disease identification method based on the improved ResNet18 model according to claim 8, characterized in that: The hyperparameters include batch size and learning rate, and the recorded results include four evaluation indicators: accuracy, precision, recall and F1 score.

10. The tea disease identification method based on the improved ResNet18 model according to any one of claims 1 to 9, characterized in that: The improved ResNet18 model is trained and verified by a ten-fold cross-validation method, and the loss function in the training and verification process is a cross-entropy loss function.

Citation Information

Patent Citations

  • Alzheimer disease classification method based on improved ResNet network

    CN113989551A

  • Infrared weak and small target detection method and device

    CN118397458A

Cited By

  • Tea grading method and system

    CN119992536A

  • Tea production line flow intelligent detection method, equipment, medium and product

    CN120047799A