A method and system for semantic segmentation of geographic environment based on remote sensing images
Through the Segformer encoder and the decoder of the pooled feature pyramid structure, combined with the cross-entropy loss function and AdamW optimizer, the shortcomings in accuracy and robustness of the remote sensing image semantic segmentation model are solved, and high accuracy and strong generalization capabilities are achieved. semantic segmentation effect.
Patent Information
- Application Number
- CN202410939567.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-15
AI Technical Summary
Existing remote sensing image semantic segmentation models have deficiencies in accuracy, robustness, and generalization capabilities, making it difficult to effectively handle complex texture information and noise in geographical environments, resulting in inaccurate segmentation results.
Using Segformer encoder and decoder based on pooled feature pyramid structure, by constructing PPM Head layer, FPN Feature layer, Fuse layer and Head layer, combined with cross-entropy loss function and AdamW optimizer, a semantic segmentation model is built to improve feature extraction and Integration capabilities.
It achieves high-precision semantic segmentation of remote sensing images, enhances the robustness and generalization capabilities of the model, and can more accurately identify and segment geographical elements, especially in different scenes and regions.
Smart Images

Figure CN118470333B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning applications, and in particular to a method and system for semantic segmentation of a geographic environment based on remote sensing images. Background Art
[0002] In the prior art, with the continuous development of artificial intelligence deep learning methods, computer vision has gradually become a hot research field in artificial intelligence. At present, one of the key technologies for computers to understand semantic information in images is image segmentation. Image semantic segmentation can divide each pixel in the image into different semantic categories. Compared with traditional image classification tasks, semantic segmentation requires that all pixels in the image be classified one by one, that is, to determine the category to which each pixel belongs, such as buildings, roads, cars, farmland, etc. in the segmented image. Semantic segmentation based on remote sensing images is of great significance to urban planning, agricultural production, environmental protection, disaster monitoring, urban and rural development, etc., and can provide reliable geographic information support for decision-making and management in related fields.
[0003] There are a large number of geographic environment structures and complex texture information in remote sensing images. At present, most remote sensing image semantic segmentation models adopt an encoder-decoder structure. However, there are still some problems with the existing decoder structure. First, due to multiple upsampling operations in the decoder, it is easy to cause information loss and confusion. Secondly, in the same semantic space, the spatial relationship and contextual information between different land object categories are important, but the existing decoder cannot handle their relationship well. In addition, since the segmented image is often affected by remote sensing data, the decoder needs to better handle noise, transformation, and inaccurate labeling in the remote sensing image. At this stage, a geographic environment semantic segmentation method and system based on remote sensing images is needed. Summary of the invention
[0004] In order to solve the above problems, the present invention proposes a method and system for semantic segmentation of geographic environment based on remote sensing images, which can solve the difficult problems of low accuracy, weak robustness and poor generalization ability of semantic segmentation of remote sensing images, and provide more efficient and accurate technology for environmental detection and urban planning.
[0005] In a first aspect, the present invention provides a method for semantic segmentation of a geographical environment based on remote sensing images, which adopts the following technical solution:
[0006] A method for semantic segmentation of geographic environment based on remote sensing images, comprising:
[0007] Acquire a remote sensing image data set, and preprocess the acquired remote sensing image data set;
[0008] An encoder is constructed based on the acquired remote sensing image dataset, and the encoder is used to extract features of the image dataset;
[0009] Construct the decoder based on the feature extraction of the encoder, including constructing the PPM Head layer, FPN Feature layer, Fuse layer, Fused Feature Map layer, and Head layer;
[0010] Combine the constructed encoder and decoder into a semantic segmentation model;
[0011] The semantic segmentation model is trained and optimized using remote sensing image datasets, including using the cross entropy loss function to calculate the error between the output value and the predicted value, and optimizing it using the AdamW optimizer based on the error value;
[0012] Use the trained semantic segmentation model to output the prediction results.
[0013] Furthermore, the acquired remote sensing image data set is preprocessed, including outlining vector samples based on the acquired remote sensing image, adding a category field to label the vector samples, rasterizing the vectors to obtain vector grids according to the remote sensing image resolution, number of rows and columns, and projection, segmenting the remote sensing image and the vector grid into images of equal width and height according to the specified number of rows and columns, number of bands, and number of overlapping pixels of adjacent slices, and dividing the segmented images into a training set and a test set.
[0014] Furthermore, the encoder is constructed based on the acquired remote sensing image data set, including an encoder part adopting a Segformer encoder, and the Segformer encoder is provided with four Transformer blocks with different output feature map sizes.
[0015] Furthermore, the decoder is constructed according to the feature extraction of the encoder, including constructing a PPM Head layer, an FPN Feature layer, a Fuse layer, a Fused Feature Map layer and a Head layer based on a pooled feature pyramid structure, and the feature images of four different depths output by the encoder are respectively input into the deconvolution upsampling part of the decoder of the corresponding size to obtain feature maps with the same size, and the feature maps of the same size are input into the Fused Feature Map layer for weighted fusion, and finally each classified pixel is output through a multi-layer perceptron.
[0016] Furthermore, the construction of the PPM Head layer, FPN Feature layer, Fuse layer, Fused Feature Map layer and Head layer includes using the PPM Head layer to receive feature semantic information output by the encoder, fusing features of different levels through the FPN Feature layer to capture multi-scale target information; further fusing and strengthening features according to the Fuse layer and the Fused Feature Map layer; based on the fused feature map, the Head layer uses the Softmax function to convert each pixel in the feature map into a probability distribution of different categories to obtain a pixel-level classification result.
[0017] Furthermore, the constructed encoder and decoder are combined into a semantic segmentation model, including using feature maps of different sizes generated by four Transformer blocks in the encoder, inputting the deepest feature map into the FPN pyramid network of the decoder after passing through the feature pyramid pooling layer, generating four feature maps of different scales according to the decoder, integrating the feature map into the FPN pyramid network again, using the FPN pyramid network to fuse feature information of different scales and semantic levels, and finally, classifying each pixel through a multi-layer perceptron to complete pixel-level semantic segmentation prediction.
[0018] Furthermore, the remote sensing image dataset is used to train and optimize the semantic segmentation model, including using a cross entropy loss function to measure the difference between the model prediction value and the actual value, and optimizing using an AdamW optimizer according to the error value. The cross entropy loss function The calculation formula is:
[0019] ,
[0020] in, represents the predicted value of pixel i in the image, represents the true value of pixel i in the image, and p represents the total number of pixels in the image.
[0021] In the second aspect, a geographic environment semantic segmentation system based on remote sensing images includes:
[0022] The data acquisition module is configured to: acquire a remote sensing image data set, and preprocess the acquired remote sensing image data set;
[0023] The encoder module is configured to: construct an encoder based on the acquired remote sensing image data set, and use the encoder to extract features of the image data set;
[0024] The decoder module is configured to: construct a decoder according to the feature extraction of the encoder, including constructing a PPMHead layer, an FPN Feature layer, a Fuse layer, a Fused Feature Map layer, and a Head layer;
[0025] The model module is configured to: combine the constructed encoder and decoder into a semantic segmentation model;
[0026] The model training module is configured to: train and optimize the semantic segmentation model using the remote sensing image dataset, including calculating the error between the output value and the predicted value using the cross entropy loss function, and optimizing using the AdamW optimizer according to the error value;
[0027] The output module is configured to output prediction results using the trained semantic segmentation model.
[0028] In a third aspect, the present invention provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded and executed by a processor of a terminal device, for example, a method for semantic segmentation of a geographic environment based on remote sensing images.
[0029] In a fourth aspect, the present invention provides a terminal device comprising a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded by the processor and executing the method for semantic segmentation of a geographic environment based on remote sensing images.
[0030] In summary, the present invention has the following beneficial technical effects:
[0031] 1. The present invention can extract rich and multi-level feature information from remote sensing images by using an encoder such as Segformer and a decoder based on a pooled feature pyramid structure. The Transformer Block in the encoder can capture global context information, and the decoder can effectively reconstruct and refine these features, thereby accurately identifying and segmenting different geographic elements.
[0032] 2. The present invention constructs the PPM Head layer, FPN Feature layer, Fuse layer, Fused Feature Map layer and Head layer to process and fuse the features output by the encoder from different dimensions and levels. The PPM Head layer receives the feature semantic information of the encoder, which helps to deeply understand the complex feature representation; the FPN Feature layer fuses features at different levels to capture multi-scale target information, thereby better coping with the diversity of object sizes in the geographical environment.
[0033] 3. The present invention connects the encoder and decoder horizontally through the FPN pyramid network to fuse feature maps of different semantic information. This multi-scale and multi-level feature fusion method enables the model to learn more general feature patterns, so that when facing remote sensing images of different regions and scenes, it has stronger generalization ability and can accurately perform semantic segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is an overall structural diagram of a model in a method for semantic segmentation of a geographic environment based on remote sensing images in an embodiment of the present invention.
[0035] Figure 2 It is a feature pyramid model diagram in a method for semantic segmentation of a geographic environment based on remote sensing images in an embodiment of the present invention.
[0036] Figure 3 It is a structural diagram of a decoder in a method for semantic segmentation of a geographic environment based on remote sensing images according to an embodiment of the present invention.
[0037] Figure 4 This is a segmentation effect diagram of an urban scene according to an embodiment of the present invention.
[0038] Figure 5 This is a diagram of the segmentation effect in a rural scene according to an embodiment of the present invention.
[0039] Figure 6 This is a rendering of a suburban scene according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The present invention is further described in detail below in conjunction with the accompanying drawings.
[0041] Example 1
[0042] Reference Figure 1 , a geographical environment semantic segmentation method based on remote sensing images of this embodiment includes:
[0043] Acquire a remote sensing image data set, and preprocess the acquired remote sensing image data set;
[0044] An encoder is constructed based on the acquired remote sensing image dataset, and the encoder is used to extract features and encode the image dataset;
[0045] Construct the decoder based on the output of the encoder, including constructing the PPM Head layer, FPN Feature layer, Fuse layer, Fused Feature Map layer, and Head layer;
[0046] Combine the constructed encoder and decoder into a semantic segmentation model;
[0047] The semantic segmentation model is trained and optimized using remote sensing image datasets, including using the cross entropy loss function to calculate the error between the output value and the predicted value, and optimizing it using the AdamW optimizer based on the error value;
[0048] Use the trained semantic segmentation model to output the prediction results.
[0049] Specifically, a remote sensing image-based geographic environment semantic segmentation method of this embodiment includes the following steps: S1, obtaining a remote sensing image dataset, and preprocessing the obtained remote sensing image dataset;
[0050] The LoveDA dataset and Potsdam dataset are used for model training and testing. The LoveDA dataset contains 5987 high-resolution remote sensing images, and the Potsdam dataset contains a total of 38 red, green and blue channels, with a size of 6000×6000 pixels, and the corresponding ground truth labels.
[0051] In the LoveDA dataset, the model uses 2512 images as training sets and 1670 images as test sets. The model slices 38 images in the Potsdam dataset. After removing images with inconsistent formats, 3456 images and their label images are obtained as training sets, and 2013 images and their label images are used as test sets. The specific slicing method is as follows: first, vector samples are drawn according to the acquired remote sensing images. When annotating vectors, ensure that their coordinate system and projection are consistent with the image, and add a category field to indicate the category of the feature (for example, background is 0, target category is 1, etc.). Note that the boundaries of the annotated vectors should not exceed the boundaries of the image, check the validity of the input parameters and vectors, and then rasterize the vectors so that their resolution, number of rows and columns, and projection are the same as the template image. Then, the image and the converted annotated grid are sliced according to the specified number of rows and columns, number of bands, and number of overlapping pixels of adjacent slices. The slices with inconsistent formats in the image slices are deleted, and the slices in the same position are retained.
[0052] like Figure 2 As shown, S2, constructing an encoder based on the acquired remote sensing image data set, and using the encoder to extract features and encode the image data set;
[0053] The overall encoding and decoding structure used in the present invention is Mit-PPM-FPN, and the Segformer encoder is used in the encoder part. Since the Segformer encoder has four Transformer blocks, the size of the feature map output by each Transformer block is different. Therefore, the decoder based on the feature pyramid structure can well receive the feature images generated by each stage of the encoder. Feature information analysis of these images can better predict category information of the same category at different scales.
[0054] The encoder part uses a four-layer FPN pyramid network to horizontally connect the feature images of four different scales output by the decoder part. The deepest feature map is also input into the FPN through a feature pyramid pooling layer. This can improve the generalization ability and prediction accuracy of the model. By timely processing the feature maps of different scales output by the encoder, the feature fusion can converge faster and get better results.
[0055] like Figure 3 As shown, S3, constructing a decoder according to the output result of the encoder, including constructing a PPM Head layer, an FPN Feature layer, a Fuse layer, a Fused Feature Map layer, and a Head layer;
[0056] The decoder uses a feature pyramid structure based on pooling. The four feature images of different depths output by the encoder are respectively input into the deconvolution upsampling part of the corresponding size of the decoder. Then the feature maps of different levels and scales are upsampled to make them have the same size. After that, they are spliced or weighted fused through the Fused Feature Map to finally obtain a comprehensive feature map. This feature map can simultaneously retain high-quality feature information of different levels and sizes, thereby improving the expressiveness and generalization ability of the model. Finally, each pixel after classification is output through an MLP layer.
[0057] The decoder part of the present invention is mainly composed of five parts: PPM Head layer, FPN Feature layer, Fuse layer, FusedFeature Map layer and Head layer.
[0058] (1) PPM Head Layer
[0059] The PPM Head is used in the decoder to receive the highest-level feature semantic information in order to enhance the network's understanding of deeper semantic information. The PPM module divides the input feature map into sub-regions of different scales, each of which has a different size and scale. Then, for each sub-region, the PPM module uses a set of independent pooling operations, including average pooling, maximum pooling, etc., to capture contextual information in different ranges. The feature vectors obtained at each scale are cascaded together to form a multi-scale pyramid pooling. The PPM module can effectively eliminate differences in object size and position, and improve the model's ability to recognize objects and generalize performance.
[0060] (2) FPN Feature Layer
[0061] This part fuses the features obtained from bottom to top through a special pyramid connection method. Specifically, the feature maps of different resolutions from the four modules of the encoder are enlarged to the same size as the high-resolution feature map by upsampling. Then the feature maps of two adjacent levels are fused in an element-wise addition manner, and the fused result is sent to the next level.
[0062] Through this process, a set of multi-scale feature maps can be obtained, which can effectively capture target information of different scales, thereby improving the detection or segmentation ability of the model. In FPN, feature maps of different resolutions are cascaded together to form a cascade feature map, and detection and classification predictions are made on the cascade feature map. Using FPN can provide better detection performance while maintaining a relatively fast processing speed.
[0063] (3) Fuse layer
[0064] In this section, the feature maps that have passed through FPN are initially fused. Since different feature maps differ in size and dimension, they need to be adjusted before feature fusion, and unified to the same size and dimension through convolution, interpolation, pooling, etc., to facilitate subsequent feature fusion and processing. The feature maps of different convolutional layers are added together according to the same size to obtain a new feature map, which is then sent to the next convolutional layer for further processing. This processing method can fuse the low-level features of the bottom layer with the high-level features of the upper layer, thereby extracting more semantic information, making the model more powerful in detecting or segmenting targets.
[0065] (4) Fused Feature Map layer
[0066] Fused Feature Map fuses multiple convolutional neural network feature maps of different sizes and levels to obtain a more powerful feature representation. In the neural network model, each convolution layer outputs a feature map, which contains the abstract high-dimensional features of the original image after the convolution operation.
[0067] In order to better utilize these feature maps and extract rich semantic information, fuse them and generate a more powerful feature representation, the present invention upsamples feature maps of different levels and scales so that they have the same size, and then concatenates or weighted fuses them to finally obtain a comprehensive feature map. This feature map can simultaneously retain high-quality feature information of different levels and sizes, thereby improving the expressiveness and generalization ability of the model.
[0068] (5) Head layer
[0069] The fused feature map with rich semantic information is predicted and output. The upsampled feature map can be regarded as a matrix in which each element corresponds to a pixel. For each pixel, it needs to be classified into the corresponding target category. The upsampled feature map is input into a convolutional layer, and the matrix of category probabilities is output. Then, the Softmax function is used to convert it into the probability distribution of each pixel belonging to different categories, so as to obtain the pixel-level classification result.
[0070] like Figure 1 As shown, S4, the constructed encoder and decoder are combined into a semantic segmentation model;
[0071] First, the four Transformer blocks in the encoder generate feature maps of different sizes, which contain information of the image at different levels and scales.
[0072] Then, the deepest feature map is processed by the feature pyramid pooling layer (PPM Head layer), which can perform multi-scale pooling operations on the feature map to capture richer contextual information. The processed feature map is input into the feature pyramid network (FPN pyramid network) of the decoder.
[0073] The decoder generates four feature maps of different scales, which can better handle objects of different sizes and detail information in the image. Then, these feature maps are integrated into the FPN pyramid network again. The function of the FPN pyramid network is to fuse feature information of different scales and semantic levels. Through this fusion, the multi-scale features from the encoder can be fully utilized, so that the model can pay attention to the global and local information of the image at the same time, thereby improving the segmentation ability of objects of various sizes and shapes.
[0074] Finally, each pixel is classified by a multi-layer perceptron to complete pixel-level semantic segmentation prediction. The multi-layer perceptron can determine the category of each pixel based on the fused feature information, achieve accurate classification at the pixel level, and obtain the final semantic segmentation result. The advantage of this combination is that it can effectively combine the rich features extracted by the encoder and the upsampling and feature fusion capabilities of the decoder. The encoder extracts multi-scale features through Transformer blocks and pooling operations, and the decoder fuses these features through the FPN pyramid network and restores them to the resolution of the original image, thereby achieving accurate semantic classification of each pixel and improving the performance and accuracy of the semantic segmentation model. Specifically, it can better handle objects of different sizes and shapes, retain more detailed information, and can adaptively fuse features of different levels and scales to cope with complex geographical environments and image content, that is, complete the combination of the encoder and decoder into a semantic segmentation model.
[0075] S5. Use the remote sensing image dataset to train and optimize the semantic segmentation model, including using the cross entropy loss function to calculate the error between the output value and the predicted value, and using the AdamW optimizer to optimize according to the error value;
[0076] The loss function is a function used in deep learning to measure the difference between the model's predicted value and the actual value. When training a neural network, the loss function is used to represent the error between the model's output and the true label, and the model parameters are optimized by minimizing the value of the loss function. The model uses the cross entropy loss function during training. The cross entropy loss function mainly describes the distance between the expected output and the actual output, and can measure the similarity between the predicted value and the true value. The formula is as follows:
[0077] ,
[0078] in, represents the predicted value of pixel i in the image, represents the true value of pixel i in the image, and p represents the total number of pixels in the image.
[0079] The optimizer used in the present invention is the AdamW optimizer, which is a variant based on the Adam optimizer. On the basis of the Adam optimizer, it introduces a regularization method, namely weight decay, to solve the problem that the weight decay effect of the Adam optimizer is not good. Weight decay is a commonly used regularization method, which limits the complexity of the model by adding a regularization term to the objective function, thereby reducing the risk of overfitting. In the traditional SGD optimizer, the implementation of weight decay is to multiply the weight vector by a number less than 1, that is, to reduce it along the direction of the gradient. However, when applied to the Adam optimizer, weight decay affects the convergence of the algorithm, causing the training process to become unstable. In order to solve this problem, AdamW adopts a new weight decay strategy, that is, "reset" the weight in the Adam optimizer, and divide the L2 norm of the weight by a parameter before each update, where refers to the learning rate, which is equivalent to a standard weight decay for all parameters in the last step of Adam update. This strategy will make the model have better generalization performance and will not affect the convergence of the Adam optimizer.
[0080] In addition, the AdamW optimizer can also adaptively adjust the learning rate, use quadratic gradients to estimate the parameter update amount, adaptively scale the gradient, etc. The AdamW optimizer has better performance and effects in deep learning training.
[0081] S6. Use the trained semantic segmentation model to output the prediction results;
[0082] First, we tested it in an urban scene and compared it with the Segformer model. In the test results, different colors represent different objects or geographical elements. The semantic segmentation results of remote sensing images in urban scenes are as follows: Figure 4 As shown by Figure 4 It can be seen that the present invention has a better segmentation effect on vehicles and can have a better understanding of the semantic information of the edge part.
[0083] The second is to conduct semantic segmentation tests in rural geographical environments, mainly testing the accuracy of segmentation of farmland and agricultural and forestry edges. Figure 5 As shown by Figure 5 It can be seen that compared with the Segformer method, the present invention has better segmentation effects on agriculture, forestry and farmland, and can better predict the semantic information of the edge parts of farmland and agriculture and forestry.
[0084] The third is to test the suburban geographical environment, mainly testing the segmentation effect of large-area buildings, such as Figure 6 As shown, the results show that the present invention has a better segmentation effect on large-area buildings such as factories and can more accurately predict the edge information of large-area buildings.
[0085] Example 2
[0086] The difference between this embodiment and embodiment 1 is that this embodiment provides a geographical environment semantic segmentation system based on remote sensing images;
[0087] The data acquisition module is configured to: acquire a remote sensing image data set, and preprocess the acquired remote sensing image data set;
[0088] The encoder module is configured to: construct an encoder based on the acquired remote sensing image data set, and use the encoder to extract features and encode the image data set;
[0089] The decoder module is configured to: construct a decoder according to the output result of the encoder, including constructing a PPMHead layer, an FPN Feature layer, a Fuse layer, a Fused Feature Map layer, and a Head layer;
[0090] The model module is configured to: combine the constructed encoder and decoder into a semantic segmentation model;
[0091] The model training module is configured to: train and optimize the semantic segmentation model using the remote sensing image dataset, including calculating the error between the output value and the predicted value using the cross entropy loss function, and optimizing using the AdamW optimizer according to the error value;
[0092] The output module is configured to output prediction results using the trained semantic segmentation model.
[0093] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded and executed by a processor of a terminal device, for a method for semantic segmentation of a geographic environment based on remote sensing images.
[0094] A terminal device includes a processor and a computer-readable storage medium, wherein the processor is used to implement various instructions; the computer-readable storage medium is used to store multiple instructions, wherein the instructions are suitable for being loaded by the processor and executing the method for semantic segmentation of a geographic environment based on remote sensing images.
[0095] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for semantic segmentation of geographic environment based on remote sensing images, characterized in that: include: Acquire a remote sensing image data set, and preprocess the acquired remote sensing image data set; An encoder is constructed based on the acquired remote sensing image dataset, including an encoder part using a Segformer encoder, wherein the Segformer encoder is provided with four Transformer blocks having different output feature map sizes, and the encoder is used to extract features of the image dataset; The decoder is constructed according to the feature extraction of the encoder, including the construction of the PPM Head layer, FPN Feature layer, Fuse layer, Fused Feature Map layer and Head layer based on the pooling feature pyramid structure, and the feature images of four different depths output by the encoder are respectively input into the deconvolution upsampling part of the corresponding size of the decoder to obtain feature maps with the same size, and the feature maps of the same size are input into the Fused Feature Map layer for weighted fusion, and finally each pixel after classification is output through the multi-layer perceptron, wherein the PPM Head layer, FPN Feature layer, Fuse layer, Fused Feature Map layer and Head layer are constructed, including using the PPM Head layer to receive the feature semantic information output by the encoder, dividing the input feature map into sub-regions of different scales, and the size and scale of each sub-region are different. Then, for each sub-region, a set of independent pooling operations, including average pooling and maximum pooling, are used to capture contextual information in different ranges. The feature vectors obtained at each scale are cascaded together to form a multi-scale pyramid pooling, and the features of different levels are fused through the FPNFeature layer to capture multi-scale target information; according to the Fuse layer and FusedFeature The Map layer further fuses and strengthens the features. The Fuse layer unifies them to the same size and dimension through convolution, interpolation, and pooling. The feature maps of different convolutional layers are added together according to the same size to obtain a new feature map, which is then sent to the next convolutional layer for further processing. Based on the fused feature map, the Head layer uses the Softmax function to convert each pixel in the feature map into a probability distribution of different categories to obtain pixel-level classification results. Specifically, for each pixel, it is classified into the corresponding target category, and the upsampled feature map is input into a convolutional layer to output a matrix of category probabilities. The FPN Feature layer upsamples the feature maps of different resolutions from the four modules of the encoder to the same size as the high-resolution feature map, and then fuses the feature maps of two adjacent layers in an element-wise manner, and then sends the fused result to the next layer. The constructed encoder and decoder are combined into a semantic segmentation model, including feature maps of different sizes generated by the four Transformer blocks in the encoder, the deepest feature map is input into the FPN pyramid network of the decoder after passing through the feature pyramid pooling layer, four feature maps of different scales are generated according to the decoder, the feature maps are integrated into the FPN pyramid network again, and the feature information of different scales and semantic levels is fused by the FPN pyramid network. Finally, each pixel is classified by a multi-layer perceptron to complete the pixel-level semantic segmentation prediction; The semantic segmentation model is trained and optimized using the remote sensing image dataset, including using the cross entropy loss function to calculate the error between the output value and the predicted value, and optimizing using the AdamW optimizer based on the error value. The calculation formula is: , in, Represents pixels in an image i The predicted value of Represents pixels in an image i The true value of p Represents the total number of pixels in the image; Use the trained semantic segmentation model to output the prediction results.
2. The method for semantic segmentation of geographical environment based on remote sensing images according to claim 1, characterized in that: The remote sensing image data set is preprocessed, including outlining vector samples based on the remote sensing image, adding a category field to label the vector samples, rasterizing the vectors to obtain vector grids according to the remote sensing image resolution, number of rows and columns, and projection, segmenting the remote sensing image and the vector grid into images of equal width and height according to the specified number of rows and columns, number of bands, and number of overlapping pixels of adjacent slices, and dividing the segmented images into a training set and a test set.
3. A geographical environment semantic segmentation system based on remote sensing images, executing the method according to claim 1, characterized in that: include: The data acquisition module is configured to: acquire a remote sensing image data set, and preprocess the acquired remote sensing image data set; The encoder module is configured to: construct an encoder based on the acquired remote sensing image data set, and use the encoder to extract features of the image data set; The decoder module is configured to: construct a decoder according to the feature extraction of the encoder, including constructing a PPM Head layer, an FPN Feature layer, a Fuse layer, a Fused Feature Map layer, and a Head layer; The model module is configured to: combine the constructed encoder and decoder into a semantic segmentation model; The model training module is configured to: train and optimize the semantic segmentation model using the remote sensing image dataset, including calculating the error between the output value and the predicted value using the cross entropy loss function, and optimizing using the AdamW optimizer according to the error value; The output module is configured to output prediction results using the trained semantic segmentation model.
4. A computer-readable storage medium storing a plurality of instructions, characterized in that: The instructions are suitable for being loaded by a processor of a terminal device and executing a method for semantic segmentation of a geographic environment based on remote sensing images as described in any one of claims 1-2.
5. A terminal device, comprising a processor and a computer-readable storage medium, wherein the processor is used to implement each instruction; and the computer-readable storage medium is used to store multiple instructions, characterized in that: The instructions are suitable for being loaded by a processor and executing a method for semantic segmentation of a geographic environment based on remote sensing images as described in any one of claims 1-2.
