TOIST: Task Oriented Instance Segmentation Transformer with Noun-Pronoun Distillation
Abstract
Current referring expression comprehension algorithms can effectively detect or segment objects indicated by nouns, but how to understand verb reference is still under-explored.
As such, we study the challenging problem of task oriented detection, which aims to find objects that best afford an action indicated by verbs like sit comfortably on .
Towards a finer localization that better serves downstream applications like robot interaction, we extend the problem into task oriented instance segmentation.
A unique requirement of this task is to select preferred candidates among possible alternatives.
Thus we resort to the transformer architecture which naturally models pair-wise query relationships with attention, leading to the TOIST method.
In order to leverage pre-trained noun referring expression comprehension models and the fact that we can access privileged noun ground truth during training, a novel noun-pronoun distillation framework is proposed.
Noun prototypes are generated in an unsupervised manner and contextual pronoun features are trained to select prototypes.
As such, the network remains noun-agnostic during inference.
We evaluate TOIST on the large-scale task oriented dataset COCO-Tasks and achieve +10.9% higher mAP box than the best-reported results.
The proposed noun-pronoun distillation can boost mAP box and mAP mask by +2.8% and +3.8%.
Codes and models are publicly available at https://github.com/AIR-DISCOVER/TOIST .
Introduction
As benchmarked by the RefCOCO, RefCOCO+ [27][61] and RefCOCO-g [45] datasets, noun referring expression comprehension models have seen tremendous progress, thanks to large-scale vision-language pre-training models like VL-BERT [57], VilBERT [43], OSCAR [33], UNITER [10], 12-in-1 [44] and MDETR [26].
As shown in the left top part of Fig.
1, these algorithms take noun prompts like hatchback car as inputs and generate a bounding box or an instance mask of that car.
However, in real-world applications like intelligent service robots, system inputs usually come in the form of affordance (i.e., the capability to support an action or say a verb phrase).
Whether modern vision-language model designs can effectively understand verb reference remains under-explored.
To this end, we focus on the challenging problem of task oriented detection, as introduced by the
COCO-Tasks benchmark [55].
As shown in the right top part of Fig.
1, a task oriented detector outputs three boxes of forks as they can be used to smear butter .
We also extend the problem to an upgraded instance segmentation version using existing COCO masks [40], as the masks can provide finer localization.
When RGB-D pairs are available, instance masks can be used to obtain object point clouds.
When image sequences are available, instance masks can be used to reconstruct objects using visual hull [31][11][67].
As such, the newly proposed task oriented instance segmentation formulation (Fig. 1 bottom) is useful for down-stream robot interaction applications.
[Figure]
While noun referring expression comprehension datasets aim to minimize ambiguity [45], an interesting and challenging feature of task oriented detection/segmentation is the intrinsic ambiguity.
For example, in the right top panel of Fig. 1, the pizza peel can also be used to smear butter .
If we have neither forks nor pizza peels at hand, it is still possible to use the plate to smear butter .
Another example is shown in Fig.
1 bottom.
When we consider an object to step on , the chair is a better choice because the sofa is soft and the table is heavy to move.
When the need switches to sit comfortably on , sofas are obviously the best candidates.
In one word, objects that afford a verb are ambiguous and the algorithm needs to model preference .
To this end, current models [55] use a two-stage pipeline, in which objects are firstly detected then relatively ranked.
Inspired by the success of DETR-like methods [6][65][41] and the advantage of the attention mechanism in revealing the relationship between visual elements [34][64], we resort to the transformer architecture as it imposes self-attention on object queries thus naturally models the pair-wise relative preference between object candidates.
Our one-stage method is named as T ask O riented I nstance S egmentation T ransformer and abbreviated as TOIST.
Transformers are considered to be data hungry [5][14], but obtaining large-scale visually grounded verb reference data with relative preference (e.g., COCOTasks [55]) is difficult.
This inspires us to explore the possibility of reusing knowledge in noun referring expression comprehension models.
We propose to use pronouns like something as a proxy and distill knowledge from noun embedding prototypes generated by clustering.
Specifically, we first train a TOIST model with verb-noun input (e.g., step on chair for the bottom panel of Fig.
1 bottom), using the privileged noun ground truth.
But during inference, we cannot access the noun chair , thus we train the second TOIST model with verb-pronoun input (e.g., step on something ) and distill knowledge from the first TOIST model.
As such, the second TOIST model remains noun-agnostic during inference and achieves better performance than directly training a model with verb-pronoun input.
This framework is named as noun-pronoun distillation .
Although leveraging knowledge from models with privileged information has been used in robotics research like autonomous driving [7] and quadrupedal locomotion [32], the proposed paradigm of distilling privileged noun information into pronoun features is novel, to the best of our knowledge.
To summarize, this paper has the following four contributions:
• We upgrade the task oriented detection task into task oriented instance segmentation and provide the first solution to it.
Although this is a natural extension, this new formulation is of practical value to robotics applications.
• Unlike existing two-stage models that firstly detect objects then rank them, we propose the first transformer-based method TOIST, for task oriented detection/segmentation.
It has only one stage and naturally models relative preference with self-attention on object queries.
• In order to leverage the privileged information in noun referring expression understanding models, we propose a novel noun-pronoun distillation framework.
It improves TOIST by +2.8% and +3.8% for mAP box and mAP mask , respectively.
• We achieve new state-of-the-art (SOTA) results on the COCO-Tasks dataset, out-performing the best reported results by +10.9% mAP box .
Codes and models are publicly available.
Related Works
Vision and Language.
Connecting vision and language is a long-existing topic for visual scene understanding.
Barnard et al.
[4] propose a system that translates image regions into nouns.
Babytalk [30] is an early method that turns images into sentences, based upon conditional random fields.
Visual question answering [3] aims to answer questions about an image, with potential applications in helping visually impaired people [19].
The CLEVR dataset [25] focuses on the reasoning ability of question answering models, thanks to a full control over the synthetic data.
The Flickr30k benchmark [51] addresses the phrase grounding task that links image regions and descriptions.
Vision-language navigation [2][16] aims to learn navigation policies that fulfill language commands.
DALL-E [52] shows impressive text-to-image generation capability.
Video dense captioning [28][15] generates language descriptions for detected salient regions.
Visual madlibs [60] focuses on fill-the-blank question answering.
Visual commonsense reasoning [62] proposes the more challenging task of justifying an answer.
Referring expression detection [61][45] and segmentation [24] localize objects specified by nouns.
Although this literature is very large with many problem formulations proposed, the task of detecting objects that afford verbs (e.g., COCO-Tasks[55]) is still under-explored.
Action and Affordance.
Verbs, as the link between subjects and objects, have been extensively studied in the both vision [58][48] and language [23][46] communities before, while we focus on the vision side.
It is difficult to define standalone verb recognition tasks, so existing problem formulations depend on the focus on subjects or objects.
A simple taxonomy can be considered as such: recognizing subjects and verbs is named as action recognition [56][17]; recognizing verbs and objects is named as affordance recognition [66][59][13][9]; recognizing triplets is named as human-object-interaction recognition [35][63].
Task oriented object detection/segmentation, as an affordance understanding task, is very challenging and this study explores the noun-pronoun distillation framework to borrow rich knowledge from more visually grounded noun targets.
Knowledge Distillation.
This technique is proposed in the deep learning literature by Hinton et al. [22] to distill knowledge from large models to small models.
The insight is that soft logit targets generated by large models contain richer information that better serves as a supervision signal than hard one-hot labels.
Knowledge distillation has been extended to show effectiveness in other domains like continual learning [37] and object detection [8].
The survey of Guo et al.
[18] provides a comprehensive summary of knowledge distillation variants and applications.
Most related to our method is the privileged knowledge distillation methods in robotics research [7][32], in which the teacher model has access to privileged information that the student cannot access during inference.
Our noun-pronoun distillation method is tailored for the task oriented detection/segmentation problem which borrows rich knowledge from noun referring expression compression teacher models while still allowing the student model to be noun-agnostic.
Formulation
The problem is to detect and segment objects that are preferred to afford a specific task indicated by verb phrases, from an input image.
Yet clearly defining affordance and preference is actually challenging so we follow the existing annotation protocol of the COCO-Tasks dataset [55]:
Affordance.
Firstly, the target objects afford a specific task.
In an input image, it is possible that no objects or multiple objects afford the task.
And in the latter case, the objects may belong to multiple classes.
For example, in the right top panel of Fig.1, nothing affords the task sit comfortably on .
Instead, in the bottom panel, there are at least two sofas, a table and a chair that afford the task.
Preference.
Secondly, we need to find the best ones from the objects which afford the task.
In other words, the preference among multiple objects needs to be understood.
In Fig.1 bottom, the two sofas are obviously more suitable for the task sit comfortably on than other objects enumerated above.
Thus the ground truth objects for this task are the two sofas (covered in blue).
Now we formally define the task.
The input is an RGB image X v ∈ R 3 × H 0 × W 0 ( v represents visual ) and a piece of text X l ( l represents language ).
X l describes a specific task like sit comfortably on .
The targets are bounding boxes B gt =
[ b 1 , . . .
, b n gt ] ∈ [0 , 1] n gt × 4 and instance segmentation masks
M gt =
[ m 1 , . .
, m n gt ] ∈ R n gt × H
× W 0 of target objects O gt = ⟨ B gt , M gt ⟩ , where n gt ≥ 0 is the count of targets.
The four components of b i ∈ [0 , 1] 4 are normalized center coordinates, height and width of the i -th box.
An algorithm f that addresses this problem works as:
[Equation]
T r a n s f o r m e r
E n c od e r C NN
T e x t E n c od e r 2D Positional
Embedding
FF N FF N
Update
Cluster Center
C on ca t e n a t e
T r a n s f o r m e r
D ec od e r
T r a n s f o r m e r
E n c od e r
C NN
T e x t E n c od e r
FF N
FF N
C on ca t e n a t e
T r a n s f o r m e r
D ec od e r
[Figure] [Figure] [Figure]
[Figure] [Figure]
e
[Figure]
H
[Figure]
S e g m e n t H ea d Logit
[Figure]
where B pred and M pred are predicted boxes and masks, respectively.
S pred =
[ˆ s 1 , . .
, ˆ s n pred ] ∈ [0 , 1] n pred is the probability scores of the predicted objects being selected, which reflects preference.
We denote the predicted objects as O pred = ⟨ B pred , M pred , S pred ⟩ .
Method
We propose an end-to-end T ask O riented I nstance S egmentation T ransformer, abbreviated as TOIST (Section 4.1).
Leveraging pre-trained noun referring expression comprehension models, we further adopt a teacher-student framework for noun-pronoun distillation (Section 4.2).
4.1 Task Oriented Instance Segmentation Transformer
The SOTA method [55] uses a two-stage pipeline to solve the problem.
Taking a single image X v as input, it first detects the bounding boxes B pred of all objects with a Faster-RCNN [53].
Then it ranks B pred with a GNN [36], predicting the probabilities S pred of the objects being selected for a task.
Our method differs from it in three ways: (1) We address the task with a one-stage architecture, allowing joint representation learning for detection and preference modeling.
(2) We specify tasks using the text X l .
(3) We predict instance masks M pred along with bounding boxes.
We choose to build our method upon the transformer architecture [6], because the self-attention operators in the decoder can naturally model pair-wise relative preference between object candidates.
As shown in Fig.2 bottom, TOIST contains three main components: a multi-modal encoder (color brown) to extract tokenized features, a transformer encoder (color green) to aggregate features of two modalities and a transformer decoder (color blue) to predict the most suitable objects with attention.
Two Input Forms.
To find an object that affords the task of dig hole , the first step is to construct a task description input X l .
To achieve this goal, we can extend the task name with the ground truth object category to the verb-noun form like dig hole with skateboard or with a pronoun to the verb-pronoun form like dig hole with something .
While the former violates the noun-agnostic constraint during inference, it can be leveraged to improve the latter within the proposed noun-pronoun distillation framework, which will be detailed later.
For a plain TOIST, the verb-pronoun form is selected as task description X l , which is fed into the multi-modal encoder along with visual input X v .
Multi-Modal Encoder.
For X v , a pre-trained CNN-based backbone and a one-layer feed forward network (FFN) are leveraged to extract a low-resolution feature map F v ∈ R
d × H × W .
Flattening the spatial dimensions of F v into one dimension, we obtain a sequence of tokenized feature vectors
V =
[ v 1 , . .
. , v n v ] ∈ R n v × d (light blue squares ■ on the left of the transformer encoder in Fig.2), where n v = H × W .
To preserve the spatial information, 2D positional embeddings are added to
V .
For X l , we use a pre-trained text encoder and another FFN to produce corresponding feature vectors L =
[ l 1 , . . .
, l n l ] ∈ R n l × d (light orange squares ■ ), where n l is the total count of language tokens.
Among these n l features, we denotes the one corresponding to the pronoun (or noun) token as l pron (or l noun ) (dark orange squares ■ ).
We concatenate these vectors and obtain the final feature sequence [ V , L ] =
[ v 1 , . . .
, v n v , l 1 , . . .
, l n l ] ∈ R ( n v + n l ) × d .
Transformer Encoder.
The transformer encoder consists of n tr sequential blocks of multi-head self-attention layers.
Given the sequence of features [ V , L ] , it outputs processed feature sequence [ V tr , L tr ] =
[ v tr1 , . .
. , v tr n v , l tr1 , . . . , l tr n l ] ∈ R ( n v + n l ) × d .
The pronoun (or noun) feature l pron (or l noun ) is encoded into l trpron (or l trnoun ), which will be used for noun-pronoun distillation (Section 4.2).
Here for the plain TOIST, we directly use the features [ V tr , L tr ] for later processing.
Transformer Decoder.
The transformer decoder consists of n tr blocks of self-attention and crossattention layers.
It takes as input a set of learnable parameters serving as an object query sequence
Q =
[ q 1 , . . .
, q n pred ] ∈ R n pred × d .
[ V tr , L tr ] are used as keys and values for cross-attention layers.
The outputs of the transformer decoder are feature vectors Q tr = [ q tr1 , . . .
, q tr n pred ] ∈ R n pred × d , which are projected to final results by three prediction heads.
Specifically, the detect head predicts bounding boxes B pred and the segment head outputs binary segmentation masks M pred .
The logit head outputs logits G pred =
[ˆ g 1 , . . .
, ˆ g n pred ] ∈ R n pred × n max , where ˆ g i =
[ˆ g i 1 , . . .
, ˆ g in max ] .
[ˆ g i 1 , . . .
, ˆ g in l ] corresponds to text tokens L =
[ l 1 , . . .
, l n l ] ∈ R n l × d .
[ˆ g in l +1 , . . .
, ˆ g in max − 1 ] is used to pad ˆ g i to length n max (by default n max =256) and the last one ˆ g in max stands for the logit of "no-object".
With the output logits, we define the preference score ˆ s i ∈ S pred of each predicted object as:
[Equation]
During training, as in DETR [6], a bipartite matching is computed between n pred predicted objects
O pred and ground truth objects O gt with the Hungarian algorithm [29].
The matched object predictions are supervised with L1 loss and Generalized Intersection over Union (GIoU) loss [54] for localization while Dice/F-1 loss [47] and Focal cross-entropy loss [39] for segmentation.
We also adopt the soft-token prediction loss and the contrastive alignment loss used in MDETR [26].
But different from them, we do not use a single noun or pronoun as the ground truth token span for a matched object prediction.
Instead, we use the whole verb-pronoun description as token span such that the network can understand the verbs rather than noun/pronoun only.
The total loss for TOIST is:
[Equation]
where λ 1 ~ λ 6 are the weights of losses.
4.2 Noun-Pronoun Distillation
[Table]
Motivation.
As mentioned above, there are two possible input forms.
Due to the privileged information of target names (nouns), TOIST using verb-noun input out-performs its counterpart by +11.8% and +12.0% on mAP box and mAP mask , as demonstrated in Table.
We use two preliminary experiments as a motivation: directly replacing the pronoun feature l pron or l tr pron in the verb-pronoun model with the corresponding noun feature l noun or l trnoun in the verb-noun model can boost performance (see Table 1).
However, during inference, the noun of the ground truth object is unavailable.
Thus we believe a properly designed noun-pronoun distillation framework can leverage rich knowledge from the verb-noun model without violating the noun-agnostic constraint.
Distillation Framework Overview.
Two TOIST models are trained simultaneously.
The teacher (Fig.2 top) and the student (Fig.2 bottom) take as input verb-noun and verb-pronoun descriptions, respectively.
A clustering distillation method with a memory bank and a tailored cluster loss is used to distill privileged object-centric knowledge from noun to pronoun (Fig.2 middle left).
Besides, we also use a soft binary target loss imposed on G pred to distill preference knowledge (Fig.2 middle right), in which G pred are logits used to calculate preference scores S pred .
Clustering Distillation.
Since one task can be afforded by objects of many different categories, we build a text feature memory bank to store noun features, with which a prototype can be selected and used to replace pronoun feature and distill knowledge.
We term this process as clustering distillation.
Specifically, we use l trpron and l trnoun instead of l pron and l noun for this process.
The reason is that the former ones are conditioned on the image input and verb tokens of the task by self-attention layers, and thus it is meaningful to select a cluster center that suits the image and the task input.
Memory and Selector.
The size of the memory bank is n task × n mem × d .
It consists of n task queues of length n mem for n task tasks.
During training, for each sample from task j , we update the j -th queue L j mem =
[ l j 1 , . . .
, l jn mem ] by adding the noun feature l trnoun generated by the teacher model and removing the existing one closest to l trnoun .
The updated queue is clustered with the
K-means clustering method, leading to K cluster centers L j c = { l jc 1 , . .
, l jc K } .
Then the student model uses a cluster selector, which is implemented as the nearest neighbor classifier, to select a prototype l jc
s ∈
L j c according to the pronoun feature l trpron and replace l trpron with l jc s .
Concatenating other tokens and the selected prototype together, the output of student transformer encoder [ v tr s 1 , . .
. , v tr s n , l tr s 1 , . . . , l trpron , . . .
, l tr s nl ] is modified into [ v tr s 1 , . . .
, v tr s n , l tr s 1 , . . .
, l jc s , . . .
, l tr s nl ] and fed into the transformer decoder.
To distill knowledge to the student transformer encoder, we define cluster loss as:
[Equation]
4) with which the privileged object-centric knowledge is distilled from clustered noun features to pronoun feature and further to the student TOIST encoder.
Preference Distillation.
We use a soft binary target loss to distill preference knowledge from teacher to student.
For an object query, we first define binary query probabilities of being positive-query or negative-query, which denotes whether or not the query is matched to a ground truth object target, as p =
[ p pos , p neg ] ∈ R 1 × 2 .
The probabilities can be calculated by the softmax function:
[Equation]
where ˆ g j and ˆ g n max represent the logits corresponding to i -th text token and "no-object" token, respectively.
For all the object queries in teacher and student, the probability sequences are denoted by P t =
[ p t 1 , . .
p t n pred ] and P s =
[ p s 1 , . .
. , p s n pred ] .
Then we use the Hungarian algorithm to find a bipartite matching between the two sequences of object queries with P t and P s .
Formally, we search for a permutation of n pred elements σ ∈ S n pred which minimizes the matching loss:
[Equation]
where y t i =
(ˆ b t i p t i ) and ˆ b t i is the predicted bounding box.
L match is a linear combination of box prediction losses (L1 & GIoU) and KL-Divergence.
The KL-Divergence L KL can be written as:
[Equation]
With the optimal permutation ˆ σ , we define the soft binary target loss as:
[Equation]
It makes the binary query probabilities of the student model similar to the matched ones of the teacher model.
And because the preference score ˆ s (Eq.2) is defined in the same way as the probability p pos (Eq.5), the preference knowledge is distilled from teacher to student as the loss decreases. [Table]
Summary.
The final training loss function for TOIST with noun-pronoun distillation is:
[Equation]
where λ 7 and λ 8 are the weights of losses.
L t TOIST and L s TOIST are separate TOIST loss terms defined by Eq.3 for teacher and student, respectively.
Note that the cluster loss L s cluster and the soft binary target loss L s binary are only used for supervising the student model.
As a reminder, during inference, we only use the student TOIST model and the fixed memory bank to find the most suitable objects, without violating the noun-agnostic constraint.
Experiments
Dataset.
We conduct experiments on the COCO-Tasks dataset [55] which re-annotates the COCO dataset [40] with preference-aware affordance labels.
This is the only dataset that involves instancelevel preference in affordance.
Though there are other datasets for affordance detection, they neither distinguish between instances nor involve preference, such as ADE-Affordance [12] and IIT-AFF [49].
The COCO-Tasks dataset contains 14 tasks.
For each task, there are 3600 train images andtest images.
In each image, the boxes of preferred objects (one or more) are taken as ground truth labels for detection.
Using existing COCO masks, we extend the dataset to an instance segmentation version.
In Appendix B and D, we present more dataset details and show its diversity.
Metric.
We use the AP@0.5 metric for both detection and segmentation, where predicted preference scores S pred are used to rank objects.
Averaging the AP@0.5 values of all tasks leads to mAP@0.5.
The implementation details for TOIST and distillation can be found in Appendix A.
5.1 Comparisons with State-of-the-art Methods
Table 2 shows that TOIST with noun-pronoun distillation achieves state-of-the-art results compared to existing methods on COCO-Tasks.
For object detection, we use the results reported by [55] as baselines.
For instance segmentation, following the same experiment settings of [55], we build new baselines using Mask-RCNN [20].
The methods in the first row treat the problem as a standard detection or segmentation task.
All other baselines use two-stage pipelines, in which objects are firstly detected or segmented then ranked.
The proposed one-stage method achieves 41.3% mAP box and 35.2% mAP mask , which are +8.1% and +2.8% better than the previous best results ( Yolo+GGNN and Mask-RCNN+GGNN ).
Noun-pronoun distillation further boosts the performance of TOIST to 44.1% (+10.9%) mAP box and 39.0% (+6.6%) mAP mask . Our method also out-performs another baseline with the same backbone, as shown in Table 9 of Appendix C.
These results demonstrate the [Figure] effectiveness of the proposed method for the new problem of task oriented instance segmentation. Per-task quantitative results and precision-recall curves are provided in Appendix C and D.
5.2 Preference Modeling with Self-Attention
Protocol.
Our design principle is that the self-attention layers in transformers can naturally model preference.
But is this really the case?
Fig.3 (a) shows its effect.
Two plain TOIST models are trained separately, with the only difference being that one model does not contain self-attention operators in the decoder.
Note that the removal of self-attention does not impact the number of parameters.
The mAP metric is impacted by two kinds of errors: inaccurate box/mask localization or improper preference.
To analyze the preference scores alone, for all object queries, we use the boxes and masks predicted by the last block of TOIST decoder, which are arguably the most accurate.
We use the corresponding preference scores predicted by each block to calculate mAP values.
Interpretation.
For the TOIST with self-attention, the performance is gradually boosted as the source of preference scores becomes deeper: from 29.6% mAP box and 25.0% mAP mask to 41.3% and 35.2%.
For the one without self-attention, the preference scores from the first block lead to the best performance: 33.9% mAP box and 28.7% mAP mask , which is -7.5% and -6.5% lower than another
TOIST.
The results demonstrate that the self-attention in TOIST decoder models pair-wise relative preference between object candidates.
As the decoder deepens, the preference relationship between object candidates is gradually extracted by self-attention.
5.3 Effect of Clustering Distillation
CCR, CL and SBTL are short for cluster center replacement, cluster loss and soft binary target loss, respectively.
[Table]
In Table 3, we show the effects of using cluster loss and replacing pronoun features with cluster centers (noun prototypes).
In (c) and (e), leveraging the two components alone brings an increase of +0.7% mAP box ,
+1.9% mAP mask and +0.7% mAP box , +1.8% mAP mask over baseline (a) respectively.
In (g), the complete clustering distillation leads to a performance improvement of +1.0% mAP box and +2.3% mAP mask .
These results show that the clustering distillation method can improve student TOIST and enhance verb referring expression understanding.
In Fig.4, we visualize the predicted results (filtered by a preference threshold of 0.9) and the attention maps of pronoun tokens.
In the first row, when there is no clustering distillation, TOIST wrongly prefers the flower to the cup, which is also confirmed by the attention map.
But the TOIST with clustering distillation correctly selects the cup, and the attention on the flower is weakened.
This shows that clustering distillation makes student TOIST have the ability to reduce the ambiguity of verb-pronoun referring expression.
In the second row, the bounding box of the knife is correctly detected by both two models.
However, in the absence of the distillation, extra instance masks are predicted on the spoon and fork within the box.
Instead, with the distillation, the masks predicted by TOIST are concentrated on the knife and the attention is more focused on it.
This demonstrates that in the case of clustering distillation, TOIST can better ground the task into pixels within an object box.
Meanwhile, the fact that predicted masks may be inaccurate even if the box is correct makes it challenging for a robot to accurately grasp the preferred object when performing a specific task.
This proves the importance of extending task oriented object detection to instance segmentation. [Figure]
5.4 Effect
of Preference Distillation
[Figure]
In Table 3 (b), preference distillation with soft binary target loss achieves +2.1% mAP box and +2.8% mAP mask higher results than baseline (a).
This loss acts on the preference probabilities of each object candidate in student TOIST.
And the probabilities are used as scores to sort the object candidates for the calculation of mAP values.
Therefore, the result of Table 3 (b) strongly supports that the preference information is distilled to the student TOIST.
A simple taxonomy differs three scenarios where preference distillation works.
As shown in Fig.5, the predicted results (filtered by a preference threshold of 0.9) of the TOIST models w/ or w/o preference distillation are compared.
(1) Preference distillation makes the preference score of the false positive object (the baseball in the left picture) lower than the threshold.
The preference score of the false negative object (the spoon in the middle) is raised above the threshold with the distillation.
(3) When there is no distillation, the false positive object (fork) scores higher than the true positive object (knife) ( 0 . 9822 > 0 . 9808 ).
Although the distillation fails to lower the preference score of the false positive object below the threshold, its score is updated to be lower than the true positive one ( 0 . 9495 < 0 . 9680 ).
These specific results demonstrate that the information of noun referring expression is distilled to the noun-agnostic student model in the form of preference scores.
5.5 Ablation Study and Qualitative Results
Distillation Methods.
Instead of minimizing the distance between l trpron and l jc s , a straightforward way is to directly minimize the distance between l trpron and l trnoun .
As shown in Table 4, this simplified method does not work well, which prompts us to elaborate the distillation framework.
[Table] [Table] Interaction of the Two Distillation Components.
In Table 3 (d) and (f) [Table] we show the effects of cluster loss or cluster center replacement together with soft binary target loss.
(d) achieves +2.5% mAP box and +3.4% mAP mask improvement, which demonstrates the two distillation losses collaborate well. (f) only achieves +1.0% mAP box and +2.1% mAP mask improvement, slightly higher than (e) (using cluster loss only) but lower than (b) (using soft binary target loss only).
This shows that preference distillation effectively improves object preference modeling.
But solely replacing pronoun features to indicate target objects weakens the effect of preference distillation.
[Table]
Ablations for Cluster Number K .
Fig.3 (b) shows the ablations for cluster number K .
We perform distillation experiments on different K values between 1 to 10 because increasing K to an even higher value makes the clustering task more difficult.
All of the experiments yield better results than the plain TOIST (41.3% mAP box , 35.2% mAP mask ) and K =works the best.
This demonstrates that a modest K can better cluster the information of noun features and distill it to the student TOIST.
Ablations for Pronoun Input.
Table 6 shows the results of TOIST with different pronoun input.
In the plain TOIST and TOIST with distillation, the usage of something , it or them leads to similar results, [Table] while a meaningless string abcd yields less improvement.
Nevertheless, the proposed distillation framework can still work well in the last case, which demonstrates the robustness of our method. Results without Pre-training.
In our architecture, the pre-trained noun referring expression comprehension models are leveraged.
To investigate whether the noun-pronoun distillation framework is a standalone technical contribution, we conduct experiments without using pre-trained models. The models are trained from scratch on the COCO-Tasks dataset and the results are shown in Table 5, which demonstrate that the proposed distillation can still work well even without pre-training. Ablations for Task Number. Table 7 shows the ablation study of different task numbers, in which the first row corresponds to the plain TOIST without distillation and the others show the results with distillation under different n task .
The results demonstrate our proposed distillation works for different n task ,
even if n task = 1.
And overall, smaller n task leads to better performance.
We attribute this to the reduced problem complexity due to the less interaction between different tasks, which makes it easier to improve the ability of the model to understand verbs through noun-pronoun distillation.
Qualitative Results. Fig.6 shows more qualitative results.
In (a), two toilets are taken as target objects and annotated partially or totally.
But TOIST simultaneously predicts the two kinds of results for each toilet.
In (b), no object is annotated, while TOIST keenly detects two water bottles that afford the task.
In (c), TOIST predicts more accurate mask result than ground truth.
In (d), the table is selected and interestingly it does afford the task as the table edge can be used to open beer bottles. More qualitative results can be found in Appendix E.
[Figure]  Conclusion and Discussion
We explore the problem of task oriented instance segmentation and propose a transformer-based method named as TOIST with a novel noun-pronoun distillation framework.
Experiments show our method successfully models affordance and preference, achieving SOTA results on the COCO-Tasks dataset.
Limitations.
Due to the lack of large-scale datasets with more abundant tasks, TOIST is only evaluated on limited tasks.
While this is sufficient for many robotics applications, it would be interesting to explore general verb reference understanding on more tasks.
Potential Negative Social
Impact.
Because TOIST is not perfect, when it is used in robotics applications, robots may have difficulty in selecting the most suitable object to carry out a task or even cause damage.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] See Section(c)
Did you discuss any potential negative societal impacts of your work?
[Yes] See Section(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] See https://github.com/AIR-DISCOVER/TOIST .
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Appendix A and B. (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] See Appendix C. (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] See Appendix A.3.
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?
[Yes] (b) Did you mention the license of the assets?
[Yes] (a) MIT License for the COCOTasks dataset.
(b) Creative Commons Attribution 4.0 License for the Microsoft COCO dataset.
(c) Apache License 2.0 for MDETR, DETR and Mask-RCNN implemented by Detectron2.
(c) Did you include any new assets either in the supplemental material or as a URL?
[Yes] See Appendix F. (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating?
[Yes] See Appendix F. (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[Yes] See Appendix F. 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 spent on participant compensation?
[N/A]
Noun Features. As mentioned in Section 3, in an input image, it is possible that no objects or multiple objects afford a specific task.
And in the latter case, the objects may belong to multiple classes. But for the language input X l of verb-noun form, the noun corresponds to the ground truth object categories.
Therefore, when the count of targets n gt = 0 , we use an empty string to construct X l . When n gt > 0 and all target objects belong to the same category, we take a phrase like sit comfortably on sofa as X l . When n gt > 0 and the target objects belong to multiple classes, the language input X l is set to the concatenation of multiple phrasal verbs, such as sit comfortably on chair sit comfortably on bed .
We only update the proposed memory bank in the latter two cases.
In these cases, if a noun is encoded into multiple tokenized features by the text encoder, we use the mean value of the features processed by the transformer encoder as l trnoun for updating. In the last case, we take the average of multiple noun features l tr noun − 1 , . . . , l trnoun − n c as the final l trnoun , where n c is the count of classes. In this way, the privileged knowledge of multiple nouns is more easily distilled into the single pronoun feature of the student model when an image contains multiple classes of objects equally suitable for a task.
Components of TOIST.
RoBERTa-base [42] and ResNet-101 [21] are used as the text encoder and the CNN-based backbone (the image encoder).
For the logit head and the detect head, two feed forward networks of depth one and three are leveraged, respectively.
For the segment head, following the network design of [6], a multi-head attention operator and a FPN [38]-like convolutional neural network are used.
After each block in the transformer decoder, TOIST generates auxiliary outputs [1] with the prediction heads.
A.2 Loss Functions
We present the loss terms used for the plain TOIST training in details.
For the ground truth objects O gt of each training sample, we define p span i =
[Equation]
span i, 1 , . .
. , p span i,n max ] ∈ [0 , 1] n max as a uniform distribution over the span positions of the text tokens corresponding to the i -th ground truth object.
p span i,n max stands for the probability of "no-object", which is 0 for the ground truth objects.
As a reminder, we use the whole verb-pronoun (or verb-noun) description as token span.
Assuming that n gt (the count of O gt ) is smaller that n pred (the count of the predicted objects O pred ), we pad O gt with ∅ ("no-object") to be of size n pred , denoted as O ′ gt .
For ∅ , p span i is assigned to be p span i,j = 1 { j = n max } : if j = n max , p span i,j = 1 ; otherwise, p span i,j = 0 .
We denote the bipartite matching between O ′ gt and O pred as ˆ σ 0 , which is calculated by minimizing the matching loss with the Hungarian algorithm [6]:
[Equation]
Here, S n pred is the set of all permutations of n pred elements.
b i and ˆ b σ 0 ( i ) are the ground truth box and the predicted box, respectively.
ˆ g σ 0 ( i ) is the predicted logit, as detailed in the main paper.
The loss terms are defined as follows:
[Equation]
L giou is the Generalized Intersection over Union (GIoU) loss [54].
| · | calculates the size of an area.
B ( b i , ˆ b σ 0 ( i ) ) stands for the smallest box containing b i and ˆ b σ 0 ( i ) .
The calculation of L giou is implemented by linear functions, so it is differentiable and can be used for back propagation.
For segmentation, Dice/F-1 loss [47] L dice and Focal cross-entropy loss [39] L cross are leveraged:
[Equation]
Here, m i is the ground truth instance mask of the i -th object.
ˆ m σ 0 ( i ) is the corresponding predicted mask logits.
δ is the sigmoid function.
[Equation]
where
[Equation]
α and γ are hyper-parameters.
The soft-token prediction loss L token is defined as:
[Equation]
[Equation]
The contrastive alignment loss is used to align the embedded features of the predicted objects and the corresponding text tokens.
The embedded features are obtained by projecting the processed text features of the transformer encoder and the output features of transformer decoder to the same smaller dimension.
We follow the definition of [26]:
[Equation]
T + i is the set of token features that a predicted object feature o i should be aligned to.
O
+ i is the set of object features to be aligned with a token feature t i .
Here the predicted objects matched to ∅ are not included. τ is a hyper-parameter. Finally, the total loss for the plain TOIST can be written as: [Equation]
ˆ
[Equation]
[Equation]
A.3 Hyper-parameters and Training Details
For the proposed architecture, we set d = 256 , n max = 256 , n tr = 6 , n pred = 100 , n mem =and K = 3 .
For the loss functions, we set λ 1 = 5 , λ 2 = 2 , λ 3 = 1 , λ 4 = 1 , λ 5 = 1 , λ 6 = 1 , λ 7 = 10 4 , λ 8 = 50 , α = 0 .
25 , γ = 2 and τ = 0 .
During training, we augment input images with random resize and random crop.
Specifically, each image is resized such that the shortest side is between 480 and 800 pixels and the longest side is less than 1333 pixels.
With probability 0.5, an image is cropped to a random size, where each side is between 384 and 1333 pixels.
We implement TOIST with PyTorch [50].
Both of the student and teacher TOIST models are initialized with the model pre-trained by [26].
We fine-tune the two models on the COCO-Tasks dataset separately for 30 epochs.
Then we use the fine-tuned teacher model to distill knowledge to the student model for 15 epochs.
We train the models with an AdamW optimizer.
The initial learning rates are set to 10 − 5 , 10 − 5 , 5 × 10 − 5 for text encoder, backbone and transformer, respectively.
The weight decay is 10 − 4 .
Our experiments were preformed on 8 NVIDIA A100 GPUs.
[Table]
replacing the closest one
[Table]
[Table]
B Dataset Details
We perform experiments on the COCO-Tasks dataset [55] which re-annotates the COCO dataset [40] with preference-aware affordance labels. The COCO-Tasks dataset contains 14 tasks. For each task, there are 3600 train images and 900 test images. We train the proposed architecture on all the train images and evaluate it on all the test images.
In an image, the most suitable objects (one or more) for solving the task are selected and their bounding boxes are taken as ground truth labels for detection.
The number of selected objects in an image varies from zero to a dozen.
For each task, the total number of selected objects varies between 1,105 and 9,870 and the number of different object categories varies between 6 and 30.
Totally, the COCO-Tasks dataset contains 65797 selected objects spanning 49 of the 80 COCO object class categories.
This shows the diversity of the dataset.
For each task, the total count of all instances belonging to the selected categories largely varies between 7,172 and 34,160.
This shows the task oriented object detection problem on this dataset is a non-trivial problem and solving it with traditional methods is very challenging.
The preference between multiple classes and multiple instances of the same class must be taken into account.
The COCO-Tasks dataset is annotated with the available COCO detection boxes.
Leveraging the corresponding COCO segmentation masks directly gives the upgraded instance segmentation version.
We evaluate our proposed method on the upgraded dataset.
C Quantitative results
Strategies for Updating Memory Bank.
To update the text feature memory bank in noun-pronoun distillation, two strategies are compared: (1) First-in-first-out.
(2) Replacing the feature closest to the new-coming l trnoun .
As shown in Table 8, the second strategy leads to better performance.
Comparison to the Baseline with the Same Backbone.
To investigate whether our TOIST architecture is a standalone technical contribution by marginalizing the benefits brought by pre-trained models, we present another baseline ’MDETR+GGNN’.
Specially, to leverage the knowledge in noun referring expression comprehension, we use the official pre-trained model of MDETR [26] and then fine-tune it on the COCO-Task dataset.
We use the class names of the ground truth objects in each image as the text input to detect these objects.
Then we use the GGNN model [55] to infer which objects are preferred for a task.
The results are shown in Table 9.
Note that this baseline is also tested with privileged noun ground truth, but our distillation method only use the privileged knowledge during training.
Nevertheless, our proposed method still has a significant performance improvement over this strong baseline (+7.3% mAP box and +8.7% mAP mask ).
This demonstrates that our TOIST architecture is a standalone technical contribution towards task oriented instance segmentation and pretraining is necessary but insufficient to get the performance level of TOIST.
[Table]
Ablations for Loss Terms.
To demonstrate the effectiveness of the used loss terms
[Table]
we provide ablation studies in which we remove L align or L token or both.
The quantitative results are demonstrated in Table 10.
It shows that removing L token brings a performance drop of -1.2% mAP box and -0.4% mAP mask , because the association between the matched object predictions and the task descriptions is weakened.
Removing L align brings a performance drop of -0.2% mAP box and -0.1% mAP mask , because the features of an object and its corresponding text features cannot be explicitly constrained to be closer.
Interestingly, removing both of them brings a significant performance drop of -17.9% mAP box and -14.5% mAP mask , implying the two loss terms enhance the effect of each other to make TOIST understand verb reference better.
[Table]
[Table]
Replicates.
In Table 11 and 12, we show the mean and standard deviation of the results obtained by running experiments three times under different random seeds.
Per-task Results. In Table 13 and [Table]
we provide per-task results of the proposed method and existing state-of-the-art baselines on the COCO-Tasks dataset.
The results show that our TOIST model with noun-pronoun distillation achieves the best performance in most tasks.
[Table]
[Table]
D More Analysis
In Fig.
[Table]
we present the percentage of ground truth object categories, in each task.
The figures show that the distribution of object categories in each task in the COCO-Tasks dataset is very diverse.
In
Fig.8, we present the percentage of the images that contain at least one ground truth object or contain no object in each task.
These figures show that many of the images do not contain objects that are suitable for the tasks. All these statistical results demonstrate that it is non-trivial to find the objects with affordance and preference for a specific task in a given image. We present the precision-recall curves of our detection and segmentation results on all the test data or the test data that contain at least one ground truth object (termed nonempty data) in Fig.9-12. It can be seen that the curves of the results with noun input are generally higher than those with pronoun input.
The proposed noun-pronoun distillation makes the curves of the results with pronoun input closer to those with noun input, which demonstrates the effectiveness of the distillation method.
Meanwhile, on the nonempty data, the noun-pronoun distillation only marginally improves TOIST, indicating that the method makes TOIST more capable of filtering out objects that do not afford the tasks in the empty data.
We further present the precision-recall curves of our results on the test data that contain objects of specified classes in each task.
The results show that the distillation method has different performance on different categories.
For example, in the task step on something , it works for the data containing chair but does not work for those containing dining table or couch (see the first row of Fig.13).
However, in the task place flowers and get potatoes out of fire , the proposed distillation method works for almost every category (see the fifth row to the twelfth row of Fig.13).
Combined with the statistics of category proportion in Fig.7, we think one possible reason is that the effect of the distillation on different categories is influenced by the proportion of categories in the tasks.
When a few classes take a large portion of selected objects in a certain task, the effect of the distillation on these classes is good, while that on others is poor.
If the number of categories in the whole task is distributed more evenly, the distillation can boost performance for most categories.
E More Qualitative results
We present more qualitative results in Fig.15.
For each task, we select four diverse scenes for visualization.
These results show that our method is robust to complex scenes of different tasks.
F Used and Released Asserts
The license of the assets we used is as follows: (a) MIT License for the COCO-Tasks dataset.
(b)
Creative Commons Attribution 4.0 License for the Microsoft COCO dataset.
(c) Apache License 2. for MDETR, DETR and Mask-RCNN implemented by Detectron2.
All existing codes and dataset we used are open-source and allowed for research.
To avoid the disclosure of personally identifiable information and the presentation of the content that might be considered offensive, we have blurred out some of the figures in this paper.
Our code is released under the MIT license.
[Figure]
step on sit comfortably on place flowers get potatoes out of fire Input Prediction Ground Truth
Input
Prediction
Ground Truth open parcel serve wine pour
[Figure]
smear
[Figure]
Input
Prediction
[Figure]
Input
Prediction
[Figure]
extinguish fire pound carpet
Input
Prediction
Ground Truth
Input
Prediction
Ground Truth