Self-evolving zero-shot object recognition method based on sketch and text dual prompts
Through the visual text dual-modal prompting technology in the CLIP model, category-level features are extracted, solving the problem of fine-grained matching in zero-sample sketch recognition, achieving accurate recognition of unseen categories and improving the performance of cross-category retrieval.
Patent Information
- Application Number
- CN202410476227.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-04-19
AI Technical Summary
Existing image retrieval technology based on zero-sample sketches is difficult to achieve fine-grained instance-level matching, especially when feature knowledge transfer between unseen categories is not applicable, and it is difficult to meet the needs of accurate recognition in the real world.
The visual text dual-modal prompt self-evolving target recognition method based on the CLIP model is used to extract features from the supporting images and category labels through the visual prompt module and the text prompt module respectively, generate visual and text prompts for the target category, and guide the model to extract the category. level discriminating features to enhance generalization ability.
It significantly improves the performance of fine-grained sketch-photo retrieval under unknown categories, can quickly adapt to new categories, and shows excellent results in cross-category image retrieval tasks, avoiding feature interference and increased computation.
Smart Images

Figure CN118072332B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pattern recognition, and in particular to a self-evolving zero-sample target recognition method based on dual prompts of sketches and texts. Background Art
[0002] Sketch-based image retrieval (SBIR) is a key problem in sketch image understanding, which aims to match the corresponding photo image with a given hand-drawn sketch. Given the scarcity and limited variety of sketches, SBIR tasks will inevitably encounter unseen sketch categories in real applications. Therefore, research efforts have mainly focused on solving the problem of zero-shot sketch-based image retrieval (ZS-SBIR). Existing ZS-SBIR works mainly study category-level object retrieval, aiming to match sketches and photos belonging to the same category. Although significant progress has been made in this research, such coarse-grained recognition may not fully meet the practical needs of real-world ZS-SBIR applications. For example, when searching for lost items, it is desirable to identify photos that precisely correspond to individual hand-drawn sketches, rather than just category correspondence. Recently, a fine-grained ZS-SBIR task has been proposed, which aims to meet the above requirements by achieving instance-level matching between sketches and photo images.
[0003] Considering that the generalization learning approach in previous ZS-SBIR research is to learn from the training set or derive effective knowledge for handling seen categories from the pre-trained model, and then directly transfer it to unseen target categories, this approach may not be suitable for this fine-grained zero-shot recognition scenario. This is mainly because the knowledge gained from distinguishing individuals in the seen categories may not be fully transferred or applicable to unseen categories. For example, for the seen category "airplane" and the unseen category "helicopter", the presence or absence of propellers can be used as a salient feature to identify individual aircraft, but not as a salient feature to identify helicopters, because almost all helicopters have propellers. Therefore, this requires the model to be sufficiently adaptable to different target categories, so that it can selectively utilize and adjust its accumulated knowledge to adapt to the target category. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the present invention provides a self-evolving zero-shot object recognition method based on dual prompts of sketches and text. The present invention provides a zero-shot object recognition model with text category labels and a collection of images within the target category as supporting data, and uses these supporting data to train the model to extract category-specific knowledge, so that it can effectively adapt to each target category and capture the significant discriminant information between individuals within the category.
[0005] Specifically, the present invention proposes a self-evolving target recognition model of a visual text dual-modal prompt CLIP (Dual-modal PromptingContrastive Language-Image Pre-training, a contrasting language-image pre-training model of dual-modal prompting, abbreviated as DP-CLIP). Considering that the CLIP model has not only learned rich knowledge from a large amount of pre-training data, but also has an excellent zero-sample recognition ability generalized to unknown categories, the present invention adopts CLIP (Contrastive Language-Image Pre-training, contrasting language-image pre-training model) as a backbone network. The main innovation of the present invention is that in the DP-CLIP framework, a visual prompt module and a text prompt module that capture category-level key information are designed to enhance the category generalization ability of the model.
[0006] Among them, the purpose of the visual prompt module is to learn the category-specific knowledge from a set of support images within the target category, thereby promoting DP-CLIP to adapt to the target category to extract features that are discernible in this category. It is noted that Visual Prompt Tuning (VPT) may be a good tool that guides the deep model to adapt to the target task by injecting task-specific prompt vectors. However, the existing VPT method uses a shared prompt vector, lacks adaptability to different categories, and is difficult to achieve the effect of capturing category-level identification information. Therefore, in the visual prompt module, the present invention randomly selects three images from each target category as the support images of the category, uses a Transformer layer to extract category-related knowledge from these support images and transfers it to a set of learnable vectors to generate a visual prompt vector for the current category. These visual prompt vectors are then used to guide the model to adapt to the current specific target category by means of VPT. It is worth noting that in the visual prompt module, only three support images are required for each category, and it also has a good effect when learning category insights only from the input image itself (using only one support image).
[0007] The present invention takes into account that the CLIP model not only has a powerful visual encoding branch, but also the text encoding model of CLIP has learned rich semantic knowledge from a large amount of text input, and the CLIP model has a strong text-image matching ability. Therefore, the category-level text information is used to guide the effective capture of visual features, thereby designing a text prompt module. The goal of the text prompt module is to obtain knowledge about the target category from the text encoder of CLIP, and use it to guide the network to adapt to the target category. In order to achieve this goal, the present invention uses the text encoder of CLIP to embed the target category label into the text feature. Subsequently, these text features are used to generate a series of channel scaling vectors specific to the current category. Then, these scaling vectors are applied to the hidden features of the CLIP visual encoder to guide the model to pay attention to the channels related to the current category. Different from the current VPT guidance method, in the text prompt module, the present invention adopts a text information-guided visual feature channel scaling attention method to avoid mutual interference between text information and visual prompts in feature guidance. In addition, in the text prompt module, the present invention also designs a side-path guidance method, which does not directly apply text scaling guidance on the original visual features, but maps the visual features to a low-dimensional space, and implements the guidance of text information in this low-dimensional space. This side-path guidance method avoids the interference of text information on the existing knowledge in the original visual model, and at the same time, the low-dimensional feature space will not cause a large loss in the model calculation amount.
[0008] The technical solution adopted by the present invention to solve the technical problem includes the following steps:
[0009] Step 1: Build a basic network for fine-grained ZS-SBIR target recognition;
[0010] The basic network is composed of the Vision Transformer (ViT) model in the pre-trained CLIP model, which processes hand-drawn sketches and photo images to extract target features. The visual encoder model uses triplet loss as supervision, takes sketches and photos of the same identity as positive sample pairs, and sketches and photos of different identities as negative sample pairs. The triplet loss is used to bring the image features of the same identity closer and the image features of different identities farther away, guiding the network to extract identity-related target features and learn identity classification of sketches and photo images.
[0011] Step 2: Build a visual cue model to generate category-level visual cues for each category and apply the visual cues to focus on and capture the category-related discriminative visual features;
[0012] Step 3: Build a text prompt model to generate category-level text prompts for each category, and apply the text prompts to the ViT model to guide the model to focus on the discernible visual features under the category;
[0013] Step 4: Model training and testing;
[0014] When training the model, the final feature f of the current image is used g , that is, the output features of the [CLS] block vector in the last ViT layer, are used to calculate the loss function; during the training process, the present invention adopts a triplet loss function to update the model parameters, only updates the constructed visual prompt module parameters, text prompt module parameters and LayerNorm layer parameters in the ViT model, and does not update other parameters of the ViT model and the parameters of the text processing model, thereby retaining the original knowledge and excellent generalization ability in the CLIP model to a large extent, and improving the recognition effect of the model on unknown categories.
[0015] During testing, there is no overlap between the test category and the training category, that is, the test is performed on a new category that has not been seen before, so it is a category-level zero-shot recognition task; for each test category, first extract the visual cues and text cues under the category, and then apply the bimodal cues information on the ViT model to extract the final features of each sketch index and all photos in the photo library; then, for each sketch index S n , calculate the feature similarity between the sketch feature and all the photo features through sinusoidal similarity, and then sort the feature similarities from high to low. The photo with the highest feature similarity is the one with the sketch S. n Represents the target of the same identity, that is, for the sketch image S n Target recognition results.
[0016] In the basic network, the optimizer is set, and the Adam optimizer is used to update the network parameters. The learning rate of the regularization parameters in the CLIP model is set to 1e-6, and the learning rate of other trainable parameters is set to 1e-5.
[0017] The specific steps of step 2 are:
[0018] Step 2-1: Category-level visual cue generation;
[0019] Since the ZS-SBIR dataset contains sketches and photo images of different categories (such as cats, dogs, umbrellas, etc.), ZS-SBIR performs fine-grained sketch-photo image matching and retrieval within each independent category; in the constructed visual cue generation module, for a training category C i , randomly select a sketch image S, a photo I1 with the same identity ID as the sketch image S, and a photo I2 with a different identity ID in the current category as category Ci A set of support samples {S, I1, I2}; then, a convolutional layer is used to extract the image block features of the three images in the support sample, which are represented as f S , In addition, a set of learnable vectors L is initialized, which are related to the image patch features f S , The input is sent to a Transformer layer. Through the similarity calculation and feature fusion between the image blocks in the Transformer layer, the learnable vector L learns the discriminative features of the category, and these category-related discriminative features are included in the generated visual cue vector P. i In , this process is expressed as:
[0020]
[0021] Among them, Trans represents the Transformer layer, P i Represented as category C i The generated category-level visual cue vector, f′ S , and Represent the image block features f S , The features of the supporting samples that have passed the Transformer layer are no longer used in the future. Therefore, this method is open to the selection of the number of supporting samples. i Three support samples {S, I1, I2} are randomly selected and used. If it is feasible to use different numbers of support samples for a category, the different numbers range from 1 to more. Only one sketch or photo, or multiple sketches and photos, are used for the category.
[0022] In particular, since the ViT model includes 12 ViT network layers, a category-level hint vector is generated for each ViT layer; therefore, a learnable vector L is initialized for each ViT layer. j , and according to formula (1), a category-level visual cue vector P is generated for each ViT layer i j , all ViT network layers use a shared category-level visual cue vector P i ;
[0023] Step 2-2 uses category-level visual cues to guide the network to capture discriminative features;
[0024] For each category C i, the deep visual cue adjustment (VPT) method is used to use the visual cue vector to guide the visual feature extraction network ViT to focus on and capture the discriminative features related to the category; specifically, in each layer of ViT, the visual cue vector P generated in step 2-1 is i j , and the image block feature f of the current input image I I The [CLS] vector predefined in the ViT model is input into the current ViT layer to guide the network to focus on and extract the discriminative features in the current image. After 12 layers of ViT processing, the final output corresponding to the [CLS] vector is used as the final feature f of the image. g .
[0025] The specific steps of step 3 are:
[0026] Step 3-1: Category-level text prompt generation;
[0027] For each category C i First, the category name of this category [C i ] is input into a set of text templates, and the category information in the image is expressed through a text description. Taking the text template "This is a / an__in the photo." as an example, the category name of this category [C i ] into the text template, and the filled text "This is a / an[C i ]inthe photo." is input into the pre-trained CLIP text processing branch to generate text features related to the category In order to avoid accidental errors, multiple different text templates are used to generate multiple text features. Calculate the mean as the final text feature of this category; then, classify this category C i The text features of the input into a multi-layer perceptron, generate the text prompt T of this category i ;
[0028] Step 3-2 Application of text prompts;
[0029] Set the text prompt T iApplied to the network ViT model, the model is guided to focus on the discriminative visual features related to the current category. The present invention does not adopt the method used in references [1] and [2], which uses text prompts as classifiers of visual features in the model training stage and calculates the similarity between text and visual features after the visual feature extraction is completed. Instead, the text prompt is applied in the visual feature extraction process to help the model focus on the discriminative information related to the current category in the visual features. In addition, the text prompt guidance strategy is also different from the visual prompt guidance strategy. Instead of directly inserting the text prompt into the image block features as the input of the ViT layer, the text prompt is applied to focus on the feature channels related to the category in the visual features. This is to avoid the duplication of the guidance effect of the category-level text-visual bimodality caused by the same prompt strategy as the visual prompt, which cannot bring more obvious performance improvement. In addition, when focusing on the specific visual feature channels, in order to avoid interfering with the existing visual knowledge of the ViT model, the visual features of each layer are first mapped to a low-dimensional space, and then the visual feature channels guided by the text prompt are focused and selected in this low-dimensional space, and then added and fused with the original visual features. It can be expressed as:
[0030]
[0031] in, Represents the visual features of image I at the jth layer ViT, FC1 converts the original visual features Mapped to a low-dimensional common space, in the text prompt T i The feature attention is performed under the guidance of , and the channel-attended features are mapped back to the original feature space through a fully connected layer FC2; the visual features attended by the text prompts are combined with the original features Add and fuse to obtain the final visual features guided by text prompts
[0032] The beneficial effects of the present invention are:
[0033] First, the present invention uses category-level visual and textual cues, which can effectively guide the network to focus on and capture recognizable image features under the category from both visual and textual modalities to help the network perform identity matching of sketch-photo images. When faced with a new category, only a small number of images (only three) and category names under the category that do not require identity labels are obtained, which can quickly guide the image retrieval model to adapt to the current target category. The content of the present invention has achieved significant performance improvements in fine-grained sketch-photo retrieval under unknown categories, and the content of the present invention can be directly migrated to other cross-category fine-grained image retrieval tasks.
[0034] Second, in order to help the model capture the discriminative information under the current category and improve the generalization ability of the model on unknown categories, the present invention proposes a category-specific visual cue generation method that can be directly applied to unknown categories. Different from the previous category-shared visual cues, the present invention uses several randomly selected images under the target category to obtain category-specific visual cues through generation, guiding the model to adapt to the current category.
[0035] Third, the present invention proposes a method for guiding the attention of visual feature channels with category-level text cues. Different from the methods in references [1] and [2], which use the category-level text features extracted from the CLIP text encoding model as classifiers of visual features to help distinguish visual features of different categories, this method has two characteristics: ① it is only used in the training phase, and ② it is used after visual feature extraction. Therefore, this method does not meet the requirements of this task: ① it is not only used in the training phase, but can also be applied to unknown categories during testing, and ② it is hoped that in the process of visual feature extraction, the visual features can be guided to focus on the discriminative information under the target category.
[0036] Therefore, the present invention generates a text scaling vector based on the category-level text features to guide the attention and selection of the visual feature channel in the feature extraction stage, and this guidance method can be directly applied to unknown categories. In addition, in the specific implementation of this method, a side-path guidance method is adopted. Instead of directly applying text scaling guidance on the original visual features, the visual features are mapped to a low-dimensional space, and the text information is guided in this low-dimensional space. This side-path guidance method avoids the interference of text information on the existing knowledge in the original visual model, and at the same time, the low-dimensional feature space will not cause a large loss in the model calculation amount. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the network structure in the method of the present invention. DETAILED DESCRIPTION
[0038] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0039] The following is a specific example of the present invention in self-evolving zero-sample target recognition.
[0040] In this embodiment, a target recognition method based on dynamic model updating based on sketch and text dual prompts is described, and the specific process is as follows:
[0041] Step 1: Data preparation and model building.
[0042] Step 1-1: Data preprocessing and optimizer settings: First, perform data preprocessing. Process the sketches and photo images of the training category, scale them to a uniform size of 224×24, flip them left and right with a probability of 50%, and perform random grayscale processing on the photo images with a probability of 50% for data enhancement.
[0043] Step 1-2: Build a basic network for sketch-based photo image retrieval, using CLIP ViT-B / 32 as the backbone network. Design visual cue modules and text cue modules to guide the backbone network ViT to focus on and extract visual features of the target category. Set the optimizer and use the Adam optimizer to update the network parameters. The learning rate of the regularization parameters in the CLIP model is set to 1e-6, and the learning rate of other trainable parameters is set to 1e-5.
[0044] Step 2: Model training.
[0045] Step 2-1: In each batch, randomly select a training category. In each training category, randomly select 64 sets of triplets, with the hand-drawn sketch as the reference image, a photo image with the same identity ID as the positive example, and a photo image with a different identity ID as the negative example. These 64 sets of triplet images are input into the network for training.
[0046] Step 2-2: Category-level visual and textual hint generation. In a batch of images of a given category, three images (including a hand-drawn sketch and two photos) are randomly selected and fed into the visual hint module to generate visual hints for the category. In addition, the text [CLS] of this category is input into the text template, and the filled text is input into the pre-trained CLIP text processing branch to generate text features. The text features are input into the text hint module to generate text hints for the category.
[0047] The specific text templates adopt the 63 text templates used in references [1] and [2]. Reference [1] is Sain A, Bhunia AK, Chowdhury PN, et al. Clip for all things zero-shot sketch-based image retrieval, fine-grained or not [C] / / Proceedings of the IEEE / CVFConference on Computer Vision and Pattern Recognition. 2023: 2765-2775., and reference [2] is Gu X, Lin TY, Kuo W, et al. Open-vocabulary Object Detection via Vision and Language Knowledge Distillation [C] / / International Conference on Learning Representations. 2021.
[0048] Step 2-3: Feed the generated visual and textual cues into the CLIP ViT network and train the entire model under the supervision of the triplet loss for a total of 60 epochs.
[0049] Step 3: Model application
[0050] Step 3-1: For a new category of sketches and photo datasets, generate visual and textual prompts according to step 2-2, and guide the ViT network to generate visual features corresponding to each image.
[0051] Step 3-2: Calculate the cosine similarity between the given retrieval image and all images in the image library. Sort the similarity from large to small, and take the K (K = 1, 5, 10) images with the highest similarity as the target recognition result (expressed by Acc.@1, Acc.@5, Acc.@10). If there is an image with the same identity as the query sample among these images, the query is considered successful.
[0052] Experiments are conducted on the Sketchy dataset and compared with other category generalization methods. The results are shown in Table 1. The method proposed in this invention outperforms the current optimal algorithm on three related datasets.
[0053] Table 1 Target recognition effect on unknown categories
[0054]
[0055] In Table 1, CC-DG represents the method recorded in the literature [3]. The literature [3] is Kaiyue Pang, Ke Li, YongxinYang, Honggang Zhang, Timothy M Hospedales, Tao Xiang, and Yi-ZheSong. Generalising fine-grained sketch-based image retrieval. In CVPR, pages 677–686, 2019. ZSE-SBIR represents the method recorded in the literature [4]. The literature [4] is Fengyin Lin, MingkangLi, Da Li, Timothy Hospedales, Yi Zhe Song, and Yonggang Qi. Zero-shot everything sketch based image retrieval, and in explainable style. In CVPR, pages 23349–23358, 2023. B-CLIP represents the method recorded in the literature [1]. CVPR is the IEEE Conference on Computer Vision and Pattern Recognition.
[0056] The ablation experiment results of the text prompt module are shown in Table 2.
[0057] Table 2 Ablation experiment results of text prompt module
[0058]
[0059] In Table 2, "adopting the text prompt model - directly guiding the visual channel" refers to directly using the text prompt to focus on the feature channel on the original visual feature. "Fusing the visual side path feature" refers to the final visual feature obtained by adding and fusing the original visual feature with the visual feature after low-dimensional mapping. "Adopting the text prompt model - guiding the visual side path channel and fusing it" refers to the method shown in formula (2), which first maps the visual feature to a low-dimensional space, then uses the text prompt to guide the attention of the visual low-dimensional feature channel, and then fuses it with the original visual feature. From the comparison results in Table 2, it can be seen that both the text prompt directly guiding the visual features and the visual side path features will bring certain performance improvements. The method of guiding the visual side path channel and fusing the text prompt adopted in the present invention has achieved the best performance.
Claims
1. A self-evolving zero-shot object recognition method based on sketch and text dual prompts, characterized by The steps include: Step 1: Build a basic network for fine-grained ZS-SBIR target recognition; The base network is composed of the visual encoder model in the pre-trained CLIP model, which processes hand-drawn sketches and photo images to extract target features; The visual encoder model uses triplet loss as supervision, taking sketches and photos of the same identity as positive sample pairs, and sketches and photos of different identities as negative sample pairs. The triplet loss is used to bring the image features of the same identity closer and the image features of different identities farther away, guiding the network to extract identity-related target features and learn identity classification of sketch and photo images. Step 2: Build a visual cue model to generate category-level visual cues for each category and apply the visual cues to focus on and capture the category-related discriminative visual features; Step 3: Build a text prompt model to generate category-level text prompts for each category, and apply the text prompts to the ViT model to guide the model to focus on the discernible visual features under the category; In the process of visual feature extraction, textual cues are applied to help the model focus on the discriminative information in the visual features that is relevant to the current category; In addition, the textual cue guidance strategy is different from the visual cue guidance strategy. Instead of directly inserting the textual cue into the image block features as the input of the ViT layer, the textual cue is applied to focus on the feature channels related to the category in the visual features. Step 4: Model training and testing; When training the model, the final feature f of the current image is used g , that is, the output features of the [CLS] block vector in the last ViT layer, which is used to calculate the loss function; during the training process, the model parameters are updated using the triplet loss function, and only the constructed visual prompt module parameters, text prompt module parameters and LayerNorm layer parameters in the ViT model are updated, while other parameters of the ViT model and the parameters of the text processing model are not updated; During testing, there is no overlap between the test category and the training category, that is, the test is performed on a new category that has not been seen before, so it is a category-level zero-shot recognition task; for each test category, first extract the visual cues and text cues under the category, and then apply the bimodal cues information on the ViT model to extract the final features of each sketch index and all photos in the photo library; then, for each sketch index S n , the feature similarity between the sketch feature and all the photo features is calculated by sinusoidal similarity, and then the feature similarity is sorted from high to low. The photo with the highest feature similarity is the photo with the sketch index S n Represents the target of the same identity, that is, the sketch index S n Target recognition results.
2. The self-evolving zero-shot target recognition method based on sketch and text dual prompts according to claim 1 is characterized by: In the basic network, the optimizer is set, and the Adam optimizer is used to update the network parameters. The learning rate of the regularization parameters in the CLIP model is set to 1e-6, and the learning rate of other trainable parameters is set to 1e-5.
3. The self-evolving zero-shot target recognition method based on sketch and text dual prompts according to claim 1 is characterized by: The specific steps of step 2 are: Step 2-1: Category-level visual cue generation; Since the ZS-SBIR dataset contains sketches and photos of different categories, ZS-SBIR performs fine-grained sketch-photo image matching and retrieval within each independent category; in the constructed visual cue generation module, for a training category C i , randomly select a sketch image S, a photo I1 with the same identity ID as the sketch image S, and a photo I2 with a different identity ID in the current category as category C i A set of support samples {S, I1, I2}; then, a convolutional layer is used to extract the image block features of the three images in the support samples, which are represented as In addition, a set of learnable vectors L is initialized, which are consistent with the image patch features. The input is sent to a Transformer layer. Through the similarity calculation and feature fusion between the image blocks in the Transformer layer, the learnable vector L learns the discriminative features of the category, and these category-related discriminative features are included in the generated visual cue vector P. i In , this process is expressed as: Among them, Trans represents the Transformer layer, P i Represented as category C i The generated category-level visual cue vector, and Represents image block features The features of the support samples after the Transformer layer, for any category C i Three support samples {S, I1, I2} are randomly selected and used. If it is feasible to use different numbers of support samples for a category, the different numbers range from 1 to more. Only one sketch or photo, or multiple sketches and photos, are used for the category. Step 2-2 uses category-level visual cues to guide the network to capture discriminative features; For each category C i , using the deep visual cue adjustment method, the visual cue vector is used to guide the visual feature extraction network ViT to focus on and capture the recognizable features related to the category; specifically, in each layer of ViT, the visual cue vector P generated in step 2-1 is i j , and the image block feature f of the current input image I I The [CLS] vector predefined in the ViT model is input into the current ViT layer to guide the network to focus on and extract the discriminative features in the current image. After 12 layers of ViT processing, the final output corresponding to the [CLS] vector is used as the final feature f of the image. g .
4. The self-evolving zero-shot target recognition method based on sketch and text dual prompts according to claim 3 is characterized by: Since the ViT model consists of 12 ViT network layers, a category-level prompt vector is generated for each ViT layer; therefore, a learnable vector L is initialized for each ViT layer. j , and according to formula (1), a category-level visual cue vector P is generated for each ViT layer i j , all ViT network layers use a shared category-level visual cue vector P i .
5. The self-evolving zero-shot object recognition method based on sketch and text dual prompts according to claim 1 is characterized by: The specific steps of step 3 are: Step 3-1: Category-level text prompt generation; For each category C i First, the category name of this category [C i ] is input into a set of text templates, and the category information in the image is expressed through a text description, and the category name of this category [C i ] is filled into the text template, and the filled text is input into the pre-trained CLIP text processing branch to generate text features related to the category In order to avoid accidental errors, multiple different text templates are used to generate multiple text features. Calculate the mean as the final text feature of this category; then, classify this category C i The text features of the input into a multi-layer perceptron, generate the text prompt T of this category i ; Step 3-2 Application of text prompts; Set the text prompt T i Applied to the network ViT model, the model is guided to focus on the discriminative visual features related to the current category; when focusing on specific visual feature channels, the visual features of each layer are first mapped to a low-dimensional space, and then the visual feature channels guided by text prompts are focused and selected in this low-dimensional space, and then added and fused with the original visual features; the text prompt guidance method is side-path guidance, which is expressed by the formula: f I j′ =FC2(FC1(f I j ×T i ))+f I j (2) Among them, f I j Represents the visual features of image I at the jth layer ViT, FC1 converts the original visual features f I j Mapped to a low-dimensional common space, in the text prompt T i The feature attention is performed under the guidance of , and the channel-attended features are mapped back to the original feature space through a fully connected layer FC2; the visual features attended by the text prompts are combined with the original features f I j Add and fuse to obtain the final visual feature f guided by the text prompt I j′ .
Citation Information
Patent Citations
Fine-grained sketch image retrieval method based on deep cascade cross-modal correlation
CN111324765A
Subtitle information detection method and device, equipment and storage medium
CN114495128A
Face restoration method based on multi-scale face analysis graph fusion
CN116664435A
Visual large language model method based on few-sample learning
CN117273150A
Sketch based search methods
WO2017168125A1
