Global modeling and semantic integration combined generalized small sample remote sensing segmentation algorithm
Through the method of combining global modeling and semantic integration, the problem of base class and new class representation in remote sensing small sample segmentation is solved, the classification accuracy and feature relationship are improved, the small sample segmentation performance is improved, and the demand for new classes is adapted to the increase.
Patent Information
- Application Number
- CN202410672865.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-23
AI Technical Summary
Existing small-sample segmentation algorithms have poor application results in the field of remote sensing images. In particular, they cannot effectively coordinate the relationship between base classes and new classes, resulting in degraded base class performance and poor classification effects, and cannot meet the segmentation needs of engineering remote sensing.
A generalized small-sample remote sensing segmentation algorithm that combines global modeling and semantic integration is used to extract features through the encoder, calculate category contrast loss to maximize category distance, dynamically update the prototype, build a dynamic decoder, and use cosine similarity to generate segmentation masks. It is combined with weighted cross-entropy loss for end-to-end training to ensure that the feature relationship between the base class and the new class is maintained and updated.
Effectively pay attention to the relationship between base classes and new classes, improve classification accuracy, maintain good base class features, enhance feature interrelationships, improve the overall small sample segmentation performance, and adapt to the expansion needs of new classes.
Smart Images

Figure CN118537745A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a generalized small sample remote sensing segmentation algorithm combining global modeling with semantic integration. Background Art
[0002] Few-shot segmentation is a research problem in the field of computer vision, focusing on how to perform semantic segmentation of images when there are only a very small number of labeled samples. The ultimate goal of few-shot segmentation is to use K training image pairs in the support set to "learn" a model so that the model can segment new samples of the categories that appear in the training image pairs.
[0003] At present, FSS under remote sensing conditions is mainly used for image classification under natural conditions. The classification scenarios are relatively simple and have low practical value. There is a high similarity between objects of different categories, and objects of the same category may contain large differences. The current semantic segmentation algorithm based on small sample learning has poor application effect in the field of remote sensing images.
[0004] Small sample segmentation algorithms are divided into parameter-based and prototype-based small sample segmentation algorithms.
[0005] The parameter structure-based method uses a feature encoder to extract image features, a feature comparator to compare features of different categories, and finally uses a feature decoder to predict the segmentation map. In small sample training, the feature encoder usually uses a backbone network to extract features, and the weights of the backbone network remain unchanged during the training process. The training process is usually implemented by iteratively updating the feature comparator and feature decoder.
[0006] The prototype-based method uses the average value of the input vectors of samples of each category in the support set as the prototype. Different foreground objects and backgrounds are embedded in different prototypes, and each prototype represents the corresponding category. In order to extract more comprehensive information from the prototype, a more comprehensive prototype is obtained by decomposing the overall prototype to obtain partial foreground and background prototypes and multiple prototypes. For the test sample, the distance from the test prototype of the sample to the prototypes of each class in the support set is calculated using a metric function to generate a predicted segmentation map.
[0007] However, prototype-based small sample segmentation cannot coordinate the relationship between the base class and the new class. The independent update process of the base class and the new class usually damages the feature representation of the base class and causes the performance of the base class to degrade. The existing categories are not closely connected. When the base class and new class are continuously added to start training, the feature distance of all classes cannot be adjusted well, resulting in a decrease in the overall classification effect.
[0008] Aiming at the lack of small sample segmentation in the field of engineering remote sensing. Due to the unique characteristics of remote sensing images, such as object blur, small object morphological differences, similarities between classes, and differences within classes, general small sample segmentation cannot meet the current remote sensing segmentation needs. Summary of the invention
[0009] The purpose of the present invention is to provide a generalized small sample remote sensing segmentation algorithm that combines global modeling with semantic integration, solve the representation problem of base classes and new classes in remote sensing small sample segmentation, maintain good segmentation effects for samples in the query set, while maintaining good features of the base class and increasing the relationship between features, thereby improving the overall small sample segmentation performance as a whole.
[0010] The technical solution adopted by the generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration disclosed in the present invention is:
[0011] A generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration includes the following steps:
[0012] Step 1: extract feature F through the encoder. In the generalized small sample semantic segmentation, a rich set of labeled images is provided for M base classes, and only K labeled images are provided for each of N new classes. The total number of classes is C = {c 0 ,c 1 ,…,c M ,c M+1 ,…,c M+N}, background category c 0 Represents pixels that do not belong to any target category. The goal of this task is to simultaneously distinguish the basic class and the new class in the background, that is, a total of M+N+1 classes;
[0013] Step 2: Calculate the category contrast loss L c , to maximize the distance between different categories during the dynamic update of the network and minimize the intra-class update distance d calculated based on the current iteration and the previous iteration M :
[0014]
[0015] Where M is the number of base classes, represents the precise feature P of class i in the t-step of dynamic update;
[0016] At the same time, the model is encouraged to maximize the inter-class distance d between prototypes of different categories B This improvement helps to improve the accuracy of classification. B The calculation formula is:
[0017]
[0018] Among them, T = M + N + 1 represents the total number of all categories, and the final contrast loss L c The calculation formula is:
[0019] L c =d M / d B #(3)
[0020] Step 3: Build a dynamic decoder. Given an input image First, the image is segmented into features
[0021] In order to implement a dynamic decoder, each category to be predicted is assigned a learnable category label and a category label sequence is obtained x i Representation and Category C i Related learnable features, T represents the number of categories, and then these labels Block-wise visual features in the encoder Concatenate and transform F using x to generate corresponding visual label features and category embedding
[0022] Finally, by calculating the embedding value S for each category i and the visual embedding value F i The similarity between them is used to obtain the segmentation mask for each category. To prevent the similarity score from being biased towards the new category, the cosine similarity is used to generate the mask. Therefore, first, in e v and e c For each embedding 2 Normalized, we get:
[0023] e v =F′ 0 , F′ 1 , F′ 2 , F′ 3 , …F′ T #(4)
[0024]
[0025] The segmentation mask S is then generated by:
[0026]
[0027] in, is a feature parameter used to amplify the peak after softmax. t is the parameter of the current step, and i is the category number. Since the range of cosine similarity is between [-1, 1], S is reshaped into T×H×P×W×P, and then upsampled to the size of the input image, and the softmax operation is used to obtain the final segmentation prediction value.
[0028] As a preferred solution, directly in S t Fine-tuning the model will forget the segmentation ability related to the old class, which may lead to catastrophic forgetting. To solve this problem, a pseudo-label method without entropy threshold is used to obtain the combined label Y t′ , use Y t′ To supervise the weighted cross entropy loss to supervise the current prediction S t .
[0029] As a preferred solution, given a pair of samples (X t , Y t ), first generate the segmentation prediction value S for the learned old class through the old model in the previous step t-1 , then, according to S t-1 The predicted foreground category for the current sample Y t Re-label the background area in the label to obtain the combined label Y t′ , using γ t′ To supervise the weighted cross entropy loss to supervise the current prediction S t :
[0030]
[0031] In the training phase, the above three loss terms are combined for end-to-end training as follows:
[0032] L total =L WCE +βL C +γL LCE #(8)
[0033] Among them, β and γ are weight coefficients used to balance these three terms, L LCE It is the cross entropy loss function. In each training iteration, in addition to updating the parameters of the network Φ, the pixel-level features are also updated online.
[0034] During the inference phase, the final pixel prediction results are obtained through non-parametric clustering of the pixel embeddings output from the learned model Φ.
[0035] The beneficial effects of a generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration introduced in the present invention are:
[0036] 1. It can focus on the relationship between the prototypes of the base class and the new class, and proposes contrast loss to model the dynamic updates within and between classes. This loss can correctly balance feature extraction and construction when samples are scarce. It has a good effect on small sample segmentation.
[0037] 2. At the same time, the progressive learning framework provides a novel perspective for iterating model parameters, which can cope with the increasing expansion requirements of new classes and speed up the training process. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is an algorithm framework diagram of a generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration according to the present invention. DETAILED DESCRIPTION
[0039] The present invention will be further described and illustrated below in conjunction with specific embodiments and accompanying drawings:
[0040] Please refer to Figure 1 A generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration is characterized by comprising the following steps:
[0041] Step 1: In generalized small-sample semantic segmentation, a rich set of labeled images is provided for M base classes, and only K labeled images are provided for each of N new classes, with a total of C = {c 0 , c 1 , …, c M , c M+1 , …, c M+N}, background category c 0 Represents pixels that do not belong to any target category. The goal of this task is to simultaneously distinguish the basic class and the new class in the background, that is, a total of M+N+1 classes;
[0042] Step 2: Calculate the category contrast loss L c . To maximize the distance between different categories during the dynamic update of the network, minimize the intra-class update distance d calculated based on the current iteration and the previous iteration M :
[0043]
[0044] Where M is the number of base classes, represents the precise feature P of class i in the t-step of dynamic update;
[0045] At the same time, the model is encouraged to maximize the inter-class distance d between prototypes of different categories B This improvement helps improve the accuracy of classification. B The calculation formula is:
[0046]
[0047] Among them, T = M + N + 1 represents the total number of all categories, and the final contrast loss L c The calculation formula is:
[0048] L c =d M / d B #(3)
[0049] Step 3, the network can be divided into image CNN encoder and CNN decoder. Given an input image First, the image is segmented into features In order to implement a dynamic decoder, each category to be predicted is assigned a learnable category label and a category label sequence is obtained x i Representation and Category C i Related learnable features, T represents the number of categories. Then these labels Block-wise visual features in the encoder Concatenate and transform F using x to generate corresponding visual label features and category embedding
[0050] Finally, by calculating the embedding value S for each category i and the visual embedding value F i The similarity between them is used to obtain the segmentation mask for each category. To prevent the similarity score from being biased towards new categories, the cosine similarity is used to generate the mask. Therefore, first in e v and e c For each embedding 2 Normalized, we get:
[0051] e v =F′ 0 , F′ 1 , F′ 2 , F′ 3 , …F T #(4)
[0052]
[0053] The segmentation mask S is then generated by:
[0054]
[0055] in, is a feature parameter used to amplify the peak value after softmax, t is the parameter of the current step, and i is the category number. Because the range of cosine similarity is between [-1, 1], S is reshaped into T×H×P×W×P, then upsampled to the size of the input image, and the softmax operation is used to obtain the final segmentation prediction value
[0056] In the above scheme, fine-tuning the model directly on the original St will forget the segmentation ability related to the old class, which may lead to catastrophic forgetting. To solve this problem, a pseudo-labeling method without entropy threshold is used to obtain the combined label γ t′ , use Y t′ To supervise the weighted cross entropy loss to supervise the current prediction S t .
[0057] Specifically, given a pair of samples (X t , Y t ), first generate the segmentation prediction value St for the learned old class through the old model in the previous step -1 , then, according to the St -1 The predicted foreground category for the current sample Y t The background area in the ground truth is re-labeled to obtain the combined label Y t′ , use Y t′ To supervise the weighted cross entropy loss to supervise the current prediction S t :
[0058]
[0059] In the training phase, the above three loss terms are combined for end-to-end training as follows:
[0060] L total =L WCE +βL C +γL LCE #(8)
[0061] Among them, β and γ are weight coefficients used to balance these three terms, L LCE It is the cross entropy loss function. In each training iteration, in addition to the parameter update of the network Φ, the pixel-level features are also updated online.
[0062] The # in the above formula represents the serial number corresponding to the formula.
[0063] During the inference phase, the final pixel prediction results are obtained through non-parametric clustering of the pixel embeddings output from the learned model Φ.
[0064] Encoder: This is usually a convolutional neural network (CNN) that processes the input image and generates a feature representation. Both the support image (the image with known labels) and the query image (the image to be labeled) are processed through the encoder.
[0065] Prototype Learning: This step involves generating class-specific prototypes, which are representative feature vectors for each class. Prototypes are derived from the encoder output of the support image.
[0066] Category contrast loss: This is a loss function used in the model training process to increase the distance between prototypes of different categories while reducing the distance within the same category prototype, thereby enhancing the model's ability to distinguish different categories.
[0067] Support Masking and Reshaping: Support masking is applied to the output of the encoder to isolate features associated with a specific class. Reshaping is the transformation of the data dimensions to accommodate subsequent processing steps.
[0068] Softmax Function: This function is applied on the output probabilities, helping to convert them into a range between 0 and 1, where each number represents the probability of a given pixel belonging to a particular class.
[0069] Pseudo-label: This refers to an initial guess about the label of a query image, based on a comparison between the features of the query image and the class prototype.
[0070] Weighted Cross Entropy Loss: This loss function is used to fine-tune the model to reduce the error by comparing the pseudo labels with the query ground truth labels (true labels).
[0071] Update prototypes and labels: The model updates the category prototypes and labels of query images based on the calculated loss, improving feature representation (prototype) and labeling accuracy.
[0072] From step t-1 to step t: represents an iterative update across time steps, showing that the process is dynamic and involves multiple passes through the data to refine the output.
[0073] The present invention provides a generalized small sample remote sensing segmentation algorithm combining global modeling with semantic integration.
[0074] 1. It can focus on the relationship between the prototypes of the base class and the new class, and proposes contrast loss to model the dynamic updates within and between classes. This loss can correctly balance feature extraction and construction when samples are scarce. It has a good effect on small sample segmentation.
[0075] 2. At the same time, the progressive learning framework provides a novel perspective for iterating model parameters, which can cope with the increasing expansion requirements of new classes and speed up the training process.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.
Claims
1. A generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration, comprising the following steps: Step 1: Extract features F through the encoder. In the generalized small-sample semantic segmentation, a rich set of labeled images is provided for M base classes, and only K labeled images are provided for each of N new classes. The total number of classes is C = {c0, c1, ..., c M ,c M+1 ,…,c M+N }, the background category c0 represents pixels that do not belong to any target category. The goal of this task is to distinguish the basic class and the new class in the background at the same time, that is, a total of M+N+1 classes; Step 2: Calculate the category contrast loss L c , to maximize the distance between different categories during the dynamic update of the network and minimize the intra-class update distance d calculated based on the current iteration and the previous iteration M : Where M is the number of base classes, represents the precise feature P of class i in the t-step of dynamic update; At the same time, the model is motivated to maximize the inter-class distance d between prototypes of different categories B This improvement helps to improve the accuracy of classification. B The calculation formula is: Among them, T = M + N + 1 represents the total number of all categories, and the final contrast loss L c The calculation formula is: L c =d M / d B #(3) Step 3: Build a dynamic decoder. Given an input image First, the image is divided into features In order to implement a dynamic decoder, each category to be predicted is assigned a learnable category label and a category label sequence is obtained x i Representation and Category C i Related learnable features, T represents the number of categories, and then these labels and block-wise visual features in the encoder Perform concatenation and use x to transform F to generate the corresponding visual label features and category embeddings Finally, by calculating the embedding value S for each category i and the visual embedding value F i The similarity between them is used to obtain the segmentation mask of each category. To prevent the similarity score from being biased towards the new category, the cosine similarity is used to generate the mask. Therefore, first, in e v and e c Each embedding is l2 normalized in e v =F′0,F′1,F′2,F′3,…F T #(4) The segmentation mask S is then generated by: in, It is a feature parameter used to amplify the peak after softmax. t is the parameter of the current step, and i is the category number. Since the range of cosine similarity is between [-1, 1], S is reshaped into T×H×P×W×P (P is the predicted probability of the pixel point), and then upsampled to the size of the input image, and the softmax operation is used to obtain the final segmentation prediction value.
2. A generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration as claimed in claim 1, characterized in that: Directly in S t Fine-tuning the model will forget the segmentation ability related to the old class, which may lead to catastrophic forgetting. To solve this problem, a pseudo-label method without entropy threshold is used to obtain the combined label Y t′ , use Y t′ To supervise the weighted cross entropy loss to supervise the current prediction S t .
3. The generalized small sample remote sensing segmentation algorithm combining global modeling and semantic integration as described in claim 2 is characterized in that: Specifically, given a pair of samples (X t ,Y t ), first generate the segmentation prediction value S for the learned old class through the old model in the previous step t―1 , then, according to S t―1 The predicted foreground category for the current sample Y t Re-label the background area in the label to obtain the combined label Y t′ , use Y t′ To supervise the weighted cross entropy loss to supervise the current prediction S t : During the training phase, the above three loss terms are combined for end-to-end training as follows: L total =L WCE +βL C +γL LCE #(8) Among them, β and γ are weight coefficients used to balance the three terms, L LCE It is the cross entropy loss function. In each training iteration, in addition to updating the parameters of the network Φ, the pixel-level features are also updated online. During the inference phase, the final pixel prediction results are obtained through non-parametric clustering of the pixel embeddings output from the learned model Φ.
Citation Information
Patent Citations
Small sample semantic segmentation method based on anti-aliasing semantic reconstruction
CN113221977A
Remote sensing image semantic segmentation method and system based on diffusion model and knowledge distillation
CN117152427A
Cited By
Small sample HSI classification method based on prototype mask comparison and cross-stage feature refinement
CN119672440A
Spatial transcriptome data clustering method based on progressive learning and multi-modal fusion
CN120256988A
Course learning and reinforcement learning driven dynamic optimal self-consistent clustering method
CN120372315A
Generalized small sample image segmentation method, system, medium and equipment
CN120510366A
