A method for farmland crop recognition based on fusion of semantic segmentation and superpixel segmentation
By integrating semantic segmentation and superpixel segmentation in farmland scene image recognition, the problems of low recognition accuracy and poor edge segmentation effect in the prior art are solved, and more accurate and precise recognition of crop species in farmland images are achieved.
Patent Information
- Application Number
- CN202111330273.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-11-11
AI Technical Summary
The existing crop species recognition algorithm based on deep learning has problems such as low recognition accuracy, poor edge segmentation effect, and not suitable for scenes with complex crop species.
The method based on the fusion of semantic segmentation and superpixel segmentation is adopted, and image features are extracted and segmented through the semantic segmentation model (DeepLabV3+), and combined with the SLIC superpixel segmentation algorithm and the Threshold Voting algorithm, the results are fused to improve the recognition accuracy and edge segmentation effect.
It improves the accuracy of crop species recognition in farmland images, improves the object segmentation effect on complex edges, and is suitable for scenes with complex crop species.
Smart Images

Figure CN114067219B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing and application technology, and specifically relates to a method for identifying farmland crops based on the fusion of semantic segmentation and superpixel segmentation. Background Art
[0002] The current mainstream way to obtain agricultural data is to use remote sensing satellites and remote sensing images for agricultural monitoring, which has the characteristics of wide range, high dynamics and fast speed. However, factors such as complex and diverse cultivated land terrain, scattered cultivated land distribution and complex crop types have led to the inability of satellite remote sensing images to provide very refined agricultural images. In order to achieve precision agriculture, more refined agricultural data is needed as a supplement to satellite remote sensing images to ensure that every inch of cultivated land can be reasonably used. With the rapid development of technologies such as the Internet of Things, LBS, and big data, agricultural monitoring has long entered the era of big data. Ordinary users can also easily use mobile phones, cars, drones and other terminal devices with positioning functions to help collect and upload farmland images and geographic information. This way of obtaining information is called volunteered geographic information (VGI). The agricultural images obtained in this way have the advantages of easy acquisition, large data volume, accurate location and high resolution, which can provide a very rich data supplement for agricultural detection based on satellite remote sensing images.
[0003] While spontaneous geographic information has enriched the sources of agricultural data, it has also brought some problems. The main difficulty is that the agricultural images obtained through VGI are complex, the data volume is huge, and the image quality is uneven. If only relying on manual power, it would be too much work to extract effective information about crops and cultivated land from such a large number of farmland scene pictures. Therefore, it is necessary to use computers and corresponding image recognition algorithms to automatically identify crops in farmland images to improve the efficiency of obtaining agricultural information.
[0004] Deep learning technology has made some research progress in the field of crop recognition based on RGB images. Jiang Honghua (see Jiang Honghua, Zhang Chuanyin, Zhang Zhao, Mao Wenhua, Wang Dong, Wang Dongwei, Weed Detection Method in Corn Field Based on Mask R-CNN [J]. Transactions of the Chinese Society of Agricultural Machinery, 2020, 51(06): 220-228+247) et al. implemented a weed detection method in corn field based on Mask R-CNN target detection network, with a weed recognition rate of 91%. Wu F et al. collected a large number of farmland scene images through VGI, collected and sorted them into a farmland image dataset, and trained a classifier containing 5 common neural network classification models to classify the types of major crops in farmland images (see Wu F, Wu B, Zhang M, Zeng H, Tian F. Identification of Crop Type in Crowdsourced Road View Photos with Deep Convolutional Neural Network [J]. Sensors (Basel, Switzerland), 2021, 21(4)). Yan et al. used Google Street View image data to train a multi-layer neural network classification model that can identify crop types such as alfalfa, almonds, corn, cotton, grapes, soybeans, and pistachios (see Yulin Y, Youngryel R. Google street view and deep learning: a new ground truthing approach for crop mapping [J]. ArXiv preprint arXiv: 1912.05024, 2019). Ringland et al. trained a multi-classification network model based on Inception V3 to classify multiple types of roadside crops, with an average accuracy of 83.3% for multiple classifiers (see Ringland J, Bohm M, Baek S R. Characterization of food cultivation along roadside transects with Google Street View imagery and deep learning [J]. Computers and Electronics in Agriculture, 2019, 158: 36-50).
[0005] So far, domestic and foreign researchers have proposed many algorithms for crop recognition in RGB images, but there are still some defects: (1) There are very few datasets for pixel-level annotation of crop types in farmland images, and most research work focuses on simple classification of crops in farmland images or segmentation of single-type crop plants in farmland images; (2) The accuracy of crop type recognition in complex farmland scenes is not high enough; (3) The existing semantic segmentation network is not effective in segmenting objects with complex edges. The pixel-level classification capability provided by the semantic segmentation network and the precise segmentation of object edges by superpixel segmentation can overcome these shortcomings to a certain extent, but there is currently no relevant research on the method of using the fusion of semantic segmentation and superpixel segmentation to perform pixel-level crop type classification on RGB farmland images at home and abroad. Summary of the invention
[0006] The purpose of the present invention is to provide a farmland crop recognition method based on the fusion of semantic segmentation and superpixel segmentation, aiming to solve the technical problems of the existing algorithm for crop type recognition in farmland scene images based on deep learning, such as low type recognition accuracy, poor edge segmentation effect and unsuitability for scenes with complex crop types.
[0007] The specific technical solution for achieving the purpose of the present invention is:
[0008] A method for identifying farmland crops based on the fusion of semantic segmentation and superpixel segmentation, the method comprising the following specific steps:
[0009] Step 1: Image preprocessing: Screen the iCrop farmland image dataset, use image annotation tools to annotate the crop types that need to be identified in the screened farmland images, and divide the dataset into training set, validation set, and test set;
[0010] Step 2: Semantic segmentation model training: Use the training set and validation set annotated in step 1 to train the semantic segmentation model, and use the accuracy, recall, mean intersection over union (mIoU), F1-score, and Kappa as evaluation indicators to select the optimal semantic segmentation model parameters. The semantic segmentation model uses DeepLabV3+ as the basic framework, and the model includes an encoder and a decoder. When a farmland image is input into the semantic segmentation model, the encoder is first used to extract features from the image. The encoder includes:
[0011] (1) Backbone network Aligned Xception: The backbone network performs multi-layer convolution and downsampling on the input image to obtain image features of several layers with different sizes;
[0012] (2) Texture feature enhancement: Texture feature enhancement is used to extract the texture features of the input image and merge them with the image features extracted by the backbone network to obtain a feature map after texture feature enhancement.
[0013] (3) Multi-layer attention fusion: Using the feature maps of different sizes extracted by the backbone network, multi-layer attention features of the farmland image are extracted;
[0014] (4) Atrous Spatial Convolution Pooling Pyramid (ASPP): It uses atrous spatial convolution with different sampling rates to extract the contextual information of the input image.
[0015] After the encoder extracts the image features, the decoder will upsample and decode the image features extracted by the encoder twice to obtain the semantic coarse segmentation result;
[0016] Step 3: Semantic segmentation: Use the semantic segmentation model trained in step 2 to perform semantic segmentation on the test set obtained in step 1 to obtain a rough semantic segmentation result;
[0017] Step 4: Superpixel segmentation: Use the SLIC superpixel segmentation algorithm to perform superpixel segmentation on the test set obtained in step 1 to obtain the superpixel segmentation result;
[0018] Step 5: Result fusion: Use the Threshold Voting algorithm to fuse the semantic coarse segmentation result obtained in step 3 with the superpixel segmentation result obtained in step 4, and finally obtain the semantic fine segmentation recognition result of the farmland image.
[0019] The texture feature enhancement described in step 2 is as follows:
[0020] (1) Use 12 kinds of Gabor filters with convolution kernel sizes of 7, 11, and 15 and rotation angles θ of 0, π / 2, π, and 3π / 2 to extract the texture features of the input image, and obtain 12 texture feature maps with a size of 512×512. These 12 texture feature maps are concatenated together to obtain a texture feature map with a size of 12×512×512;
[0021] (2) The texture feature map with a size of 12×512×512 obtained in step (1) is input into the separable convolution layer. The output dimension of the separable convolution layer is 24, and the convolution kernel size is 3×3. It is then input into the activation layer and the maximum pooling layer in sequence to obtain a feature map with a size of 24×256×256.
[0022] (3) The feature map obtained in step (2) is sequentially input into the separable convolution layer, activation layer and maximum pooling layer with a dimension of 32 and kernel_size of 3×3 to obtain a feature map with a size of 32×64×64;
[0023] (4) The feature map obtained in step (3) is sequentially input into the separable convolution layer, activation layer and maximum pooling layer with a dimension of 32 and a kernel_size of 3×3 to obtain a 32×33×33 texture feature;
[0024] (5) The feature map of the input image extracted by the backbone network is fused with the texture features obtained in step (4) to obtain a feature map with enhanced texture features.
[0025] The specific steps of multi-layer attention fusion described in step 2 are as follows:
[0026] (1) Extract the feature map of size 64×257×257 from the backbone network, input it into the spatial attention mechanism and channel attention mechanism respectively, add the results of the two attention mechanisms, and then use the separable convolution layer with an output dimension of 64 and a kernel_size of 3×3, the separable convolution layer with an output dimension of 128 and a kernel_size of 3×3, and the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 to perform convolution in turn to obtain the first layer of attention features;
[0027] (2) Extract the feature map of size 128×129×129 from the backbone network, input it into the spatial attention mechanism and channel attention mechanism respectively, add the results of the two attention mechanisms, and then use the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3, and the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 to perform convolution in turn to obtain the second layer of attention features;
[0028] (3) Extract the feature map of size 256×65×65 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms and then use a separable convolutional layer with an output dimension of 256 and a kernel_size of 3×3 for convolution to obtain the third layer of attention features.
[0029] (4) Extract the feature map of size 728×33×33 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms and then perform convolution using a separable convolutional layer with an output dimension of 256 and a kernel_size of 1×1 to obtain the fourth layer of attention features.
[0030] (5) The four-layer attention features are fused and then convolved using a separable convolutional layer with an output dimension of 1024 and a kernel_size of 1×1 to obtain a multi-layer fused attention feature.
[0031] Step 5: Use the Threshold Voting algorithm to fuse the results. The specific steps are as follows:
[0032] (1) Traverse all superpixels according to the superpixel segmentation result obtained in step 4, and count the semantic rough segmentation result obtained in step 3 in the corresponding position of each superpixel, that is, count the number of pixel points belonging to each type of crop in each superpixel;
[0033] (2) Based on the statistical results of step (1), calculate the proportion of the number of pixels of each type of crop in each superpixel;
[0034] (3) While traversing each superpixel, the semantic coarse segmentation result of the corresponding position of the superpixel is determined based on the proportion of the number of pixels of each type of crop in the superpixel. If the proportion of pixels of a certain type of crop in the superpixel exceeds a threshold (Threshold>0.5), the semantic coarse segmentation result of the corresponding position of the superpixel is uniformly modified to that type of crop; if the proportion of pixels of no crop type in the superpixel exceeds the threshold, the semantic coarse segmentation result of the corresponding position of the superpixel is retained; after traversing all superpixels, the final semantic fine segmentation result is obtained.
[0035] Beneficial effects of the present invention:
[0036] The present invention introduces a texture feature enhancement module into the semantic segmentation network, increases the proportion of texture features in the backbone network, and solves the problem of inaccurate classification caused by the close color features between crop types in farmland scene images. The present invention takes into account the problem that crop plots in farmland images are scattered and difficult to identify, and introduces a multi-layer attention fusion module to strengthen the interdependence between crop plots of the same type in the global scope, as well as the interdependence between different feature channel dimensions at the same location, further improving the overall recognition accuracy of farmland images. The present invention uses the Threshold Voting algorithm to fuse the results of SLIC superpixel segmentation and semantic segmentation, improving the problem of inaccurate plot edge segmentation caused by downsampling in the semantic segmentation network. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a flow chart of the crop recognition method based on semantic segmentation and superpixel segmentation of the present invention;
[0038] Figure 2 Schematic diagram of the semantic segmentation network structure;
[0039] Figure 3 Schematic diagram of the structure for texture feature enhancement;
[0040] Figure 4Schematic diagram of the structure of multi-layer attention fusion;
[0041] Figure 5 This is a diagram of crop recognition results in Example 1 of the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical features and technical solutions of the present invention clearer and more specific, the present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0043] Example 1
[0044] The crop recognition method of RGB farmland images based on the fusion of semantic segmentation and superpixel segmentation is implemented by taking the iCrop farmland image dataset as an example. Figure 1 As shown, the specific implementation steps are as follows:
[0045] Step 1: Image preprocessing: Screen the iCrop farmland image dataset, remove duplicate, blurred, occluded and other unusable images, resize all images to 512×512, use the image annotation tool Labelme to annotate the five types of farmland crops (corn, rice, wheat, rapeseed and bare land) that need to be identified in the screened farmland images, and annotate the crop types that do not need to be identified as "others". Divide the annotated farmland image data into training set, validation set and test set in a ratio of 6:2:2;
[0046] Step 2: Semantic segmentation model training: Use the training set and validation set obtained in step 1 to train the semantic segmentation model, and obtain the optimal semantic segmentation model parameters through precision analysis;
[0047] Step 3: Semantic segmentation: Use the semantic segmentation model parameters trained in step 2 to perform coarse semantic segmentation on the test set obtained in step 1. The semantic segmentation network structure is as follows: Figure 2 As shown, the specific operation steps of the semantic segmentation network are as follows:
[0048] (1) Send the farmland image to the backbone network to extract image features;
[0049] (2) At the same time, the input image will also be sent to the texture feature enhancement module, and the Gabor filter will be used to obtain the multi-scale texture features of the farmland image;
[0050] (3) The multi-layer attention fusion module obtains feature maps of 4 layers of different scales from the backbone network and obtains multi-layer attention features;
[0051] (4) The four groups of attention features obtained in step (3) are combined with the image features extracted by the backbone network in step (1) and the multi-scale texture features obtained in step (2) for feature fusion;
[0052] (5) Input the result of feature fusion obtained in step (4) into ASPP to obtain features under multi-scale receptive fields;
[0053] (6) The decoder obtains a set of feature maps of a specific size from the backbone network and passes through a layer of separable convolution. At the same time, the output of step (5) is upsampled to the same size, and the two are feature fused. After passing through a separable convolution layer and 4 times upsampling, a coarse semantic segmentation result is obtained.
[0054] Texture feature enhancement structure such as Figure 3 The specific steps are as follows:
[0055] (1) Use 12 kinds of Gabor filters with convolution kernel sizes of 7, 11, and 15 and rotation angles θ of 0, π / 2, π, and 3π / 2 to extract the texture features of the input image, and obtain 12 texture feature maps with a size of 512×512. These 12 texture feature maps are concatenated together to obtain a texture feature map with a size of 12×512×512;
[0056] (2) The texture feature map with a size of 12×512×512 obtained in step (1) is input into the separable convolution layer. The output dimension of the separable convolution layer is 24, and the convolution kernel size is 3×3. It is then input into the activation layer and the maximum pooling layer in sequence to obtain a feature map with a size of 24×256×256.
[0057] (3) The feature map obtained in step (2) is sequentially input into the separable convolution layer, activation layer and maximum pooling layer with a dimension of 32 and kernel_size of 3×3 to obtain a feature map with a size of 32×64×64;
[0058] (4) The feature map obtained in step (3) is sequentially input into the separable convolution layer, activation layer and maximum pooling layer with a dimension of 32 and a kernel_size of 3×3 to obtain a 32×33×33 texture feature;
[0059] (5) The feature map of the input image extracted by the backbone network is fused with the texture features obtained in step (4) to obtain a feature map with enhanced texture features.
[0060] The structure of the multi-layer attention fusion module is as follows Figure 4 The specific steps are as follows:
[0061] (1) Extract the feature map of size 64×257×257 from the backbone network, input it into the spatial attention mechanism and channel attention mechanism respectively, add the results of the two attention mechanisms, and then use the separable convolution layer with an output dimension of 64 and a kernel_size of 3×3, the separable convolution layer with an output dimension of 128 and a kernel_size of 3×3, and the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 to perform convolution in turn to obtain the first layer of attention features;
[0062] (2) Extract the feature map of size 128×129×129 from the backbone network, input it into the spatial attention mechanism and channel attention mechanism respectively, add the results of the two attention mechanisms, and then use the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3, and the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 to perform convolution in turn to obtain the second layer of attention features;
[0063] (3) Extract the feature map of size 256×65×65 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms and then use a separable convolutional layer with an output dimension of 256 and a kernel_size of 3×3 for convolution to obtain the third layer of attention features.
[0064] (4) Extract the feature map of size 728×33×33 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms and then perform convolution using a separable convolutional layer with an output dimension of 256 and a kernel_size of 1×1 to obtain the fourth layer of attention features.
[0065] (5) The four-layer attention features are fused and then convolved using a separable convolutional layer with an output dimension of 1024 and a kernel_size of 1×1 to obtain a multi-layer fused attention feature.
[0066] Step 4: Superpixel segmentation: Use the SLIC superpixel segmentation algorithm to perform superpixel segmentation on the test image, and divide the input image of size 512×512 into 1000 superpixels;
[0067] Step 5: Result fusion: Use the Threshold Voting algorithm to fuse the semantic coarse segmentation result obtained in step 3 with the superpixel segmentation result obtained in step 4 to obtain the final semantic fine segmentation result. The fusion algorithm steps are as follows:
[0068] (1) Traverse all superpixels according to the superpixel segmentation result obtained in step 4, and count the semantic rough segmentation result obtained in step 3 in the corresponding position of each superpixel, that is, count the number of pixel points belonging to each type of crop in each superpixel;
[0069] (2) Based on the statistical results of step (1), calculate the proportion of the number of pixels of each type of crop in each superpixel;
[0070] (3) While traversing each superpixel, determine whether to modify the semantic coarse segmentation result of the superpixel corresponding position according to the proportion of the number of each type of crop pixel points in the superpixel. If the proportion of pixel points of a certain type of crop in the superpixel exceeds the threshold (Threshold = 0.7), the semantic coarse segmentation result of the superpixel corresponding position is uniformly modified to the type of crop; if the proportion of pixel points of no crop type in the superpixel exceeds the threshold, the semantic coarse segmentation result of the superpixel corresponding position is maintained without modification. After traversing all superpixels, the final semantic fine segmentation result is obtained.
[0071] Using the above method, the semantic segmentation network model is trained and the input test set farmland images are recognized to obtain the following Figure 5 The recognition results shown in the figure, where (a) is the input farmland image to be identified, (b) is the true distribution (GT) of farmland crop types, (c) is the semantic segmentation result, and (d) is the final recognition result that combines semantic segmentation and superpixel segmentation. In (b), (c), and (d), black represents the background, dark gray represents wheat, and light gray represents other plant types that do not need to be identified.
[0072] The present invention is suitable for identifying various types of crops in RGB farmland images. According to the above-mentioned crop identification process, crop plots in farmland images can be segmented more accurately according to different types.
Claims
1. A method for farmland crop recognition based on the fusion of semantic segmentation and superpixel segmentation, characterized in that: The method comprises the following specific steps: Step 1: Image preprocessing: Screen the iCrop farmland image dataset, use image annotation tools to annotate the crop types that need to be identified in the screened farmland images, and divide the dataset into training set, validation set, and test set; Step 2: Semantic segmentation model training: Use the training set and validation set annotated in step 1 to train the semantic segmentation model, and use the accuracy, recall, mean intersection over union (mIoU), F1-score, and Kappa as evaluation indicators to select the optimal semantic segmentation model parameters. The semantic segmentation model uses DeepLabV3+ as the basic framework, and the model includes an encoder and a decoder; When a farmland image is input into the semantic segmentation model, an encoder is first used to extract features from the image. The encoder includes: (1) Backbone network Aligned Xception: The backbone network performs multi-layer convolution and downsampling on the input image to obtain image features of several layers with different sizes; (2) Texture feature enhancement: Texture feature enhancement is used to extract the texture features of the input image and merge them with the image features extracted by the backbone network to obtain a feature map after texture feature enhancement. (3) Multi-layer attention fusion: Using feature maps of different sizes extracted by the backbone network, we extract multi-layer attention features of farmland images. (4) Atrous Spatial Convolution Pooling Pyramid (ASPP): It uses atrous spatial convolutions with different sampling rates to extract contextual information of the input image. After the encoder extracts the image features, the decoder will upsample and decode the image features extracted by the encoder twice to obtain the semantic coarse segmentation result; Step 3: Semantic segmentation: Use the semantic segmentation model trained in step 2 to perform semantic segmentation on the test set obtained in step 1 to obtain a rough semantic segmentation result; Step 4: Superpixel segmentation: Use the SLIC superpixel segmentation algorithm to perform superpixel segmentation on the test set obtained in step 1 to obtain the superpixel segmentation result; Step 5: Result fusion: Use the Threshold Voting algorithm to fuse the semantic coarse segmentation result obtained in step 3 with the superpixel segmentation result obtained in step 4, and finally obtain the semantic fine segmentation recognition result of the farmland image.
2. The method for farmland crop recognition based on the fusion of semantic segmentation and superpixel segmentation according to claim 1, characterized in that: The texture feature enhancement described in step 2 is as follows: (1) Use 12 types of Gabor filters with convolution kernel sizes of 7, 11, and 15 and rotation angles θ of 0, π / 2, π, and 3π / 2 to extract the texture features of the input image, and obtain 12 texture feature maps with a size of 512×512. These 12 texture feature maps are concatenated together to obtain a texture feature map with a size of 12×512×512; (2) The texture feature map of size 12×512×512 obtained in step (1) is input into the separable convolution layer. The output dimension of the separable convolution layer is 24, and the convolution kernel size is 3×3. It is then input into the activation layer and the maximum pooling layer in sequence to obtain a feature map of size 24×256×256. (3) The feature map obtained in step (2) is input into the separable convolution layer, activation layer and maximum pooling layer with a dimension of 32 and a kernel_size of 3×3 in sequence to obtain a feature map with a size of 32×64×64; (4) The feature map obtained in step (3) is input into the separable convolution layer, activation layer and maximum pooling layer with dimension 32 and kernel_size 3×3 in sequence to obtain a 32×33×33 texture feature; (5) The feature map of the input image extracted by the backbone network is fused with the texture features obtained in step (4) to obtain a feature map with enhanced texture features.
3. The method for farmland crop recognition based on the fusion of semantic segmentation and superpixel segmentation according to claim 1, characterized in that: The specific steps of multi-layer attention fusion described in step 2 are as follows: (1) Extract the feature map of size 64×257×257 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms, and then use the separable convolution layer with an output dimension of 64 and a kernel_size of 3×3, the separable convolution layer with an output dimension of 128 and a kernel_size of 3×3, and the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 to perform convolution in turn to obtain the first layer of attention features; (2) Extract the feature map of size 128×129×129 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms, and then use the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 and the separable convolution layer with an output dimension of 256 and a kernel_size of 3×3 to perform convolution in turn to obtain the second layer of attention features; (3) Extract the feature map of size 256×65×65 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms and then perform convolution using a separable convolutional layer with an output dimension of 256 and a kernel_size of 3×3 to obtain the third layer of attention features. (4) Extract the feature map of size 728×33×33 from the backbone network and input it into the spatial attention mechanism and channel attention mechanism respectively. Add the results of the two attention mechanisms and then perform convolution using a separable convolutional layer with an output dimension of 256 and a kernel_size of 1×1 to obtain the fourth layer of attention features. (5) The four-layer attention features are fused and then convolved using a separable convolutional layer with an output dimension of 1024 and a kernel_size of 1×1 to obtain a multi-layer fused attention feature.
4. The method for farmland crop recognition based on the fusion of semantic segmentation and superpixel segmentation according to claim 1, characterized in that: Step 5: Use the Threshold Voting algorithm to fuse the results. The specific steps are as follows: (1) Traverse all superpixels according to the superpixel segmentation results obtained in step 4, and count the semantic rough segmentation results obtained in step 3 at the corresponding position of each superpixel, that is, count the number of pixels belonging to each type of crop in each superpixel; (2) Based on the statistical results of step (1), calculate the proportion of the number of pixels of each type of crop in each superpixel; (3) While traversing each superpixel, determine whether to modify the semantic coarse segmentation result of the superpixel corresponding position based on the proportion of the number of pixels of each type of crop in the superpixel. If the proportion of pixels of a certain type of crop in the superpixel exceeds the threshold, the semantic coarse segmentation result of the superpixel corresponding position is uniformly modified to that type of crop; if the proportion of pixels of no crop type in the superpixel exceeds the threshold, the semantic coarse segmentation result of the superpixel corresponding position is retained; after traversing all superpixels, the final semantic fine segmentation result is obtained.