Terraced field extraction method and system based on deep learning semantic segmentation model
By constructing a terraced field extraction method based on deep learning semantic segmentation model, using multi-level convolution and class weights, the problem of insufficient recognition ability of terraced field plots in complex geographical environments is solved, and higher recognition rate and extraction accuracy are achieved.
Patent Information
- Application Number
- CN202510466190.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-04-11
AI Technical Summary
The existing deep learning-based terraced land plot recognition method is difficult to accurately segment and identify under complex geographical environments, resulting in poor recognition capabilities and insufficient accuracy.
A terrace extraction method based on deep learning semantic segmentation model is constructed, and a classification weight is generated through multi-stage convolution operation, parallel multi-branch processing, upsampling and feature fusion, the probability distribution of terraced pixels is obtained, and the recognition ability of the model is improved through the spatial attention mechanism.
It significantly improves the recognition rate and extraction accuracy of terraced plots in complex geographical environments, enhances the robustness of geographical objects of different areas and locations, and optimizes the extraction effect of terraced plots.
Smart Images

Figure CN119992345B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of terraced field image extraction, and in particular to a terraced field extraction method and system based on a deep learning semantic segmentation model. Background Art
[0002] Remote sensing technology has important applications in agriculture, enabling large-scale, highly efficient monitoring of crop species, area, and distribution. As important agricultural production sites, accurate extraction of the area and distribution of terraced fields is crucial for agricultural management and decision-making. Some terraced areas are primarily composed of mountains, hills, and basins and valleys. Compared to large plains, these areas have a more complex geographical environment, placing higher demands on remote sensing intelligent extraction algorithms.
[0003] In recent years, the development of remote sensing and deep learning technologies has led to significant progress, particularly in the field of high-resolution remote sensing terraced field image recognition. Convolutional neural networks (CNNs) have demonstrated superior performance in tasks such as image classification and segmentation. However, existing deep learning-based methods for identifying cultivated land parcels still have limitations. For example, in complex geographical environments such as mountains, hills, and basins, the following situations often occur:
[0004] 1. The shape and size of the planting areas of terraced fields are irregular and often interspersed with other land features, making it difficult for the model to accurately segment the terraced fields.
[0005] 2. Terraces are usually distributed in mountainous areas with steep slopes, uneven terrain, and diverse slope directions. This results in irregular shapes and sizes of terraces in remote sensing images, with unclear boundaries, making it difficult for automatic extraction algorithms to accurately identify and segment terraces.
[0006] 3. Terraced fields are prone to shadows due to terrain obstruction and changing sun angles. Shadows reduce image contrast and clarity, making it more difficult to distinguish terraced fields from surrounding features.
[0007] In summary, this leads to problems such as poor terraced field recognition ability and insufficient accuracy. Summary of the Invention
[0008] The purpose of the present invention is to provide a terrace extraction method and system based on a deep learning semantic segmentation model, aiming to solve the problem that traditional technologies have poor terrace plot recognition ability and insufficient accuracy due to the complex actual distribution environment of terraces.
[0009] In a first aspect, the present invention provides a method for extracting terraced fields based on a deep learning semantic segmentation model, the method comprising:
[0010] Construct a dataset about terraced fields and train a semantic segmentation model based on the dataset, specifically including:
[0011] Performing a multi-level convolution operation on the data set to obtain multi-level convolution features, and performing parallel multi-branch processing on the convolution features to obtain a first feature, a second feature, a third feature, and a fourth feature;
[0012] performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature;
[0013] Splicing the fusion feature with the convolution feature to obtain a spliced feature, generating a category weight according to the spliced feature, and obtaining a terraced pixel probability distribution of each image in the data set according to the category weight;
[0014] The image to be tested is input into the trained semantic segmentation model to obtain the target terrace pixel probability distribution corresponding to the image to be tested, and all terrace plots are extracted from the image to be tested according to the target terrace pixel probability distribution.
[0015] Furthermore, the step of constructing a data set about terraced fields includes:
[0016] Acquire terraced remote sensing images, and annotate the images in the terraced remote sensing images frame by frame, wherein the annotation results include terraced contours, terraced surfaces, and backgrounds, and generate a data set based on the annotated images.
[0017] Furthermore, the step of performing a multi-level convolution operation on the data set to obtain a multi-level convolution feature includes:
[0018] Perform multi-level convolution operations according to the following formula:
[0019] ;
[0020] in, Indicates the The composite operation of the stage includes convolution, normalization, and activation in sequence. 、 Respectively represent Level, first Level convolutional features, Represents an image in the dataset;
[0021] The step of performing parallel multi-branch processing on the convolution features to obtain the first feature, the second feature, the third feature, and the fourth feature includes:
[0022] The convolutional features are processed in parallel using the following formula:
[0023] ;
[0024] in, 、 、 、 Represent the first feature, the second feature, the third feature, and the fourth feature respectively, The void ratio is of Convolution, d represents the void rate, represents global average pooling, Indicates first Convolution, then upsampling operation, and the features are adjusted to and , represents the height of the feature, Indicates the width of the feature.
[0025] Furthermore, the step of performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature includes:
[0026] The upsampling process is performed according to the following formula:
[0027] ;
[0028] in, represents the adjusted i-th level convolution feature, , represents the i-th level upsampled feature, , Represents bilinear times upsampling;
[0029] Generate multi-scale features according to the following formula:
[0030] ;
[0031] in, Represents multi-scale features, represents channel dimension splicing, express The feature tensor dimension of The height becomes , the width becomes , the number of channels becomes 256;
[0032] Fusion is performed according to the following formula:
[0033] ;
[0034] in, represents the fusion feature, express convolution, 、 、 They represent the second-level, third-level, and fourth-level upsampling features respectively.
[0035] Furthermore, the step of splicing the fusion feature with the convolution feature to obtain a spliced feature, and generating a category weight according to the spliced feature includes:
[0036] Class weights are generated according to the following formula:
[0037] ;
[0038] in, Represents the category weight vector, C represents the dimension of the vector, which is a positive integer. 、 represents a learnable weight matrix, represents an activation function, represents the rectified linear unit activation function, Represents the splicing feature, express The vector space where .
[0039] Furthermore, the step of obtaining the terraced pixel probability distribution of each image in the data set according to the category weight includes:
[0040] Generate a spatial attention map based on the class weights:
[0041] ;
[0042] in, is the spatial attention map, Indicates size The matrix of all 1s, represents the tensor product;
[0043] Perform feature reweighting on the spatial attention map:
[0044] ;
[0045] in, represents the feature representation after feature reweighting by the spatial attention mechanism, represents element-wise multiplication;
[0046] The probability distribution of terraced pixels is obtained according to the following formula:
[0047] ;
[0048] in, represents the probability distribution of terraced pixels, represents normalization processing, is a learnable weight matrix, Indicates bilinear 8x upsampling, is a learnable bias vector.
[0049] Furthermore, the step of inputting the image to be tested into the trained semantic segmentation model to obtain the target terrace pixel probability distribution corresponding to the image to be tested, and extracting all terrace plots from the image to be tested according to the target terrace pixel probability distribution includes:
[0050] Acquire a terrace pixel point set and a background pixel point set according to the target terrace pixel probability distribution, wherein the terrace pixel point set includes a plurality of first pixel points with terrace attributes and a first pixel coordinate corresponding to each of the first pixel points, and the background pixel point set includes a plurality of second pixel points with background attributes and a second pixel coordinate corresponding to each of the second pixel points;
[0051] Acquire at least one first connected area according to the first pixel point and the first pixel coordinates;
[0052] Determining whether the area of the first connected region is greater than a preset area threshold;
[0053] If the area of the first connected region is less than or equal to the preset area threshold, all pixels in the first connected region are changed to second pixels;
[0054] If the area of the first connected region is greater than a preset area threshold, the first connected region is converted into a line vector, and the line vector is converted into a surface vector, and the extraction vector result of the terrace is obtained according to the surface vector.
[0055] In a second aspect, the present invention provides a terrace extraction system based on a deep learning semantic segmentation model, the system comprising:
[0056] The semantic segmentation model training module is used to construct a dataset about terraced fields and train a semantic segmentation model based on the dataset, specifically including:
[0057] Performing a multi-level convolution operation on the data set to obtain multi-level convolution features, and performing parallel multi-branch processing on the convolution features to obtain a first feature, a second feature, a third feature, and a fourth feature;
[0058] performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature;
[0059] Splicing the fusion feature with the convolution feature to obtain a spliced feature, generating a category weight according to the spliced feature, and obtaining a terraced pixel probability distribution of each image in the data set according to the category weight;
[0060] The terraced field image detection module is used to input the image to be tested into the trained semantic segmentation model, obtain the target terraced field pixel probability distribution corresponding to the image to be tested, and extract all terraced field plots from the image to be tested according to the target terraced field pixel probability distribution.
[0061] In a third aspect, the present invention provides a storage medium storing one or more programs, which, when executed by a processor, implement the above-mentioned terrace extraction method based on the deep learning semantic segmentation model.
[0062] In a fourth aspect, the present invention provides an electronic device, comprising a memory and a processor, wherein:
[0063] The memory is used to store computer programs;
[0064] When the processor is used to execute the computer program stored in the memory, it implements the above-mentioned terrace extraction method based on the deep learning semantic segmentation model.
[0065] Compared with the prior art, the present invention has the following advantages:
[0066] The above-mentioned terrace extraction method based on a deep learning semantic segmentation model significantly improves the ability to express crop characteristics in terraced plots and the model's recognition rate of terraced plots in complex terraced geographical environments by introducing multi-level convolution and class weighting. Increasing class weighting enhances class differentiation and provides robustness for a variety of geographic objects of varying sizes and locations. It accurately identifies specific categories even when the geographic objects are small or partially occluded. This enables the model to better identify the type, area, and distribution of various geographic objects (including terraced plots) in complex scenarios, thereby optimizing the extraction of terraced plots and improving their accuracy in complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 This is a flowchart of a terraced field extraction method based on a deep learning semantic segmentation model proposed in one embodiment of the present invention;
[0068] Figure 2 A detailed diagram of step S101 proposed in one embodiment of the present invention;
[0069] Figure 3 A schematic diagram of an image to be detected according to an example of an embodiment of the present invention;
[0070] Figure 4 A schematic diagram of a first connected region according to an embodiment of the present invention;
[0071] Figure 5 A schematic diagram of a line vector diagram according to an embodiment of the present invention;
[0072] Figure 6 A schematic diagram of a surface vector diagram according to an embodiment of the present invention;
[0073] Figure 7 This is a structural diagram of a terraced field extraction system based on a deep learning semantic segmentation model proposed in one embodiment of the present invention.
[0074] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0075] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be the common meanings understood by people with ordinary skills in the field to which the invention belongs. The words "including" and similar words used in this article mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0076] like Figure 1 As shown, an embodiment of the present invention provides a terrace extraction method based on a deep learning semantic segmentation model, the method comprising steps S101 to S102, wherein:
[0077] Step S101: constructing a data set about terraced fields, and training a semantic segmentation model based on the data set;
[0078] It should be noted that if Figure 2As shown, this step includes steps S1011 to S1014, wherein:
[0079] Step S1011: Acquire a remote sensing image of a terraced field, and annotate the image in the remote sensing image of the terraced field frame by frame. The annotation result includes the terraced field outline, terraced field surface and background, and generate a data set based on the annotated image.
[0080] Specifically, after obtaining the remote sensing image, the terraces need to be manually marked first. When manually marking the terrace plots, image annotation software is needed to open the remote sensing image of the terrace area in the software and mark the features of the terrace plots in the image.
[0081] Since the spectral characteristics of terraced fields in terraced remote sensing images are similar to those of other landforms (such as vegetation, weeds, etc.), and in order to address the core difficulty of terraced field extraction, namely the diversity of terraced field characteristics in remote sensing images, the data used for annotation must include terraced fields of irregular shapes and sizes, with a total of no less than 8,000 images after cropping based on the actual remote sensing image resolution, in order to provide sufficient samples covering as rich terraced features as possible for model training. When annotating, judgments must be made based on multiple aspects of information such as the texture, shape, and location of the terraced fields. The specific requirements are as follows:
[0082] (1) For the terrace outline, use the polygon annotation tool in the software to outline the terrace boundary point by point along the edge of the terrace. During the drawing process, the accuracy of the boundary must be ensured, especially in areas where terraces are interspersed with other land features. Careful distinction must be made to avoid mistakenly including other land features in the terrace outline.
[0083] (2) When marking the terrace surface, use the marking tool to fill in the area representing the terrace surface within the terrace outline. Also pay attention to distinguishing it from the surrounding landforms to ensure that the marked terrace surface range is accurate.
[0084] (3) When labeling the background class, label the area other than the terrace outline and terrace surface. During the labeling process, the consistency and completeness of the labeling should be maintained, and each terrace plot in the image should be accurately labeled. After the labeling is completed, the labeled data is saved in a software-specific format for subsequent conversion to the data format required for model training.
[0085] The subsequent part is mainly operated by the computer program designed in the present invention. The program creates a clear data set directory structure on the storage device, and creates three subdirectories "train", "val" and "test" under the root directory, which are used to store the training set, validation set and test set data respectively. Under each subdirectory, two subdirectories "images" and "masks" are created respectively. The "images" directory is used to store remote sensing image data, and the "masks" directory is used to store the corresponding labeled data. The data set is divided according to the ratio of 7:2:1, that is, 70% of the data is used as the training set for model training; 20% of the data is used as the validation set for evaluating the performance of the model and adjusting the model parameters during the training process; and 10% of the data is used as the test set for the final evaluation of the generalization ability of the model. In order to ensure that the terrace features are evenly distributed in the data set, the present invention adopts a random sampling method when dividing the data. Under the premise of having enough labeled data, the data set construction process of the present invention can ensure the subsequent training needs of the complex model for terrace extraction.
[0086] Step S1012: performing a multi-level convolution operation on the data set to obtain multi-level convolution features, and performing parallel multi-branch processing on the convolution features to obtain a first feature, a second feature, a third feature, and a fourth feature;
[0087] It should be pointed out that the multi-level convolution operation is first performed according to the following formula:
[0088] ;
[0089] in, Indicates the The composite operation of the stage includes convolution, normalization, and activation in sequence. 、 Respectively represent Level, first Level convolutional features, Represents an image in the dataset. Specifically, the second- and third-level convolutional features contain rich spatial detail information such as edges and textures, while the fourth- and fifth-level convolutional features contain high-level semantic information, such as object categories. In this paper, by extracting these multi-level convolutional features, the model can simultaneously utilize both detail and semantic information to improve the segmentation accuracy of terraces.
[0090] In addition, the convolutional features are processed in parallel with multiple branches according to the following formula:
[0091] ;
[0092] in, 、 、 、 Represent the first feature, the second feature, the third feature, and the fourth feature respectively, The void ratio is of Convolution, d represents the void rate, represents global average pooling, Indicates first Convolution, then upsampling operation, and the features are adjusted to and , represents the height of the feature, Indicates the width of the feature.
[0093] Step S1013: performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature;
[0094] It should be noted that the upsampling process is specifically performed according to the following formula:
[0095] ;
[0096] in, represents the adjusted i-th level convolution feature, , represents the i-th level upsampled feature, , Represents bilinear times upsampling;
[0097] Generate multi-scale features according to the following formula:
[0098] ;
[0099] in, Represents multi-scale features, represents channel dimension splicing, express The feature tensor dimension of The height becomes , the width becomes , the number of channels becomes 256;
[0100] Fusion is performed according to the following formula:
[0101] ;
[0102] in, represents the fusion feature, express convolution, 、 、 They represent the second-level, third-level, and fourth-level upsampling features respectively.
[0103] It should be noted that the aforementioned multi-scale features are obtained by capturing contextual features, and the fused features are obtained by fusing multi-level adjusted convolutional features, thereby jointly solving the scale change problem of complex scenes. In the semantic segmentation model of the present invention, the algorithm for setting the fused features can improve the model's sensitivity to complex terraced targets with uneven terrain, large slopes, and diverse slopes in mountainous areas. Compared with the original model, it has stronger specialization and is more suitable for the task of terrace extraction.
[0104] Step S1014: splicing the fusion feature and the convolution feature to obtain a spliced feature, generating a category weight according to the spliced feature, and obtaining a terraced pixel probability distribution of each image in the data set according to the category weight.
[0105] It should be noted that in this step, the category weights are generated according to the following formula:
[0106] ;
[0107] in, Represents the category weight vector, C represents the dimension of the vector, which is a positive integer. 、 represents a learnable weight matrix, The role of The feature vector processed by the activation function is linearly transformed and mapped to a space with the same dimension as the number of categories. represents an activation function, Represents the rectified linear unit activation function, which is a nonlinear function defined as For each element in the input vector, if the element is greater than 0, it remains unchanged; if the element is less than 0, it is set to 0. By introducing Activation function, the model can learn more complex nonlinear relationships and enhance the expressive power of the model. Represents the splicing feature, express The vector space where . The role of the global average pooling ( ) performs a linear transformation on the feature vector after , mapping it to a new feature space and changing the dimension of the feature.
[0108] Generate a spatial attention map based on the class weights:
[0109] ;
[0110] in, is the spatial attention map, Indicates size The matrix of all 1s, represents the tensor product;
[0111] Perform feature reweighting on the spatial attention map:
[0112] ;
[0113] in, represents the feature representation after feature reweighting by the spatial attention mechanism, represents element-wise multiplication;
[0114] The probability distribution of terraced pixels is obtained according to the following formula:
[0115] ;
[0116] in, represents the probability distribution of terraced pixels, represents normalization processing, is a learnable weight matrix, Indicates bilinear 8x upsampling, is a learnable bias vector.
[0117] It should be noted that the purpose of obtaining the spatial attention map in this step is to adjust features for different categories, improve the model's ability to distinguish difficult samples, and enhance segmentation accuracy. In this invention, due to the introduction of convolutional features with higher spatial resolution in the model, it is more sensitive to complex shapes in space, and can improve the accuracy of the model in separating the irregular contours of terraces, which has a significant improvement in the problem of difficulty in distinguishing terraces from surrounding objects.
[0118] In addition, it should be noted that the convolution features concatenated with the fusion features are generally one or more of the second-level convolution features, the third-level convolution features, and the fourth-level convolution features.
[0119] Step S102: inputting the image to be tested into the trained semantic segmentation model to obtain the target terrace pixel probability distribution corresponding to the image to be tested, and extracting all terrace plots from the image to be tested according to the target terrace pixel probability distribution.
[0120] It should be pointed out that if Figures 3 to 6As shown in FIG, after the semantic segmentation model is trained, the image to be identified is input into the trained semantic segmentation model, so that the target terrace pixel probability distribution can be obtained.
[0121] Furthermore, a terrace pixel point set and a background pixel point set are obtained according to the target terrace pixel probability distribution, wherein the terrace pixel point set includes a plurality of first pixel points with terrace attributes and a first pixel coordinate corresponding to each of the first pixel points, and the background pixel point set includes a plurality of second pixel points with background attributes and a second pixel coordinate corresponding to each of the second pixel points; at least one first connected region is obtained according to the first pixel points and the first pixel coordinates; it is determined whether the area of the first connected region is greater than a preset area threshold; if the area of the first connected region is less than or equal to the preset area threshold, all the pixel points in the first connected region are changed to second pixel points, thereby eliminating small-area broken patches that may have errors;
[0122] If the area of the first connected region is greater than a preset area threshold, the first connected region is converted into a line vector, and the line vector is converted into a surface vector, and the extraction vector result of the terrace is obtained according to the surface vector.
[0123] Specifically, when converting line vectors, the first connected area in the raster image is narrowed to one pixel width to form a skeleton line, and unnecessary pixels on the edge are iteratively deleted. Starting from one point, adjacent pixels are connected in a clockwise or counterclockwise manner to convert the raster outline into a line vector composed of coordinate points. Then, for closed lines, directly enclose the surface; for open lines, based on the connection relationship with other lines, find the connection points to form a closed polygon, and reconstruct the correct topological relationship between surfaces and surfaces, and between surfaces and lines to ensure the accuracy and completeness of the data. Then, using the Douglas Peucker algorithm, find the point on the curve (surface boundary) that is farthest from the line connecting the first and last endpoints. If the distance is greater than the preset distance threshold, it will be retained and recursively processed in segments; if it is less than the preset distance threshold, it will be deleted and replaced with a straight line segment, thereby achieving surface vector thinning and simplification.
[0124] Due to the complex texture characteristics related to the shape and size of the terraces, the varying lighting conditions caused by the terrain, and the diverse spectral characteristics of the terraces themselves, the model's original predictions inevitably contain a small amount of fragmented patches or overly complex edge contours. Directly using the model output as the extracted terrace plots, despite the relatively small differences in area, would inevitably lead to poor usability during the terrace-by-terrace identification process. However, the post-extraction processing designed by the present invention, tailored to the various characteristics of the terraces, can significantly improve these issues.
[0125] In addition, in some embodiments, the above extraction process is also evaluated, and the accuracy and error evaluation indicators are as follows:
[0126] (1) Accuracy reflects the proportion of correctly predicted pixels in the total pixels. The formula is as follows:
[0127] ;
[0128] in Represents the number of pixels that are correctly predicted to be positive (for example, terraced pixels are correctly identified). represents the number of pixels correctly predicted as negative class (non-terraced pixels are correctly identified), is the number of pixels incorrectly predicted as positive, is the number of pixels incorrectly predicted as negative.
[0129] (2) Intersection over Union (IoU) calculates the ratio of the intersection over union of the predicted result and the true label. For each category, the IoU is calculated and averaged to obtain the mean IoU (mIoU), which can fully reflect the segmentation performance of the model on different categories. The formula is as follows:
[0130] ;
[0131] (3) Mean Absolute Error (MAE) can intuitively reflect the average degree to which the prediction results deviate from the true value. The smaller the value, the more accurate the prediction. The formula is as follows:
[0132] ;
[0133] in, is the total number of pixels, is the predicted pixel class, These indicators together constitute the accuracy evaluation system of the present invention and serve as the basis for evaluating the accuracy of the method in the longitude verification phase.
[0134] In summary, the above-mentioned terrace extraction method based on a deep learning semantic segmentation model significantly improves the ability to express crop characteristics in terraced plots and the model's recognition rate of terraced plots in complex terraced geographical environments by introducing multi-level convolution and class weighting. Increasing class weighting enhances class differentiation and provides robustness for a variety of geographic objects of varying sizes and locations. It accurately identifies specific categories even when the geographic objects are small or partially occluded. This enables the model to better identify the type, area, and distribution of various geographic objects (including terraced plots) in complex scenarios, thereby optimizing the extraction of terraced plots and improving their accuracy in complex scenes.
[0135] like Figure 7 As shown, the present invention provides a terrace extraction system based on a deep learning semantic segmentation model, the system comprising:
[0136] The semantic segmentation model training module 10 is used to construct a data set about terraced fields and train a semantic segmentation model based on the data set, specifically including:
[0137] Performing a multi-level convolution operation on the data set to obtain multi-level convolution features, and performing parallel multi-branch processing on the convolution features to obtain a first feature, a second feature, a third feature, and a fourth feature;
[0138] performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature;
[0139] Splicing the fusion feature with the convolution feature to obtain a spliced feature, generating a category weight according to the spliced feature, and obtaining a terraced pixel probability distribution of each image in the data set according to the category weight;
[0140] The terraced field image detection module 20 is used to input the image to be tested into the trained semantic segmentation model, obtain the target terraced field pixel probability distribution corresponding to the image to be tested, and extract all terraced field plots from the image to be tested according to the target terraced field pixel probability distribution.
[0141] On the other hand, the present invention further proposes a storage medium on which one or more programs are stored, which, when executed by a processor, implement the above-mentioned terrace extraction method based on the deep learning semantic segmentation model.
[0142] On the other hand, the present invention also proposes an electronic device, including a memory and a processor, wherein the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory to implement the above-mentioned terrace extraction method based on the deep learning semantic segmentation model.
[0143] Those skilled in the art will appreciate that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device), or in conjunction with such instruction execution system, apparatus, or device. For purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device.
[0144] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting, or processing it in another suitable manner as necessary, and then storing it in a computer memory.
[0145] It should be understood that various components of the present invention may be implemented using hardware, software, firmware, or a combination thereof. In the aforementioned embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one or a combination of the following technologies known in the art may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.
[0146] While the embodiments of the present invention have been described in detail above, it will be apparent to those skilled in the art that various modifications and variations of these embodiments are possible. However, it should be understood that such modifications and variations are within the scope and spirit of the present invention as set forth in the claims. Furthermore, the invention described herein is susceptible to other embodiments and may be practiced or implemented in a variety of ways.
Claims
1. A terrace extraction method based on a deep learning semantic segmentation model, characterized in that: The method comprises: Construct a dataset about terraced fields and train a semantic segmentation model based on the dataset, specifically including: Performing a multi-level convolution operation on the data set to obtain multi-level convolution features, and performing parallel multi-branch processing on the convolution features to obtain a first feature, a second feature, a third feature, and a fourth feature; Multi-level convolution operations are performed according to the following formula: ; in, Indicates the The composite operation of the stage includes convolution, normalization, and activation in sequence. 、 Respectively represent Level, first Level convolutional features, Representing the images in the dataset, the second-level and third-level convolutional features contain spatial detail information of edges and textures, and the fourth-level and fifth-level convolutional features contain high-order semantic information; The convolutional features are processed in parallel using the following formula: ; in, 、 、 、 Represent the first feature, the second feature, the third feature, and the fourth feature respectively, The void ratio is of Convolution, d represents the void rate, represents global average pooling, Indicates first Convolution, then upsampling operation, and the features are adjusted to and , represents the height of the feature, Indicates the width of the feature; performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature; The upsampling process is performed according to the following formula: ; in, represents the adjusted i-th level convolution feature, , represents the i-th level upsampled feature, , Represents bilinear times upsampling; Generate multi-scale features according to the following formula: ; in, Represents multi-scale features, represents channel dimension splicing, express The feature tensor dimension of The height becomes , the width becomes , the number of channels becomes 256; Fusion is performed according to the following formula: ; in, represents the fusion feature, express convolution, 、 、 Represent the 2nd, 3rd, and 4th level upsampling features respectively; Splicing the fusion feature with the convolution feature to obtain a spliced feature, generating a category weight according to the spliced feature, and obtaining a terraced pixel probability distribution of each image in the data set according to the category weight; Class weights are generated according to the following formula: ; in, Represents the category weight vector, C represents the dimension of the vector, which is a positive integer. 、 represents a learnable weight matrix, represents an activation function, represents the rectified linear unit activation function, Represents the splicing feature, express The vector space where The image to be tested is input into the trained semantic segmentation model to obtain the target terrace pixel probability distribution corresponding to the image to be tested, and all terrace plots are extracted from the image to be tested according to the target terrace pixel probability distribution.
2. The terrace extraction method based on deep learning semantic segmentation model according to claim 1 is characterized in that: The steps of constructing a dataset about terraced fields include: Acquire terraced remote sensing images, and annotate the images in the terraced remote sensing images frame by frame, wherein the annotation results include terraced contours, terraced surfaces, and backgrounds, and generate a data set based on the annotated images.
3. The terrace extraction method based on deep learning semantic segmentation model according to claim 2 is characterized in that: The step of obtaining the terraced pixel probability distribution of each image in the data set according to the category weight includes: Generate a spatial attention map based on the class weights: ; in, is the spatial attention map, Indicates size The matrix of all 1s, represents the tensor product; Perform feature reweighting on the spatial attention map: ; in, represents the feature representation after feature reweighting by the spatial attention mechanism, represents element-wise multiplication; The probability distribution of terraced pixels is obtained according to the following formula: ; in, represents the probability distribution of terraced pixels, represents normalization processing, is a learnable weight matrix, Indicates bilinear 8x upsampling, is a learnable bias vector.
4. The terrace extraction method based on deep learning semantic segmentation model according to claim 3 is characterized in that: The step of inputting the image to be tested into the trained semantic segmentation model, obtaining a target terrace pixel probability distribution corresponding to the image to be tested, and extracting all terrace plots from the image to be tested according to the target terrace pixel probability distribution includes: Acquire a terrace pixel point set and a background pixel point set according to the target terrace pixel probability distribution, wherein the terrace pixel point set includes a plurality of first pixel points with terrace attributes and a first pixel coordinate corresponding to each of the first pixel points, and the background pixel point set includes a plurality of second pixel points with background attributes and a second pixel coordinate corresponding to each of the second pixel points; Acquire at least one first connected area according to the first pixel point and the first pixel coordinates; Determining whether the area of the first connected region is greater than a preset area threshold; If the area of the first connected region is less than or equal to the preset area threshold, all pixels in the first connected region are changed to second pixels; If the area of the first connected region is greater than a preset area threshold, the first connected region is converted into a line vector, and the line vector is converted into a surface vector, and the extraction vector result of the terrace is obtained according to the surface vector.
5. A terraced field extraction system based on a deep learning semantic segmentation model, characterized in that: The system comprises: The semantic segmentation model training module is used to construct a dataset about terraced fields and train a semantic segmentation model based on the dataset, specifically including: Performing a multi-level convolution operation on the data set to obtain multi-level convolution features, and performing parallel multi-branch processing on the convolution features to obtain a first feature, a second feature, a third feature, and a fourth feature; Multi-level convolution operations are performed according to the following formula: ; in, Indicates the The composite operation of the stage includes convolution, normalization, and activation in sequence. 、 Respectively represent Level, first Level convolutional features, Representing the images in the dataset, the second-level and third-level convolutional features contain spatial detail information of edges and textures, and the fourth-level and fifth-level convolutional features contain high-order semantic information; The convolutional features are processed in parallel using the following formula: ; in, 、 、 、 Represent the first feature, the second feature, the third feature, and the fourth feature respectively, The void ratio is of Convolution, d represents the void rate, represents global average pooling, Indicates first Convolution, then upsampling operation, and the features are adjusted to and , represents the height of the feature, Indicates the width of the feature; performing upsampling processing on the convolution feature to obtain a multi-level upsampling feature, generating a multi-scale feature based on the first feature, the second feature, the third feature, and the fourth feature, and fusing the multi-scale feature with the multi-level upsampling feature to obtain a fused feature; The upsampling process is performed according to the following formula: ; in, represents the adjusted i-th level convolution feature, , represents the i-th level upsampled feature, , Represents bilinear times upsampling; Generate multi-scale features according to the following formula: ; in, Represents multi-scale features, represents channel dimension splicing, express The feature tensor dimension of The height becomes , the width becomes , the number of channels becomes 256; Fusion is performed according to the following formula: ; in, represents the fusion feature, express convolution, 、 、 Represent the 2nd, 3rd, and 4th level upsampling features respectively; Splicing the fusion feature with the convolution feature to obtain a spliced feature, generating a category weight according to the spliced feature, and obtaining a terraced pixel probability distribution of each image in the data set according to the category weight; Class weights are generated according to the following formula: ; in, Represents the category weight vector, C represents the dimension of the vector, which is a positive integer. 、 represents a learnable weight matrix, represents an activation function, represents the rectified linear unit activation function, Represents the splicing feature, express The vector space where The terraced field image detection module is used to input the image to be tested into the trained semantic segmentation model, obtain the target terraced field pixel probability distribution corresponding to the image to be tested, and extract all terraced field plots from the image to be tested according to the target terraced field pixel probability distribution.
6. A storage medium, characterized in that The storage medium stores one or more programs, which, when executed by the processor, implement the terrace extraction method based on the deep learning semantic segmentation model as described in any one of claims 1 to 4.
7. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein: The memory is used to store computer programs; When the processor is used to execute the computer program stored in the memory, it implements the terrace extraction method based on the deep learning semantic segmentation model as described in any one of claims 1 to 4.