A method for segmenting cotton field Verticillium wilt lesions
By combining the CNN and Transformer modules and using the feature pyramid pooling module for multi-scale feature extraction and fusion, the problem of low spot segmentation accuracy and insufficient robustness in the existing technology is solved, and a more efficient field Verticillium wilt disease is achieved. Spot segmentation effect.
Patent Information
- Application Number
- CN202310816117.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-07-05
AI Technical Summary
Existing lesion segmentation solutions are difficult to label manually, have low efficiency, and low accuracy. Traditional CNN models have limitations in processing long-distance dependencies and sequence data, and non-end-to-end methods may lead to information loss and loss, and cannot fully Exploit correlation information between features.
A neural network model based on CNN-Transformer and feature pyramid modules is used to extract local features through multi-layer residual blocks, combined with the Transformer block for global feature fusion, and the feature pyramid pooling module is used for multi-scale feature extraction and fusion, combined with dual lines Segmentation is performed using a sexual interpolation upsampling method, and the model is trained to achieve more accurate lesion segmentation.
It improves the accuracy and robustness of field Verticillium wilt lesion segmentation, can better handle lesion areas of different scales and shapes, performs better than traditional methods, and has higher accuracy and robustness.
Smart Images

Figure CN116993756B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of agricultural disease detection, and in particular to a method for segmenting field cotton Verticillium wilt lesions. Background Art
[0002] The related patents for lesion segmentation in the prior art are as follows:
[0003] "A method for plant leaf lesion segmentation and recognition using a multi-scale deconvolution network" (application number: 202011047680.4, application date: 2020.09.29) uses a small amount of pixel-level labels to achieve end-to-end plant leaf lesion segmentation and recognition. First, a multi-scale feature extraction module is constructed using a multi-scale residual block to extract multi-scale disease features; then a classification and bridging module is introduced to obtain the activation map of a specific class. This activation map contains the key information of a specific category of lesions, which is upsampled to achieve lesion segmentation; finally, a deconvolution module is designed, combined with a small amount of lesion annotations to guide the feature extraction network to focus on the true location of the lesions, and further optimize the recognition and segmentation effects. It can be applied to the recognition and segmentation of plant leaf diseases where the number of pixel-level annotation samples is insufficient, and realizes the integration of recognition and segmentation. The model has strong robustness in disease images with insufficient light and noise interference.
[0004] "A method and system for segmenting an image of adhesion spots on cotton leaves" (application number: 201811061115.6, application date: 2018.09.12), the method includes: S1, obtaining the least squares circular error value of the connected component in the cotton lesion area image; S2, adjusting the h threshold of the H-minima method based on the least squares circular error value, and comparing the cotton lesion area image after transformation by the H-minima method with the h threshold until the number of minimum points changes, then performing distance transformation and watershed segmentation; S3, judging whether the least squares circular error value before watershed segmentation is greater than the least squares circular error value after watershed segmentation; if not, the segmentation ends and the lesion segmentation area is obtained; S4, marking the lesion segmentation area, and performing logical operations on the lesion segmentation area and the cotton lesion original image to obtain the adhesion lesion image segmentation result. The extraction of cotton lesion areas and the automatic segmentation of adhesion lesions can be realized, which is of great significance for the diagnosis of cotton diseases.
[0005] Through the above search and the patent literature listed above, it is not difficult to find that although there have been relevant patents for lesion segmentation based on CNN and traditional machine learning algorithms, there are some problems in terms of both design concept and technical effect.
[0006] ① The existing lesion segmentation scheme uses traditional machine learning algorithms and methods based on convolutional neural networks (CNN). Traditional machine learning segmentation methods are mainly manual annotation and threshold-based methods. These methods have problems such as difficulty in manual annotation, low efficiency, low accuracy, and being affected by factors such as lighting, and are difficult to meet the needs of large-scale data analysis. Traditional CNN models have some limitations when processing long-distance dependencies and sequence data. CNN is mainly suitable for processing local features and spatial relationships, and has weak modeling capabilities for global information.
[0007] ② The existing lesion segmentation scheme also adopts a non-end-to-end method that combines CNN with traditional machine learning algorithms. In the non-end-to-end method, CNN is responsible for extracting the underlying features of the image, while the traditional machine learning algorithm is responsible for further processing these features. This layered processing may lead to information loss. The quality and expressiveness of the underlying features have an important impact on the final segmentation results. If the underlying features are not accurate or rich enough, it may limit the performance of the overall algorithm. In addition, traditional machine learning algorithms have limitations on the coupling and dependency between features. This will cause the algorithm to be unable to fully utilize the relevant information between features, thereby limiting the improvement of segmentation performance. Summary of the invention
[0008] In order to overcome the deficiencies of the prior art, the present invention aims to provide a method for segmenting field cotton Verticillium wilt lesions.
[0009] To achieve the above object, the present invention provides the following solutions:
[0010] A method for segmenting field cotton Verticillium wilt lesions, comprising:
[0011] Acquire the image to be tested;
[0012] Inputting the image to be tested into a trained field Verticillium wilt lesion segmentation model to obtain a segmentation result;
[0013] The method for constructing the field Verticillium wilt lesion segmentation model comprises:
[0014] Performing image processing on a plurality of acquired cotton Verticillium wilt lesion images to obtain sample images;
[0015] The sample image is input into a CNN network with a multi-layer residual block for feature extraction, and a maximum pooling layer is used for dimensionality reduction to obtain a local feature map after dimensionality reduction;
[0016] The local feature map after dimensionality reduction is input into the feature map embedding module to obtain a one-dimensional vector with position information;
[0017] Input the one-dimensional vector into the Transformer block and repeat 12 times to obtain global feature fusion data, and adjust the global feature fusion data to obtain a two-dimensional global feature map;
[0018] Inputting the two-dimensional global feature map into a feature pyramid module to perform multi-scale feature extraction and fusion on the two-dimensional global feature map to obtain a feature map that fuses features of different scales;
[0019] The local feature map extracted by the CNN network with residual blocks in the last layer is concatenated with the feature map that fuses features of different scales, and aggregated by two-dimensional convolution. Then, the bilinear interpolation upsampling method is used to expand the aggregated feature map size space to the same size as the sample image to obtain the predicted image segmentation mask.
[0020] With the goal of minimizing the multi-classification loss function, the neural network model based on CNN-Transformer and feature pyramid modules was trained to obtain a trained field Verticillium wilt lesion segmentation model.
[0021] Preferably, the field Verticillium wilt lesion segmentation model includes CNN, Transformer, feature pyramid pooling module, channel fusion module for fusing the output feature map of the CNN network with the multi-scale features output by the feature pyramid module, and image segmentation network.
[0022] Preferably, the acquired multiple cotton Verticillium wilt lesion images are processed to obtain sample images, including:
[0023] Acquire a cotton Verticillium wilt lesion dataset; the cotton Verticillium wilt lesion dataset includes a plurality of cotton Verticillium wilt lesion images under a field background;
[0024] Lighting correction, image denoising, image annotation and image enhancement are performed on each of the cotton Verticillium wilt lesion images to obtain a plurality of sample images and corresponding real image Verticillium wilt lesion segmentation masks.
[0025] Preferably, the number of the residual blocks is 3.
[0026] Preferably, the sample image is input into a CNN network with a multi-layer residual block for feature extraction, and a maximum pooling layer is used for dimensionality reduction to obtain a local feature map after dimensionality reduction, including:
[0027] Inputting the sample image into the first residual block for feature extraction to obtain a first-layer local feature map;
[0028] Inputting the first layer of local feature maps into the second residual block for feature extraction to obtain a second layer of local feature maps;
[0029] Inputting the second layer local feature map into the third residual block for feature extraction to obtain a third layer local feature map;
[0030] The third layer local feature map is input into the maximum pooling layer, and the dimension of the third layer feature map is reduced to obtain the local feature map after dimension reduction.
[0031] Preferably, the local feature map after dimensionality reduction is input into a feature map embedding module to obtain a one-dimensional vector with position information, including:
[0032] Input the reduced-dimensional local feature map into the Patch_embeddings module, and divide the reduced-dimensional local feature map into small blocks of fixed size;
[0033] Flatten each small block to convert it into a vector;
[0034] Add each vector to the corresponding position encoding generated by the Position_embeddings module to obtain a one-dimensional vector with position information;
[0035] The one-dimensional vector data with position information is mapped to a vector space of another dimension through linear projection.
[0036] Preferably, the one-dimensional vector is input into the Transformer block and repeated 12 times to obtain global feature fusion data, and the global feature fusion data is adjusted to obtain a two-dimensional global feature map, including:
[0037] Input the one-dimensional vector obtained by linear projection mapping into the first LayerNorm layer to obtain the first layer normalized data;
[0038] Input the normalized data of the first layer into the Multi-Head Self-Attention layer to obtain the first layer of global feature data;
[0039] The first-layer global feature data is added and fused with the data inputted by the first LayerNorm layer to obtain the first-layer global feature fusion data;
[0040] Input the first layer global feature fusion data into the second LayerNorm layer to obtain the second layer normalized data;
[0041] Input the normalized data of the second layer into the MLP layer to obtain the second layer global feature fusion data;
[0042] Add the second layer global feature fusion data to the first layer global feature fusion data to obtain the third layer global feature fusion data;
[0043] The third layer global feature fusion data is input to the next Transformer Layer and repeated 12 times;
[0044] Adjust the global feature fusion data output by the last TransformerLayer to obtain a two-dimensional global feature map.
[0045] Preferably, the feature pyramid pooling module includes four MCBR layers, an upsampling layer, a 1×1 convolution layer and a skip connection; the MCBR layer includes a MaxPool layer, a convolution layer, a batch normalization layer and a ReLU activation function.
[0046] Preferably, the method for constructing the field Verticillium wilt lesion segmentation model further comprises:
[0047] The trained field Verticillium wilt lesion segmentation model is verified for accuracy to obtain a verified field Verticillium wilt lesion segmentation model.
[0048] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0049] The invention provides a field cotton Verticillium wilt lesion segmentation method, comprising: acquiring an image to be tested; inputting the image to be tested into a trained field cotton Verticillium wilt lesion segmentation model to obtain a segmentation result; the field cotton Verticillium wilt lesion segmentation model construction method comprises: performing image processing on a plurality of acquired cotton Verticillium wilt lesion images to obtain a sample image; inputting the sample image into a CNN network with a multi-layer residual block to perform feature extraction, and using a maximum pooling layer to perform dimensionality reduction to obtain a local feature map after dimensionality reduction; inputting the local feature map after dimensionality reduction into a feature map embedding module to obtain a one-dimensional vector with position information; inputting the one-dimensional vector into a Transformer block for 12 times to obtain global feature fusion data, and the global feature fusion is embedded in the model. The combined data is adjusted to obtain a two-dimensional global feature map; the two-dimensional global feature map is input into the feature pyramid module to extract and fuse multi-scale features of the two-dimensional global feature map to obtain a feature map that fuses features of different scales; the local feature map extracted by the CNN network with residual blocks in the last layer is channel-joined with the feature map that fuses features of different scales, and after two-dimensional convolution aggregation, the size space of the aggregated feature map is expanded to the same size as the sample image using a bilinear interpolation upsampling method to obtain a predicted image segmentation mask; with the goal of minimizing the multi-classification loss function, the neural network model based on the CNN-Transformer and feature pyramid modules is trained to obtain a trained field wilt lesion segmentation model. The present invention can more accurately segment field wilt lesions, has a certain robustness, and can cope with lesion areas of different scales and shapes. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0051] Figure 1 A flow chart of a method provided by an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of implementation steps provided for an embodiment of the present invention;
[0053] Figure 3 A diagram of a residual unit network structure provided in an embodiment of the present invention;
[0054] Figure 4 A structural diagram of a feature graph embedding module provided in an embodiment of the present invention;
[0055] Figure 5 A Transformer structure diagram provided for an embodiment of the present invention;
[0056] Figure 6 A network diagram of a feature pyramid pooling module provided by an embodiment of the present invention;
[0057] Figure 7 MCBR network structure diagram provided for an embodiment of the present invention;
[0058] Figure 8 A complete network model structure diagram provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] The present invention aims to provide a field cotton Verticillium wilt lesion segmentation method, which can more accurately segment field cotton Verticillium wilt lesions and has a certain robustness, and can cope with lesion areas of different scales and shapes.
[0061] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] Figure 1 A flow chart of a method provided by an embodiment of the present invention, such as Figure 1 As shown, the present invention provides a method for segmenting field cotton Verticillium wilt lesions, comprising:
[0063] Step 100: Acquire an image to be tested;
[0064] Step 200: inputting the image to be tested into a trained field Verticillium wilt lesion segmentation model to obtain a segmentation result;
[0065] The method for constructing the field Verticillium wilt lesion segmentation model comprises:
[0066] Step 201: performing image processing on the acquired multiple cotton Verticillium wilt lesion images to obtain sample images;
[0067] Step 202: input the sample image into a CNN network with multiple layers of residual blocks for feature extraction, and use a maximum pooling layer for dimensionality reduction to obtain a local feature map after dimensionality reduction;
[0068] Step 203: inputting the local feature map after dimensionality reduction into a feature map embedding module to obtain a one-dimensional vector with position information;
[0069] Step 204: input the one-dimensional vector into the Transformer block and repeat 12 times to obtain global feature fusion data, and adjust the global feature fusion data to obtain a two-dimensional global feature map;
[0070] Step 205: inputting the two-dimensional global feature map into a feature pyramid module to perform multi-scale feature extraction and fusion on the two-dimensional global feature map to obtain a feature map that fuses features of different scales;
[0071] Step 206: The local feature map extracted by the CNN network with the residual block of the last layer is channel-joined with the feature map integrating features of different scales, and aggregated by two-dimensional convolution. Then, the size space of the aggregated feature map is expanded to the same size as the sample image using the bilinear interpolation upsampling method to obtain the predicted image segmentation mask;
[0072] Step 207: With the goal of minimizing the multi-classification loss function, the neural network model based on the CNN-Transformer and feature pyramid modules is trained to obtain a trained field Verticillium wilt lesion segmentation model.
[0073] Figure 2 A schematic diagram of implementation steps provided for an embodiment of the present invention, such as Figure 2 As shown, the steps of this embodiment during specific implementation are as follows:
[0074] Step 1: Obtain a dataset of cotton Verticillium wilt lesions. The dataset includes multiple images of cotton Verticillium wilt lesions in a field background. Perform illumination correction, image denoising, image annotation and image enhancement on each field cotton Verticillium wilt lesion image in the leaf dataset to obtain multiple sample Verticillium wilt lesion images and corresponding real image Verticillium wilt lesion segmentation masks.
[0075] Step 2: Input each cotton Verticillium wilt lesion image into a multi-layer Residual unit CNN network for feature extraction to obtain a local feature map of each field cotton Verticillium wilt lesion image. The local feature map is input into a Maxpool layer to obtain a local feature map after dimensionality reduction. The local feature map after dimensionality reduction is embedded into the module to obtain a one-dimensional vector with position information. The one-dimensional vector is then input into the Transformer block for 12 times, and a one-dimensional vector of the same size as the original is output. The one-dimensional vector is reshaped into a two-dimensional global feature map.
[0076] Figure 3 A diagram of a residual unit network structure provided in an embodiment of the present invention. Figure 4 A structural diagram of a feature graph embedding module provided in an embodiment of the present invention, Figure 5 The Transformer structure diagram provided by the embodiment of the present invention. Figure 3 , Figure 4 and Figure 5 As shown, there are three Residual units, each of which contains three components: a convolutional layer consisting of two 1×1 convolutions and one 3×3 convolution, three group normalization (GN) layers and three ReLU activation functions, and a residual jump connection. The feature map embedding module structure contains a Patch_embeddings, a Position_embeddings, a Linear Projection, and a Flatten operation. There are 12 Transformer Layer network structures, each of which contains two residual modules. The first residual module contains a LayerNormalization and a Multi-Head Self-Attention (MSA) layer and a residual jump connection; the second residual module contains a LayerNormalization and an MLP layer and a residual jump connection.
[0077] Therefore, the field cotton Verticillium wilt lesion image is input into three Residual unit networks for feature extraction to obtain a local feature map, specifically including:
[0078] Step 2.1.1: Input the field cotton Verticillium wilt lesion image into the first Residual unit network module for feature extraction to obtain a first-layer local feature map.
[0079] Step 2.1.2: Input the first layer local feature map into the second Residual unit network module for feature extraction to obtain the second layer local feature map.
[0080] Step 2.1.3: Input the second layer local feature map into the third Residual unit network module for feature extraction to obtain the third layer local feature map.
[0081] Step 2.2.1: Input the third-layer local feature map into the Maxpool layer, and reduce the dimension of the third-layer feature map to obtain a reduced-dimensional local feature map.
[0082] Furthermore, the dimension-reduced local feature map is input into a feature map embedding module to obtain a one-dimensional vector with position information, specifically including:
[0083] Step 2.3.1: Input the reduced-dimensionality local feature map into the Patch_embeddings module, and divide the reduced-dimensionality local feature map into small patches (Patches) of fixed size.
[0084] Step 2.3.2: Each fixed block is converted into a vector after the Flatten operation.
[0085] Step 2.3.3: Add each vector to the corresponding position encoding generated by the Position_embeddings module to obtain one-dimensional vector data with position information.
[0086] Step 2.3.4: Map the one-dimensional vector data with position information into a vector space of another dimension through linear projection.
[0087] Input the one-dimensional vector obtained in step 2.3.4 into the TransformerLayer layer, repeat 12 times, obtain the global feature fusion data, and reshape the global feature fusion data into a two-dimensional global feature map. Each layer of TransformerLayer specifically includes:
[0088] Step 2.4.1: Input the one-dimensional vector obtained in step 2.3.4 (or the one-dimensional data output by the previous TransformerLayer) into the first LayerNorm layer to obtain the first layer normalized data.
[0089] Step 2.4.2: Input the normalized data of the first layer into the Multi-Head Self-Attention (MSA) layer to obtain the first layer of global feature data.
[0090] Step 2.4.3: Add and fuse the first-layer global feature data with the data input by the first LayerNorm layer to obtain the first-layer global feature fusion data.
[0091] Step 2.4.4: Input the first layer global feature fusion data into the second LayerNorm layer to obtain the second layer normalized data.
[0092] Step 2.4.5: Input the normalized data of the second layer into the MLP layer to obtain the second layer of global feature fusion data.
[0093] Step 2.4.6: Add the second layer global feature fusion data to the first layer global feature fusion data to obtain the third layer global feature fusion data.
[0094] Step 2.4.7: Input the third layer global feature fusion data into the next TransformerLayer and repeat 12 times.
[0095] Step 2.4.8: Reshape the global feature fusion data output by the last TransformerLayer into a two-dimensional global feature map.
[0096] Step 3: Input the two-dimensional global feature map into the feature pyramid module, perform multi-scale feature extraction and fusion on the two-dimensional global feature map, and obtain a feature map that integrates features of different scales.
[0097] Figure 6 A network diagram of a feature pyramid pooling module provided by an embodiment of the present invention, Figure 7 The MCBR network structure diagram provided by the embodiment of the present invention. Figure 6 and Figure 7As shown in the figure, the feature pyramid pooling module includes four MCBR layers, an upsample layer (Upsample layer), a 1×1 convolution layer and a jump connection. The MCBR layer includes a MaxPool layer, a convolution layer (Conv layer), a batch normalization layer (BatchNormalization, BN) and a ReLU activation function. First, the two-dimensional global feature map is input into four MCBR layers of different scales to obtain four multi-scale receptive field feature maps, and then the bilinear interpolation upsampling method is used to expand the spatial size of the four multi-scale receptive field feature maps to the same size as the two-dimensional global feature map. Then, the four feature maps containing multi-scale information and the two-dimensional global feature map are spliced in the channel dimension, and then 1×1 convolution is used for aggregation processing to obtain a feature map that integrates different scale features and different channel information.
[0098] Step 4: Concatenate the third-layer local feature map obtained in step 2.1.3 with the feature map obtained in step 3, perform two-dimensional convolution aggregation, and then use the bilinear interpolation upsampling method to expand the aggregated feature map size space to the same size as the input image to obtain the predicted image segmentation mask.
[0099] Figure 8 This is a complete network model structure diagram provided by the embodiment of the present invention. Figure 8 As shown, the third-layer local feature map obtained in step 2.1.3 is input into a 1×1 convolution for channel fusion to obtain a feature map of fused channel information. The spatial size of the feature map obtained in step 3 is expanded to the same size as the fused channel information feature map using the bilinear interpolation upsampling method, and then channel-joined with the fused channel information feature map. The obtained feature map is then aggregated by 3×3 convolution, batch normalized and input into the ReLU activation function, and then input into the Dropout layer. The bilinear interpolation upsampling method is then used to expand the spatial size of the feature map output by the dropout to the size of the input image to obtain the predicted image segmentation mask.
[0100] Step 5: With the goal of minimizing the multi-classification loss function (Cross EntropyLoss), the neural segmentation network is trained to obtain a field wilt lesion segmentation model. The field wilt lesion segmentation model includes CNN, Transformer, feature pyramid pooling module and image segmentation network.
[0101] The specific calculation formula of the multi-classification loss function (Cross EntropyLoss) is:
[0102]
[0103] Among them, K represents the total number of categories, y iRepresents the true label of the input sample, p i Represents the predicted value of the model for the sample as the i-th class. The goal of the loss function is to minimize the difference between the predicted value and the true value, so that the model's predicted value is closer to the true label. The gradient of the loss function for the model parameters is calculated through the back propagation algorithm, and the model parameters are updated.
[0104] Step 6: Evaluate the results predicted by the model using mIoU and mPA as evaluation indicators.
[0105] The calculation formula for IoU of each category is as follows:
[0106]
[0107] Among them, j represents the index of the category, TP j Indicates the number of pixels predicted to be the jth category and correctly classified, FP j FN represents the number of pixels predicted to be of the jth category but misclassified. j It represents the number of pixels in the jth category in the true label but not classified. mIoU is the average IoU of each category.
[0108] The calculation formula for PA in each category is as follows:
[0109]
[0110] Among them, j represents the index of the category, TP j Indicates the number of pixels predicted to be the jth category and correctly classified, FP j It represents the number of pixels predicted as the jth class but misclassified. mPA is the average PA of each class.
[0111] The present invention utilizes the CNN-Transformer fusion module, and one of the keys of the method is to combine the two methods of CNN and Transformer. CNN is used as the backbone network for local feature extraction, and the Transformer module is used for global context modeling of the features extracted by CNN. The fused architecture enables the model to capture local and global information at the same time, thereby improving the segmentation accuracy. Through the collaborative work of CNN and Transformer, the model can better understand the target and contextual relationship in the image, thereby improving the expressive power of the features. And the feature pyramid pooling module can adaptively pool feature information of different scales, thereby improving the richness and diversity of features. By performing pyramid pooling operations on features at different levels, the model can obtain multi-scale feature information and better adapt to lesions of different scales. In this embodiment, the low-level local features extracted by CNN are fused with the multi-scale global feature channels after Transformer and feature pyramid pooling, which can fuse low-level semantic information and high-level multi-scale global semantic information, thereby improving segmentation accuracy.
[0112] The beneficial effects of the present invention are as follows:
[0113] (1) Higher accuracy: The mIoU and mPA of this method for field wilt lesion data segmentation are 87.14 and 92.62 respectively, while the mIoU and mPA of PSPNet are 84.63 and 91.0 respectively, and the mIou and mPA of Unet are 86.1 and 91.7 respectively. From the perspective of mIoU and mPA, this method outperforms PSPNet and Unet. This is because this method uses a feature pyramid pooling module and a Transformer module, which can effectively extract and utilize multi-scale and cross-scale feature information, thereby improving the accuracy of segmentation.
[0114] (2) Capable of capturing global and local information: This method introduces the Transformer module, which weights the input features through the self-attention mechanism, thereby capturing global and local information. Such features help improve the accuracy of segmentation. The Transformer module can model the relationship between features and achieve more accurate segmentation by adaptively adjusting the importance of features.
[0115] (3) High robustness: Based on the feature pyramid pooling module, this method can fuse and filter multi-scale features to accurately segment lesions of different scales and sizes. This mechanism enhances the robustness of the model, enabling it to handle lesions of different sizes and shapes. Whether it is a small lesion or a large lesion, this method can effectively segment.
[0116] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0117] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for segmenting field cotton Verticillium wilt lesions, It is characterized in that include: Acquire the image to be tested; Inputting the image to be tested into a trained field Verticillium wilt lesion segmentation model to obtain a segmentation result; The method for constructing the field Verticillium wilt lesion segmentation model comprises: Performing image processing on a plurality of acquired cotton Verticillium wilt lesion images to obtain sample images; The sample image is input into a CNN network with a multi-layer residual block for feature extraction, and a maximum pooling layer is used for dimensionality reduction to obtain a local feature map after dimensionality reduction; The local feature map after dimensionality reduction is input into the feature map embedding module to obtain a one-dimensional vector with position information; Input the one-dimensional vector into the Transformer block and repeat 12 times to obtain global feature fusion data, and adjust the global feature fusion data to obtain a two-dimensional global feature map; Inputting the two-dimensional global feature map into a feature pyramid module to perform multi-scale feature extraction and fusion on the two-dimensional global feature map to obtain a feature map that fuses features of different scales; The local feature map extracted by the CNN network with residual blocks in the last layer is concatenated with the feature map that fuses features of different scales, and then aggregated by two-dimensional convolution. Then, the bilinear interpolation upsampling method is used to expand the aggregated feature map size space to the same size as the sample image to obtain the predicted image segmentation mask. With the goal of minimizing the multi-classification loss function, the neural network model based on CNN-Transformer and feature pyramid modules was trained to obtain a trained field Verticillium wilt lesion segmentation model. The reduced local feature map is input into the feature map embedding module to obtain a one-dimensional vector with position information, including: Input the reduced-dimensional local feature map into the Patch_embeddings module, and divide the reduced-dimensional local feature map into small blocks of fixed size; Flatten each small block to convert it into a vector; Add each vector to the corresponding position encoding generated by the Position_embeddings module to obtain a one-dimensional vector with position information; Map one-dimensional vector data with position information into another dimensional vector space through linear projection; The one-dimensional vector is input into the Transformer block and repeated 12 times to obtain global feature fusion data, and the global feature fusion data is adjusted to obtain a two-dimensional global feature map, including: Input the one-dimensional vector obtained by linear projection mapping into the first Layer Norm layer to obtain the first layer normalized data; Input the normalized data of the first layer into the Multi-Head Self-Attention layer to obtain the first layer of global feature data; The first-layer global feature data is added and fused with the data inputted by the first Layer Norm layer to obtain the first-layer global feature fusion data; Input the first layer global feature fusion data into the second Layer Norm layer to obtain the second layer normalized data; Input the normalized data of the second layer into the MLP layer to obtain the second layer global feature fusion data; Add the second layer global feature fusion data to the first layer global feature fusion data to obtain the third layer global feature fusion data; The third layer global feature fusion data is input to the next Transformer Layer and repeated 12 times; Adjust the global feature fusion data output by the last Transformer Layer to obtain a two-dimensional global feature map; The feature pyramid pooling module includes four MCBR layers, an upsampling layer, a 1×1 convolution layer, and a skip connection; the MCBR layer includes a MaxPool layer, a convolution layer, a batch normalization layer, and a ReLU activation function; The field Verticillium wilt lesion segmentation model includes CNN, Transformer, feature pyramid pooling module, channel fusion module for fusing the output feature map of the CNN network with the multi-scale features output by the feature pyramid module, and image segmentation network.
2. The method for segmenting field cotton Verticillium wilt lesions according to claim 1, It is characterized in that The obtained multiple cotton Verticillium wilt lesion images are processed to obtain sample images, including: Acquire a cotton Verticillium wilt lesion dataset; the cotton Verticillium wilt lesion dataset includes a plurality of cotton Verticillium wilt lesion images under a field background; Lighting correction, image denoising, image annotation and image enhancement are performed on each of the cotton Verticillium wilt lesion images to obtain a plurality of sample images and corresponding real image Verticillium wilt lesion segmentation masks.
3. The method for segmenting field cotton Verticillium wilt lesions according to claim 1, It is characterized in that The number of the residual blocks is 3.
4. The method for segmenting field cotton Verticillium wilt lesions according to claim 3, It is characterized in that The sample image is input into a CNN network with a multi-layer residual block for feature extraction, and a maximum pooling layer is used for dimensionality reduction to obtain a local feature map after dimensionality reduction, including: Inputting the sample image into the first residual block for feature extraction to obtain a first-layer local feature map; Inputting the first layer of local feature maps into the second residual block for feature extraction to obtain a second layer of local feature maps; Inputting the second layer local feature map into the third residual block for feature extraction to obtain a third layer local feature map; The third layer local feature map is input into the maximum pooling layer, and the dimension of the third layer local feature map is reduced to obtain a local feature map after dimension reduction.
5. The method for segmenting field cotton Verticillium wilt lesions according to claim 1, It is characterized in that The method for constructing the field Verticillium wilt lesion segmentation model also includes: The trained field Verticillium wilt lesion segmentation model is verified for accuracy to obtain a verified field Verticillium wilt lesion segmentation model.
Citation Information
Patent Citations
A cotton leaf adhesion lesion spot image segmentation method and system
CN109359653A
Method for realizing plant leaf scab segmentation and identification by multi-scale deconvolution network
CN112183635A
Multi-scale fusion landmark image retrieval method and system for feature consistency suggestion
CN114579794A
Food image segmentation method and system based on dynamic transformer
CN114648535A
U-shaped self-adaptive EST unmanned aerial vehicle remote sensing image segmentation method and system
CN115035131A
