Automatic extraction method and system of terraced fields based on deep learning semantic segmentation model
Through the improved LinkNet semantic segmentation model, combined with texture enhancement and spatial hole pyramid modules, the problem of blurring edge features of the third type of terraces in terrace remote sensing feature extraction is solved, and the accuracy and image quality of terrace classification are improved.
Patent Information
- Application Number
- CN202410210468.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-26
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-02-26
AI Technical Summary
Existing semantic segmentation models perform poorly in extracting terraced remote sensing features, especially the third type of terraces, which have unclear edge features, rough texture features and no obvious boundaries, resulting in low classification accuracy.
Using the improved LinkNet semantic segmentation model, combined with the starting module, encoder-decoder structure, texture enhancement module and spatial hole pyramid module, the average pooling layer is used to reduce the loss of detail information, and the texture enhancement and spatial attention mechanisms are introduced to enhance texture features. and reduce misclassification.
It improves the segmentation accuracy of terraces, especially the extraction effect of the third type of terraces, reduces misclassification, enhances the model's ability to capture texture and contextual features, and improves image quality.
Smart Images

Figure CN118115889B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method and system for automatically extracting terraces based on a deep learning semantic segmentation model. Background Art
[0002] Soil and water conservation measures are a series of measures taken to protect and improve soil quality, reduce soil erosion, and maintain the rational use of water resources, including soil and water conservation engineering measures, farming measures, and biological measures. Accurately identifying different types of soil and water conservation measures and their spatial distribution is the key to in-depth research on regional soil and water loss laws, systematic evaluation of soil and water conservation benefits, and scientific dynamic monitoring of soil and water loss.
[0003] Terraces are a type of soil and water conservation engineering measure with a long history and wide application. Traditional terrace information statistics are mainly achieved through field surveys, but manual statistics are time-consuming and laborious. With the continuous development of high-resolution image processing technology, the use of high-resolution remote sensing images to extract terrace information has matured.
[0004] In recent years, with the rapid improvement of computer hardware performance and the optimization and development of algorithms, artificial intelligence technologies represented by deep learning have gradually been applied in remote sensing image classification and object extraction, and have shown characteristics such as fastness and efficiency. At the same time, with the continuous expansion of the depth and breadth of convolutional neural networks, various optimization methods and network model structures have been developed and applied on primary network models, and advanced convolutional neural network models have been combined with comprehensive knowledge in the field of remote sensing, which has continuously improved the classification and extraction performance of remote sensing images.
[0005] The current mainstream semantic segmentation models include Deep-Lab, FCN, U-Net, PSP-Net, etc. After transfer learning and model adaptive scene adjustment, they can be applied to the recognition and extraction of various remote sensing object categories. They are mainly concentrated in the extraction of object categories such as roads, water bodies, and cultivated land. There are relatively few remote sensing object extractions for terraces. Summary of the invention
[0006] The main purpose of the present invention is to provide a method and system for automatic extraction of terraces based on a deep learning semantic segmentation model, which can improve the classification and extraction performance of terrace remote sensing images.
[0007] The technical solution adopted by the present invention is:
[0008] A method for automatically extracting terraces based on a deep learning semantic segmentation model is provided, comprising the following steps:
[0009] Obtain the visible light remote sensing image of the terraced field to be extracted, and crop it into multiple regular images of the same size;
[0010] According to the edge features, texture features and morphological features of the terraces, the cropped images are divided into the first type of terraces, the second type of terraces and the third type of terraces; the first type of terraces have clear edge features, obvious texture features, and a relatively small aspect ratio; the second type of terraces have clear edge features, obvious texture features, and a small and narrow shape; the third type of terraces have unclear edge features, rough texture features and no obvious boundaries;
[0011] The first and second types of terraces are extracted by using a pre-set U-Net model to obtain the extracted images of the first and second types of terraces;
[0012] The third type of terraces are extracted by using the pre-trained improved LinkNet semantic segmentation model to obtain the extracted images of the third type of terraces;
[0013] Among them, the improved LinkNet semantic segmentation model includes a starting module, four pairs of encoder-decoder structures and a terminal module; the first pooling layer of the starting module is an average pooling layer to reduce the loss of detail features; a channel attention mechanism is added between each pair of encoder-decoder structures, and a high-order feature extraction module is added between the fourth pair of encoder-decoder structures; the high-order feature extraction module includes a texture enhancement module and a spatial hole pyramid module, and the feature map of the output of the fourth pair of encoder-decoder structures is enhanced at multiple levels through the texture enhancement module; the spatial hole pyramid module introduces a spatial attention mechanism SAM based on the traditional ASPP module, specifically, 4 parallel convolution branches and 1 global average pooling branch are set on the output after feature enhancement by the texture enhancement module to learn high-level multi-scale features, the 4 parallel convolution branches include 1 convolution branch and 3 hole convolution branches, the expansion rate of the hole convolution branch gradually increases, and the spatial attention module is applied to the 3 hole convolution branches respectively.
[0014] Following the above technical solution, in the spatial attention mechanism SAM, the four parallel convolution branches include one 1×1 convolution branch and three 3×3 dilated convolution branches, and the expansion rates of the dilated convolution branches are set to 6, 12, and 18, respectively.
[0015] Following the above technical solution, the texture enhancement module performs 5 levels of feature enhancement on the input feature map as follows: the first layer only uses 1×1 convolution for calculation; then uses four parallel dilation convolutions with dilation rates of {1, 3, 5, 7}, and reduces the number of channels to 1 / 4 of the original number of channels: the first layer uses 1×1 convolution and then enlarges the feature map; the second layer first performs 1×1 convolution, then uses 1×3 and 3×1 convolutions, and finally enlarges the feature map; the third layer first performs 1×1 convolution, then uses 1×5 and 5×1 convolutions, and finally enlarges the feature map; the fourth layer first performs 1×1 convolution, then uses 1×7 and 7×1 convolutions to splice 4 levels of feature maps, and adds them to the feature map after 1×1 convolution.
[0016] Following the above technical solution, the acquisition of the sample set for model training mainly includes the following steps:
[0017] Manual visual interpretation was performed on the high-resolution RGB visible light remote sensing images of the survey area in multiple phases, and vector annotation was performed on the terraced areas to generate binary images in PNG format, with the terraced value as "1" and the non-terraced value (background value) as "0";
[0018] The remote sensing images were cropped regularly to generate several PNG format images with a size of 512×512 pixels, and three terrace sample sets were formed according to different terrace types.
[0019] Perform image rotation, dislocation transformation, brightness adjustment, and random erasure on sample images to improve the quantity and quality of training samples;
[0020] Set the area ratio of terraced fields to non-terraced fields, and remove sample images with an area ratio of terraced fields to non-terraced fields less than 0.2;
[0021] The three terrace sample sets were divided into training set, test set and validation set in a ratio of 7:1:2.
[0022] Following the above technical solution, the intersection over union (IoU), pixel accuracy (PA) and Kappa coefficient are used to evaluate the model segmentation results.
[0023] Following the above technical solution, when training the model, four hyperparameters are selected: batch size, learning rate, weighted crossentropyloss loss function and AdaGrad optimizer for model optimization.
[0024] When the batch size is used for parameter adjustment during training, the batch size is set at 128 as the dividing line. The test results are compared after training by decreasing the batch size (×0.5) and increasing it (×2). If the decreasing result is better, increase it by ×0.5 again until the result no longer improves.
[0025] When using the learning rate for parameter adjustment, use a non-fixed learning rate and set 0.01 as the initial learning rate. After each iteration, use the estimated model parameters to view the value of the error function. If the error rate is reduced compared to the previous iteration, increase the learning rate, otherwise decrease the learning rate.
[0026] Following the above technical solution, the method further comprises the steps of:
[0027] Perform median filtering on the images extracted from the three types of terraces;
[0028] The filtered images are stitched together to obtain a complete terrace distribution map.
[0029] The present invention also provides a terrace automatic extraction system based on a deep learning semantic segmentation model, comprising:
[0030] An image acquisition module is used to acquire the visible light remote sensing image of the terraced field to be extracted and crop it into multiple regular images of the same size;
[0031] The preliminary classification module is used to classify the cropped images into the first type of terraces, the second type of terraces and the third type of terraces according to the edge features, texture features and morphological features of the terraces. The first type of terraces have clear edge features, obvious texture features and a relatively small aspect ratio in terms of morphology. The second type of terraces have clear edge features, obvious texture features and a small and narrow shape. The third type of terraces have unclear edge features, rough texture features and no obvious boundaries.
[0032] The first terrace extraction module is used to extract the first type of terraces and the second type of terraces through a preset U-Net model to obtain extracted images of the first type of terraces and the second type of terraces;
[0033] The second terrace extraction module is used to extract the third type of terraces by using a pre-trained improved LinkNet semantic segmentation model to obtain an image of the third type of terraces after extraction;
[0034] Among them, the improved LinkNet semantic segmentation model includes a starting module, four pairs of encoder-decoder structures and a terminal module; the first pooling layer of the starting module is an average pooling layer to reduce the loss of detail features; a channel attention mechanism is added between each pair of encoder-decoder structures, and a high-order feature extraction module is added between the fourth pair of encoder-decoder structures; the high-order feature extraction module includes a texture enhancement module and a spatial hole pyramid module, and the feature map of the output of the fourth pair of encoder-decoder structures is enhanced at multiple levels through the texture enhancement module; the spatial hole pyramid module introduces a spatial attention mechanism SAM based on the traditional ASPP module, specifically, 4 parallel convolution branches and 1 global average pooling branch are set on the output after feature enhancement by the texture enhancement module to learn high-level multi-scale features, the 4 parallel convolution branches include 1 convolution branch and 3 hole convolution branches, the expansion rate of the hole convolution branch gradually increases, and the spatial attention module is applied to the 3 hole convolution branches respectively.
[0035] Following the above technical solution, the system also includes:
[0036] A filtering module is used to perform median filtering on the images extracted from the three types of terraces;
[0037] The stitching module is used to stitch the filtered images to obtain a complete terrace distribution map.
[0038] Following the above technical solution, in the spatial attention mechanism SAM, the four parallel convolution branches include one 1×1 convolution branch and three 3×3 dilated convolution branches, and the expansion rates of the dilated convolution branches are set to 6, 12, and 18, respectively.
[0039] The present invention also provides a computer storage medium, which stores a computer program that can be executed by a processor, and the computer program executes the automatic terrace extraction method based on the deep learning semantic segmentation model described in the above technical solution.
[0040] The beneficial effects of the present invention are as follows: the present invention preliminarily classifies the features of terraces, and uses differentiated deep learning models for different types of terraces, and selects appropriate deep learning network models according to the features of different types of terraces. In particular, for the third type of terraces with unclear edge features, rough texture features and no obvious boundaries, they are extracted through an improved LinkNet semantic segmentation model. In the improved model, the maximum pooling layer in the starting module is modified to an average pooling layer to reduce the loss of detail information in the feature map. In addition, a texture enhancement module (TEM) and a spatial void pyramid module (SAM-ASPP) are introduced in the central area of the model to enhance the texture features of the third type of terraces, increase the receptive field to achieve a dense feature sampling effect, and reduce the information loss caused by upsampling; and the channel attention mechanism is used to perform channel weighting on the feature maps generated by each feature encoding layer to reduce the interference of irrelevant features, thereby improving the segmentation accuracy of the terraces.
[0041] Furthermore, by setting dilated convolutions with different dilation rates in the spatial atrous pyramid module, the grouped receptive fields of different sizes in the human visual system are imitated, so that the module can capture the fine-grained texture of the terraces and amplify the contextual clues in feature recognition, thereby reducing the misclassification of the third type of terraces.
[0042] Furthermore, the present invention uses median filtering technology to post-process the model output image. In median filtering, the gray value of each pixel will be replaced by the median of the gray values of all pixels in its neighborhood. This method is very effective in removing salt and pepper noise or other types of impulse noise while retaining the edge information of the image. Therefore, the present invention uses this technology to improve the segmentation results and enhance the image quality.
[0043] Furthermore, compared with the traditional method, the present invention fully considers the characteristics of seasonal changes of crops in some terraces and uses high-resolution remote sensing images of the study area in different seasons.
[0044] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 This is the process of an automatic terrace extraction method based on a deep learning semantic segmentation model in an embodiment of the present invention Figure 1 ;
[0047] Figure 2 This is the process of an automatic terrace extraction method based on a deep learning semantic segmentation model in an embodiment of the present invention Figure 2 ;
[0048] Figure 3 It is a schematic diagram of the deep learning model training and prediction process according to an embodiment of the present invention;
[0049] Figure 4 1 is a schematic diagram of the structure of a semantic segmentation model of LinkNet improved according to an embodiment of the present invention;
[0050] Figure 5 1 is a schematic diagram of the structure of an encoder and a decoder in an improved LinkNet semantic segmentation model according to an embodiment of the present invention;
[0051] Figure 6 is a structural diagram of a channel attention mechanism according to an embodiment of the present invention;
[0052] Figure 7 is a structural diagram of a texture enhancement module according to an embodiment of the present invention;
[0053] Figure 8 is a structural diagram of a spatial attention mechanism according to an embodiment of the present invention;
[0054] Fig. 9 It is a structural diagram of a spatial void pyramid module (SAM-ASPP) according to an embodiment of the present invention;
[0055] Fig.10 This is a result map of terraced fields classification in Panjiawan Village, Baimiaohe Town, Luotian County, Huanggang City, Hubei Province, according to an embodiment of the present invention;
[0056] Fig.11 It is a structural schematic diagram of an automatic terrace extraction system based on a deep learning semantic segmentation model according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0058] It should be noted that the illustrations provided in the embodiments of the present invention are only used to illustrate the basic concept of the present invention in a schematic manner. Therefore, the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout type may also be more complicated.
[0059] In the present invention, it is also necessary to explain that, if the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, if the terms "first" and "second" appear, they are only used for description and distinction purposes, and cannot be understood as indicating or implying relative importance.
[0060] Example 1
[0061] like Figure 1 As shown, the automatic terrace extraction method based on the deep learning semantic segmentation model in the embodiment of the present invention includes the following steps:
[0062] S1, obtaining a visible light remote sensing image of the terraced field to be extracted, and cutting it into multiple regular images of the same size;
[0063] S2. According to the edge features, texture features and morphological features of the terraces, the cropped images are divided into the first type of terraces, the second type of terraces and the third type of terraces; the first type of terraces have clear edge features, obvious texture features, and a relatively small aspect ratio; the second type of terraces have clear edge features, obvious texture features, and a small and narrow shape; the third type of terraces have unclear edge features, rough texture features and no obvious boundaries;
[0064] S3, extracting the first type of terraced fields and the second type of terraced fields through a preset U-Net model to obtain extracted images of the first type of terraced fields and the second type of terraced fields;
[0065] S4, extracting the third type of terraces through the pre-trained improved LinkNet semantic segmentation model to obtain the extracted image of the third type of terraces;
[0066] Among them, the improved LinkNet semantic segmentation model includes a starting module, four pairs of encoder-decoder structures and a terminal module; the first pooling layer of the starting module is an average pooling layer to reduce the loss of detail features; a channel attention mechanism is added between each pair of encoder-decoder structures, and a high-order feature extraction module is added between the fourth pair of encoder-decoder structures; the high-order feature extraction module includes a texture enhancement module and a spatial hole pyramid module, and the feature map of the output of the fourth pair of encoder-decoder structures is enhanced at multiple levels through the texture enhancement module; the spatial hole pyramid module introduces a spatial attention mechanism SAM based on the traditional ASPP module, specifically, 4 parallel convolution branches and 1 global average pooling branch are set on the output after feature enhancement by the texture enhancement module to learn high-level multi-scale features, the 4 parallel convolution branches include 1 convolution branch and 3 hole convolution branches, the expansion rate of the hole convolution branch gradually increases, and the spatial attention module is applied to the 3 hole convolution branches respectively.
[0067] like Figure 2 As shown, further, the method also includes the steps of:
[0068] S5, performing median filtering on the images extracted from the three types of terraces;
[0069] S6. Stitch the filtered images to obtain a complete terrace distribution map.
[0070] The present invention uses median filtering technology to post-process the model output image. Median filtering is a common nonlinear image processing technology used to remove noise in images. In median filtering, the grayscale value of each pixel will be replaced by the median of the grayscale values of all pixels in its neighborhood. This method is very effective in removing salt and pepper noise or other types of impulse noise while retaining the edge information of the image. Therefore, the present invention uses this technology to improve the segmentation results and enhance the image quality.
[0071] After image post-processing, the terraced field results can be checked. For missed or wrongly picked areas, sample supplementation or image correction can be performed. After feedback, the model can be retrained to strengthen it. Finally, through this iterative feedback enhancement method, relatively satisfactory results can be obtained through multiple rounds of training based on the selected evaluation indicators.
[0072] After obtaining the segmented images, the images need to be re-stitched and the labels converted into vectors to obtain a complete terrace distribution map.
[0073] The present invention fully considers the topographic and geomorphic characteristics of terraces and the visual characteristics of terraces, designs a classification standard to divide terraces into different types, which is more in line with the actual distribution form of terraces than traditional methods; designs different deep learning models according to the visual characteristics of different terrace types, and the method has a good inhibitory effect on complex background noise, effectively reducing the classification error rate; designs an improved LinkNet model to address the problems existing in the early classification of easily confused terraces, introduces a texture enhancement module (TEM) into the traditional LinkNet model to enhance the texture characteristics of this type of terraces, and designs a spatial atrous pyramid module (SAM-ASPP) to enhance the receptive field of the context in the terrace classification process, which can also better retain the location information of the terraces and reduce the misclassification of terraces.
[0074] Example 2
[0075] The difference between this embodiment and embodiment 1 mainly lies in the process of building and training the deep learning model. Figure 3 As shown, it mainly includes the following steps:
[0076] (1) Obtain high-resolution RGB visible light remote sensing images of the survey area in multiple phases.
[0077] Since some terraces are cultivated with different crops in different seasons or have fallow periods, if only remote sensing images of one season are used to train the neural network, the neural network may not be able to recognize such terraces due to seasonal reasons. Therefore, the present invention uses high-resolution remote sensing images of the study area in four seasons.
[0078] Remote sensing image data are: multi-temporal high-resolution RGB visible light remote sensing images that have been preprocessed by radiation calibration, atmospheric correction, orthorectification, geometric correction, etc.
[0079] (2) Construction of terraced field dataset
[0080] Based on the original remote sensing images, the terraces are classified by analyzing their morphological characteristics and the topographic and geomorphic characteristics of the region, thus constructing a multi-temporal and multi-classification high-resolution remote sensing terrace dataset.
[0081] (2.1) Classification of terraces
[0082] This method divides terraces into three categories according to their morphological edges and other features in remote sensing images, as shown in Table 1. The first type of terraces has obvious morphological features, regular shapes, and certain strip characteristics; the second type of terraces has different shape characteristics from the first type of terraces, with more obvious strip characteristics; the third type of terraces has unclear morphological features, and the terrace area is small, which is easily confused with sloping farmland.
[0083] Table 1 Classification standards of terraces
[0084]
[0085] (2.2) Dataset processing
[0086] ArcGIS Pro software remote sensing was used to perform manual visual interpretation of the image pictures, and the terraced areas were vector-annotated to generate binary images in PNG format, with terraced values as "1" and non-terraced values (background values) as "0". The remote sensing images were then clipped regularly to generate several PNG format images with a size of 512×512 pixels. After that, the sample images were rotated, dislocated, adjusted in brightness, and randomly erased to increase the number of training samples and the quality of the data set.
[0087] (2.3) Terraced field dataset generation
[0088] After the original annotated image is cropped and cut, several sample sets are formed according to the different types of terraces, and data set samples are formed through data enhancement and other methods; then, considering that the distribution of some sample terraces is too fragmented and scattered, the present invention sets the area ratio of terraces to non-terraced areas, and eliminates sample images with an area ratio of terraces to non-terraced areas less than 0.2, and does not put them in the data set for training; finally, the three terrace data sets are divided into training set, test set, and validation set at a ratio of 7:1:2.
[0089] (3) Selecting accuracy evaluation indicators
[0090] The present invention uses Intersection over Union (IoU), Pixel Accuracy (PA) and Kappa coefficient to evaluate the model segmentation results.
[0091] The intersection over union (IoU) and mean intersection over union (MIoU) are:
[0092] This step mainly uses the intersection over union (IoU), which is to calculate the ratio of the intersection and union of the two sets of true values and predicted values. The calculated IoU values of each category are averaged to get the mean intersection over union (MIoU). The IoU and MIoU of terrace and non-terraced values are as follows:
[0093]
[0094]
[0095]
[0096] In the formula, TPThe representative model predicts the terraces as terraces. FP The representative model predicts terraces as non-terraces. FN The representative model predicts non-terraced fields as terraced fields. TN The representative model predicts non-terraced fields as non-terraced fields, as shown in Table 2 below.
[0097] Pixel Accuracy PA )for:
[0098] PA It is also called overall accuracy, which indicates the ratio of correctly predicted pixels to the total number of pixels. The formula is as follows:
[0099]
[0100] Table 2 CNN model confusion matrix
[0101] The Kappa coefficient is:
[0102] Kappa Coefficient is an indicator used for consistency testing. For binary problems, consistency refers to whether the model prediction results are consistent with the actual values. The specific expression of Kappa Coefficient is as follows:
[0103]
[0104]
[0105] in, PA Represents the overall accuracy, The total sample size is In the case of , assuming that the number of real samples of each class is , , and the predicted number of samples for each class is , , thus obtaining K Value, that is, the Kappa coefficient.
[0106] (4) Select parameter configuration
[0107] The hyperparameter selection of deep learning mainly includes batch size, learning rate, loss function, optimizer, etc. The hyperparameter design of this method adopts certain parameter adjustment techniques to achieve the best fitting effect of the model.
[0108] Batch Size: This invention uses 128 as the dividing line for Batch Size. Use parameter adjustment techniques: compare the test results after training by decreasing BatchSize by (×0.5) and increasing it by (×2). If the decrease is better, increase it by ×0.5 again until the result no longer improves.
[0109] Learning Rate: The present invention does not use a fixed learning rate during the training process, and uses 0.01 as the initial learning rate. Use parameter adjustment techniques: use the estimated model parameters to check the value of the error function after each iteration. If the error rate is reduced compared to the previous iteration, the learning rate can be increased, otherwise the learning rate can be reduced;
[0110] The loss function is: This invention uses the Weighted CrossEntropyLoss loss function to extract the terraces. Compared with the original CrossEntropyLoss, it can achieve better results when the number of samples is unbalanced. The formula is as follows:
[0111]
[0112] in M represents the number of categories, is a Vector, the elements have only two values 0 and 1. If the category is the same as the sample category, it takes 1, otherwise it takes 0. Indicates that the predicted sample belongs to probability. The calculation formula is: ,in Indicates the number of pixels, Indicates the category The number of pixels.
[0113] The optimizer is: AdaGrad is an adaptive learning rate optimization algorithm, which is commonly used in the training of deep learning models. Its main idea is to assign a continuously cumulative learning rate to each parameter and adaptively adjust the learning rate according to the historical gradient information of the parameter. Therefore, the present invention adopts AdaGrad as the optimizer.
[0114] (5) Deep learning model selection
[0115] This step uses differentiated deep learning models for different types of terraces and selects appropriate deep learning network models based on the characteristics of different types of terraces.
[0116] The first and second types of terraces are widely distributed in mountainous areas, with obvious edge features, uniform internal textures, and relatively small shapes, so the edge feature extraction requires more accuracy. In this regard, the present invention uses a U-Net model to extract terraces.
[0117] The U-Net model is: The U-Net model uses an encoder-decoder structure, where the encoder is used to gradually extract image features and reduce the resolution, and the decoder restores the low-resolution feature map to the original resolution through upsampling operations. Skip connections are introduced to help retain detail information. The activation function of the U-Net model uses the ReLu function, and the classifier uses the Softmax function.
[0118] For the third type of terraces: First, the input remote sensing image has a high resolution, so the network used to classify this terrace should have a large receptive field that can cover the entire image. Second, this type of terrace may often be confused with sloping farmland, and there are often trees and weeds growing inside, and the edge morphology is relatively fuzzy, but its unique internal texture features still exist. In high-resolution remote sensing images, it is mainly distinguished by internal texture features. Third, this type of terrace is small in area and fragmented in distribution, so it is very necessary to retain detailed spatial information. Therefore, the present invention uses the semantic segmentation model of LinkNet designed and improved for these problems to extract the third type of terrace information.
[0119] like Figure 4 As shown in the figure, the improved LinkNet semantic segmentation model is: the traditional LinkNet model adopts an encoder-decoder structure: the encoder part is mainly composed of 3 3×3 initial convolutional layers and 4 encoders. The encoder part mainly extracts high-level semantic features of the terraced area through residual blocks and pooling operations, generates feature maps, and reduces the size of feature maps. After the initial convolution layer, the 512×512 RGB image becomes a feature map with 64 channels and a size of 256×256. After passing through 4 encoders, the feature map size changes to 128×128, 64×64, 32×32, and 16×16, and the number of channels changes to 64, 128, 256, and 512 respectively. The decoder part consists of 4 deconvolution blocks and 1 terminal output convolution layer. After 4 deconvolution blocks, the size of the 16×16×512 feature map changes to 32×32, 64×64, 128×128, and 256×256, and the number of channels changes to 256, 128, 64, and 64 respectively. Finally, the output convolution layer generates a 512×512×1 terrace distribution map. Among them, the encoding and decoding parts use pixel-by-pixel addition to perform feature fusion (see Figure 5 ).
[0120] Therefore, on the basis of retaining the traditional LinkNet model backbone network, the present invention modifies the maximum pooling layer in the model's starting module into an average pooling layer to reduce the loss of detail information in the feature map. Afterwards, the texture enhancement module (TEM) and the spatial atrous pyramid module (SAM-ASPP) are introduced in the center area of the model to enhance the texture features of the third type of terraces, increase the receptive field to achieve a dense feature sampling effect, and reduce the information loss caused by upsampling. Secondly, the channel attention mechanism is used to perform channel weighting on the feature maps generated by each feature encoding layer to reduce the interference of irrelevant features and improve the segmentation accuracy of the terraces (see Figure 6 ).
[0121] The texture enhancement module (TEM) is an important factor in the identification of the third type of terraces, considering that the edge morphology of the third type of terraces is relatively fuzzy, but its unique internal texture features still exist. Figure 7 As shown in the figure, the texture enhancement module performs 5 levels of feature enhancement on the input feature map as follows: the first layer only uses 1×1 convolution for calculation; then uses four parallel dilation convolutions with dilation rates of {1, 3, 5, 7}, and reduces the number of channels to 1 / 4 of the original number of channels: the first layer uses 1×1 convolution and then enlarges the feature map; the second layer first performs 1×1 convolution, then uses 1×3 and 3×1 convolutions, and finally enlarges the feature map; the third layer first performs 1×1 convolution, then uses 1×5 and 5×1 convolutions, and finally enlarges the feature map; the fourth layer first performs 1×1 convolution, then uses 1×7 and 7×1 convolutions to splice 4 levels of feature maps, and adds them to the feature map after 1×1 convolution. By setting dilated convolutions with different dilation rates and imitating the grouped receptive fields of different sizes in the human visual system, the module can capture the fine-grained texture of the terraces and amplify the contextual clues in feature recognition, thereby reducing the misclassification of the third type of terraces.
[0122] The Spatial Atrous Pyramid Module (SAM-ASPP) is: considering that the third type of terraces are scattered and fragmented, it is difficult to occupy the entire image size, and local detail features are difficult to collect, and more spatial position information needs to be retained. The present invention introduces the spatial attention mechanism (SAM) based on the ASPP module, such as Figure 8 As shown in Figure 1, four parallel convolution branches and one global average pooling branch are set on the final output of the encoding network to learn high-level multi-scale features. The four parallel convolution branches include one 1×1 convolution branch and three 3×3 dilated convolution branches. The dilation rates of the dilated convolution are set to 6, 12, and 18, respectively. Then, the spatial attention module is applied to the three dilated convolution branches (see Fig. 9 ).
[0123] The traditional ASPP module obtains receptive fields of different scales through dilated convolutions (also called expanded convolutions) with different sampling rates, which can effectively capture the contextual information of terrace images at various scales and increase the feature differences between terraces and non-terraced areas. The use of the spatial attention mechanism (SAM) enables the module to dynamically adjust the weights according to the features of the terraces at each spatial position, so that the network can pay more attention to the importance of terraces at different positions in the image, retain more spatial position information of the terraces, and achieve more accurate feature extraction.
[0124] Example 3
[0125] This embodiment selects some typical terraced areas in Panjiawan Village, Baimiaohe Town, Luotian County, Huanggang City, Hubei Province as the study area, and uses a deep learning model to automatically extract the terraces in the area, as follows.
[0126] 1. Obtain 0.5 m resolution GF-1 RGB visible light remote sensing images of Panjiawan Village, Baimiaohe Town, Luotian County, Huanggang City, Hubei Province in four seasons, and perform radiometric calibration, atmospheric correction, orthorectification, geometric correction and other preprocessing.
[0127] 2. The terraced field dataset is constructed as follows:
[0128] 1) ArcGIS Pro software was used to perform sample annotation and image cropping on the remote sensing images of the study area of Panjiawan Village, Baimiaohe Town, Luotian County, Huanggang City, Hubei Province.
[0129] 2) According to the three classification standards of terraced fields, the terraced fields in Panjiawan Village, Baimiaohe Town, Luotian County, Huanggang City, Hubei Province were classified
[0130] 3) Use Python to perform image rotation, displacement transformation, brightness adjustment, random erasure, etc. on the labeled, cropped and classified samples.
[0131] 4) After the original images were labeled, cropped, classified, and data enhanced, sample images with a terrace-to-non-terraced area ratio of less than 0.2 were removed. Finally, a terrace dataset of different terrace categories in the region was constructed and divided into training set, test set, and validation set in a ratio of 7:1:2.
[0132] 3. Build deep learning models for different terrace types and train the constructed data sets. The specific steps are as follows:
[0133] 1) The U-Net model was used to train the first and second type of terraced field datasets in Zhuxi County.
[0134] 2) Use the improved LinkNet semantic segmentation model to train the third type of easily confused terraced plots.
[0135] 3) Adjust parameters according to evaluation indicators and select the optimal parameter configuration
[0136] 4. Perform median filtering on the output image of the semantic segmentation model, and then perform iterative feedback and sample supplementation on the terraced field results to strengthen the model results. Fig.10 shown.
[0137] Finally, the cropped images are re-stitched and the labels are converted into vectors to obtain the complete terrace vector.
[0138] Example 4
[0139] This embodiment is mainly used for the above-mentioned implementation method embodiment.
[0140] like Fig.11 As shown, the automatic terrace extraction system based on the deep learning semantic segmentation model in this embodiment includes:
[0141] An image acquisition module is used to acquire the visible light remote sensing image of the terraced field to be extracted and crop it into multiple regular images of the same size;
[0142] The preliminary classification module is used to classify the cropped images into the first type of terraces, the second type of terraces and the third type of terraces according to the edge features, texture features and morphological features of the terraces. The first type of terraces have clear edge features, obvious texture features and a relatively small aspect ratio in terms of morphology. The second type of terraces have clear edge features, obvious texture features and a small and narrow shape. The third type of terraces have unclear edge features, rough texture features and no obvious boundaries.
[0143] The first terrace extraction module is used to extract the first type of terraces and the second type of terraces through a preset U-Net model to obtain extracted images of the first type of terraces and the second type of terraces;
[0144] The second terrace extraction module is used to extract the third type of terraces by using a pre-trained improved LinkNet semantic segmentation model to obtain an image of the third type of terraces after extraction;
[0145] Among them, the improved LinkNet semantic segmentation model includes a starting module, four pairs of encoder-decoder structures and a terminal module; the first pooling layer of the starting module is an average pooling layer to reduce the loss of detail features; a channel attention mechanism is added between each pair of encoder-decoder structures, and a high-order feature extraction module is added between the fourth pair of encoder-decoder structures; the high-order feature extraction module includes a texture enhancement module and a spatial hole pyramid module, and the feature map of the output of the fourth pair of encoder-decoder structures is enhanced at multiple levels through the texture enhancement module; the spatial hole pyramid module introduces a spatial attention mechanism SAM based on the traditional ASPP module, specifically, 4 parallel convolution branches and 1 global average pooling branch are set on the output after feature enhancement by the texture enhancement module to learn high-level multi-scale features, the 4 parallel convolution branches include 1 convolution branch and 3 hole convolution branches, the expansion rate of the hole convolution branch gradually increases, and the spatial attention module is applied to the 3 hole convolution branches respectively.
[0146] Furthermore, the system also includes:
[0147] A filtering module is used to perform median filtering on the images extracted from the three types of terraces;
[0148] The stitching module is used to stitch the filtered images to obtain a complete terrace distribution map.
[0149] Each module is mainly used to implement each step of the method embodiment, which will not be described in detail here.
[0150] Example 5
[0151] The present application also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and when the program is executed by a processor, a corresponding function is realized. When the computer-readable storage medium of this embodiment is executed by a processor, the automatic terrace extraction method based on a deep learning semantic segmentation model of the method embodiment is realized.
[0152] In summary, the present invention divides terraces into three different types according to the terrain characteristics and visual features of the terraces, and visually interprets the remote sensing images of the study area in different seasons according to the classification standard, thereby constructing multi-phase terrace data sets of three terrace categories respectively; different deep learning models are designed for different terrace types for classification and extraction, and the U-Net model is used to extract the first and second types of terraces, and the improved LinkNet model is used to extract the third type of easily confused terraces. Compared with traditional methods, the present invention fully considers the visual characteristics and topographical features of the terraces, improves the extraction model, makes it more consistent with the actual distribution form of the terraces, and improves the classification accuracy of the terraces.
[0153] It should be pointed out that, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, and two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.
[0154] The order of execution of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0155] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.
Claims
1. A method for automatic extraction of terraced fields based on a deep learning semantic segmentation model, characterized in that: The following steps are involved: Obtain the visible light remote sensing image of the terraced field to be extracted, and crop it into multiple regular images of the same size; According to the edge features, texture features and morphological features of the terraces, the cropped images are divided into the first type of terraces, the second type of terraces and the third type of terraces; the first type of terraces have clear edge features, obvious texture features, and a relatively small aspect ratio; the second type of terraces have clear edge features, obvious texture features, and a small and narrow shape; the third type of terraces have unclear edge features, rough texture features and no obvious boundaries; The first and second types of terraces are extracted by using a pre-set U-Net model to obtain the extracted images of the first and second types of terraces; The third type of terraces are extracted by using the pre-trained improved LinkNet semantic segmentation model to obtain the extracted images of the third type of terraces; Among them, the improved LinkNet semantic segmentation model includes a starting module, four pairs of encoder-decoder structures and a terminal module; the first pooling layer of the starting module is an average pooling layer to reduce the loss of detail features; a channel attention mechanism is added between each pair of encoder-decoder structures, and a high-order feature extraction module is added between the fourth pair of encoder-decoder structures; the high-order feature extraction module includes a texture enhancement module and a spatial hole pyramid module, and the feature map of the output of the fourth pair of encoder-decoder structures is enhanced at multiple levels through the texture enhancement module; the spatial hole pyramid module introduces a spatial attention mechanism SAM based on the traditional ASPP module, specifically, 4 parallel convolution branches and 1 global average pooling branch are set on the output after feature enhancement by the texture enhancement module to learn high-level multi-scale features, the 4 parallel convolution branches include 1 convolution branch and 3 hole convolution branches, the expansion rate of the hole convolution branch gradually increases, and the spatial attention module is applied to the 3 hole convolution branches respectively.
2. The method for automatically extracting terraced fields based on a deep learning semantic segmentation model according to claim 1, characterized in that: In the spatial attention mechanism SAM, the four parallel convolution branches include one 1×1 convolution branch and three 3×3 dilated convolution branches, and the expansion rates of the dilated convolution branches are set to 6, 12, and 18, respectively.
3. The method for automatically extracting terraced fields based on a deep learning semantic segmentation model according to claim 1, characterized in that: The texture enhancement module performs 5 levels of feature enhancement on the input feature map as follows: the first layer only uses 1×1 convolution for calculation; then uses four parallel dilation convolutions with dilation rates of {1, 3, 5, 7}, and reduces the number of channels to 1 / 4 of the original number of channels: the first layer uses 1×1 convolution and then enlarges the feature map; the second layer first performs 1×1 convolution, then uses 1×3 and 3×1 convolutions, and finally enlarges the feature map; the third layer first performs 1×1 convolution, then uses 1×5 and 5×1 convolutions, and finally enlarges the feature map; the fourth layer first performs 1×1 convolution, then uses 1×7 and 7×1 convolutions to splice 4 levels of feature maps, and adds them to the feature map after 1×1 convolution.
4. The method for automatically extracting terraced fields based on a deep learning semantic segmentation model according to claim 1, characterized in that: The acquisition of sample sets for model training mainly includes the following steps: Manual visual interpretation was performed on the high-resolution RGB visible light remote sensing images of the survey area in multiple phases, and vector annotation was performed on the terraced areas to generate binary images in PNG format, with terraced values as "1" and non-terraced values (background values) as "0"; The remote sensing images were cropped regularly to generate several PNG format images with a size of 512×512 pixels, and three terrace sample sets were formed according to different terrace types. Perform image rotation, dislocation transformation, brightness adjustment, and random erasure on sample images to improve the quantity and quality of training samples; Set the area ratio of terraced fields to non-terraced fields, and remove sample images with an area ratio of terraced fields to non-terraced fields less than 0.2; The three terrace sample sets were divided into training set, test set and validation set in a ratio of 7:1:
2.
5. The method for automatically extracting terraced fields based on a deep learning semantic segmentation model according to claim 1, characterized in that: Specifically, the intersection over union (IoU), pixel accuracy (PA), and Kappa coefficient are used to evaluate the model segmentation results.
6. The method for automatically extracting terraced fields based on a deep learning semantic segmentation model according to claim 1, characterized in that: When training the model, four hyperparameters are selected: batch size, learning rate, WeightedCrossEntropyLoss loss function, and AdaGrad optimizer for model optimization. When the batch size is used for parameter adjustment during training, the batch size is set at 128 as the dividing line. The batch size is reduced by ×0.5 and increased by ×2. After training, the test results are compared. If the reduction is better, it is increased by ×0.5 again until the result no longer improves. When using the learning rate for parameter adjustment, use a non-fixed learning rate and set 0.01 as the initial learning rate. After each iteration, use the estimated model parameters to view the value of the error function. If the error rate is reduced compared to the previous iteration, increase the learning rate, otherwise decrease the learning rate.
7. The method for automatically extracting terraced fields based on a deep learning semantic segmentation model according to any one of claims 1 to 6, characterized in that: The method further comprises the steps of: Perform median filtering on the images extracted from the three types of terraces; The filtered images are stitched together to obtain a complete terrace distribution map.
8. An automatic terrace extraction system based on deep learning semantic segmentation model, characterized in that: include: An image acquisition module is used to acquire the visible light remote sensing image of the terraced field to be extracted and crop it into multiple regular images of the same size; The preliminary classification module is used to classify the cropped images into the first type of terraces, the second type of terraces and the third type of terraces according to the edge features, texture features and morphological features of the terraces. The first type of terraces have clear edge features, obvious texture features and a relatively small aspect ratio in terms of morphology. The second type of terraces have clear edge features, obvious texture features and a small and narrow shape. The third type of terraces have unclear edge features, rough texture features and no obvious boundaries. The first terrace extraction module is used to extract the first type of terraces and the second type of terraces through a preset U-Net model to obtain extracted images of the first type of terraces and the second type of terraces; The second terrace extraction module is used to extract the third type of terraces by using a pre-trained improved LinkNet semantic segmentation model to obtain an image of the third type of terraces after extraction; Among them, the improved LinkNet semantic segmentation model includes a starting module, four pairs of encoder-decoder structures and a terminal module; the first pooling layer of the starting module is an average pooling layer to reduce the loss of detail features; a channel attention mechanism is added between each pair of encoder-decoder structures, and a high-order feature extraction module is added between the fourth pair of encoder-decoder structures; the high-order feature extraction module includes a texture enhancement module and a spatial hole pyramid module, and the feature map of the output of the fourth pair of encoder-decoder structures is enhanced at multiple levels through the texture enhancement module; the spatial hole pyramid module introduces a spatial attention mechanism SAM based on the traditional ASPP module, specifically, 4 parallel convolution branches and 1 global average pooling branch are set on the output after feature enhancement by the texture enhancement module to learn high-level multi-scale features, the 4 parallel convolution branches include 1 convolution branch and 3 hole convolution branches, the expansion rate of the hole convolution branch gradually increases, and the spatial attention module is applied to the 3 hole convolution branches respectively.
9. The automatic terrace extraction system based on deep learning semantic segmentation model according to claim 8 is characterized in that: The system also includes: A filtering module is used to perform median filtering on the images extracted from the three types of terraces; The stitching module is used to stitch the filtered images to obtain a complete terrace distribution map.
10. A computer storage medium, characterized in that: A computer program executable by a processor is stored therein, and the computer program executes the automatic terrace extraction method based on a deep learning semantic segmentation model as described in any one of claims 1 to 6.
