A small sample classification method based on attribute knowledge prompt learning
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2026-08-11
AI Technical Summary
在灵活性层面,现有提示结构受限于固定设计范式或简单组合策略,难以有效适配复杂多变的属性信息表达需求;在语义对齐方面,提示表征与外部文本知识蕴含的深度语义及细节特征之间存在显著鸿沟,导致特征表示的准确性与完整性不足;在知识整合维度,当前方法普遍聚焦信息丰富度提升,缺乏统一框架实现多源属性知识的系统性学习与高效融合
[0016] 1. This invention generates instance-level attribute descriptions, accurately distilling the attribute knowledge of a multimodal large model into textual soft cues; it uses a multimodal coupling function to transfer attribute knowledge from text to visual soft cues, extracting refined attribute-specific image features; and then uses channel-level weights generated by a hybrid expert model to dynamically fuse attribute features, generating robust representations for small sample classification.
Smart Images

Figure CN121392346B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a few-sample classification method based on attribute knowledge prompting learning, belonging to the field of few-sample classification technology. Background Technology
[0002] The leapfrog development in deep learning has largely benefited from the support of large-scale annotated datasets. With massive amounts of labeled data, models have achieved excellent performance across various tasks. However, in real-world applications, the scarcity of labeled data often becomes a key factor limiting the effectiveness of traditional methods. Inspired by the human ability to learn efficiently from a small number of samples, few-shot learning has emerged as a new paradigm, aiming to enable deep learning models to perform well even when relying on only a small number of labeled samples.
[0003] Frontier models such as Contrastive Language-Image Pretraining (CLIP) have brought significant breakthroughs to the field of few-shot learning. By pre-training on a large number of image-text pairs, CLIP employs a contrastive learning strategy to construct a shared embedding space, thereby capturing rich visual concepts from natural language descriptions. This mechanism reduces the dependence on large amounts of labeled data and facilitates efficient transfer to downstream tasks. Especially with limited sample sizes, CLIP exhibits extremely high adaptability and superior performance.
[0004] In CLIP-based few-shot learning methods, cue learning has evolved into an effective strategy. This approach significantly improves performance on new tasks by introducing additional cues with minimal parameters but rich contextual information, narrowing the domain gap between pre-training tasks and downstream applications without requiring extensive fine-tuning of the entire model. Early attempts relied primarily on hand-designed hard cues, such as text templates like "a photo of {category}" as encoder input to guide the model in associating textual and visual content. Subsequent developments shifted to using learnable continuous vectors instead of fixed text templates—so-called soft cues—which adaptively adjust through an optimization process to better capture textual diversity. Nevertheless, the problem of textual contextual uniformity due to over-reliance on category names persists. To address this, researchers have begun exploring methods that integrate multiple category-specific attribute phrases or words into a single learnable soft cue to enhance the richness of textual expression. However, this approach lacks specificity and granularity, making it difficult to fully exploit the diverse knowledge dimensions present in the text. Therefore, recent research trends utilize multiple soft cues to more accurately capture the diverse information in different phrase texts, thereby improving the quality of semantic representation.
[0005] Despite significant progress in few-shot classification, cue learning still faces several technical bottlenecks. In terms of flexibility, existing cue structures are limited by fixed design paradigms or simple combination strategies, making it difficult to effectively adapt to the complex and ever-changing needs of attribute information representation. Regarding semantic alignment, a significant gap exists between cue representations and the deep semantic and detailed features inherent in external textual knowledge, resulting in insufficient accuracy and completeness of feature representations. In terms of knowledge integration, current methods generally focus on enhancing information richness, lacking a unified framework for the systematic learning and efficient fusion of multi-source attribute knowledge. These challenges collectively constrain further breakthroughs and practical applications of cue learning-based few-shot classification methods. Summary of the Invention
[0006] The technical problem to be solved by this invention is to provide a few-shot classification method based on attribute knowledge prompting learning. This method learns text attribute knowledge from a multimodal large model through text soft prompts and couples it to visual soft prompts. It uses channel-level mutual information fusion to obtain robust fusion features based on the attribute features of visual soft prompts, thereby improving the accuracy of few-shot classification.
[0007] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0008] A few-sample classification method based on attribute knowledge hints learning includes the following steps:
[0009] Step 1: Using a multimodal large language model, generate local attribute description text and global attribute description text for each image based on the characteristics of the images in the training set;
[0010] Step 2: Use a text encoder to extract features from the local attribute description text and the global attribute description text to obtain local attribute text features and global attribute text features;
[0011] Step 3: Define local and global attribute text soft tips in the clip text branch and embed them in the transformer encoding layer of the clip text branch to obtain local attribute text features and global attribute text features based on soft tips.
[0012] Step 4: Perform one-to-one feature distillation alignment between the text features obtained in Step 2 and the text features obtained in Step 3, so that the text soft tooltip can learn attribute knowledge from the attribute description text.
[0013] Step 5: Define local attribute visual soft cues in the clip vision branch and embed them in the transformer encoding layer of the clip vision branch. Perform multimodal coupling processing with the text soft cues with attribute knowledge learned in Step 4 to obtain local attribute image features.
[0014] Step 6: In the clip vision branch, channel-level mutual information loss constraints are applied to the local attribute image features obtained in Step 5, and the global attribute image features are fused together. The classification results are calculated by combining the global attribute image features with the global attribute text features based on soft prompts obtained in Step 3, thus achieving small sample classification.
[0015] Compared with the prior art, the present invention, employing the above technical solution, has the following technical effects:
[0016] 1. This invention generates instance-level attribute descriptions, accurately distilling the attribute knowledge of a multimodal large model into textual soft cues; it uses a multimodal coupling function to transfer attribute knowledge from text to visual soft cues, extracting refined attribute-specific image features; and then uses channel-level weights generated by a hybrid expert model to dynamically fuse attribute features, generating robust representations for small sample classification.
[0017] 2. This invention constructs a training paradigm comprising three stages: attribute cue distillation, attribute knowledge transfer, and attribute feature fusion. This paradigm effectively addresses the problems of insufficient flexibility, poor semantic alignment, and difficulties in knowledge integration during few-shot cue learning, achieving accurate classification results in both general and fine-grained classification tasks. Attached Figure Description
[0018] Figure 1 This is a flowchart of a few-sample classification method based on attribute knowledge prompting learning according to the present invention;
[0019] Figure 2 This is a structural diagram of the method proposed in this invention. Detailed Implementation
[0020] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0021] like Figure 1 and Figure 2 As shown, this invention proposes a few-sample classification method based on attribute knowledge hint learning, the specific steps of which are as follows:
[0022] Step 1: Utilize a multimodal language model to generate semantically rich local attribute description text and global attribute description text for the images based on the characteristics of the dataset; the specific process is as follows:
[0023] (1) Adaptive attribute selection: Ask the multimodal large model to give k noteworthy attribute aspects based on the characteristics of general or fine-grained datasets.
[0024] (2) Local attribute description generation: Based on k attributes, a multimodal large model is used to generate k semantically rich local attribute description texts for each image. in, This represents the text describing the i-th local attribute; d spec This represents a collection of text describing local attributes.
[0025] (3) Global attribute description generation: The resulting multiple local attribute description texts d spec The data is then fed back into the multimodal large model for generalization and summarization, generating a global attribute description text d containing all attribute details. global .
[0026] Step 2: Input the local and global attribute description text obtained in Step 1 into the text encoder to obtain the original local and global attribute text features; the specific steps are as follows:
[0027] For each image, a total of k+1 attribute description texts can be obtained through step 1. Input these attribute description texts into a completely frozen text encoder. The embedded features obtained after passing through all transformer encoding layers but not the final projection layer are as follows:
[0028]
[0029] in, This represents the global attribute text feature obtained from the global attribute description text.
[0030] Step 3: Set multiple sets of local and global attribute text soft tips and embed them into the text encoding layer to obtain local and global attribute text features based on the soft tips; the specific steps are as follows:
[0031] In the clip text branch The code defines a total of k+1 sets of local and global attribute text soft cues, each set containing b learnable tokens. The specific process is as follows:
[0032]
[0033] in, Textual hints representing global attribute knowledge, CLS represents the category token, [·,·] represent concatenation operations, P all This represents a set of text hint groups. These attribute text hint groups are then embedded into the clip text branch. The specific process in the first J transformer encoding layers is as follows:
[0034]
[0035] Among them, Z j This indicates the feature token generated after the CLS tag is encoded by the first j-1 transformer encoding layers, and... This represents the text soft hint introduced in the (j-1)th transformer encoding layer. The symbol '_' indicates that the original feature of length b is replaced with the text soft hint in the j-th transformer encoding layer. After layer J, subsequent transformer encoding layers directly process the token from the previous layer without using the soft hint for replacement. The specific process is as follows:
[0036]
[0037] Here, M represents the total number of transformer encoding layers in the clip text branch. After layer-by-layer processing of all M transformer encoding layers in the first two stages, the feature W based on soft cues is finally obtained. pmt The specific process is as follows:
[0038]
[0039] in, This represents the global attribute text features obtained from the global attribute text soft tooltip.
[0040] Step 4: Perform one-to-one feature distillation alignment between the text features from Step 2 and Step 3, enabling the text soft tooltip to learn attribute-specific knowledge from the long attribute text; the specific steps are as follows:
[0041] Using distillation loss L KD Minimize W obtained in step 3 pmt And W obtained in step 2 clip The distance between features is used to extract attribute knowledge from the text descriptions generated by the multimodal large model into multiple sets of attribute text soft hints. The specific process is as follows:
[0042]
[0043] Where ‖·‖ represents Euclidean distance.
[0044] Step 5: Set multiple sets of visual soft cues for local attributes and embed them into the image coding layer. Then, perform multimodal coupling processing with the text soft cues from Step 3 to obtain multiple local attribute-specific image features. The specific steps are as follows:
[0045] (1) Define k sets of local attribute visual soft cues in the clip visual branch. Each group contains b learnable tokens. Unlike the text branch, the visual branch does not assign soft hints for global attributes. The specific process is as follows:
[0046]
[0047] in, This represents the k-th local visual soft cue. These local attribute visual soft cue groups are also embedded into the first J transformer encoding layers of the clip visual branch v, as follows:
[0048]
[0049] Among them, E j This represents the image patch features in the j-th transformer coding layer. This represents the learnable class label of the image in the j-th transformer coding layer of the clip vision branch. Furthermore, the first J transformer coding layers of the vision branch also have a soft-cue-based substitution operation '_'.
[0050] (2) A multimodal coupling process for soft cues is introduced between the first J transformer encoding layers of the clip text and visual branches, and attribute knowledge is transferred one-to-one from text soft cues to visual soft cues to better capture subtle visual attributes.
[0051] Specifically, for the j-th layer out of the first J transformer encoding layers, text soft hints are used. As keys and values, raw visual soft cues Attention is calculated based on the query, and an update is generated to obtain a new visual soft cue for this layer. The specific process is as follows:
[0052]
[0053]
[0054] in, This represents the affinity value of the i-th attribute between the text and the visual soft cue in the j-th transformer encoding layer, where Proj is the projection layer and d is the affinity value between the text and the visual soft cue. v It is a feature dimension of visual soft cues.
[0055] After stepwise processing through the first J transformer encoding layers in the visual and text branches, local attribute image features are obtained before the (J+1)th transformer encoding layer.
[0056]
[0057] in, This represents the k-th local attribute image feature.
[0058] Step 6: Apply channel-level mutual information loss constraints to multiple attribute-specific image features, fuse them to obtain global attribute image features, and then calculate logits with the global attribute text features from Step 3 for final classification; the specific process is as follows:
[0059] A hybrid expert model (MoE) is set before each of the last MJ transformer coding layers in the clip vision branch, with each MoE consisting of several experts. It consists of a gated network G(·), where N E This is a predefined number of experts. Then, to achieve cross-attribute information exchange, [the following will be implemented]... The k local attribute image features are concatenated to represent multi-attribute feature pairs. In addition, to avoid unnecessary parameters generated by high-dimensional feature concatenation, R(·) is used for dimensionality reduction to obtain the processed features of the Jth visual layer. As shown below:
[0060]
[0061] Where Cat(·) represents feature concatenation. Next, The gating network G input to the (J+1)th transformer coding layer J+1 (·), to obtain N E The corresponding gating weights for each expert are calculated as follows:
[0062]
[0063] in, This is a learnable expert weight vector, and the first κ outputs are normalized using Softmax(·). Then, the multi-attribute score vector representing the importance of each attribute in the (J+1)th transformer encoding layer is calculated. The specific process is as follows:
[0064]
[0065] Where GAP(·) represents global average pooling, and Score J+1 Each attribute-specific score is normalized to the (0,1) range along the channel dimension using the Sigmoid function. Next, a channel-level mutual information loss L is introduced. MIThis constrains the attribute score vectors of MoE to form a probability distribution reflecting the relative importance of each attribute across the channels. Assuming the information representation changes linearly, L... MI The definition is as follows:
[0066]
[0067] Where U represents the number of channels, This represents the score of the i-th attribute on the u-th channel. After applying mutual information regularization, the score vector... As an importance weight, it applies to local attribute image features. The features are then fused. Then, the fused features are combined using the hyperparameter λ. Local attribute image features The features are added together to generate the input features of the (J+1)th transformer coding layer. The specific process is as follows:
[0068]
[0069] Finally, after progressive processing through the last MJ visual encoding layers (transformer encoding layers), a global attribute image feature integrating information from different attributes is obtained. Then, the global attribute image features Compared with previously obtained global attribute text features based on global attribute text soft hints The logit classification results are calculated together, and the specific process is as follows:
[0070]
[0071] Where p(c|x) represents the probability of predicting category c, and C represents the total number of categories. τ represents the classification weight of the c-th category in the global attribute text soft tooltip, τ represents the temperature parameter, and cos represents the cosine similarity.
[0072] The present invention will be further illustrated below through examples:
[0073] A. Experimental conditions
[0074] In this embodiment, the experimental environment consisted of an NVIDIA GeForce RTX 3080 GPU, Python 3.9, torch 2.0.0 + cu118, and torchvision 0.15.1 + cu118. The experimental setup was 5-way 1-shot and 5-way 1-shot. The model used in the experiment was CLIP VIT-B / 16.
[0075] B. Evaluation Criteria for Experimental Results
[0076] The classification accuracy (the average of the results under the three seed settings) is used as the evaluation criterion. The higher the accuracy, the better the model performance.
[0077] C. Experimental Comparison Analysis
[0078] The CLIP VIT-B / 16 model, applying the method of this invention, was tested on three general datasets: CIFAR-FS (CIFAR), FC-100, and Mini-ImageNet (MINI), and five fine-grained datasets: CUB, Flower102 (Flower), StanfordDogs (Dogs), and StanfordCars (Cars). Table 1 compares the performance with general-domain few-shot image classification methods on the three general datasets, and Table 2 compares the performance with fine-grained-domain few-shot image classification methods on the four fine-grained datasets.
[0079] Table 1
[0080]
[0081] Table 2
[0082]
[0083]
[0084] This embodiment conducted experiments on three general and four fine-grained datasets, and compared the results. The comparison results in Tables 1 and 2 with current state-of-the-art few-sample image classification methods demonstrate that the method of this invention outperforms other compared methods in few-sample image classification, illustrating the effectiveness of this method in both general and fine-grained domains.
[0085] Based on the same inventive concept, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the aforementioned few-sample classification method based on attribute knowledge prompting learning.
[0086] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the aforementioned few-sample classification method based on attribute knowledge prompting learning.
[0087] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0089] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0090] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0091] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solutions based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.
Claims
1. A few-sample classification method based on attribute knowledge hints learning, characterized in that, Includes the following steps: Step 1: Using a multimodal large language model, generate local attribute description text and global attribute description text for each image based on the characteristics of the images in the training set; Step 2: Use a text encoder to extract features from the local attribute description text and the global attribute description text to obtain local attribute text features and global attribute text features; Step 3: Define local and global attribute text soft tips in the clip text branch and embed them in the transformer encoding layer of the clip text branch to obtain local attribute text features and global attribute text features based on the soft tips; the specific process is as follows: Define local and global attribute text soft tips in the clip text branch. Group text soft tips, each group of text soft tips includes There are 1 learnable lexical units, namely: , , in, This represents a set of text soft prompt groups. They represent the first Textual hints for group learning of local attribute knowledge. Indicates the first Text-based soft hints for group learning of global attribute knowledge. They represent the first The first group of text soft prompts One learnable lexical unit, Indicates category terms; The first stage involves assembling text-based soft prompt groups. Before embedding the clip text branch In a transformer coding layer, the formula is as follows: , in, , They represent Marked before Feature units generated after encoding by a transformer encoding layer This indicates the first clip text branch. One transformer encoding layer Indicates the first Textual soft hints, symbols introduced by a transformer encoding layer Indicates length is The original features in the first Each transformer encoding layer was replaced with a text soft hint; The second phase, in the After one transformer coding layer, subsequent transformer coding layers directly process the tokens from the previous layer without using soft suggestions for replacement. The specific process is as follows: , in, This indicates the total number of transformer encoding layers in the clip text branch. Indicates embedding into the first Learning the first transformer coding layer Textual hints for attribute knowledge; After the above two stages of layer-by-layer processing, local attribute text features and global attribute text features based on soft prompts are obtained: , in, Indicates a text soft tooltip based on global attributes. Global attribute text features, These represent text soft tips based on local attributes. Local attribute text features; Step 4: Perform one-to-one feature distillation alignment between the text features obtained in Step 2 and Step 3, enabling the text soft tooltip to learn attribute knowledge from the attribute description text; the specific process is as follows: Using distillation loss Minimize the text features obtained in step 2 Text features obtained in step 3 The distance between them is used to extract attribute knowledge from the attribute description text generated by the multimodal large language model into text soft prompts. The specific process is as follows: , in, Represents Euclidean distance. These represent texts described by local attributes. The obtained text features This represents the text features obtained by describing the text using global attributes. The local attribute describes the amount of text; Step 5: Define local attribute visual soft cues in the clip vision branch and embed them in the transformer encoding layer of the clip vision branch. Perform multimodal coupling processing with the text soft cues with attribute knowledge learned in Step 4 to obtain local attribute image features. Step 6: In the clip vision branch, channel-level mutual information loss constraints are applied to the local attribute image features obtained in Step 5, and the global attribute image features are fused together. The classification results are calculated by combining the global attribute image features with the global attribute text features based on soft prompts obtained in Step 3, thus achieving small sample classification.
2. The few-sample classification method based on attribute knowledge prompting learning according to claim 1, characterized in that, The specific process of step 1 is as follows: Step 1.1: Utilize a multimodal large language model to generate [data / form] based on the characteristics of the images in the training set. An image-related attribute, This is the default value; Step 1.2, based on Each image is associated with a specific attribute, and a multimodal large language model is used to generate the following for each image: Local attributes describe text, using sets. express, Indicates the first The text describes a local attribute. Step 1.3, utilize a multimodal large language model to... By summarizing the local attribute description texts, a global attribute description text containing all attribute details is obtained. .
3. The few-sample classification method based on attribute knowledge prompting learning according to claim 1, characterized in that, The specific process of step 2 is as follows: Using a text encoder to describe local attributes of text and global property description text Feature extraction is performed, using the features output from the last transformer layer of the text encoder as local and global attribute text features; the formula is as follows: , in, , , Indicates a text encoder. Indicates the first A local attribute description text.
4. The few-sample classification method based on attribute knowledge prompting learning according to claim 1, characterized in that, The specific process of step 5 is as follows: Step 5.1, define local attribute visual soft cues in the clip visual branch, totaling... Groups of visual soft cues, each group of visual soft cues includes There are 1 learnable lexical units, namely: , , in, This represents a set of visual soft cues. They represent the first Group of local visual soft cues, They represent the first The first group of local visual soft cues One learnable lexical unit; Set up visual soft cue groups Before embedding the clip visual branch In a transformer coding layer, the formula is as follows: , in, They represent the first Image patch features in a transformer coding layer These represent the first and second visual branches of the clip, respectively. Learnable class labels for images in each transformer encoding layer; symbols Indicates length is The original features in the first Each transformer coding layer was replaced with visual soft cues. The first branch of the clip visual branch One transformer encoding layer Indicates embedding into the first Learning the first transformer coding layer Visual soft cues for attribute knowledge; Step 5.2, before the clip text branch The first transformer coding layer and the clip vision branch Multimodal coupling of soft cues is introduced between the transformer encoding layers to transfer attribute knowledge one-to-one from text soft cues to visual soft cues; the specific process is as follows: For the first of the clip vision branches A transformer encoding layer, using text soft prompts. As keys and values, raw visual soft cues Attention is calculated as a query, and new visual soft cues are obtained by updating. The formula is as follows: , , in, Indicates the first Between the first transformer encoding layer text and visual soft cues Affinity values for each attribute For projection layer, Feature dimensions for visual soft cues; Before passing through the clip visual and text branches After processing through several transformer encoding layers, in the clip vision branch... Local attribute image features are obtained before each transformer encoding layer. : , in, They represent the first Local attribute image features.
5. The few-sample classification method based on attribute knowledge prompting learning according to claim 4, characterized in that, The specific process of step 6 is as follows: Step 6.1, after the clip visual branch Each transformer coding layer is preceded by a hybrid expert model, and each hybrid expert model consists of several experts. and a gated network Composition, in which, The preset number of experts. For the hybrid expert model One expert module; Will In The local attribute image features are concatenated to obtain the first one. Features after processing of a transformer coding layer : , in, Indicates feature splicing, Represents feature dimensionality reduction; Will Enter the number Gated network of a transformer coding layer ,get The corresponding gating weights for each expert are calculated as follows: , in, For learnable expert weight vectors, the first Each output passes Normalize the function. This is the default value; Step 6.2, calculate the first... The multi-attribute score vector representing the importance of each attribute in each transformer encoding layer. The formula is as follows: , in, Indicates global average pooling. Each attribute's specific score is passed through The function is normalized to the range (0,1) along the channel dimension; Step 6.3, introduce channel-level mutual information loss To regularize the attribute score vectors of the hybrid expert model. The definition is as follows: , in, Indicates the number of channels. Indicates the first The attribute in the first The score value on each channel; Step 6.4, after mutual information regularization, the score vector As an importance weight, it applies to local attribute image features. The features are then fused to obtain the fused characteristics. Use hyperparameters The fused features Local attribute image features Add to generate the first Input features of a transformer coding layer The formula is as follows: , , After After progressive processing by several transformer encoding layers, a global attribute image feature is obtained that integrates image feature information from different local attribute images. ; Step 6.5, global attribute image features Compared with the global attribute text features based on soft prompts obtained in step 3 The classification result is obtained by calculating together, using the following formula: , in, Indicates the prediction category is The probability, Indicates the total number of categories. These represent the categories in the global attribute text features based on soft prompts. Classification weights Indicates temperature parameter, This represents the cosine similarity.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the few-sample classification method based on attribute knowledge prompting learning as described in any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the few-sample classification method based on attribute knowledge prompting learning as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Large model prompt learning method based on category attribute knowledge enhancement
CN116994098A