DualCoOp: Fast Adaptation to Multi-Label Recognition with Limited Annotations
Abstract
Solving multi-label recognition (MLR) for images in the low-label regime is a challenging task with many real-world applications.
Recent work learns an alignment between textual and visual spaces to compensate for insufficient image labels, but loses accuracy because of the limited amount of available MLR annotations.
In this work, we utilize the strong alignment of textual and visual features pretrained with millions of auxiliary image-text pairs and propose Dual Context Optimization ( DualCoOp ) as a unified framework for partial-label MLR and zero-shot MLR.
DualCoOp encodes positive and negative contexts with class names as part of the linguistic input (i.e. prompts).
Since DualCoOp only introduces a very light learnable overhead upon the pretrained vision-language framework, it can quickly adapt to multi-label recognition tasks that have limited annotations and even unseen classes.
Experiments on standard multi-label recognition benchmarks across two challenging low-label settings demonstrate the advantages of our approach over state-of-the-art methods.
Project page: https://cs-people.bu.edu/sunxm/DualCoOp/project.html
Introduction
Image recognition has become a very popular and successful research area in recent years, due to the development of large-scale datasets [12, 28] and advanced model architectures [14, 19, 38, 54].
However, the majority of image recognition approaches have focused on single-label prediction, which ignores the intrinsic multi-label nature of images.
Unlike single-label recognition [14, 19, 38, 54] multi-label image recognition aims to recognize all semantic labels present in an image [10, 11, 35, 37, 52, 66, 61], providing a more comprehensive understanding and benefiting applications like image retrieval, video analysis and recommendation systems.
Multi-label recognition typically deals with images of complex scenes and diverse objects.
Collecting multi-label annotations becomes difficult to scale up, for two reasons: (i) annotating images with the full semantic label set is laborious and (ii) samples of particular categories can be hard to find.
The first challenge can be addressed by multi-label recognition with partial labels , where merely some of the categories are annotated for each training image.
Recent works proposed solutions to partiallabel MLR based on semi-supervised learning [24, 41], normalized training objectives [15], or label correlations [8, 21, 46].
The second setting involves zero-shot MLR, where novel unseen categories are recognized by transferring knowledge from seen categories, with solutions like principal image features [3, 69], knowledge graphs [29], and attention mechanisms [22, 44].
Despite significant progress on the two settings, existing approaches are not designed to handle both.
We propose to unify these settings as limited-annotation MLR and design a solution that can handle practical scenarios with either partial or missing labels.
Successful solutions to the above problems transfer knowledge from fully-annotated categories to partially-labeled and novel categories by learning an alignment between images and category
[Figure]
names [8, 46, 69].
Recently, vision-language pretraining models are bridging the visual-textual gap via large-scale pretraining, e.g., CLIP [47] is trained with 400 million image-text pairs.
In this work, we draw inspiration from the recent success of prompt learning for such models [20, 25, 40, 48, 70, 72].
Prompt learning provides a convenient way to transfer pretrained vision-language models to other tasks.
It designs additional templated or learnable prompt tokens for textual input to “inform” the model about downstream tasks and avoids finetuning the entire model which can be inefficient and data-hungry.
By doing so, recent works like CoOp [71] have demonstrated CLIP’s remarkable generalisation to various zero-shot image tasks [20, 47, 72].
However, these methods mainly focus on matching each image with a single label, hence they are not able to handle the multi-label setting.
To adapt the knowledge learned in CLIP to multi-label image recognition, we propose the DualCoOp framework.
As shown in Fig.
1 (c), DualCoOp learns a pair of differentiable prompts to provide positive and negative contexts for the target class.
Instead of using hand-crafted thresholding to determine positive labels [51], the dual prompts naturally result in a positive and a negative classifier, so the existence of the target class in the image can be easily decided by comparing their scores.
Unlike prior models, shown in Fig.
1 (a)(b), we avoid fine-tuning the full vision-language model and only learn the prompts, which are much smaller compared to the entire model.
Therefore, our simple framework achieves much higher efficiency when adapting to different datasets.
Additionally, we modify the attention mechanism of CLIP to better model spatial information in images, improving its ability to recognize multiple objects in MLR.
With these design choices, we achieve a unified framework for addressing the general challenges of multi-label recognition with limited annotations.
We summarize our contributions as follows:
• We propose DualCoOp to quickly adapt powerful vision-language models to solve multi-label recognition tasks using limited annotations.
• We propose dual (positive and negative) prompts to drastically reduce the number of learnable parameters, and improve the spatial modeling of the visual encoder to better distinguish multiple objects. • We conduct extensive experiments on partial-label MLR (on MS-COCO [34] and VOC2007 [16]) and zero-shot MLR (on MS-COCO and NUS-WIDE [11]).
Notably, DualCoOp improves mAP by 6 . 8% with 10% of labels on VOC2007, and F1-score at Top-3 Prediction by 10 . 8% for zero-shot MLR on NUS-WIDE.
Related Works
Multi-Label Recognition with Limited Annotations.
Multi-label image recognition has drawn increasing attention in past years.
One straightforward solution to this problem is to individually learn a binary classifier for each category [36, 43, 57], which however does not consider correlations among labels.
Hence, recent works have focused on incorporating semantic dependencies among labels via graph neural networks [10, 11, 61] or RNN/LSTM [35, 59, 62, 66].
Some work also considers the spatial distribution of labels in the image, and exploits object proposals [33, 37, 60] or attention mechanism [52, 62, 73] as a regularization to rectify the prediction.
However, despite achieving significant progress, these methods require a large-scale and complete annotated dataset to train models [27, 34].
This limits their application to more practical scenarios where data is partially annotated for training [4, 6, 41, 55, 56, 64] and unseen (zero-shot) categories may appear during testing [7, 18, 29, 42, 69].
With partially labeled data, where merely some labels of each sample are known, Mahajan et al .
[41] and Joulin et al .
[24] attempt to use web supervision to automatically generate the pseudo labels, which unfortunately leads to poor performance as the web supervision is noisy and incomplete [67].
To avoid external noise, Durand et al .
[15] exploit the proportion of annotated samples for different labels and propose a normalized BCE loss to train models based on the given partial labels.
More recent works explicitly transfer information from known labels to complement unknown labels by utilizing category-specific feature blending [46] or label co-occurrences [8] at both instance-level and prototype-level.
Unlike partial annotation of the same label set for training and testing, zero-shot multi-label image recognition needs to handle novel categories during testing, hence inspiring a different route based on a joint visual-label embedding space [7, 22, 42, 44, 69].
Zhang et al .
[69] propose to find a principal direction that ranks related labels first in the joint embedding space optimized via a tailored zero-shot ranking loss.
Cohen et al .
[3] further improve the idea by learning multiple principal vectors to support the semantic diversity.
Huynh et al .
[22] consider the spatial regularization and propose a shared multi-attention model and obviate the need for explicit region proposals [50].
Narayan et al .
[44] propose to enhance the region-based features so as to minimize inter-class feature entanglement.
Though significant progress has been made in each of the directions, existing methods still require a lot of MLR data and complex architectures/losses.
Our approach reduces the need for hard-to-get
MLR data by pretraining on unsupervised text-image pairs.
While it may seem unfair to compare existing MLR methods with ones based on such pretraining, we point out that the pretraining data is unsupervised and thus easier to obtain.
We also provide experiments comparing DualCoOp to baselines using the same pretraining.
Importantly, previous methods are designed for only one task, hence have limitations in practical applications.
In contrast, our proposed framework can be easily adapted with small data and can address both partial and zero-shot tasks at the same time.
Prompt Learning for Vision-Language Models.
Vision-Language Models [23, 47] based on contrastive learning have demonstrated impressive ability to learn generic visual representations.
As a milestone, CLIP [47] is trained with 400 million curated image-text pairs, and shows remarkable transfer capability for over 30 classification datasets.
With such powerful vision-language models, several follow-ups [17, 63, 65, 68] have been proposed to explore the training strategies for training downstream classification tasks.
Instead of fine-tuning the entire model [13, 19], which may damage the learned representation space, recent approaches adopt the prompt-based paradigm that formalizes
NLP tasks as masked language modeling (prompt templates)
Zhou et al .
[71] propose to tune prompts for downstream classification tasks, and further introduce input-conditional prompts for better generalization ability [72].
Lu et al .
[39] learn the distribution of diverse prompts to handle the varying visual representations.
Huang et al .
[20] generate pseudo labels for images to learn prompts in an unsupervised way.
Though achieving promising improvements for downstream tasks, these methods address the multi-class zero-shot image recognition, assuming each image has one label, hence lacking the ability to handle the multi-label setting.
In this paper, we present a novel framework to efficiently transfer VLMs to address multi-label image recognition with limited annotations.
Method
Problem Definition.
We formally define multi-label recognition with limited annotations as follows:
Consider M as the set of categories which describe objects or attributes in images.
Given a training image I , the existence of a category m ∈ M can be positive, negative or unknown, corresponding to the label y m
=
1 , − 1 or 0 respectively.
During inference, we predict each label of interest for an input image.
[Figure]
[Figure]
[Figure]
ASL
[Figure]
Many existing MLR problems fit into this broad definition.
In this paper, we consider the settings with partial or missing labels: (1) Partial-label MLR [8, 15, 46], in which only a subset of labels are known ( +1 or − 1 ) for one training image and we are interested in predicting all existing labels during inference.
(2) Zero-shot MLR [3, 22, 49], in which each label is either known (seen) or unknown (unseen) for all images during training and we are interested in predicting either all labels or only unknown (unseen) labels during inference.
In this paper, we propose a unified framework to address the limited-annotation MLR in both scenarios.
Approach Overview.
To compensate for insufficient or missing image labels, it is important to learn how the meanings of category names are related to each other, so we can transfer knowledge between related categories.
This is usually done by learning an alignment between the visual and textual spaces.
However, our dataset is too limited to learn a broad and generalizable mapping.
We propose
DualCoOp to instead leverage the strong alignment of visual and textual feature spaces learned by large-scale vision-language pretraining (CLIP [48]) with a light-weight learnable overhead which quickly adapts to the MLR task with limited semantic annotations.
Figure 2 provides an overview of our proposed approach.
DualCoOp learns a pair of “prompt” contexts in the form of two learnable sequences of word vectors, to provide positive and negative contextual surroundings of a given category name m .
This generates positive and negative textual features ( F mt )
+ and ( F mt ) − that are fed into the pretrained text encoder.
Furthermore, to better recognize multiple objects, which can be located at different locations in the image, the spatial aggregation step is modified.
We first compute the similarity score of each projected visual feature F iv at location i with ( F mt ) + / ( F mt ) − to obtain prediction logits over regions.
For each class, we perform aggregation of all spatial logits, in which the weight for each logit is determined by its relative magnitude.
We call this Class-Specific Region
Feature Aggregation .
During training, we optimize the learnable prompts via the ASL loss [51] while keeping all other network components frozen.
During inference, we directly compare the final positive and negative logits to make a prediction for each label y m .
Dual Learnable Prompts.
Instead of learning a single prompt for a class [71], we propose Dual
Context Optimization ( DualCoOp ) which learns two contrastive prompts’ contexts for each class.
The learnable part in dual prompts carries positive and negative contextual surroundings individually and can be optimized end-to-end from data via binary classification loss.
Specifically, we define the pair of prompts given to the text encoder as follows:
[Equation]
[Equation] [Equation] [Equation] where each V is a learnable word embedding vector ( e.g. with dimension 512 in CLIP [48]) and CLS is the given category name.
N +
and N − are the numbers of word tokens learned in the positive and negative prompts respectively.
For simplicity, we set N + = N − in our experiments.
We learn a pair of positive and negative prompts for each class (i.e. class-specific prompt pair) when solving MLR with partial labels, and learn a pair of prompts shared for all classes in zero-shot MLR.
With a pair of prompts, we compute the binary classification output p with the following form:
[Equation]
where < · , · > represents cosine similarity and p is the predicted probability for a given (image, label) pair as positive example.
E v ( · ) and E t ( · ) are the visual and textual encoders from the vision-language pretraining.
A ( · ) is our new aggregation function to adaptively reduce the spatial dimension of visual features for each class, which will be discussed next.
Class-Specific Region Feature Aggregation.
In multi-label image recognition, it is common that multiple objects appear in different regions of the image.
Pooling to produce a single image-level feature vector for all classes gives sub-optimal performance since spatial information is reduced and different objects are mixed.
In this work, we reformulate the last multi-headed attention pooling layer of the visual encoder in CLIP [48] and apply class-specific pooling to adaptively aggregate region features in the multi-label setting.
The original attention pooling layer in CLIP pools the visual feature map first, and then projects the global feature vector into text space as follows:
[Equation]
where q , v and k are independent linear embedding layers and x = E v ( I ) is the output feature map of the visual encoder.
By removing the pooling operation, we can project the visual feature x i of each region i to the textual space [70]:
[Equation]
For each region i and each class m , we compute cosine similarity between F iv and ( F mt ) + =
E t ( Prompt + ) as S + i,m = <
F iv , ( F mt ) + > , and compute S − i,m in the same way.
In order to make a single prediction for the whole image, we aggregate S + i,m and S − i,m into S + m and S − m according to the magnitude of S + i,m , i.e.:
[Equation]
Notably, we do not introduce any new parameters in our re-formulation of the spatial aggregation function.
All parameters used to project visual features to the textual space are inherited from the original multi-headed attention pooling layer in CLIP.
Optimization .
We apply the Asymmetric Loss (ASL) [51] to handle the inherent positive-negative imbalance in the optimization of multi-label recognition.
Specially, we compute losses for a positive (image, label) pair L + and a negative (image, label)
pair L − as follows:
[Equation]
where p c = max( p − c, 0) is the probability for negative examples shifted by hard thresholding via the margin c .
We set the hyper-parameters γ − ≥ γ + , so that ASL down-weighs and hard-thresholds easy negative samples.
The pair of learnable prompts are updated by back-propagating ASL through the frozen text encoder.
Experiments 4.1 Multi-Label Recognition with Partial Labels
Datasets.
We conduct experiments on MS-COCO [34], VOC2007 [16] and BigEarth [5] to evaluate multi-label recognition with partial labels.
MS-COCO [34] contains 80 common object categories
[Table]
and we use the official train2014 (82K images) and val2014 (40K images) splits for training and test.
VOC2007 [16] contains 20 object categories and we use the official trainval (5K images) and test (5K images) splits for training and test.
Furthermore, since CLIP pretraining data is not publicly available and it is plausible that CLIP pretraining data covers many coarse and fine-grained visual domains since it performs well in the zero-shot evaluation for many downstream tasks, we also experiment on a Remote Sensing Image dataset BigEarth [5], whose domain is far from the domains of the datasets in the mainstream papers (i.e. PASCAL VOC, MS-COCO, and NUS-WIDE).
To create the training set with partial labels, we randomly mask out labels from the fully annotated training set 1 and use the remaining labels for training by following standard practice [8, 15, 46].
In this work, we vary the proportion of kept labels from 10% to 90% [8, 46].
Evaluation.
On all datasets, we follow [8, 15, 46] to report the mean average precision (mAP) for each proportion of labels available for optimization (from 10% to 90% ) and its average value for all proportions.
We count the learnable parameters (#P) of each baseline and DualCoOp to measure the complexity of optimization 2 .
We also report the per-class and the average overall precision (CP and OP), recall (CR and OR), and F1 (CF1 and OF1) of DualCoOp under different proportions of labels for training in the supplementary material due to the page limit.
Implementation.
We adopt ResNet-101 [19] as the visual encoder in all baselines and DualCoOp for input resolution 448 × 448, and use the same Transformer [48, 58] in CLIP [47] as the text encoder.
The visual and text encoders are initialized from the CLIP pretrained model and kept frozen during optimization.
For each class/label, we learn two independent context vectors with 16 context tokens (N = 16) following [71], which is the only learnable part in DualCoOp .
We use the SGD optimizer with an initial rate of 0.002 which is decayed by the cosine annealing rule.
We train context vectors for 50 epochs with a batch-size 32/8/32 for MS-COCO/VOC2007/BigEarth, respectively.
For ASL loss, we choose γ + = 1 , γ − = 2 and c = 0 .
05 via validation.
Training is done with one RTX A6000.
Baselines.
To evaluate the effectiveness of DualCoOp , we compare with the following baselines: (1).SSGRL [9], GCN-ML [10] and KGGR [7] adopt graph neural networks to model label dependencies.
We follow [8] to report their performance in the partial-label setting.
Curriculum labeling [15] and SST [8] generate pseudo labels for unknown labels.
Partial BCE [15] uses a normalized BCE loss to better exploit partial labels.
SARB [46] blends category-specific representation across different images to transfer information of known labels to complement unknown labels. [Table] [Table]
Results.
Table 1 shows the comparison of mAP between DualCoOp and all baselines optimized with 10% to 90% of labels.
For the two most recent works (SST [8] and SARB [46]), we further substitute the ImageNet pretrained weights [19] with the CLIP pretrained weights [47] when initializing of their visual encoders, which results in SST ∗ and SARB ∗ in Table 1.
Since we learn class-specific prompts, DualCoOp on MS-COCO adopts more learnable parameters than VOC2007.
Our proposed
DualCoOp achieves the best performance across all proportions of labels available during the training with the smallest learnable overhead (1.3M vs. 29.6M in SARB ∗ on MS-COCO and 0.3M vs. 29.6M in SARB ∗ on VOC2007).
Notably, DualCoOp yields a great improvement over the second-best method, 3 . 2% on MS-COCO and 6 . 8% on VOC2007, especially when only providing 10% of labels during the training.
This indicates that DualCoOp can quickly adapt to the multi-label recognition task with a few labels. On BigEarth, we compare DualCoOp with the strong baseline SARB.
Tableshows that DualCoOp consistently improves over SARB by 11 . 0% when only providing 10% of labels and 6 . 1% for average performance which proves DualCoOp boosts the performance in various visual domains by taking advantage of the powerful vision-language pretraining.
Full Label Training. On MS-COCO, we use 100% of training labels and finetune the visual encoder, DualCoOp achieves 85.2% mAP, outperforming previous SOTA approaches like ASL [51] (85.0% mAP) and CSRA [74] (83.5% mAP) with the same ResNet-101 backbone. Without finetuning the visual encoder, we notice that our performance drops to 83.2% mAP, which is still comparable to the performance of ASL and CSRA.
Such a performance drop may be due to the noise in the image-text pairs used for pre-training the CLIP model and the misalignment of the objectives between the pre-training task and MLR task.
This also shows that it is non-trivial to address the MLR task with the pretrained CLIP model, even though it is pre-trained with larger-scale data.
Computational Cost.
We compare the computational cost between DualCoOp and SARB [46] in terms of training/testing latency and memory (see Table 3) using the same device (one Nividia A
GPU).
For the current multi-label recognition task, the categories are pre-set before inference, (i.e. we already know which class we would like to consider during inference.)
In this case, we compute the text features for each class from the learned prompts and the class name ahead of the inference.
Then we use the pre-computed text features to predict each image during the test.
Since the text features are pre-computed (very light-weighted computing overhead), the text encoder is not executed during inference.
For inference, the latency time and memory consumption of DualCoOp are the same as other baselines when using the same backbone for the image encoder.
During training, CLIP-based methods slightly raise latency time and memory consumption since image and text encoders are both executed during the forward, and only prompts are updated in DualCoOp .
4.2 Zero-shot Multi-Label Recognition
Datasets.
Following [3, 22], we conduct experiments on MS-COCO [34] and NUS-WIDE [11] to perform zero-shot multi-label recognition.
On MS-COCO, we follow [2, 3] to split the dataset into 48 seen classes and 17 unseen classes.
NUS-WIDE [11] dataset includes 270K images.
Following [3, 22] we use 81 human-annotated categories as unseen classes and an additional set of 925 labels obtained from Flickr tags as seen classes.
Evaluation.
We follow [3] and report precision, recall, and F1 score at Top-3 predictions in each image on MS-COCO.
We also follow [3, 22] to report mAP over all categories as well as precision, recall, and F1 score at Top-3 and Top-5 predictions in each image on NUS-WIDE. We evaluate all [Table]
[Table] methods with both zero-shot setting (test only on unseen classes) and generalized zero-shot setting (test on both seen and unseen classes) [Table]
Implementation.
We adopt ResNet-50 [19] similar to [3] as the visual encoder in DualCoOp for input resolution 224.
Instead of learning class-specific prompts [Table] we learn the class-agnostic context vectors with 64 context tokens (N = 64) for all classes, which is the only learnable part in DualCoOp .
We optimize context vectors for 50 epochs with a batch-size 32/192 for MS-COCO/NUS-WIDE, respectively.
During inference, we combine the learnt pair of context vectors with the class name for each class (either base class or novel class) and compute the text features.
Other implementation details are the same with Sec. 4.
Baselines.
To evaluate the effectiveness of DualCoOp in the zero-shot setting, we compare with the following baselines: (1).
CONSE [45] adopts an ensemble of classifiers for unseen classes.
LabelEM [1] learns a joint image-label embedding.
Fast0Tag [69] and SDL [3] estimate one or multiple diverse principal directions of the input images.
Deep0Tag
[49] and LESA [22] estimate the relevant regions via region proposals and attention techniques respectively.
BiAM [44] enhances the region-based features to minimize inter-class feature entanglement.
Results.
Table 4-5 shows the comparison between DualCoOp and all SOTA methods of zero-shot learning and generalized zero-shot learning on MS-COCO and NUS-WIDE datasets.
DualCoOp achieves the best F1 score in all cases with a very light learnable overhead (0.02M) and improves the performance of zero-shot learning (unseen labels) with a significant margin: F1 score improves by 12.5 @Top-3 on MS-COCO, and by 10.8 @Top-3 and 10.9 @Top-5 on NUS-WIDE.
This shows the power of exploiting the pretrained alignment of textual and visual spaces in CLIP via DualCoOp to solve multi-label recognition.
4.3 Ablation Studies
Effectiveness of Text Supervision.
To show the effectiveness of text supervision from label space, we compare the model learned with discrete label space (“Discrete Label”) with four methods (SST [8], SARB [46], CoOp [71] and DualCoOp ) which introduce the textual space to utilize the contextual correlation of labels in Table 6.
We find that methods with text supervision usually perform better [Table] [Table] than the method only using discrete labels.
However, when the semantic annotations are limited, text supervision sometimes yields worse performance (e.g. mAP of SST is 1 .
5% lower than Discrete
Labels with only 10% of labels).
CoOp [71] utilizes the visual-textual alignment. However, with the original multi-head attention and single positive prompt, it yields worse performance than Discrete
Labels.
To better utilize the well-pretrained alignment, DualCoOp learns dual context pairs and adopts class-specific region feature aggregation, which leads to great performance ( e.g. 7 . 8% higher than Discrete Labels with 10% of labels) and quickly adapts to the dataset even with limited labels.
Ablation of Prompt Design.
We compare our proposed dual learnable prompts with two hand-crafted prompts and one prompt learning method on the MS-COCO dataset with the zero-shot setting (see
Table 7).
Hand-crafted prompts can use either contextless class names [31] or manually designed prompt templates.
In our experiments, we carefully choose the positive and negative prompt templates as “a photo of a [classname]” and “a photo without a [classname]”.
In contrast with performing the binary classification for each class with dual learnable prompts as the input, we also experiment with learning a single prompt of positive or negative contexts and use a chosen threshold (0.5 in our experiment) to make the prediction for each class.
As we can see, the single positive prompt learning method (M2) performs better than non-learnable methods (M0 and M1), and a single negative learnable prompt (M3) achieves much worse accuracy than its positive counterpart (M2).
However, when we include both positive and negative prompts, dual prompts (M4) performs even better than a single prompt, which indicates that DualCoOp learns complementary and beneficial information in the dual prompt pair.
M4 also outperforms M2 in terms of mAP with both ZSL (77.53% vs. 64.74%) and GZSL (69.8% vs. 63.1%).
To keep the same amount of learnable parameters as in single prompt settings, we also halve the token size (M5), and find that DualCoOp still outperforms two single prompts in M2 and M3 by large gaps, demonstrating the effectiveness of our dual-prompt design.
Multi-Headed Attention vs. Class-Specific Region Aggregation.
In Table 8, we compare the adaptive ability of these two visual aggregation methods when training/testing with a larger resolution (see Table 8), which is crucial in multi-label recognition as spatial details matter.
For a fair comparison, we only replace the class-specific region aggregation in DualCoOp with the original multi-headed attention layer in CLIP [48] at the end of the visual encoder.
We adaptively resize the input feature map to match the input dimension of the multi-headed attention layer
[Table]
[Table] As shown in Table 8, multi-headed attention is bonded to the pre-training image resolution ( in CLIP), while our class-specific region aggregation benefits from the increased input resolution either during training or in inference.
Our class-specific feature aggregation uses original weights, but actually performs better than finetuning the original multi-headed attention layer. [Figure]
Ablation of Finetuning DualCoOp.
To better examine the effectiveness of finetuning for DualCoOp , we have implemented two different finetuning mechanisms for DualCoOp : (1).
only finetune the weights in ClassSpecific Region Feature Aggregation, (2).
finetune all weights in the CLIP image-encoder.
As shown in Table 8, finetuning aggregation function can stably improve the performance over the non-finetuning setting with different amounts of labels available.
However, finetuning the entire visual encoder does not always outperform the nonfinetuning baseline, especially under limited annotations ( ≤ 70% labels).
Ablation of Aggregation Function. We experiment with different functions to aggregate the regional logits for each class in Fig.
We compute final logits in three ways: (1) taking the average of logits at all spatial locations (“Ave”), (2) taking the region with the largest positive logit (“Max”), and (3) generating aggregating weights for all spatial locations via a softmax function over the positive logits (“Ours”).
“Max” performs better than “Ave”, which indicates the regional feature is more informative than the global feature in multi-label recognition.
Furthermore, by taking account of both the regional and the global features, “Ours” gives the best performance.
Conclusion
In this paper, we propose a unified framework, DualCoOp , for two types of multi-label recognition with limited annotations.
It utilizes the powerful vision-language pretraining from a large-scale dataset.
By introducing a lightweight learnable overhead, it can quickly adapt to solve multi-label recognition after receiving a small amount of labels.
In DualCoOp , we learn a pair of positive and negative prompts followed by the target class name as the linguistic input.
Furthermore, to better aggregate visual region features for each class, we reformulate the original visual attention in the pretraining model as a class-specific region feature aggregation.
We conduct extensive experiments for both partial-label MLR and Zero-Shot MLR across MS-COCO, VOC2007, and NUS-WIDE datasets showing the efficacy of our proposed approach over state-of-the-art methods.
Limitations.
Since the vision-language pretraining adopts a large Transformer-based language model and all labels need to be feed-forward through the text encoder, the large language model limits the size of the label set.
Also, compared to training the model with both seen and unseen labels, we still get worse performance for the zero-shot unseen classes even though we have used 400M auxiliary samples in the pretraining.
This highlights the difficulty of zero-shot MLR.
Negative Societal Impacts.
Negative impacts of our research are difficult to predict, however, it shares many of the pitfalls associated with deep learning models.
These include susceptibility to adversarial attacks and data poisoning, dataset bias, and lack of interpretability.
Other risks associated with the deployment of computer vision systems include privacy violations when images are captured without consent, or used to track individuals for profit, or increased automation resulting in job losses.
While we believe that these issues should be mitigated, they are beyond the scope of this paper.
Furthermore, we should be cautious of the result of failures of the system which could impact the performance/user experience of the high-level AI systems based on our research. Acknowledgement
This work is supported by NSF and DARPA LwLL.
It reflects the opinions and conclusions of its authors, but not necessarily the funding agents.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contribu- tions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] Please refer to the limitations in the conclusion (c) Did you discuss any potential negative societal impacts of your work?
[Yes] Please refer to the Negative Societal Impacts.
in the conclusion (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[N/A] (b) Did you include complete proofs of all theoretical results?
[N/A] 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] Please check our project page included in the abstract and https://github.com/sunxm2357/DualCoOp for our code.
We use public datasets which can downloaded directly and provide the details for the hyperparameters in the training see Sec.(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] Please check implementation details in Sec.(c)
Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[No] (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] Please check implementation details in Sec.4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[N/A] (b) Did you mention the license of the assets?
[N/A] (c) Did you include any new assets either in the supplemental material or as a URL?
[N/A] (d) Did you discuss whether and how consent was obtained from people whose data you’re us- ing/curating?
[N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable informa- tion or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount [Table]
participant compensation?
[N/A]
A Different Prompt Length
[Figure]
We have provided the comparison of the performance of DualCoOp with different of prompt context (i.e. N = 2 , 4 , 6 , 8 , 16 , 32 , 64 ) in all three different experiment scenarios (see Fig.
4 and 5).
In MLR with partial labels, we learn class-specific prompts and thus
DualCoOp performs good when N is small, such as 8, 16.
For zero-shot learning in MLR, we learn uniform prompts shared by all classes and it requires larger N (e.g. 32 or 64) for good performance.
In the main paper, we use N = 16 for all experiments of MLR with partial labels and use N = 32 for experiments in zero-shot learning.
[Figure]
In the main paper, we set N + = N − for simplicity.
Here, we conduct experiments in both partial-label MLC and Zero-Shot MLC settings to check the performance of different N − s by controlling the N + as the same.
As shown Table 9 and 10, F1-Score generally improves with larger N − in both partial label and zero-shot settings.
B Full performance of MLR with Partial Labels
In this section, we provide the average per-class and average overall precisions (CP and OP), recalls (CR and oR) and F1 scores (CF1 and OF1) of DualCoOp in the experiment of MLR with Partial Labels on MS-COCO [34],
VOC2007 [16] and BigEarth [5] (see Table 11, 12 and 13 in supplementary material) as a supplementary for Table 1 and 2 in the main paper.
C Visualization of Class-Specific Region Feature Aggregation
We have visualized the class-specific region feature aggregation on MS-COCO dataset (in Fig. 6).
We can see
DualCoOp generates the high attention score at the correct objects.
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
CR
CF
OP
OR
OF mAP
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
Input
Chair
Potted Plant
Microwave
Potted Plant
Sink
[Figure]
Bottle
Vase
Oven
[Figure]
Car
Dog
Person
[Figure]