A remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guidance mask
By generating spatial prediction bias information and spatial guidance masks, and adjusting the loss weights, the problem of unreliable supervision in remote sensing image semantic segmentation models is solved, thereby improving the model's stability and detail recognition capabilities.
Patent Information
- Application Number
- CN202611408797.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-11
- Publication Date
- 2026-11-24
AI Technical Summary
Existing training methods for semantic segmentation models of remote sensing images are prone to introducing unreliable supervision, leading to unstable model training results, especially in the identification of target boundaries and small regions.
By generating spatial prediction bias information as the basis for judging pixel reliability, and using the main branch and mask branch of the initial remote sensing image semantic segmentation model, a spatial guiding mask is generated to shield uncertain regions, the loss weights are adjusted, and iterative updates are performed to obtain the target remote sensing image semantic segmentation model.
It improves the stability and accuracy of the semantic segmentation model for remote sensing images, especially in the identification of target boundaries and small regions, and enhances the model's dynamic adaptability and training effect.
Smart Images

Figure CN123160889A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision, and in particular to a method for semantic segmentation of remote sensing images based on dynamic pixel mining and spatial guided masking. Background Technology
[0002] Semantic segmentation is used to assign semantic category labels to each pixel in an input remote sensing image. It is a fundamental technology for tasks such as natural scene understanding, remote sensing image analysis, remote sensing image processing, dual-temporal change detection, and visual inspection in intelligent manufacturing. Semantic segmentation models typically learn the mapping relationship between remote sensing image content and category labels through pixel-level supervised learning. The training stability of these models directly affects the recognition quality of target boundaries, small regions, and long-tail categories.
[0003] Existing training methods for semantic segmentation models of remote sensing images involve pre-increasing the weights of pixels with high loss or low confidence to train the model. This method introduces unreliable supervision, which leads to unreliable model training results. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a semantic segmentation method for remote sensing images based on dynamic pixel mining and spatial guided masking. This method generates spatial prediction bias information and uses this bias information as a criterion for judging the reliability of pixels, thus avoiding the problem of unreliable supervision introduced during model training. The specific scheme is as follows: This application provides a semantic segmentation method for remote sensing images based on dynamic pixel mining and spatial guided masking, including: The training remote sensing image is processed using the main branch of the initial remote sensing image semantic segmentation model to obtain the corresponding master prediction result. Based on the prediction difference between the master prediction result and the pixel-level label corresponding to the training remote sensing image, corresponding spatial prediction bias information is generated. The spatial prediction bias information represents the reliability of the prediction result corresponding to each pixel position. The master prediction result represents the prediction score of each pixel position in the training remote sensing image to belong to each category. Based on the spatial prediction bias information, a dynamic discrimination criterion corresponding to the training remote sensing image is determined, and each pixel position in the training remote sensing image is divided into a reserved region and a masked region according to the dynamic discrimination criterion to generate a corresponding spatial guiding mask; the spatial guiding mask is a binary mask with the same spatial size as the training remote sensing image. The training remote sensing image is processed using the spatial guidance mask to mask the remote sensing image information within the masked area, and the corresponding processed remote sensing image is input into the mask branch of the initial remote sensing image semantic segmentation model for processing to obtain the corresponding mask branch prediction result. Calculate the corresponding main branch loss and mask branch loss based on the main prediction result and the mask branch prediction result respectively, determine the target weight corresponding to the mask branch loss based on the spatial guiding mask, and determine the target total loss based on the main branch loss, the mask branch loss and the target weight; The parameters of the initial remote sensing image semantic segmentation model are iteratively updated based on the target total loss to obtain the corresponding target remote sensing image semantic segmentation model, and the target remote sensing image semantic segmentation model is used to perform semantic segmentation of the remote sensing image to be segmented.
[0005] Optionally, before processing the training remote sensing image using the main branch of the initial remote sensing image semantic segmentation model, the method further includes: The training remote sensing image is subjected to corresponding preprocessing operations according to the remote sensing image type; the preprocessing operations include at least one of scaling, cropping, flipping and color perturbation.
[0006] Optionally, generating corresponding spatial prediction bias information based on the prediction difference between the main prediction result and the pixel-level labels corresponding to the training remote sensing image includes: The main prediction result is converted into prediction category number information with the same coding system as the pixel-level label; The predicted category number information is compared pixel by pixel with the pixel-level label, and the corresponding prediction deviation is determined according to the consistency of the number at each pixel position, so as to generate the prediction deviation information that retains the spatial distribution information of each pixel position.
[0007] Optionally, determining the dynamic discrimination criterion corresponding to the training remote sensing image based on the spatial prediction bias information includes: The deviation values of all pixel positions included in the spatial prediction deviation information are statistically analyzed to obtain statistical characteristic parameters that reflect the overall prediction level of the current model, and these statistical characteristic parameters are determined as the dynamic discrimination criterion.
[0008] Optionally, dividing the pixel locations in the training remote sensing image into reserved regions and masked regions according to the dynamic discrimination criterion includes: Pixels with a deviation level lower than the dynamic discrimination standard in the spatial prediction deviation information are assigned to the reserved area, while pixels with a deviation level not lower than the dynamic discrimination standard are assigned to the shielded area.
[0009] Optionally, processing the training remote sensing image using the spatial guiding mask includes: Multiply the value in the spatial guide mask corresponding to the shielded area by the pixel value of each channel at the corresponding position in the training remote sensing image; wherein the value in the spatial guide mask corresponding to the shielded area is zero.
[0010] Optionally, determining the target weights corresponding to the mask branch loss based on the spatial guiding mask includes: The target proportion of the number of pixels belonging to the reserved region in the spatial guidance mask to the total number of pixels in the training remote sensing image is calculated, and the target weight corresponding to the mask branch loss is determined based on the target proportion.
[0011] Optionally, the main branch of the initial remote sensing image semantic segmentation model and the mask branch share the same set of model parameters; the prediction result of the mask branch is the data obtained by the initial remote sensing image semantic segmentation model based on the shared model parameters on the processed remote sensing image.
[0012] Optionally, the initial remote sensing image semantic segmentation model can be either a convolutional neural network model or a visual Transformer network.
[0013] Optionally, the main branch loss and the mask branch loss are one or a combination of cross-entropy loss, Dice loss, and IoU loss.
[0014] In this application, the training remote sensing image is first processed using the main branch of the initial remote sensing image semantic segmentation model to obtain the corresponding master prediction result. Then, spatial prediction bias information is generated based on the prediction difference between the master prediction result and the pixel-level labels corresponding to the training remote sensing image. The spatial prediction bias information characterizes the reliability of the prediction result corresponding to each pixel position. The master prediction result characterizes the prediction score of each pixel position in the training remote sensing image to belong to each category. Then, based on the spatial prediction bias information, a dynamic discrimination criterion corresponding to the training remote sensing image is determined. Based on the dynamic discrimination criterion, each pixel position in the training remote sensing image is divided into a reserved region and a masked region to generate a corresponding spatial guiding mask. The spatial guiding mask is a binary mask with the same spatial size as the training remote sensing image. Then, the spatial guiding mask is used... The training remote sensing image is processed using the spatially guided mask to mask remote sensing image information within the masked area. The processed remote sensing image is then input into the mask branch of the initial remote sensing image semantic segmentation model for further processing to obtain the corresponding mask branch prediction result. Subsequently, the corresponding main branch loss and mask branch loss are calculated based on the main prediction result and the mask branch prediction result, respectively. The target weight corresponding to the mask branch loss is determined based on the spatially guided mask, and the total target loss is determined based on the main branch loss, the mask branch loss, and the target weight. Finally, the parameters of the initial remote sensing image semantic segmentation model are iteratively updated based on the total target loss to obtain the corresponding target remote sensing image semantic segmentation model. The target remote sensing image semantic segmentation model is then used to perform semantic segmentation on the remote sensing image to be segmented. Therefore, this application solves the problem of unreliable supervision introduced by directly strengthening uncertain pixels by generating spatial prediction bias information based on the prediction difference between the master prediction result and the pixel-level label, and uses this bias information as the basis for judging the reliability of pixels; it also solves the problem of the lack of dynamic adaptability of the discrimination rules by determining dynamic discrimination criteria based on spatial prediction bias information to divide the reserved area and the masked area. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the process of a remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking disclosed in this application; Figure 2This is a schematic diagram of a specific model training method disclosed in this application; Figure 3 This is a schematic diagram of a model training process disclosed in this application. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] See Figure 1 As shown, this embodiment of the invention discloses a method for semantic segmentation of remote sensing images based on dynamic pixel mining and spatial guided masking, including: Step S11: Process the training remote sensing image using the main branch of the initial remote sensing image semantic segmentation model to obtain the corresponding master prediction result, and generate corresponding spatial prediction deviation information based on the prediction difference between the master prediction result and the pixel-level label corresponding to the training remote sensing image; the spatial prediction deviation information characterizes the reliability of the prediction result corresponding to each pixel position; the master prediction result characterizes the prediction score of each pixel position in the training remote sensing image belonging to each category.
[0019] The method in this embodiment uses the spatial deviation between the current prediction and the pixel-level label as a statistical basis, prioritizes the retention of stable, reliable, and easy-to-learn pixels as well as some difficult pixels with deviations lower than the current mean, and masks high-deviation and uncertain pixels. It also uses the spatial location of the retained pixels to complete secondary inference and context reconstruction. At the same time, it adaptively determines the auxiliary loss weights according to the proportion of effective pixels in the mask, thereby achieving stable optimization that is dynamically updated with training iterations without the need for additional hyperparameter mining.
[0020] Specifically, this method adds an auxiliary training chain to the regular main branch training of any semantic segmentation model. This chain consists of prediction bias evaluation, mean-guided pixel discrimination, mask-guided semantic segmentation, and adaptive loss constraints. The main branch and the mask branch share the same set of model parameters. The auxiliary chain is only enabled during the training phase and removed during the inference phase. The overall process is as follows: Figure 2 As shown, the process includes steps such as traditional semantic segmentation, prediction bias assessment, and mean-guided pixel discrimination.
[0021] Let the training remote sensing image be I, the image height and width be H and W respectively, the pixel-level label map (i.e., pixel-level labels) be Y, the number of semantic categories be C, and the semantic segmentation model to be trained be denoted as Fθ, where θ represents the model parameters. The semantic segmentation model (i.e., the initial remote sensing image semantic segmentation model) can be a convolutional network, a visual Transformer network, a pixel classification network, or a mask classification network, and its encoder, decoder, and segmentation head are not limited by this invention. For each training iteration, perform (1) main branch prediction and prediction deviation evaluation (PDE); (2) mean-guided pixel discrimination (MGPD); (3) mask-guided semantic segmentation (MGSS); (4) adaptive loss constraint (ALC); and (5) dynamic update and model output steps.
[0022] In this embodiment, spatial prediction deviation information is generated based on the prediction difference between the master prediction result and the pixel-level label corresponding to the training remote sensing image. This includes: converting the master prediction result into prediction category number information with the same coding system as the pixel-level label; comparing the prediction category number information with the pixel-level label pixel by pixel, and determining the corresponding prediction deviation based on the consistency of the number at each pixel position, so as to generate prediction deviation information that retains the spatial distribution information of each pixel position.
[0023] Specifically, in this embodiment, (1) the specific steps of main branch prediction and prediction deviation evaluation (PDE) are as follows: Input image batch I into the semantic segmentation model Obtain the pixel-by-pixel class probability or class score of the main branch. (i.e., the main prediction result). Along the category dimension... Perform the maximum response index operation to convert the multi-channel output into a predicted category number map P with the same spatial size as the label map; represent the pixel-level label Y as a natural number category number map, calculate the absolute deviation of each pixel position in the unified number space, and obtain the prediction deviation matrix D (i.e., spatial prediction deviation information).
[0024] ; ; ; in, The representation inputs the original, unmasked image I into the semantic segmentation model. Processing, c represents the category dimension, The representation is based on the category dimension, indexing the corresponding category number of the highest probability prediction for each pixel position coordinate (i, j) of each image. It should be noted that different types of pixels correspond to different category numbers. (i, j) represents the pixel position information of the i-th row and j-th column of the image. P(i, j) represents the predicted category segmentation map. Y(i, j) represents the segmentation map of the true label. D(i, j) represents the absolute difference between the main prediction and the label, representing the prediction bias.
[0025] The prediction bias matrix D preserves the spatial location of each pixel and the current prediction consistency information. D(i,j) equal to 0 indicates that the predicted category of the corresponding pixel is consistent with the label; D(i,j) non-zero indicates that the predictions are inconsistent. In other implementations, a category difference metric that can preserve the spatial location of pixels can also be used to obtain D, but it must be ensured that this difference metric can be recalculated as the model parameters are updated.
[0026] In addition, in this embodiment, before processing the training remote sensing image using the main branch of the initial remote sensing image semantic segmentation model, corresponding preprocessing operations can be performed on the training remote sensing image according to the remote sensing image type; the preprocessing operations include at least one of scaling, cropping, flipping, and color perturbation.
[0027] Step S12: Determine the dynamic discrimination criterion corresponding to the training remote sensing image based on the spatial prediction deviation information, and divide the pixel positions in the training remote sensing image into reserved areas and masked areas according to the dynamic discrimination criterion to generate a corresponding spatial guiding mask; the spatial guiding mask is a binary mask with the same spatial size as the training remote sensing image.
[0028] In this embodiment, determining the dynamic discrimination criterion corresponding to the training remote sensing image based on spatial prediction deviation information includes: statistically analyzing the deviation values of all pixel positions contained in the spatial prediction deviation information to obtain statistical characteristic parameters that reflect the overall prediction level of the current model, and determining the statistical characteristic parameters as the dynamic discrimination criterion.
[0029] This invention uses the current average prediction deviation as a dynamic discrimination threshold and the effective pixel ratio of the mask as an auxiliary loss weight. Both pixel segmentation and loss weights are directly generated from training statistics, eliminating the need to manually set hard sample thresholds, fixed sampling ratios, mask ratios, or loss decay curves. This allows it to adapt to different training stages, data distributions, network backbones, and segmentation heads.
[0030] In addition, according to the dynamic discrimination criterion, the pixel positions in the training remote sensing image are divided into reserved regions and masked regions, including: the pixel positions in the spatial prediction deviation information with a deviation degree lower than the dynamic discrimination criterion are divided into reserved regions, and the pixel positions with a deviation degree not lower than the dynamic discrimination criterion are divided into masked regions.
[0031] Specifically, (2) Mean-Guided Pixel Discrimination (MGPD) includes the following steps: Calculate the mean of the prediction bias matrix D for the current image or the current training batch, and use this mean as the adaptive pixel discrimination threshold (i.e., dynamic discrimination criterion) τ for this iteration. Compare the bias of each pixel in D with τ, and generate a binary guiding mask M (i.e., spatial guiding mask) with the same spatial size as the input image, so that pixel positions with biases lower than τ are set to 1 and retained, and pixel positions with biases not lower than τ are set to 0 and masked. ; in, This represents the generated binary mask image.
[0032] Since τ is generated by the statistical distribution of the current prediction bias, the pixel partitioning in the early, middle, and late stages of model training will automatically adjust as the model's capabilities change, without the need to manually specify fixed thresholds, Top-K ratios, or exponential decay parameters. The retained set simultaneously includes both easily learnable pixels with correct predictions and some difficult pixels with biases below the overall mean, thereby establishing a stable semantic prior based on reliable pixels and avoiding high-bias, uncertain pixels from directly dominating backpropagation.
[0033] In other words, this embodiment preserves pixel spatial locations using a prediction bias matrix of the same size as the image and a binary guiding mask, transforming sample mining from independent pixel selection into spatial structure constraints. The preserved regions provide semantic anchors for the model, while the occluded regions enable the model to infer from the context, thereby enhancing the consistency within the regions, boundary recovery capabilities, and semantic understanding of complex scenes.
[0034] Step S13: Process the training remote sensing image using the spatial guidance mask to mask the remote sensing image information within the masked area, and input the corresponding processed remote sensing image into the mask branch of the initial remote sensing image semantic segmentation model for processing to obtain the corresponding mask branch prediction result.
[0035] In this embodiment, the training remote sensing image is processed using a spatial guiding mask, including: multiplying the value of the spatial guiding mask corresponding to the masked area with the pixel value of each channel at the corresponding position in the training remote sensing image; wherein, the value of the spatial guiding mask corresponding to the masked area is zero.
[0036] Specifically, (3) Mask-Guided Semantic Segmentation (MGSS) includes the following steps: The input image I is multiplied element-wise using a binary guided mask M to obtain the masked image (i.e., the processed remote sensing image). .Will By inputting the semantic segmentation model Fθ, which shares parameters with the main branch, we obtain the masked branch prediction (i.e., the masked branch prediction result). In the mask, pixels with a value of 1 retain the original image pixels, while pixels with a value of 0 are masked. Thus, the difficult pixels preserved within the mask can be corrected a second time using reliable semantic cues from adjacent, easily learned pixels, while the high-biased regions masked outside the mask prompt the model to utilize the surrounding context and spatial semantic continuity to complete the reconstruction, forming a correction guide and reconstruction guide for difficult pixels.
[0037] ; ; in, This indicates pixel-by-pixel multiplication.
[0038] Unlike traditional methods that directly enhance high-loss pixels in hard sample mining, this invention first establishes a reliable semantic prior using predictively stable, easily learned pixels. Then, it guides the learning of difficult regions through in-mask secondary correction and out-of-mask context reconstruction. This optimization path, progressing from easy to difficult, reduces the interference of blurred boundaries, class transitions, and noisy labeled pixels on the training process, thereby improving the stability of the gradient signal.
[0039] Step S14: Calculate the corresponding main branch loss and mask branch loss according to the main prediction result and the mask branch prediction result respectively, determine the target weight corresponding to the mask branch loss according to the spatial guiding mask, and determine the target total loss according to the main branch loss, the mask branch loss and the target weight.
[0040] In this embodiment, determining the target weight corresponding to the mask branch loss based on the spatial guiding mask includes: calculating the target proportion of the number of pixels belonging to the reserved region in the spatial guiding mask to the total number of pixels in the training remote sensing image, and determining the target weight corresponding to the mask branch loss based on the target proportion.
[0041] Accordingly, (4) the Adaptive Loss Constraint (ALC) specifically includes the following steps: calculating the main branch predictions respectively. The main segmentation loss (i.e., the main branch loss) between the label Y and the label Y. and mask branch prediction The mask segmentation loss (i.e., mask branch loss) between the label Y and the label Y. The segmentation loss can be cross-entropy loss, Dice loss, IoU loss, or a combination thereof. The proportion r of retained pixels out of all pixels in the binary guided mask M is statistically calculated, and r is directly used as the adaptive weight of the mask branch loss to construct the total training loss (i.e., the target total loss). .
[0042] ; ; When the mask-preserved area is small, the mask image has a lot of missing information, and the secondary inference is difficult, r automatically decreases to avoid unstable mask loss excessively interfering with the main task; when the mask-preserved area increases and the reliability of secondary inference improves, r automatically increases to make full use of spatial guidance. The main branch loss coefficient remains at 1, thus ensuring that conventional segmentation learning always plays a dominant role.
[0043] Step S15: Iteratively update the parameters of the initial remote sensing image semantic segmentation model according to the total target loss to obtain the corresponding target remote sensing image semantic segmentation model, and use the target remote sensing image semantic segmentation model to perform semantic segmentation of the remote sensing image to be segmented.
[0044] It should be noted that the main branch and the mask branch of the initial remote sensing image semantic segmentation model share the same set of model parameters; the prediction result of the mask branch is the data obtained by the initial remote sensing image semantic segmentation model based on the shared model parameters on the processed remote sensing image.
[0045] In other words, this invention uses the same segmentation model with shared parameters to complete the main branch and mask branch inference, without requiring changes to the model's encoder or decoder structure. It can be used as a training-phase plugin and combined with convolutional networks, visual Transformers, pixel classification, and mask classification frameworks. Auxiliary links are removed during the inference phase, thus not increasing the number of online model parameters or additional inference paths, and has good engineering compatibility.
[0046] In this embodiment, (5) dynamic update and model output specifically include the following steps: in accordance with Backpropagation and updates are performed on the model parameters θ. In the next training iteration, the main branch prediction, prediction bias matrix D, statistical threshold τ, binary guide mask M, and mask ratio r are recalculated, ensuring that pixel mining, spatial guidance, and loss weighting are continuously updated according to the model's learning state. After training, the updated semantic segmentation model is saved. During actual inference, only the image to be segmented is input into this model to obtain the segmentation result; label comparison, dynamic mask construction, and secondary inference are no longer performed, thus avoiding additional inference computation during the deployment phase.
[0047] To facilitate understanding of the solutions in this application, an embodiment of the present invention will be described in conjunction with the accompanying drawings. This embodiment takes multi-category image semantic segmentation with pixel-level labels as an example, and the training process is as follows: Figure 3 As shown. The computing device used includes a processor, memory, and graphics computing unit. The memory stores training remote sensing images, pixel-level labels, semantic segmentation model parameters, and program instructions for executing this method.
[0048] (1) Data preparation and model initialization: Acquire training data. Read in training remote sensing images and their pixel-level labels in batches. For natural scenes, remote sensing images, or dual-temporal images, scaling, cropping, flipping, and color perturbation can be performed as needed for the task; the label images use integer numbers that correspond one-to-one with the semantic categories.
[0049] Initialize the semantic segmentation model Fθ and the base segmentation loss function L. Fθ can be a Swing Transformer, SegFormer, MaskFormer, Mask2Former, or other networks that output pixel-wise class scores. The same training steps can be used when using a convolutional encoder.
[0050] (2) Evaluation of main branch reasoning and prediction bias: Input the original image batch I into Fθ to obtain the main branch prediction. .like For the C channel category score, the predicted category number map P is obtained by taking the maximum response index along the category dimension.
[0051] Label Y is converted into a label numbering map with the same size and numbering system as P. The absolute difference is calculated pixel by pixel to obtain the prediction bias matrix D. D does not aggregate pixel spatial locations, thus it can pinpoint the specific location of each correctly predicted or inconsistently predicted region.
[0052] (3) Mean-guided pixel discrimination and mask construction: The mean value of each image D is calculated to obtain the threshold τ for the current iteration.
[0053] Compare D with τ to generate a binary guide mask M. Set pixels with a deviation less than τ to 1, and pixels with a deviation not less than τ to 0.
[0054] The original image I is obtained by element-wise multiplication with M. For multi-channel images, the single-channel M is copied along the channel dimension and multiplied by each channel respectively; for dual-temporal inputs, the same spatial mask can be applied to the two mutually registered temporal images.
[0055] (4) Mask-guided secondary reasoning: Will Input Fθ, which shares parameters with the main branch, and obtain Sharing parameters allows the main branch and mask branch to learn in the same feature space and avoids introducing independently deployed models for auxiliary paths.
[0056] In regions where M equals 1, the retained easy-to-learn pixels provide stable category and spatial location priors, while difficult pixels with lower bias can obtain secondary corrections within the same region. In regions where M equals 0, the input information is masked, and the model needs to reconstruct the corresponding category based on the surrounding semantic continuity and global context, thereby transferring knowledge from reliable regions to difficult regions.
[0057] (5) Adaptive loss constraints and parameter updates: Calculate using the basic segmentation loss L respectively =L( ,Y) and =L( If the model itself uses a combination of cross-entropy and Dice loss, then both branches use this combination, and there is no need to set up a special loss form for this invention.
[0058] The mask ratio r is obtained by calculating the ratio of the number of pixels with a value of 1 in M to the total number of pixels. As the target of backpropagation, r dynamically changes with M, which can weaken the auxiliary branch when there is a lot of missing information in the mask image, and enhance spatial guidance when the mask image is relatively reliable.
[0059] Using the optimizer Backpropagation is performed and θ is updated. The main branch inference, bias assessment, pixel discrimination, mask inference, and loss constraints are repeated until the set number of iterations is reached or the verification metric no longer improves. D, τ, M, and r are regenerated in each iteration.
[0060] (6) Model saving and inference: After training, the parameters of Fθ are saved. During deployment, the image to be segmented is directly input into Fθ, and the semantic segmentation result is output. Pixel-level labels are not required, D and τ are not calculated, M is not constructed, masking branches are not executed, and auxiliary losses are not calculated. Therefore, the optimization gains obtained during training will not increase the number of network branches and computational cost during the inference phase.
[0061] This application covers tasks involving natural scenes, remote sensing, and remote sensing and dual-temporal change detection, and covers various SwinTransformer backbones and segmentation heads such as SegFormer, MaskFormer, and Mask2Former. In representative results, this application achieves a maximum mIoU improvement of 1.93 percentage points in remote sensing segmentation and a maximum mIoU improvement of 1.80 percentage points relative to strong segmentation heads in natural scenes. Under the same baseline, it exhibits more stable gains compared to manual thresholding for difficult samples and random masking methods. Training cost comparisons show that its peak memory and floating-point computation costs are close to those of similar masking optimization methods, without incurring additional inference costs.
[0062] Therefore, this application solves the problem of unreliable supervision introduced by directly strengthening uncertain pixels by generating spatial prediction bias information based on the prediction difference between the master prediction result and the pixel-level label, and uses this bias information as the basis for judging the reliability of pixels; it also solves the problem of the lack of dynamic adaptability of the discrimination rules by determining dynamic discrimination criteria based on spatial prediction bias information to divide the reserved area and the masked area.
[0063] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0064] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A semantic segmentation method for remote sensing images based on dynamic pixel mining and spatial guided masking, characterized in that, include: The training remote sensing image is processed using the main branch of the initial remote sensing image semantic segmentation model to obtain the corresponding master prediction result. Based on the prediction difference between the master prediction result and the pixel-level label corresponding to the training remote sensing image, corresponding spatial prediction bias information is generated. The spatial prediction bias information represents the reliability of the prediction result corresponding to each pixel position. The master prediction result represents the prediction score of each pixel position in the training remote sensing image to belong to each category. Based on the spatial prediction deviation information, the dynamic discrimination criteria corresponding to the training remote sensing image are determined, and each pixel position in the training remote sensing image is divided into a reserved area and a masked area according to the dynamic discrimination criteria to generate a corresponding spatial guidance mask. The spatial guidance mask is a binary mask with the same spatial size as the training remote sensing image; The training remote sensing image is processed using the spatial guidance mask to mask the remote sensing image information within the masked area, and the corresponding processed remote sensing image is input into the mask branch of the initial remote sensing image semantic segmentation model for processing to obtain the corresponding mask branch prediction result. Calculate the corresponding main branch loss and mask branch loss based on the main prediction result and the mask branch prediction result respectively, determine the target weight corresponding to the mask branch loss based on the spatial guiding mask, and determine the target total loss based on the main branch loss, the mask branch loss and the target weight; The parameters of the initial remote sensing image semantic segmentation model are iteratively updated based on the target total loss to obtain the corresponding target remote sensing image semantic segmentation model, and the target remote sensing image semantic segmentation model is used to perform semantic segmentation of the remote sensing image to be segmented.
2. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, Before processing the training remote sensing images using the main branch of the initial remote sensing image semantic segmentation model, the process also includes: The training remote sensing image is subjected to corresponding preprocessing operations according to the remote sensing image type; the preprocessing operations include at least one of scaling, cropping, flipping and color perturbation.
3. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The step of generating corresponding spatial prediction bias information based on the prediction difference between the master prediction result and the pixel-level labels corresponding to the training remote sensing image includes: The main prediction result is converted into prediction category number information with the same coding system as the pixel-level label; The predicted category number information is compared pixel by pixel with the pixel-level label, and the corresponding prediction deviation is determined according to the consistency of the number at each pixel position, so as to generate the prediction deviation information that retains the spatial distribution information of each pixel position.
4. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The step of determining the dynamic discrimination criteria corresponding to the training remote sensing image based on the spatial prediction bias information includes: The deviation values of all pixel positions included in the spatial prediction deviation information are statistically analyzed to obtain statistical characteristic parameters that reflect the overall prediction level of the current model, and these statistical characteristic parameters are determined as the dynamic discrimination criterion.
5. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The step of dividing the pixel positions in the training remote sensing image into reserved regions and masked regions according to the dynamic discrimination criterion includes: Pixels with a deviation level lower than the dynamic discrimination standard in the spatial prediction deviation information are assigned to the reserved area, while pixels with a deviation level not lower than the dynamic discrimination standard are assigned to the shielded area.
6. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The process of processing the training remote sensing image using the spatial guiding mask includes: Multiply the value in the spatial guide mask corresponding to the shielded area by the pixel value of each channel at the corresponding position in the training remote sensing image; wherein the value in the spatial guide mask corresponding to the shielded area is zero.
7. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, Determining the target weights corresponding to the mask branch loss based on the spatial guiding mask includes: The target proportion of the number of pixels belonging to the reserved region in the spatial guidance mask to the total number of pixels in the training remote sensing image is calculated, and the target weight corresponding to the mask branch loss is determined based on the target proportion.
8. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The main branch of the initial remote sensing image semantic segmentation model and the mask branch share the same set of model parameters; the prediction result of the mask branch is the data obtained by the initial remote sensing image semantic segmentation model based on the shared model parameters on the processed remote sensing image.
9. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The initial remote sensing image semantic segmentation model is either a convolutional neural network model or a visual Transformer network.
10. The remote sensing image semantic segmentation method based on dynamic pixel mining and spatial guided masking according to claim 1, characterized in that, The main branch loss and the mask branch loss are one or a combination of cross-entropy loss, Dice loss, and IoU loss.
