Small sample analysis method based on generality attribute induction
By introducing common attribute tokens and a bidirectional optimization module, the problem of insufficient utilization of cross-category common knowledge in small sample analysis is solved, the generalization ability and boundary segmentation accuracy of the model are improved, and efficient segmentation results are achieved.
Patent Information
- Application Number
- CN202511741056.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-24
AI Technical Summary
Existing small sample analysis methods fail to effectively utilize common semantic knowledge across categories, resulting in insufficient adaptability of the model when faced with data distribution bias, and it is prone to overfitting or being disturbed by the background, ignoring useful information in the background.
By introducing learnable common attribute tokens, we explicitly model cross-category shared semantic knowledge and employ an adaptive target extraction module and a bidirectional optimization module. We also utilize a mask cross-attention mechanism to separate the foreground and background and interact with features, generating a corrected fusion token.
It significantly improves the model's generalization ability and boundary segmentation accuracy with small sample sizes, and performs particularly well in scenarios with large intra-class differences and high inter-class similarity, achieving an excellent balance between accuracy and efficiency, making it easy to apply in practice.
Smart Images

Figure CN121564366A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision, and in particular to a small sample analysis method based on the induction of common attributes. Background Technology
[0002] Few-shot analytics aims to achieve accurate segmentation of unknown categories using a very small number of labeled samples, thereby reducing reliance on large-scale labeled data. Current mainstream methods can be divided into two categories: prototype matching-based and pixel comparison-based. Prototype matching methods compress support set features into single or multiple prototype vectors and perform segmentation by calculating the similarity between query image pixels and prototypes. While efficient, this type of method is prone to losing detailed information during global feature compression, and when support samples exhibit changes in appearance or viewpoint, the prototypes struggle to accurately represent category distribution, leading to decreased generalization ability. Pixel comparison methods directly calculate the similarity between pixels in the support set and query set. While preserving more details, they are sensitive to noise, computationally complex, and susceptible to background interference.
[0003] More importantly, existing methods learn information about the current target only from given support samples. However, there are common attributes that can be shared between different categories (e.g., common parts or texture patterns such as "wings", "wheels", "limbs"). This target-independent common knowledge helps the model understand the compositional rules of objects, so that when faced with insufficient support samples, large intra-class differences or high inter-class similarities, it can use such prior knowledge to correct cognitive biases and make more robust judgments. Therefore, existing technologies have the following shortcomings: (1) they fail to effectively utilize cross-category common semantic knowledge, resulting in insufficient adaptability of the model when faced with data distribution bias; (2) with limited samples, the mining of target-specific information is prone to overfitting or bias; (3) there is insufficient synergistic utilization of foreground and background, and useful information in the background is often ignored. Summary of the Invention
[0004] Purpose of the invention: The purpose of this invention is to provide a small sample analysis method based on common attribute induction. By introducing learnable common attribute tokens, it explicitly models semantic knowledge shared across categories, thereby solving the problems of large distribution bias and weak generalization ability caused by neglecting common attributes in existing technologies.
[0005] Technical solution: The present invention provides a small sample analysis method based on common attribute induction, characterized by comprising the following steps:
[0006] (1) Extract target-specific foreground and background prototype tokens from supporting images using an adaptive target extraction module;
[0007] (2) The target-specific tokens obtained are fused with a set of pre-trained common attribute tokens to generate corrected fused tokens. The common attribute tokens are used to summarize and characterize the semantic attributes learned from multi-class data and shared across classes during the training phase.
[0008] (3) Input the obtained fusion token and the query image features into the bidirectional optimization module, and perform bidirectional feature interaction and optimization for foreground and background separation through the mask cross attention mechanism, and output the final segmentation mask.
[0009] Furthermore, in step (1), the adaptive target extraction module uses an iterative clustering algorithm based on feature distance and spatial distance to extract prototype tokens, including the following steps:
[0010] (11) Initialize the superpixel seed uniformly within the region that supports the set mask indication;
[0011] (12) In each iteration, calculate the combined distance between the pixel feature and the current seed point, wherein the combined distance is a weighted combination of the feature Euclidean distance and the spatial Euclidean distance;
[0012] (13) The seed point features are updated through soft association mapping. After multiple iterations, representative cluster centers are selected as target-specific foreground and background prototype tokens.
[0013] Furthermore, in step (2), the common attribute token is a set of learnable parameter vectors that are optimized together with other network parameters during the model training phase to summarize common attributes from the training data of the basic categories.
[0014] Furthermore, in step (2), generating the corrected fusion token specifically involves concatenating the target-specific token with the common attribute token, and then mapping it to a unified feature space through a linear projection layer.
[0015] Furthermore, in step (3), the bidirectional optimization module adopts the Transformer architecture, and the mask cross-attention mechanism is implemented through a binary mask. The mask constrains the attention range of the current layer based on the intermediate segmentation prediction result of the previous layer, so that the foreground token only focuses on the region predicted as the foreground and the background token only focuses on the region predicted as the background.
[0016] Furthermore, in step (3), a composite loss function is used during the training phase, as shown in the following formula:
[0017] ;
[0018] ;
[0019] ;
[0020] in, Supervise the initial coarse mask. Supervise the final fine mask. The multi-scale gradient matching loss is used to improve boundary quality. The supervised initial coarse mask loss is a combination of Dice loss and binary cross-entropy loss, and the supervised final fine mask loss is a combination of weighted intersection-union loss and multi-scale gradient matching loss. The loss weights are determined through cross-validation.
[0021] The small sample analysis system based on common attribute induction described in this invention includes:
[0022] Extraction Module: This module is used to extract target-specific foreground and background prototype tokens from the supporting image through the adaptive target extraction module. The adaptive target extraction module adopts an iterative clustering algorithm based on feature distance and spatial distance. It initializes superpixel seeds in the region indicated by the support set mask, updates the seed point features by calculating the comprehensive distance between pixel features and seed points, and selects representative cluster centers as prototype tokens.
[0023] The fusion module is used to fuse the obtained target-specific tokens with a set of pre-trained common attribute tokens to generate a corrected fused token. The common attribute tokens are learnable parameter vectors that summarize cross-class shared semantic attributes from multi-class data during the training phase and map them to a unified feature space through a linear projection layer.
[0024] The bidirectional optimization module is used to input the obtained fusion token and query image features into the bidirectional optimization module. Through the mask cross-attention mechanism, it performs bidirectional feature interaction and optimization for foreground and background separation, and outputs the final segmentation mask. The bidirectional optimization module adopts the Transformer architecture, and the mask dynamically constrains the attention range according to the intermediate segmentation prediction results of the previous layer.
[0025] Furthermore, in the extraction module, the comprehensive distance of the iterative clustering algorithm is a weighted combination of feature Euclidean distance and spatial Euclidean distance, and the weight factors are determined through training optimization.
[0026] Furthermore, in the fusion module, the number and dimensions of common attribute tokens are dynamically adjusted based on the statistical characteristics of the basic category data.
[0027] Furthermore, in the bidirectional optimization module, the mask cross-attention mechanism is implemented through binary masks. The foreground token only focuses on pixel regions predicted as foreground, and the background token only focuses on pixel regions predicted as background. The segmentation results are then optimized iteratively through multiple Transformers.
[0028] Furthermore, in the bidirectional optimization module, a composite loss function is used during the training phase, as shown in the following formula:
[0029] ;
[0030] ;
[0031] ;
[0032] in, Supervise the initial coarse mask. Supervise the final fine mask. The multi-scale gradient matching loss is used to improve boundary quality. The supervised initial coarse mask loss is a combination of Dice loss and binary cross-entropy loss, and the supervised final fine mask loss is a combination of weighted intersection-union loss and multi-scale gradient matching loss. The loss weights are determined through cross-validation.
[0033] Beneficial Effects: Compared with existing technologies, this invention has the following significant advantages: Common Attribute Induction: It innovatively introduces learnable common attribute tokens, enabling the model to actively inductively summarize and utilize cross-class shared knowledge, effectively compensating for insufficient information in small samples and fundamentally alleviating distribution bias. Bias Correction Mechanism: By explicitly fusing target-specific information and common prior knowledge through the target correction module, the model's decision-making becomes more robust, especially beneficial for handling challenging scenarios with large intra-class differences and high inter-class similarities. Precise Feature Separation: The bidirectional optimization module achieves strict foreground-background decoupling through a mask attention mechanism, significantly reducing background interference and improving the accuracy of boundary segmentation. Excellent Performance and Efficiency: In PASCAL-5... i and COCO-20 i Experiments on standard datasets show that the present invention achieves state-of-the-art performance in both 1-shot and 5-shot settings (e.g., on PASCAL-5). i With a 1-shot mIoU of 68.5% and only about 2.5M model parameters, it demonstrates an excellent balance between accuracy and efficiency, making it easy to deploy in practical applications. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the overall architecture of the method of the present invention.
[0035] Figure 2 This is a detailed structural diagram of the bidirectional optimization module in this invention.
[0036] Figure 3 This is a comparison curve of mIoU between the method of this invention and the baseline method during the training and inference phases. Detailed Implementation
[0037] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. The following embodiments are for illustrative purposes only and are not intended to limit the scope of the invention.
[0038] like Figure 1 As shown, this embodiment provides a small sample analysis method based on common attribute induction, including the following steps:
[0039] Step 1: Model Input and Feature Extraction. Input includes support set images. and its binary mask and query images A pre-trained convolutional neural network (such as VGG-16 or ResNet-50) is used as the backbone network to extract feature maps from the support set and query set, respectively. and The parameters of the backbone network are fixed during training.
[0040] Step 2: Adaptive target extraction aims to extract high-quality target-specific prototype tokens S from a limited number of support samples; it includes the following steps:
[0041] Step 2.1: Support set mask Uniformly initialize within the specified foreground and background areas respectively. Superpixel seed points ;
[0042] Step 2.2: For the t-th iteration (t=1,...,T), for each pixel p and each seed point... Calculate the soft correlation degree:
[0043] ;
[0044] ;
[0045] Among them, distance The characteristic Euclidean distance, Let r be the spatial Euclidean distance, and r be the balance factor;
[0046] Step 2.3: Based on the correlation weights, perform a weighted average of the pixel features and update the features of each seed point:
[0047] ;
[0048] in It is a normalization factor;
[0049] Step 2.4: After T iterations, select the top-ranked points from the converged seed points. The most representative points form the target-specific token:
[0050] ;
[0051] The first half represents the foreground, and the second half represents the background.
[0052] Step 3: The target correction module corrects distribution bias by fusing common attribute tokens; this includes the following steps:
[0053] Step 3.1: Calculate query features With prospect target token The cosine similarity is calculated, and an initial coarse segmentation mask is obtained through MaxPool aggregation. ;
[0054] Step 3.2: Combine the target-specific token S with the pre-trained common attribute tokens The pieces are stitched together and then projected through a linear projection layer. To merge:
[0055] ;
[0056] The common attribute token X is randomly initialized at the start of model training and is learned along with the network throughout the training process;
[0057] Step 4: As Figure 2 As shown, this module performs fine-tuning through L layers (L=3) of Transformers; it includes the following steps:
[0058] Step 4.1: Fusion Token and query pixel features ;
[0059] Step 4.2: In the first... Layer, based on the output mask of the previous layer. Generate binary mask The mask specifies that for foreground tokens ( The first half only allows it to focus on predictions as prospects ( For the background token, attention is only allowed on pixels predicted as background. Irrelevant attention weights are set to... ;
[0060] Step 4.3: Use the mask to perform cross-attention calculation:
[0061]
[0062] Where Q, K, and V are obtained by projecting the token and pixel features, respectively;
[0063] Step 4.4: The token features interact and transform through the self-attention layer and the feedforward network;
[0064] Step 4.5: Write the updated token information back to the pixel features through another round of cross-attention;
[0065] Step 4.6: Pixel features of the last layer The final segmentation mask is obtained through a linear classifier and a sigmoid function. ;
[0066] Step 5: Model training uses a composite loss function:
[0067] ;
[0068] ;
[0069] ;
[0070] in, Supervise the initial coarse mask. Supervise the final fine mask. Multi-scale gradient matching loss is used to improve boundary quality. The Adam optimizer is employed with an initial learning rate of 10. -3 In PASCAL-5 i Train on the dataset for 50 epochs in COCO-20 i Train on the dataset for 100 epochs.
[0071] Step 6: After training, the model can be directly used for inference. Inputting only image-mask pairs and a query image will output the segmentation result of the query image. Due to its small number of parameters (approximately 2.5M), it can be easily deployed to edge devices for real-time applications.
[0072] See Tables 1-3 for parameter explanations.
[0073] Table 1 Parameter Explanation 1 ; Table 2 Parameter Explanation 2 ; Table 3 Parameter Explanation 3 .
Claims
1. A small sample analysis method based on the induction of common attributes, characterized in that, Includes the following steps: (1) Extract target-specific foreground and background prototype tokens from the supporting image through the adaptive target extraction module. The adaptive target extraction module adopts an iterative clustering algorithm based on feature distance and spatial distance, initializes superpixel seeds in the region indicated by the support set mask, updates seed point features by calculating the comprehensive distance between pixel features and seed points, and selects representative cluster centers as prototype tokens. (2) The target-specific tokens obtained are fused with a set of pre-trained common attribute tokens to generate corrected fused tokens. The common attribute tokens are learnable parameter vectors. During the training phase, semantic attributes shared across categories are summarized from multi-category data and mapped to a unified feature space through a linear projection layer. (3) Input the obtained fusion token and query image features into the bidirectional optimization module, and perform bidirectional feature interaction and optimization for foreground and background separation through the mask cross attention mechanism, and output the final segmentation mask. The bidirectional optimization module adopts the Transformer architecture, and the mask dynamically constrains the attention range according to the intermediate segmentation prediction results of the previous layer.
2. The small sample analysis method based on common attribute induction according to claim 1, characterized in that, In step (1), the comprehensive distance of the iterative clustering algorithm is a weighted combination of feature Euclidean distance and spatial Euclidean distance, and the weight factor is determined through training optimization.
3. The small sample analysis method based on common attribute induction according to claim 1, characterized in that, In step (2), the number and dimensions of common attribute tokens are dynamically adjusted according to the statistical characteristics of the basic category data.
4. The small sample analysis method based on common attribute induction according to claim 1, characterized in that, In step (3), the mask cross-attention mechanism is implemented through binary masks. The foreground token only focuses on the pixel regions predicted as foreground, and the background token only focuses on the pixel regions predicted as background. The segmentation result is optimized through multi-layer Transformer iteration.
5. The small sample analysis method based on common attribute induction according to claim 1, characterized in that, In step (3), a composite loss function is used during the training phase, as shown in the following formula: ; ; ; in, Supervise the initial coarse mask. Supervise the final fine mask. The multi-scale gradient matching loss is used to improve boundary quality. The supervised initial coarse mask loss is a combination of Dice loss and binary cross-entropy loss, and the supervised final fine mask loss is a combination of weighted intersection-union loss and multi-scale gradient matching loss. The loss weights are determined through cross-validation.
6. A small-sample analysis system based on common attribute induction, characterized in that, include: Extraction Module: This module is used to extract target-specific foreground and background prototype tokens from the supporting image through the adaptive target extraction module. The adaptive target extraction module adopts an iterative clustering algorithm based on feature distance and spatial distance. It initializes superpixel seeds in the region indicated by the support set mask, updates the seed point features by calculating the comprehensive distance between pixel features and seed points, and selects representative cluster centers as prototype tokens. The fusion module is used to fuse the obtained target-specific tokens with a set of pre-trained common attribute tokens to generate a corrected fused token. The common attribute tokens are learnable parameter vectors that summarize cross-class shared semantic attributes from multi-class data during the training phase and map them to a unified feature space through a linear projection layer. The bidirectional optimization module is used to input the obtained fusion token and query image features into the bidirectional optimization module. Through the mask cross-attention mechanism, it performs bidirectional feature interaction and optimization for foreground and background separation, and outputs the final segmentation mask. The bidirectional optimization module adopts the Transformer architecture, and the mask dynamically constrains the attention range according to the intermediate segmentation prediction results of the previous layer.
7. A small sample analysis system based on common attribute induction according to claim 6, characterized in that, In the extraction module, the comprehensive distance of the iterative clustering algorithm is a weighted combination of feature Euclidean distance and spatial Euclidean distance, and the weight factors are determined through training optimization.
8. A small sample analysis system based on common attribute induction according to claim 6, characterized in that, In the fusion module, the number and dimensions of common attribute tokens are dynamically adjusted based on the statistical characteristics of the basic category data.
9. A small sample analysis system based on common attribute induction according to claim 6, characterized in that, In the bidirectional optimization module, the mask cross-attention mechanism is implemented using binary masks. The foreground token only focuses on pixel regions predicted as foreground, and the background token only focuses on pixel regions predicted as background. The segmentation results are then optimized iteratively through multiple Transformers.
10. A small sample analysis system based on common attribute induction according to claim 6, characterized in that, In the bidirectional optimization module, a composite loss function is used during the training phase, as shown in the following formula: ; ; ; in, Supervise the initial coarse mask. Supervise the final fine mask. The multi-scale gradient matching loss is used to improve boundary quality. The supervised initial coarse mask loss is a combination of Dice loss and binary cross-entropy loss, and the supervised final fine mask loss is a combination of weighted intersection-union loss and multi-scale gradient matching loss. The loss weights are determined through cross-validation.