Tomato leaf disease recognition method based on VC-Net and mueller algorithm
This paper proposes a tomato leaf disease identification method based on VC-Net and Mueller algorithm. By using a visual Transformer and an improved Encoder self-attention module for image segmentation and denoising, and combining it with the training module of Mueller algorithm, the method solves the problem of low detection efficiency of tomato leaf disease and achieves high-precision and time-efficient disease detection.
Patent Information
- Application Number
- CN202311351039.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-18
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2043-10-18
AI Technical Summary
Existing technologies for detecting tomato leaf diseases suffer from low detection efficiency and time consumption, and the acquisition of high-quality images is difficult, affecting the accuracy and time of deep learning detection.
A tomato leaf disease identification method based on VC-Net and Mueller algorithm is adopted. The image is segmented by the Patch Embedding module of the visual Transformer, combined with the improved Encoder self-attention module and Gaussian denoising processing, and the Mueller algorithm is used to automatically stop the training module, thus optimizing the training process.
It improves the accuracy of tomato leaf disease identification, saves time and costs, and performs well on small datasets, achieving efficient and accurate disease detection.
Smart Images

Figure CN117315478B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer image processing and recognition, and particularly relates to a tomato leaf disease recognition method based on VC-Net and Mueller algorithm. Background Art
[0002] Tomatoes are a fruit and vegetable with significant nutritional value and health benefits. Rich in vitamin C, vitamin A, and potassium, they help boost immunity, promote healthy vision and skin, and maintain heart health. Their diverse varieties and uses make tomatoes an essential part of our daily diet, offering a delicious, healthy, and diverse choice. However, tomatoes are also susceptible to various agricultural diseases, which can lead to significant yield declines and significant economic losses for farmers and tomato plants. These diseases include tomato bacterial spot, tomato early blight, tomato late blight, leaf mold, powdery mildew, tomato leaf spot, two-spot spider mite disease, tomato leaf spot, tomato mosaic virus, and yellow leaf curl virus. Therefore, to prevent and control tomato diseases, it is crucial to strengthen detection methods and promptly identify the specific disease.
[0003] In current large-scale crop cultivation, traditional manual detection methods are often inefficient and time-consuming. The application of deep learning technology in agricultural pest and disease detection is now crucial. Deep learning technology can automatically learn and extract disease features by training large amounts of image data, enabling efficient and accurate tomato leaf disease detection. However, the workload of collecting pest and disease images in practice is large, and acquiring high-quality images is difficult, which impacts the accuracy and time of existing deep learning detection methods. Therefore, highly accurate detection results in production can help farmers accurately determine the type and severity of the disease and make appropriate control decisions. Summary of the Invention
[0004] Purpose of the invention: In response to the problems pointed out in the background technology, the present invention provides a tomato leaf disease identification method based on VC-Net and Mueller algorithm, which has high recognition accuracy and can effectively save time costs.
[0005] Technical solution: The present invention proposes a tomato leaf disease identification method based on VC-Net and Mueller algorithm, comprising the following steps:
[0006] Step 1: First, preprocess the tomato leaf disease image data, perform data enhancement on the tomato leaf disease images, and divide the dataset;
[0007] Step 2: Use the Patch Embedding module in the visual Transformer to first divide each image input after step 1 into blocks;
[0008] Step 3: Construct a network model based on VC-Net to extract features from the divided images. The VC-Net network model includes two feature extraction modules, a denoising module, and a classification output module. The first feature extraction module is a convolution feature extraction module, which is composed of 11 convolution blocks stacked together, and adds an SE attention mechanism after each convolution, while performing a linear residual connection. The second feature extraction module is an improved Encoder self-attention module, which is equipped with an improved multi-head self-attention, which changes the original self-attention to LSA self-attention and adds a zero mask zero_mask matrix.
[0009] Step 4: Train the VC-Net-based network model in step 3 using the constructed training module based on the Mueller algorithm, and analyze and judge the results of the training loss and accuracy using the training module based on the Mueller algorithm;
[0010] Step 5: Through iterative training on the tomato leaf disease dataset, the model parameters are continuously adjusted to obtain the optimal tomato leaf disease recognition model and save the model parameters for testing to achieve the classification of tomato leaf disease.
[0011] Furthermore, the data preprocessing in step 1 is to divide the input image into data sets, randomly crop, horizontally flip and normalize them; and divide them into 11 categories of tomato leaf disease data sets according to the types of tomato leaf diseases, namely tomato bacterial spot, tomato early blight, tomato late blight, leaf mold, powdery mildew, tomato leaf spot, two-spotted spider mite disease, tomato spot, tomato mosaic virus, yellow leaf curl virus and healthy tomato leaf disease.
[0012] Furthermore, in step 2, the tomato leaf disease input image is first segmented by the Patch Embedding module, and the pre-processed image is divided into 16x16 pixel blocks.
[0013] Furthermore, the structures of the two feature extraction modules in step 3 are as follows:
[0014] First, the convolution feature extraction module of the first feature extraction module includes: first performing two 3*3 convolution preliminary feature extractions, and then stacking two convolution block modules 11 times to form 11 convolution blocks;
[0015] The first convolution Block1 executes separable convolution SeparableConv, SE attention module, Relu activation function, separable convolution SeparableConv, and MaxPooling in sequence, and repeats it 3 times; the second convolution Block2 executes Relu activation function, separable convolution SeparableConv, and SE attention module in sequence, and repeats it 8 times;
[0016] The output sequence after convolution is then subjected to Gaussian denoising by the denoising module, and the image blocks are flattened by PositionEmbedding. It is then input into the Transformer and the second feature extraction is performed in the Encoder.
[0017] The improved Encoder self-attention module consists of LayerNorm, improved multi-head self-attention, Dropout, LayerNorm, MLP, and Dropout. The improved multi-head self-attention changes the original self-attention to LSA self-attention and adds a zero mask zero_mask matrix; the input and the output after Dropout are residually connected.
[0018] Furthermore, the improved multi-head self-attention execution process is:
[0019] First, the input vector is linearly transformed to obtain qkv, and then the chunk function is used to split it into three parts, represented as query q, key k and value v respectively;
[0020] Then the improved LSA attention is used to calculate the score, which is specifically expressed as:
[0021] Calculate the scaling factor scale, expand it, create a zero mask zero_mask, then use the einsum function to calculate the dot product score dots between q and k, and multiply it by the scaling factor scale, use the mask zeros_mask to set the score of the corresponding position in dots to negative infinity, and perform softmax normalization on the score through the self.attend function to obtain the attention weight attn;
[0022] Next, use the einsum function to calculate the weighted sum between the attention weight and the value v to get the output out;
[0023] Finally, the dimension of out is adjusted through the rearrange function, and then linear projection is performed through self.to_out, and the output result is returned.
[0024] Furthermore, the Gaussian denoising module structure in step 3 is as follows:
[0025] The Gaussian denoising module first performs a 3*3 convolution on the Gaussian filter, then performs two-dimensional normalization to keep the output dimension unchanged, then performs a Relu activation function and then a linear transformation through a 1*1 convolution layer, and finally repeats the BN layer and Relu layer.
[0026] Furthermore, the Mueller algorithm training structure of step 4 is as follows:
[0027] A Mueller algorithm discrimination module is added to the traditional training module, wherein the Mueller algorithm discrimination module performs Mueller algorithm processing and comparison on the training accuracy results and losses of each round, judges the degree of convergence of the training based on the judgment results, and terminates after reaching convergence; the Mueller algorithm uses the method of seeking similarities and differences of Mueller's five methods, specifically: in a set of data, the difference between multiple adjacent numbers is used to reflect the similarity of this set of numbers.
[0028] Beneficial effects:
[0029] 1. This invention performs 11 convolution blocks to extract features after image segmentation in the traditional visual Transformer, and adds an attention mechanism, which effectively solves the limitations of traditional visual Transformer in feature extraction, making the model more comprehensive in the early stage of extracting features and local features, making up for the original weak ability to extract features in spatial information and local aspects.
[0030] 2. After the convolution is used to extract features, due to the noise generated in the continuous convolution process, the present invention performs denoising processing through Gaussian filtering denoising technology, so that the noise effect can be avoided when the feature is subsequently extracted through the Transformer.
[0031] 3. This paper changes the original self-attention in the encoder to LSA local self-attention and adds a zero mask structure, so that it only focuses on sensitive information and masks some redundant information. In traditional visual Transformers, it requires a large amount of data for training to achieve good results, and its ability on smaller data is limited. The LSA used in this paper can also achieve good results on smaller data;
[0032] 4. The present invention uses a training module with the Mueller algorithm added. By analyzing and judging the parameters of each round of training results, the training can be automatically stopped when the training reaches convergence, thereby maintaining relatively high recognition accuracy while also saving the cost of training time. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flow chart of the tomato leaf disease recognition method based on VC-Net and Mueller algorithm;
[0034] Figure 2 This is a schematic diagram of the structure of the tomato leaf disease recognition network model constructed by the present invention;
[0035] Figure 3 This is a schematic diagram of the structure of adding an attention convolution feature extraction module;
[0036] Figure 4 Schematic diagram of the improved LSA attention encoder structure;
[0037] Figure 5 This is a schematic diagram of the Mueller algorithm training module structure;
[0038] Figure 6 A schematic diagram comparing the effects of each model. DETAILED DESCRIPTION
[0039] The present invention will be described in further detail below with reference to the accompanying drawings.
[0040] The present invention proposes a tomato leaf disease recognition method based on VC-Net and Mueller algorithm. Figure 1 As shown, the specific steps include:
[0041] Step 1: Preprocess the tomato leaf disease dataset, perform data augmentation on the tomato leaf disease images, and divide the dataset.
[0042] The dataset is divided into 11 categories according to different diseases, one of which is healthy tomato leaf disease, and the remaining 10 categories are tomato bacterial spot, tomato early blight, tomato late blight, leaf mold, powdery mildew, tomato leaf spot, two-spotted spider mite disease, tomato leaf spot, tomato mosaic virus, yellow leaf curl virus and a class of healthy tomato leaves according to disease characteristics.
[0043] The dataset is then divided into a training set and a validation set in a ratio of 8:2. The images in the sets come from different categories to ensure the generalization performance of the model on different categories.
[0044] The pretreatment method adopted by the present invention is as follows in detail:
[0045] (1) Random cropping: Randomly select a region from the input image as the input of the model. This can increase the diversity and generalization ability of the data. When performing random cropping, ensure that important image information, such as characteristic regions of the disease, is retained.
[0046] (2) Horizontal flip: Flip the image along the horizontal axis, i.e., flip it left to right. This data augmentation technique can increase data diversity and help the model learn features in different directions. Use the flip() function in numpy from the image processing library to implement horizontal flipping.
[0047] (3) Standardization: The image is preprocessed to have zero mean and unit variance. This preprocessing technique helps accelerate convergence, reduce the effects of brightness and color on the model, and improve the accuracy of the model. The present invention uses the method of subtracting the mean from the image pixel values and dividing by the standard deviation.
[0048] Finally, there are 10,846 preprocessed images, including 8,676 training sets and 2,170 validation sets.
[0049] Step 2: Use the patch embedding method to first segment the image. Because this method is based on a visual transformer, to meet the encoder input size, the image input sequence must be reduced. This involves first segmenting the image. For example, a 224x224 pixel image of a tomato leaf disease is divided into 14 blocks, each 16x16 pixels.
[0050] Step 3: Construct a tomato leaf disease recognition method based on VC-Net and Mueller algorithm, such as Figure 2 As shown in the figure, it mainly includes two feature extraction modules, a denoising module and a classification output module. First, the block-wise input sequence is passed through the first feature extraction module, which is a convolution module with an attention mechanism. This module can extract more prominent local features. After feature extraction, Gaussian denoising is performed to remove the noise generated by the first feature extraction process. Next, the output vector is passed through the second feature extraction module. The output feature vector graph is flattened and position embedded at the same time so that it can be input into the next feature extraction step, that is, the encoder with the LSA self-attention module is added to perform global feature extraction. After the above-mentioned local and global feature extraction, classification output is performed next. During the training process, the use of the proposed training module based on the Mueller algorithm can enable the model to automatically stop training when it reaches convergence while maintaining high accuracy, saving training time and cost.
[0051] The first feature extraction module mentioned above: Figure 3 As shown in the figure, it is mainly composed of two convolutional blocks with repeatedly stacked residuals. Block 1 mainly consists of a separable convolution SeparableConv, a Relu activation function, a separable convolution SeparableConv, a SE attention mechanism, and a maximum pooling layer MaxPooling. After the initial two 3*3 convolutions, preliminary shallow feature extraction is performed to reduce the feature map size while increasing the number of feature map channels. The output feature vector is (-1, 728, 28, 28).
[0052] Then the first convolution Block1 is performed, and before the second repetition of Block1, in order to improve the model's expressiveness, a Relu activation function is performed before Block1. This module is executed three times, and each output result and input are residually connected through a 1*1 convolution. After feature extraction of this part, the output feature vector is (-1, 728, 14, 14). Because the stride of the convolution part in this module is 2, the feature map size needs to be halved through the pooling layer. The separable convolution module used here first undergoes 3*3 channel convolution and 1*1 point-by-point convolution, and then executes the added SE attention module. The learned attention weights can further enhance the feature representation ability. When performing the SE module, the input feature vector is (-1, 728, 14, 14) and is first converted to (-1, 728, 1, 1) through the AdaptiveAvgPool layer. Then, the feature vector output by the Linear layer is (-1, 128). Then, it passes through a GELU activation function, a Linear layer, and a Sigmoid activation function to obtain the output feature vector (-1, 728). Then, the feature vector calculated by SE attention is (-1, 728, 14, 14). After three consecutive convolution Block1 modules, the output feature vector is (-1, 728, 14, 14).
[0053] Then execute the convolution Block2 module. The Block2 module mainly consists of 3 consecutive ReLU activation functions, separable convolution, and SE attention mechanism. Repeat the Block2 module 8 times, and perform residual connection on the input and output of each time.
[0054] Gaussian denoising module: This Gaussian denoising module consists of two filter kernels of different sizes. Since the present invention identifies tomato leaf diseases, it has stricter requirements on image details. Therefore, a smaller 3*3 Gaussian filter kernel is used for denoising while retaining local details. After the 3*3 filter kernel processing, a 1*1 filter kernel is used. By combining the weighted sum between channels with a nonlinear activation function, the number of channels can be linearly transformed to adapt to the subsequent output.
[0055] Second feature extraction module: After processing by the convolution module above, local features have been initially extracted. Next, the Transformer extractor is used to further extract the global vector. The denoised feature image is first flattened and positionally embedded, converting the processed feature map into a feature vector format that can be processed by the Transformer Encoder. Next, the output feature vector (-1, 768, 14, 14) needs to be flattened after the second dimension using flatten(2).transpose(1,2), and then the 1st and 2nd dimensions are swapped to obtain a new feature vector (-1, 196, 768).
[0056] like Figure 4 As shown in the figure, after the feature map output by the above preliminary feature extraction is flattened, the input is embedded into a patch feature vector of (-1, 196, 768) through Patch-Embedding, and then passed through the Layer Norm and Dropout layers to obtain a feature vector of (-1, 197, 768). The processed features are then passed to the improved LSA Attention of the Encoder, in which the original self-attention is changed to LSA self-attention, and a zero mask zero_mask matrix is added.
[0057] The improved LSA Attention implementation process of the encoder is as follows: first, the input vector is linearly transformed to obtain qkv, and then the chunk function is used to split it into three parts, represented as query (q), key (K), and value (V). Then, the improved LSA attention is used to calculate the score, which is specifically expressed as follows:
[0058] First, the scaling factor scale is calculated and expanded. Next, a zero mask zero_mask is created. The purpose of this mask is to set the score of a specific position in the attention score to negative infinity to achieve local sensitive transformation. Then, the einsum function is used to calculate the dot product score dots between q and k, and multiply it by the scaling factor scale. The mask zeros_mask is used to set the score of the corresponding position in dots to negative infinity. The score is softmax-normalized using the self.attend function to obtain the attention weight attn. Next, the einsum function is used to calculate the weighted sum between the attention weight and the value v to obtain the output out. Finally, the dimension of out is adjusted using the rearrange function, and then linearly projected using self.to_out, and the output result is returned. The output vector is (-1, 197, 768).
[0059] After the self-attention process, the dropout transformation is performed, followed by a residual connection to connect the input features with the attention-processed features to better extract contextual information. LayerNorm, MLP Block, and dropout are then applied. Residual connections are also performed. Since the depth of this model is set to 3, only three stacking operations are required. The final output feature vector is (-1, 197, 768).
[0060] Finally, the classification token cls_token is added to the feature map through the created classifier. Next, the feature representation passes through the linear layer in the head to map it to the predefined number of categories. The mapping result is then probabilized through the constructed Softmax to obtain the probability distribution of each category.
[0061] Step 4: After the above-mentioned tomato leaf disease recognition method model based on VC-Net is constructed, the model will be trained based on the Mueller algorithm training module. Figure 5 As shown, the main structure of the Mueller algorithm adopted in the present invention uses the method of seeking similarities and differences of Mueller's five methods. Now let's explain this method. In a set of data, the method of using the difference between multiple adjacent numbers to reflect the similarity of this set of numbers is called Mueller's method.
[0062] The judgment targets of the present invention are the accuracy value Accuracy and the loss value Loss, and acc and loss are set as the output values of a given model. i and loss i are the values output on the training set for the i-th iteration (epoch), and are defined as:
[0063] acc_delta=|acc i+1 -acc i |;
[0064] loss_delta=|loss i+1 -loss i |
[0065] is the difference in the output values of the two iterations. Assuming the number k and the value ξ satisfy the condition P: if acc_delta and loss_delta are both less than or equal to ξ for k consecutive times, then the loss function tends to be smooth, that is, the model begins to converge, and the model training is stopped at this time.
[0066] During implementation, we first define empty lists of prev_loss and prve_acc. Then, at the start of model training, we calculate the difference between acc and loss. Based on the predefined K and ξ, we set K to 4 and ξ to 0.02 based on the dataset and model debugging. Each calculation result is compared with ξ. If it is less than or equal to ξ, we increment N by one and compare the result with K. If it is less than K, we calculate the difference in the next round and continue comparing it with ξ. If the difference is less than or equal to ξ for K consecutive times, the model has converged and training automatically terminates. Otherwise, N is cleared and the next round of comparisons is continued.
[0067] Step 5: Finally, the tomato leaf disease recognition model is iteratively trained using the Mueller algorithm module on the tomato leaf disease dataset. Parameters are continuously adjusted to obtain the optimal tomato leaf disease recognition model and Mueller algorithm-related parameter values. The model parameters are saved for testing to achieve classification of tomato leaf diseases.
[0068] In this task, there are 10 diseased images and one healthy tomato leaf image. Therefore, the cross-entropy loss function is used to measure the difference between the probability distribution of the model output and the true label, with the goal of minimizing this difference. SGD is used as the optimizer, a gradient-based optimization algorithm that updates the model parameters to minimize the loss function. The formula for gradient descent in the SGD optimizer is:
[0069]
[0070] Among them, i represents the back propagation layer, It represents the gradient of the error, which is then multiplied by the learning rate η to update the weights of the network.
[0071] Based on the same inventive concept, the present invention proposes a tomato leaf disease recognition method based on an improved visual Transformer and Mueller algorithm, including a proposed improved network model and a training module based on the Mueller algorithm, which can save time and cost in training while maintaining high accuracy.
[0072] The performance evaluation used in this invention refers to the common multi-classification task indicators as follows:
[0073] 1. Accuracy: Accuracy is the simplest and most intuitive evaluation indicator, indicating the ratio of the number of correctly classified samples to the total number of samples. The calculation formula is:
[0074]
[0075] 2. Recall: Recall measures the ratio of the number of correctly predicted positive examples to the number of true positive examples, that is, the ratio of the number of correctly predicted positive examples to the number of true positive examples. The calculation formula is:
[0076]
[0077] The choice of these metrics depends on the specific problem and task. Therefore, when evaluating model performance, it is usually necessary to comprehensively consider multiple metrics to evaluate the model's performance. Finally, the tomato leaf disease recognition model was used to classify tomato leaf diseases.
[0078] Table 1 Comparison of experimental results of the present invention and some network models
[0079] Model Name Epoch Accuracy VIT 120 97.55% Swin Transformer 120 98.35% Xception 120 98.56% Desnet 120 98.01% This invention (Mueller) 120(100) 99.53%
[0080] As shown in Table 1, the highest accuracy of tomato leaf disease identification using the present invention is about 99.53%. When the default epoch is 120, the Mueller algorithm training module is used to perform 100 rounds, the training has converged, and the training is automatically terminated. Figure 6 It can be seen that compared with some existing mainstream Transformer models and some CNN architecture network models, the Mueller method has higher accuracy and shorter training time.
[0081] The above embodiments are intended only to illustrate the technical concepts and features of the present invention. Their purpose is to enable those skilled in the art to understand the contents of the present invention and implement them accordingly. They are not intended to limit the scope of protection of the present invention. Any equivalent changes or modifications made in accordance with the spirit of the present invention are intended to be covered by the scope of protection of the present invention.
Claims
1. A tomato leaf disease identification method based on VC-Net and Mueller algorithm, characterized in that: The following steps are involved: Step 1: First, preprocess the tomato leaf disease image data, perform data enhancement on the tomato leaf disease images, and divide the dataset; Step 2: Use the Patch Embedding module in the visual Transformer to first divide each image input after step 1 into blocks; Step 3: Construct a network model based on VC-Net to extract features from the divided images. The VC-Net network model includes two feature extraction modules, a denoising module, and a classification output module. The first feature extraction module is a convolution feature extraction module, which is composed of 11 convolution blocks stacked together, and adds an SE attention mechanism after each convolution, while performing a linear residual connection. The second feature extraction module is an improved Encoder self-attention module, which is equipped with an improved multi-head self-attention, which changes the original self-attention to LSA self-attention and adds a zero mask zero_mask matrix. Step 4: Train the VC-Net-based network model in step 3 using the constructed Mueller algorithm-based training module, and analyze and judge the training loss and accuracy results using the Mueller algorithm-based training module; Step 5: Through iterative training on the tomato leaf disease dataset, the model parameters are continuously adjusted to obtain the optimal tomato leaf disease recognition model and save the model parameters for testing to achieve the classification of tomato leaf disease.
2. The tomato leaf disease identification method based on VC-Net and Mueller algorithm according to claim 1, characterized in that: The data preprocessing in step 1 is to divide the input image into data sets, randomly crop, horizontally flip and normalize them; and divide them into 11 categories of tomato leaf disease data sets according to the types of tomato leaf diseases, namely tomato bacterial spot, tomato early blight, tomato late blight, leaf mold, powdery mildew, tomato leaf spot, two-spotted spider mite disease, tomato leaf spot, tomato mosaic virus, yellow leaf curl virus and healthy tomato leaf disease.
3. The tomato leaf disease identification method based on VC-Net and Mueller algorithm according to claim 1, characterized in that: In step 2, the tomato leaf disease input image is first divided into blocks using the Patch Embedding module, and the pre-processed image is divided into 16x16 pixel blocks.
4. The tomato leaf disease identification method based on VC-Net and Mueller algorithm according to claim 1, characterized in that: The structures of the two feature extraction modules in step 3 are as follows: First, the convolution feature extraction module of the first feature extraction module includes: first performing two 3*3 convolution preliminary feature extractions, and then stacking two convolution block modules 11 times to form 11 convolution blocks; The first convolution Block1 executes separable convolution SeparableConv, SE attention module, Relu activation function, separable convolution SeparableConv, and MaxPooling in sequence, and repeats it 3 times; the second convolution Block2 executes Relu activation function, separable convolution SeparableConv, and SE attention module in sequence, and repeats it 8 times; The output sequence after convolution is then subjected to Gaussian denoising by the denoising module, and the image blocks are flattened by the PositionEmbedding layer. It is then input into the Transformer and the second feature extraction is performed in the Encoder. The improved Encoder self-attention module consists of Layer Norm, improved multi-head self-attention, Dropout, LayerNorm, MLP, and Dropout. The improved multi-head self-attention changes the original self-attention to LSA self-attention and adds a zero mask zero_mask matrix; the input and the output after Dropout are residually connected.
5. The tomato leaf disease identification method based on VC-Net and Mueller algorithm according to claim 4, characterized in that: The improved multi-head self-attention execution process is: First, the input vector is linearly transformed to obtain qkv, and then the chunk function is used to split it into three parts, represented as query q, key k and value v respectively; Then the improved LSA attention is used to calculate the score, which is specifically expressed as: Calculate the scaling factor scale, expand it, create a zero mask zero_mask, then use the einsum function to calculate the dot product score dots between q and k, and multiply it by the scaling factor scale, use the mask zeros_mask to set the score of the corresponding position in dots to negative infinity, and perform softmax normalization on the score through the self.attend function to obtain the attention weight attn; Next, use the einsum function to calculate the weighted sum between the attention weight and the value v to get the output out; Finally, the dimension of out is adjusted through the rearrange function, and then linear projection is performed through self.to_out, and the output result is returned.
6. The tomato leaf disease identification method based on VC-Net and Mueller algorithm according to claim 1, characterized in that: The Gaussian denoising module structure in step 3 is as follows: The Gaussian denoising module first performs a 3*3 convolution on the Gaussian filter, then performs two-dimensional normalization to keep the output dimension unchanged, then performs a Relu activation function and then a linear transformation through a 1*1 convolution layer, and finally repeats the BN layer and Relu layer.
7. A tomato leaf disease identification method based on VC-Net and Mueller algorithm according to any one of claims 1 to 6, characterized in that: The Mueller algorithm training structure of step 4 is as follows: A Mueller algorithm discrimination module is added to the traditional training module, wherein the Mueller algorithm discrimination module performs Mueller algorithm processing and comparison on the training accuracy results and losses of each round, judges the degree of convergence of the training based on the judgment results, and terminates after reaching convergence; the Mueller algorithm uses the method of seeking similarities and differences of Mueller's five methods, specifically: in a set of data, the difference between multiple adjacent numbers is used to reflect the similarity of this set of numbers.
Citation Information
Patent Citations
Mueller polarization technology-based biological tissue structure classification system
CN113628762A
Deep learning-based tomato disease and insect pest detection and identification method
CN116630803A