Deep learning algorithms usually require a large amount of annotated data to achieve superior performance. To acquire enough annotated data, one common way is by collecting abundant samples from the real world and paying annotators to generate ground-truth labels. However, even if all the data samples are well annotated based on our requirements, we still face the problem of few-shot learning. Because long-tail distribution is an inherent characteristic of the real world, there always exist some rare cases that have just a few samples available, such as rare animals, uncommon road conditions. In other words, we are unable to alleviate the situation of scarce cases by simply spending more money on annotation even big data is accessible. Therefore, the study of few-shot learning is an imperative and long-lasting task.
Recently, efforts have been put into the study of few-shot object detection (FSOD) [lstd, repmet, fsod-mc, yolo-fewshot, meta-rcnn, metadet, attention-rpn, context-transformer, tfa, mpsr, fsdetview]. In FSOD, there are base classes in which sufficient objects are annotated with bounding boxes and novel classes in which very few labeled objects are available. The novel class set does not share common classes with the base class set. The few-shot detectors are expected to learn from limited data in novel classes with the aid of abundant data in base classes and to be able to detect all novel objects in a held-out testing set. To achieve this, most recent few-shot detection methods adopt the ideas from meta-learning and metric learning for few-shot recognition and apply them to conventional detection frameworks, e.g. Faster R-CNN [faster-rcnn], YOLO [yolov2].
Although recent FSOD methods have improved the baseline considerably, data scarcity is still a bottleneck that hurts the detector’s generalization from a few samples. In other words, the performance is very sensitive to the number of both explicit and implicit shots and drops drastically as data becomes limited. The explicit shots refer to the available labeled objects from the novel classes. For example, the 1-shot performance of some FSOD methods is less than half of the 5-shot or 10-shot performance, as shown in Figure 1. In terms of implicit shots, initializing the backbone network with a model pretrained on a large-scale image classification dataset is a common practice for training an object detector. However, the classification dataset contains many implicit shots of object classes overlapped with the novel classes. So the detector can have early access to novel classes and encode their knowledge in the parameters of the backbone. Removing those implicit shots from the pretrained dataset also has a negative impact on the performance as shown in Figure 1. The variation of explicit and implicit shots could potentially lead to system failure when dealing with extreme cases in the real world.
We believe the reason for shot sensitivity is due to exclusive dependence on the visual information. Novel objects are learned through images only and the learning is independent between classes. As a result, visual information becomes limited as image data becomes scarce. However, one thing remains constant regardless of the availability of visual information, i.e. the semantic relation between base and novel classes. For example in Figure 2, if we have the prior knowledge that the novel class “bicycle” looks similar to “motorbike”, can have interaction with “person”, and can carry a “bottle”, it would be easier to learn the concept “bicycle” than solely using a few images. Such explicit relation reasoning is even more crucial when visual information is hard to access [zsr-gnn].
So how can we introduce semantic relation to few-shot detection? In natural language processing, semantic concepts are represented by word embeddings[word2vec, glove] from language models, which have been used in zero-shot learning methods [zsr-gnn, zsod]. And explicit relationships are represented by knowledge graphs [wordnet, nell], which are adopted by some zero-shot or few-shot recognition algorithms [zsr-gnn, fsr-kt]. However, these techniques are rarely explored in the FSOD task. Also, directly applying them to few-shot detectors leads to non-trivial practical problems, i.e. the domain gap between vision and language, and the heuristic definition of knowledge graph for classes in FSOD datasets (see Section 3.2 and 3.3 for details).
In this work, we explore the semantic relation for FSOD. We propose a Semantic Relation Reasoning Few-Shot Detector (SRR-FSD), which learns novel objects from both the visual information and the semantic relation in an end-to-end style. Specifically, we construct a semantic space using the word embeddings. Guided by the word embeddings of the classes, the detector is trained to project the objects from the visual space to the semantic space and to align their image representations with the corresponding class embeddings. To address the aforementioned problems, we propose to learn a dynamic relation graph driven by the image data instead of pre-defining one based on heuristics. Then the learned graph is used to perform relation reasoning and augment the raw embeddings for reduced domain gap.
With the help of the semantic relation reasoning, our SRR-FSD demonstrates the shot-stable property in two aspects, see the red solid and dashed lines in Figure 1. In the common few-shot settings (solid lines), SRR-FSD achieves competitive performance at higher shots and significantly better performance at lower shots compared to state-of-the-art few-shot detectors. In a more realistic setting (dashed lines) where implicit shots of novel concepts are removed from the classification dataset for the pretrained model, SRR-FSD steadily maintains the performance while some previous methods have results degraded by a large margin due to the loss of implicit shots. We hope the proposed realistic setting can serve as a new benchmark protocol for future research. Additionally, SRR-FSD generalizes to novel classes without catastrophically forgetting the objects in the base classes, so the performance on the base set holds firmly.
We summarize our contributions as follows:
To our knowledge, our work is the first to investigate semantic relation reasoning for the few-shot detection task and show its potential to improve a strong baseline.
Our SRR-FSD achieves stable performance w.r.t the shot variation, outperforming state-of-the-art FSOD methods under several existing settings especially when the novel class data is extremely limited.
We propose a more realistic FSOD setting in which implicit shots of novel classes are removed from the classification dataset for the pretrained model, and show that our SRR-FSD can maintain a more steady performance compared to previous methods if using the new pretrained model.
2 Related Work
Object detection is a fundamental computer vision task, serving as a necessary step for various down-streaming instance-based understanding. Modern CNN-based detectors can be roughly divided into two categories. One is single-stage detector such as YOLO[yolov2], SSD [ssd], RetinaNet [retinanet], and FreeAnchor [freeanchor] which directly predict the class confidence scores and the bounding box coordinates over a dense grid. The other is multi-stage detector such as Faster R-CNN [faster-rcnn], R-FCN [r-fcn], FPN [fpn], Cascade R-CNN [cascade-rcnn], and Libra R-CNN [libra-rcnn]
which predict class-agnostic regions of interest and refine those region proposals for one or multiple times. All these methods rely on pre-defined anchor boxes to have an initial estimation of the size and aspect ratio of the objects. Recently, anchor-free detectors eliminate the performance-sensitive hyperparameters for the anchor design. Some of them detect the key points of bounding boxes[cornernet, extremenet, centernet]. Some of them encode and decode the bounding boxes as anchor points and point-to-boundary distances [guidedanchor, fsaf, fcos, rpdet, sapd]. DETR [detr] reformulates object detection as a direct set prediction problem and solve it with transformers. However, these detectors are trained with full supervision where each class has abundant annotated object instances.
Few-Shot Detection Recently, there have been works focusing on solving the detection problem in the limited data scenario. LSTD [lstd] proposes the transfer knowledge regularization and background depression regularization to promote the knowledge transfer from the source domain to the target domain. [fsod-mc] proposes to iterate between model training and high-confidence sample selection. RepMet [repmet]
adopts a distance metric learning classifier into the RoI classification head. FSRW[yolo-fewshot] and Meta R-CNN [meta-rcnn]
predict per-class attentive vectors to reweight the feature maps of the corresponding classes. MetaDet[metadet] leverages meta-level knowledge about model parameter generation for category-specific components of novel classes. In [attention-rpn], the similarity between the few shot support set and query set is explored to detect novel objects. Context-Transformer [context-transformer] relies on discriminative context clues to reduce object confusion. TFA [tfa] only fine-tunes the last few layers of the detector. Two very recent papers are MPSR [mpsr] and FSDetView [fsdetview]. MPSR develops an auxiliary branch to generate multi-scale positive samples as object pyramids and to refine the prediction at various scales. FSDetView proposes a joint feature embedding module to share the feature from base classes. However, all these methods depend purely on visual information and suffer from shot variation.
Semantic Reasoning in Vision Tasks Semantic word embeddings have been used in zero-shot learning tasks to learn a mapping from the visual feature space to the semantic space, such as zero-shot recognition [zsr-gnn] and zero-shot object detection [zsod, polarity]. In [chen_etal], semantic embeddings are used as the ground-truth of the encoder TriNet to guide the feature augmentation. In [lu_etal], semantic embeddings guide the feature synthesis for unseen classes by perturbing the seen feature with the projected difference between a seen class embedding and a unseen class embedding. In zero-shot or few-shot recognition [zsr-gnn, fsr-kt], word embeddings are often combined with knowledge graphs to perform relation reasoning via the graph convolution operation [gcn]. Knowledge graphs are usually defined based on heuristics from databases of common sense knowledge rules [wordnet, nell]. [multi-label-gcn] proposed a knowledge graph based on object co-occurrence for the multi-label recognition task. To our knowledge, the use of word embeddings and knowledge graphs are rarely explored in the FSOD task. Any-Shot Detector (ASD) [anyshot] is the only work that uses word embeddings for the FSOD task. But ASD focuses more on the zero-shot detection and it does not consider the explicit relation reasoning between classes because each word embedding is treated independently.
3 Semantic Relation Reasoning Few-Shot Detector
In this section, we first briefly introduce the preliminaries for few-shot object detection including the problem setup and the general training pipelines. Then based on Faster R-CNN [faster-rcnn], we build our SRR-FSD by integrating semantic relation with the visual information and allowing it to perform relation reasoning in the semantic space. We also discuss the problems of trivially using the raw word embeddings and the predefined knowledge graphs. Finally, we introduce the two-phase training processes. An overview of our SRR-FSD is illustrated in Figure 3.
3.1 FSOD Preliminaries
Conventional object detection problem has a base class set in which there are many instances, and a base dataset with abundant images. consists of a set of annotated images where is the image and is the annotation of labels from and bounding boxes for objects in . For few-shot object detection (FSOD) problem, in addition to and it also has a novel class set and a novel dataset , with . In , objects have labels belong to and the number of objects for each class is for -shot detection. A few-shot detector is expected to learn from and to quickly generalize to with a small such that it can detect all objects in a held-out testing set with object classes in . All classes in have semantically meaningful names.
A typical few-shot detector has two training phases. The first one is the base training phase where the detector is trained on similarly to conventional object detectors. Then in the second phase, it is further fine-tuned on the union of and . To avoid the dominance of objects from , a small subset is sampled from such that the training set is balanced concerning the number of objects per class. As the total number of classes is increased by the size of in the second phase, more class-specific parameters are inserted in the detector and trained to be responsible for the detection of novel objects. The class-specific parameters are usually in the box classification and localization layers at the very end of the network.
3.2 Semantic Space Projection
Our few-shot detector is built on top of Faster R-CNN [faster-rcnn], a popular two-stage general object detector. In the second-stage of Faster R-CNN, a feature vector is extracted for each region proposal and forwarded to a classification subnet and a regression subnet. In the classification subnet, the feature vector is transformed into a -dimentional vector through fully-connected layers. Then is multiplied by a learnable weight matrix
to output a probability distribution as in Eq. (1).
where is the number of classes and
is a learnable bias vector. Cross-entropy loss is used during training.
To learn objects from both the visual information and the semantic relation, we first construct a semantic space and project the visual feature into this semantic space. Specifically, we represent the semantic space using a set of -dimensional word embeddings [word2vec] corresponding to the object classes (including the background class). And the detector is trained to learn a linear projection in the classification subnet (see Figure 3) such that
is expected to align with its class’s word embedding after projection. Mathematically, the prediction of the probability distribution turns into Eq. (2) from Eq. (1).
During training, is fixed and the learnable variable is . A benefit is that generalization to novel objects involves no new parameters in . We can simply expand with embeddings of novel classes. We still keep the to model the category imbalance in the detection dataset.
Domain gap between vision and language. encodes the knowledge of semantic concepts from natural language. While it is applicable in zero-shot learning, it will introduce the bias of the domain gap between vision and language to the FSOD task. Because unlike zero-shot learning where unseen classes have no support from images, the few-shot detector can rely on both the images and the embeddings to learn the concept of novel objects. When there are very few images to rely on, the knowledge from embeddings can guide the detector towards a decent solution. But when more images are available, the knowledge from embeddings may be misleading due to the domain gap, resulting in a suboptimal solution. Therefore, we need to augment the semantic embeddings to reduce the domain gap. Some previous works like ASD [anyshot] apply a trainable transformation to each word embedding independently. But we leveraging the explicit relationship between classes is more effective for embedding augmentation, leading to the proposal of the dynamic relation graph in Section 3.3.
3.3 Relation Reasoning
The semantic space projection learns to align the concepts from the visual space with the semantic space. But it still treats each class independently and there is no knowledge propagation among classes. Therefore, we further introduce a knowledge graph to model their relationships. The knowledge graph is a adjacency matrix representing the connection strength for every neighboring class pairs. is involved in classification via the graph convolution operation [gcn]. Mathematically, the updated probability prediction is shown in Eq. (3).
The heuristic definition of the knowledge graph. In zero-shot or few-shot recognition algorithms, the knowledge graph is predefined base on heuristics. It is usually constructed from a database of common sense knowledge rules by sampling a sub-graph through the rule paths such that semantically related classes have strong connections. For example, classes from the ImageNet dataset [imagenet] have a knowledge graph sampled from the WordNet [wordnet]. However, classes in FSOD datasets are not highly semantically related, nor do they form a hierarchical structure like the ImageNet classes. The only applicable heuristics we found are based on object co-occurrence from [multi-label-gcn]. Although the statistics of the co-occurrence are straightforward to compute, the co-occurrence is not necessarily equivalent to semantic relation.
Instead of predefining a knowledge graph based on heuristics, we propose to learn a dynamic relation graph driven by the data to model the relation reasoning between classes. The data-driven graph is also responsible for reducing the domain gap between vision and language because it is trained with image inputs. Inspired by the concept of the transformer, we implement the dynamic graph with the self-attention architecture [attention] as shown in Figure 4. The original word embeddings are transformed by three linear layers , and a self-attention matrix is computed from the outputs of . The self-attention matrix is multiplied with the output of followed by another linear layerresnet] adds the output of with the original . Another advantage of learning a dynamic graph is that it can easily adapt to new coming classes. Because the graph is not fixed and is generated on the fly from the word embeddings. We do not need to redefine a new graph and retrain the detector from the beginning. We can simply insert corresponding embeddings of new classes and fine-tune the detector.
3.4 Decoupled Fine-tuning
In the second fine-tuning phase, we only unfreeze the last few layers of our SRR-FSD similar to TFA [tfa]. For the classification subnet, we fine-tune the parameters in the relation reasoning module and the projection matrix . For the localization subnet, it is not dependent on the word embeddings but it shares features with the classification subnet. We find that the learning of localization on novel objects can interfere with the classification subnet via the shared features, leading to many false positives. Decoupling the shared fully-connected layers between the two subnets can effectively make each subnet learn better features for its task. In other words, the classification subnet and the localization subnet have individual fully-connected layers and they are fine-tuned independently.
4.1 Implementation Details
Our SRR-FSD is implemented based on Faster R-CNN [faster-rcnn] with ResNet-101 [resnet] and Feature Pyramid Network [fpn] as the backbone using the MMDetection [mmdet]
framework. All models are trained with Stochastic Gradient Descent (SGD) and a batch size of 16. For the word embeddings, we use the L2-normalized 300-dimensional Word2Vec[word2vec] vectors from the language model trained on large unannotated texts like Wikipedia. In the relation reasoning module, we reduce the dimension of word embeddings to 32 which is empirically selected. In the first base training phase, we set the learning rate, the momentum, and the weight decay to 0.02, 0.9, and 0.0001, respectively. In the second fine-tuning phase, we reduce the learning rate to 0.001 unless otherwise mentioned. The input image is sampled by first randomly choosing between the base set and the novel set with a 50% probability and then randomly selecting an image from the chosen set.
4.2 Existing Settings
We follow the existing settings in previous FSOD methods [yolo-fewshot, metadet, meta-rcnn, tfa] to evaluate our SRR-FSD on the VOC [voc]
and COCO[coco] datasets. For fair comparison and reduced randomness, we use the same data splits and a fixed list of novel samples provided by [yolo-fewshot].
|Novel Set 1||Novel Set 2||Novel Set 3|
|Method / shot||1||2||3||5||10||1||2||3||5||10||1||2||3||5||10|
|Meta R-CNN [meta-rcnn]||19.9||25.5||35.0||45.7||51.5||10.4||19.4||29.6||34.8||45.4||14.3||18.2||27.5||41.2||48.1|
VOC The 07 and 12 train/val sets are used for training and the 07 test set is for testing. Out of its 20 object classes, 5 classes are selected as novel and the remaining 15 are base classes, with 3 different base/novel splits. The novel classes each have annotated objects, where
equals 1, 2, 3, 5, 10. In the first base training phase, our SRR-FSD is trained for 18 epochs with the learning rate multiplied by 0.1 at the 12th and 15th epoch. In the second fine-tuning phase, we train forsteps where is the number of images in the -shot novel dataset.
We report the mAP50 of the novel classes on VOC with 3 splits in Table 1. In all different base/novel splits, our SRR-FSD achieves a more shot-stable performance. At higher shots like 5-shot and 10-shot, our performance is competitive compared to previous state-of-the-art methods. At more challenging conditions with shots less than 5, our approach can outperform the second-best by a large margin (up to 10+ mAP). Compared to ASD [anyshot] which only reports results of 3-shot and 5-shot in the Novel Set 1, ours is 24.2 and 6.0 better respectively in mAP. We do not include ASD in Table 1 because its paper does not provide the complete results on VOC.
Learning without forgetting is another merit of our SRR-FSD. After generalization to novel objects, the performance on the base objects does not drop at all as shown in Table 2. Both base AP and novel AP of our SRR-FSD compare favorably to previous methods based on the same Faster R-CNN with ResNet-101. The base AP even increases a bit probably due to the semantic relation reasoning from limited novel objects to base objects.
|Shot||Method||Base AP50||Novel AP50|
|3||Meta R-CNN [meta-rcnn]||64.8||35.0|
|Ours base only||77.7||n/a|
|10||Meta R-CNN [meta-rcnn]||67.9||51.5|
|Ours base only||77.7||n/a|
COCO The minival set with 5000 images is used for testing and the rest images in train/val sets are for training. Out of the 80 classes, 20 of them overlapped with VOC are the novel classes with shots per class and the remaining 60 classes are base. We train the SRR-FSD on the base dataset for 12 epochs using the same setting as MMDetection [mmdet] and fine-tune it for a fixed number of steps where is the number of images in the base dataset. Unlike VOC, the base dataset in COCO contains unlabeled novel objects, so the region proposal network (RPN) treats them as the background. To avoid omitting novel objects in the fine-tuning phase, we unfreeze the RPN and the following layers. Table 3 presents the COCO-style averaged AP. Again we consistently outperform previous methods including FSRW [yolo-fewshot], MetaDet [metadet], Meta R-CNN [meta-rcnn], TFA [tfa], and MPSR [mpsr].
|Meta R-CNN [meta-rcnn]||8.7||19.1||6.6|
|Meta R-CNN [meta-rcnn]||12.4||25.3||10.8|
COCO to VOC For the cross-domain FSOD setting, we follow [yolo-fewshot, metadet] to use the same base dataset with 60 classes as in the previous COCO within-domain setting. The novel dataset consists of 10 samples for each of the 20 classes from the VOC dataset. The learning schedule is the same as the previous COCO within-domain setting except the learning rate is 0.005. Figure 5 shows that our SRR-FSD achieves the best performance with a healthy 44.5 mAP, indicating better generalization ability in cross-domain situations.
4.3 A More Realistic Setting
|Novel Set 1||Novel Set 2||Novel Set 3|
|Method / shot||1||2||3||5||10||1||2||3||5||10||1||2||3||5||10|
|Meta R-CNN [meta-rcnn]||11.5||22.2||24.7||36.4||45.2||10.1||16.9||22.7||29.6||40.1||10.0||21.7||27.1||32.8||41.6|
The training of the few-shot detector usually involves initializing the backbone network with a model pretrained on large-scale object classification datasets such as ImageNet [imagenet]. The set of object classes in ImageNet, i.e. , is highly overlapped with the novel class set in the existing settings. This means that the pretrained model can get early access to large amounts of object samples, i.e. implicit shots, from novel classes and encode their knowledge in the parameters before it is further trained for the detection task. Even the pretrained model is optimized for the recognition task, the extracted features still have a big impact on the detection of novel objects (see Figure 1). However, some rare classes may have highly limited or valuable data in the real world that pretraining a classification network on it is not realistic.
Therefore, we propose a more realistic setting for FSOD, which extends the existing settings. In addition to , we also require that . To achieve this, we systematically and hierarchically remove novel classes from . For each class in , we find its corresponding synset in ImageNet and obtain its full hyponym (the synset of the whole subtree starting from that synset) using the ImageNet API 111http://image-net.org/download-API. The images of this synset and its full hyponym are removed from the pretrained dataset. And the classification model is trained on a dataset with no novel objects. We provide the list of WordNet IDs for each novel class to be removed in Appendix A.
We notice that CoAE [coae] also proposed to remove all COCO-related ImageNet classes to ensure the model does not “foresee” the unseen classes. As a result, a total of 275 classes are removed from ImageNet including both the base and novel classes in VOC [voc], which correspond to more than 300k images. We think the loss of this much data may lead to a worse pretrained model in general. So the pretrained model may not be able to extract features strong enough for down-streaming vision tasks compared with the model trained on full ImageNet. Our setting, on the other hand, tries to alleviate this effect as much as possible by only removing the novel classes in VOC Novel Set 1, 2, and 3 respectively, which correspond to an average of 50 classes from ImageNet.
Under the new realistic setting, we re-evaluate previous methods using their official source code and report the performance on the VOC dataset in Table 4. Our SRR-FSD demonstrates superior performance to other methods under most conditions, especially at challenging lower shot scenarios. More importantly, our SRR-FSD is less affected by the loss of implicit shots. Compared with results in Table 1, our performance is more stably maintained when novel objects are only available in the novel dataset.
4.4 Ablation Study
In this section, we study the contribution of each component. Experiments are conducted on the VOC dataset. Our baseline is the Faster R-CNN [faster-rcnn] with ResNet-101 [resnet] and FPN [fpn]. We gradually apply the Semantic Space Projection (SSP 3.2), Relation Reasoning (RR 3.3) and Decoupled Fine-tuning (DF 3.4) to the baseline and report the performance in Table 5. We also compare three different ways of augmenting the raw word embeddings in Table 6, including the trainable transformation from ASD [anyshot], the heuristic knowledge graph from [multi-label-gcn], and the dynamic graph from our proposed relation reasoning module.
|Components||Shots in Novel Set 1|
|Faster R-CNN [faster-rcnn]||32.6||44.4||46.3||49.6||55.6|
Semantic space projection guides shot-stable learning. The baseline Faster R-CNN can already achieve satisfying results at 5-shot and 10-shot. But at 1-shot and 2-shot, performance starts to fall apart due to exclusive dependence on images. The semantic space projection, on the other hand, makes the learning more stable to the variation of shot numbers (see 1st and 2nd entries in Table 5). The space projection guided by the semantic embeddings is learned well enough in the base training phase so it can be quickly adapted to novel classes with a few instances. We can observe a major boost at lower shot conditions compared to baseline, i.e. 7.9 mAP and 2.4 mAP gain at 1-shot and 2-shot respectively. However, the raw semantic embeddings limit the performance at higher shot conditions. The performance at 5-shot and 10-shot drops below the baseline. This verifies our argument about the domain gap between vision and language. At lower shots, there is not much visual information to rely on so the language information can guide the detector to a decent solution. But when more images are available, the visual information becomes more precise then the language information starts to be misleading. Therefore, we propose to refine the word embeddings for a reduced domain gap.
|Shots in Novel Set 1|
|+SSP +TT [anyshot]||39.3||45.7||43.9||49.4||52.4|
|+SSP +HKG [multi-label-gcn]||41.6||45.5||47.8||49.7||52.5|
Relation reasoning promotes adaptive knowledge propagation. The relation reasoning module explicitly learns a relation graph that builds direct connections between base classes and novel classes. So the detector can learn the novel objects using the knowledge of base objects besides the visual information. Additionally, the relation reasoning module also functions as a refinement to the raw word embeddings with a data-driven relation graph. Since the relation graph is updated with image inputs, the refinement tends to adapt the word embeddings for the vision domain. Results in Table 5 (2nd and 3rd entries) confirm that applying relation reasoning improves the detection accuracy of novel objects under different shot conditions. We also compare it with two other ways of refining the raw word embeddings in Table 6. One is the trainable transformation (TT) from ASD [anyshot] where word embeddings are updated with a trainable metric and a word vocabulary. Note that this transformation is applied to each embedding independently which does not consider the explicit relationships between them. The other one is the heuristic knowledge graph (HKG) defined based on the co-occurrence of objects from [multi-label-gcn]. It turns out both the trainable transformation and the predefined heuristic knowledge graph are not as effective as the dynamic relation graph in the relation reasoning module. The effect of the trainable transformation is similar to unfreezing more parameters of the last few layers during fine-tuning as shown in Appendix E, which leads to overfitting when the shot is low. And the predefined knowledge graph is fixed during training thus cannot be adaptive to the inputs. In other words, the dynamic relation graph is better because it can not only perform explicit relation reasoning but also augment the raw embeddings for reduced domain gap between vision and language.
Decoupled fine-tuning reduces false positives. We analyze the false positives generated by our SRR-FSD with and without decoupled fine-tuning (DF) using the detector diagnosing tool [det-analysis]. The effect of DF on reducing the false positives in novel classes is visualized in Figure 6. It shows that most of the false positives are due to misclassification into similar categories. With DF, the classification subnet can be trained independently from the localization subnet to learn better features specifically for classification.
In this work, we propose semantic relation reasoning for few-shot object detection. The key insight is to explicitly integrate semantic relation between base and novel classes with the available visual information, which can help to learn the novel concepts better especially when the novel class data is extremely limited. We apply the semantic relation reasoning to the standard two-stage Faster R-CNN and demonstrate robust few-shot performance against the variation of shot numbers. Compared to previous methods, our approach achieves state-of-the-art results on several few-shot detection settings, as well as a proposed realistic setting where novel concepts encoded in the pretrained backbone model are eliminated. We hope this realistic setting can be a better evaluation protocol for future few-shot detectors. Last but not least, the key components of our approach, i.e. semantic space projection and relation reasoning, can be straightly applied to the classification subnet of other few-shot detectors.
Appendix A Removing Novel Classes from ImageNet
We propose a realistic setting for evaluating the few-shot object detection methods, where novel classes are completely removed from the classification dataset used for training a model to initialize the backbone network in the detector. This can guarantee that the object concept of novel classes will not be encoded in the pretrained model before training the few-shot detector. Because the novel class data is so rare in the real world that pretraining a classifier on it is not realistic.
ImageNet [imagenet] is widely used for pretraining the classification model. It has 1000 classes organized according to the WordNet hierarchy. Each class has over 1000 images for training. We systematically and hierarchically remove novel classes by finding each synset and its corresponding full hyponym (synset of the whole sub-tree starting from that synset) using the ImageNet API 222http://image-net.org/download-API. So each novel class may contain multiple ImageNet classes.
For the novel classes in the VOC dataset [voc], their corresponding WordNet IDs to be removed are as follows.
aeroplane: n02690373, n02692877, n04552348
bird: n01514668, n01514859, n01518878, n01530575, n01531178, n01532829, n01534433, n01537544, n01558993, n01560419, n01580077, n01582220, n01592084, n01601694, n01608432, n01614925, n01616318, n01622779, n01795545, n01796340, n01797886, n01798484, n01806143, n01806567, n01807496, n01817953, n01818515, n01819313, n01820546, n01824575, n01828970, n01829413, n01833805, n01843065, n01843383, n01847000, n01855032, n01855672, n01860187, n02002556, n02002724, n02006656, n02007558, n02009229, n02009912, n02011460, n02012849, n02013706, n02017213, n02018207, n02018795, n02025239, n02027492, n02028035, n02033041, n02037110, n02051845, n02056570, n02058221
boat: n02687172, n02951358, n03095699, n03344393, n03447447, n03662601, n03673027, n03873416, n03947888, n04147183, n04273569, n04347754, n04606251, n04612504
bottle: n02823428, n03062245, n03937543, n03983396, n04522168, n04557648, n04560804, n04579145, n04591713
bus: n03769881, n04065272, n04146614, n04487081
cat: n02123045, n02123159, n02123394, n02123597, n02124075, n02125311, n02127052
cow: n02403003, n02408429, n02410509
horse: n02389026, n02391049
motorbike: n03785016, n03791053
sheep: n02412080, n02415577, n02417914, n02422106, n02422699, n02423022
For the novel classes in the COCO dataset [coco], they are very common in the real world. Removing them from the ImageNet does not make sense as much as removing data-scarce classes. So we suggest for large-scale datasets like COCO, we should follow the long-tail distribution of their class frequency and select the data-scarce classes on the distribution tail to be the novel classes.
Appendix B Visualization of Relation Reasoning
Figure 7 visualizes the correlation maps between the semantic embeddings of novel and base classes before and after the relation reasoning, as well as the difference between the two maps. Nearly all the correlations are increased slightly, indicating better knowledge propagation between the two groups of classes. Additionally, it is interesting to see that some novel classes get more correlated than others, e.g. “sofa” with “bottle” and “sofa” with “table”, probably because “sofa” can often be seen together with “bottle” and “table” in the living room but the original semantic embeddings cannot capture these relationships.
Appendix C Using Other Word Embeddings
In the semantic space projection, we represent the semantic space using word embeddings from the Word2Vec [word2vec]. We could simply set the to be random vectors. Additionally, there are other language models for obtaining vector representations for words, such as the GloVe [glove]. The GloVe is trained with aggregated global word-word co-occurrence statistics from a corpus, and the resulting representations showcase interesting linear substructures of the word vector space. We also explored using word embedding with different dimensions from the GloVe in the semantic space projection step and compared with the results by the Word2Vec. Performance on the VOC Novel Set 1 is reported in Table 7. The Word2Vec can provide better representations than the GloVe of both 300 dimensions and 200 dimensions. The performance of random embeddings is significantly worse than the meaningful Word2Vec and GloVe, which again verifies the importance of semantic information for shot-stable FSOD.
|Novel Set 1|
Appendix D Reduced Dimension in Relation Reasoning
In the relation reasoning module, the dimension of word embeddings is reduced by linear layers before computing the attention map, which saves computational time. We empirically test different dimensions and select the one with the best performance, i.e. when the dimension is 32. But other choices are just slightly worse. Table 8 reports the results on VOC dataset under different dimensions. All the experiments are following the same setting as in the main paper. The only exception is that we use ResNet-50 [resnet] to reduce the computational cost of tuning hyperparameters.
|Novel Set 1|
|Novel Set 1|
|Last layer (TFA [tfa])||39.8||36.1||44.7||55.7||56.0|
|+FCs +RPN +Backbone||16.2||19.5||24.8||39.2||44.6|
|Novel Set 1||Novel Set 2||Novel Set 3|
Appendix E Finetuning More Parameters
Similar to TFA [tfa], we have a finetuning stage to make the detector generalized to novel classes. For the classification subnet, we finetune the parameters in the relation reasoning module and the projection matrix while all the parameters in previous layers are frozen. Some may argue that the improvement of our SRR-FSD over the baseline is due to more parameters finetuned in the relation reasoning module compared to the Faster R-CNN [faster-rcnn] baseline. But we show that finetuning more parameters does not necessarily lead to better results in Table 9. We take the TFA model which is essentially a Faster R-CNN finetuned with only the last layer trainable and gradually unfreeze the previous layers. It turns out more parameters involved in finetuning do not change the results substantially and that too many parameters will lead to severe overfitting.
Appendix F Complete Results on VOC
In Table 10, we present the complete results on the VOC [voc] dataset as in FSRW [yolo-fewshot] and Meta R-CNN [meta-rcnn]. We also include the very recent MPSR [mpsr] for comparison. MPSR develops an auxiliary branch to generate multi-scale positive samples as object pyramids and to refine the prediction at various scales. Note that MPSR improves its baseline by a considerable margin but its research direction is orthogonal and complimentary to ours because it is still exclusively dependent on visual information. Therefore, our approach combining visual information and semantic relation reasoning can achieve superior performance at extremely low shot (e.g. 1, 2) conditions.
Appendix G Interpretation of the Dynamic Relation Graph
In the relation reasoning module, we propose to learn a dynamic relation graph driven by the data, which is conceptually different from the predefined fixed knowledge graphs used in [zsr-gnn, multi-label-gcn, fsr-kt]. We implement the dynamic graph with the self-attention architecture [attention]. Although it is in the form of a feedforward network, it can also be interpreted as a computation related to the knowledge graph. If we denote the transformations in the linear layers , , , as , , , respectively, we can formulate the relation reasoning in Eq. (4)
where is the matrix of augmented word embeddings after the relation reasoning which will be used as the weights to compute classification scores and is the softmax function operated on the last dimension of the input matrix. The item can be interpreted as a dynamic knowledge graph in which the learnable parameters are and . And it is involved in the computation of the classification scores via the graph convolution operation [gcn], which connects the word embeddings in to allow knowledge propagation among them. The item can be viewed as a learnable transformation applied to each embedding independently.