Year: 2021

Abstract:
Is it possible to detect arbitrary objects from a single example? A central problem of all existing attempts at one-shot object detection is the generalization gap: Object categories used during training are detected much more reliably than novel ones. We here show that this generalization gap can be nearly closed by increasing the number of object categories used during training. Doing so allows us to improve generalization from seen to unseen classes from 45% to 89% and improve the state-of-the-art on COCO by 5.4 %AP50 (from 22.0 to 27.5). We verify that the effect is caused by the number of categories and not the number of training samples, and that it holds for different models, backbones and datasets. This result suggests that the key to strong few-shot detection models may not lie in sophisticated metric learning approaches, but instead simply in scaling the number of categories. We hope that our findings will help to better understand the challenges of few-shot learning and encourage future data annotation efforts to focus on wider datasets with a broader set of categories rather than gathering more samples per category. Example based object detection Successful Detection of Novel Objects! A broad training dataset Re la tiv e pe rfo rm an ce   no ve l/k no w n ob je ct s Categories 80 365 1203 46% 76% 89%

heading: 1 INTRODUCTION
text: It’s January 2021 and your long awaited household robot finally arrives. Equipped with the latest “Deep Learning Technology”, it can recognize over 21,000 objects. Your initial excitement quickly vanishes as you realize that your casserole is not one of them. When you contact customer service they ask you to send some pictures of the casserole so they can fix this. They tell you that the fix will be some time, though, as they need to collect about a thousand images of casseroles to retrain the neural network. While you are making the call your robot knocks over the olive oil because the steam coming from the pot of boiling water confused it. You start filling out the return form ...
While not 100% realistic, the above story highlights an important obstacle towards truly autonomous agents: such systems should be able to detect novel, previously unseen objects and learn to recognize them based on (ideally) a single example. Solving this one-shot object detection problem can
be decomposed into three subproblems: (1) designing a class-agnostic object proposal mechanism that detects both known and previously unseen objects; (2) learning a suitably general visual representation (metric) that supports recognition of the detected objects; (3) continuously updating the classifier to accommodate new object classes or training examples of existing classes. In this paper, we focus on the detection and representation learning part of the pipeline, and we ask: what does it take to learn a visual representation that allows detection and recognition of previously unseen object categories based on a single example?
We operationalize this question using an example-based visual search task (figure 1) that has been investigated before using handwritten characters (Omniglot; Michaelis et al. (2018a)) and real-world image datasets (Pascal VOC, COCO; Michaelis et al. (2018b); Hsieh et al. (2019); Zhang et al. (2019); Fan et al. (2020); Li et al. (2020)). Our central hypothesis is that scaling up the number of object categories used for training should improve the generalization capabilities of the learned representation. This hypothesis is motivated by the following observations. On (cluttered) Omniglot (Michaelis et al., 2018a), recognition of novel characters works almost as well as for characters seen during training. In this case, sampling enough categories during training relative to the visual complexity of the objects is sufficient to learn a metric that generalizes to novel categories. In contrast, models trained on visually more complex datasets like Pascal VOC and COCO exhibit a large generalization gap: novel categories are detected much less reliably than ones seen during training. This result suggests that on the natural image datasets, the number of categories is too small given the visual complexity of the objects and the models retreat to a shortcut (Geirhos et al., 2020) – memorizing the training categories.
To test the hypothesis that wider datasets improve generalization, we increase the number of object categories during training by using datasets (LVIS, Objects365) that have a larger number of categories annotated. Our experiments support this hypothesis and suggest the following conclusions:
• The generalization gap between training and novel categories is a key problem in one-shot object detection.
• This generalization gap can be almost closed by increasing the number of categories used for training: going from 80 classses in COCO to 1200 in LVIS improves relative performance from 45% to 89%.
• A detailed analysis shows that number of categories, not the amount of data, is the driving force behind this effect.
• Closing the generalization gap allows using established methods from the object detection community (like e.g. stronger backbones) to improve performance on known and novel categories alike.
• We use these insights to improve state-of-the-art performance on COCO by 5.4 %AP50 (from 22 %AP50 to 27.5 %AP50) using annotations from LVIS.

heading: 2 RELATED WORK
text: Object detection Object detection - the task of detecting objects in complex, cluttered scenes - has seen huge progress since the widespread adoption of DNNs Girshick et al. (2014); Ren et al. (2015); He et al. (2017); Lin et al. (2017a); Chen et al. (2019a); Wu et al. (2019); Carion et al. (2020). Similarly the number of datasets has grown steadily, fueled by the importance this task has for computer vision applications Everingham et al. (2010); Russakovsky et al. (2015); Lin et al. (2014); Zhou et al. (2017); Neuhold et al. (2017); Krasin et al. (2017); Gupta et al. (2019); Shao et al. (2019). However most models and datasets focus on scenarios where abundant examples per category are available.
Few-shot learning Algorithms for few-shot learning - learning a model from only a few examples - can broadly be separated into two categories: Metric learningKoch et al. (2015); Vinyals et al. (2016); Snell et al. (2017) - learn a good representation and metric that generalizes to new data. And meta learning Finn et al. (2017); Rusu et al. (2018) - learn a good way to learn a new task. However, recent work has shown that complex algorithmic approaches can be rivaled by improving and scaling simple approaches like transfer learning Chen et al. (2019b); Nakamura & Harada (2019); Dhillon et al. (2019); Kolesnikov et al. (2019).
Few-shot & one-shot object detection Recently, several groups have started to tackle few-shot learning for object detection. Two training and evaluation paradigms have emerged. The first is inspired by continual learning: incorporate a set of new categories with only a few labeled images per category into an existing classifier Kang et al. (2018); Yan et al. (2019); Wang et al. (2019; 2020). The second one phrases the problem as an example-based visual search: detect objects based on a single example image (Michaelis et al., 2018b; Hsieh et al., 2019; Zhang et al., 2019; Fan et al., 2020; Li et al., 2020, figure 1 left). We refer to the former (continual learning) as few-shot object detection, since typically 10–30 images are used for experiments on COCO. In contrast, we refer to the latter (visual search) as one-shot object detection, since the focus is on the setting with a single example. In the present paper we work with this latter paradigm, since it focuses on the representation learning part of the problem and avoids the additional complexity of continual learning.
Methods for one-shot object detection Existing methods for one-shot object detection usually combine a standard object detection architecture with metric or meta-learning methods Biswas & Milanfar (2015); Michaelis et al. (2018b); Hsieh et al. (2019); Zhang et al. (2019); Fan et al. (2020); Osokin et al. (2020); Li et al. (2020). To better handle complex scenes and pose changes methods such as spatial awareness Li et al. (2020) or pose transforms Biswas & Milanfar (2015); Osokin et al. (2020) have been proposed. A recent method uses a transformer to solve the matching problem Chen et al. (2021). We here use one of the most straightforward models, Siamese Faster R-CNN Michaelis et al. (2018b), to demonstrate that a change of the training data rather than the model architecture is sufficient to substantially reduce the generalization gap between known and novel categories.
Number of categories in few-shot learning Most of the few-shot learning literature focuses on developing algorithmic solutions to a set of existing small-scale benchmarks. In contrast a lot less attention has been payed to exploring new tasks or datasets. The influence of the training data was mostly observed indirectly, e.g. through better performance on datasets with more categories such as tieredImageNet vs. miniImageNet. We here flip the focus demonstrating that significant progress can be made by keeping the algorithm the same and only changing the training data. Concurrent studies confirm this finding that more categories help few-shot object detection Fan et al. (2020) and few-shot image classification Sbai et al. (2020); Jiang et al. (2020). We add to this by not only looking at few-shot performance but comparing it with performance on known categories (generalization gap). This allows us to uncover the functional relationship behind the effect (closing a shortcut).

heading: 3 EXPERIMENTS
text: Models We mainly use Siamese Faster R-CNN, an example-based version of Faster R-CNN Ren et al. (2015) similar to Siamese Mask R-CNN Michaelis et al. (2018b). Briefly, it consists of a feature extractor, a matching step and a standard region proposal network and bounding box head (figure 2). The feature extractor (called backbone in object detection) is a standard ResNet-50 with feature pyramid networks He et al. (2016); Lin et al. (2017a) which is applied to the image and reference with weight sharing. In the matching step the reference representation is compared to the image representation in a sliding window approach by computing a feature-wise L1 difference. The resulting similarity encoding representation is concatenated to the image representation and passed on to the region proposal network (RPN). The RPN proposes a set of bounding boxes which potentially contain objects. These boxes are then classified as containing an object from the reference
class or something else (other object or background). Box coordinates are refined by bounding box regression and overlapping boxes are removed using non-maximum suppression.
We additionally developed Siamese RetinaNet, a single-stage detector based on RetinaNet Lin et al. (2017b). The feature extraction and matching steps are identical to Siamese Faster R-CNN, but it uses the unified RetinaHead to jointly propose and classify bounding boxes. To counter the effect of too many negative samples, the classifier is trained with focal loss Lin et al. (2017b).
Training & Evaluation The example-based training is slightly different from the traditional object detection training paradigm. For each image a reference category is randomly chosen by picking a category with at least one instance in the image. A reference is retrieved by randomly selecting one instance from this category in another image and tightly cropping it. The labels for each bounding box are changed to 0 or 1 depending on whether the object is from the reference category or not. Annotations for objects from the held-out categories are removed from the dataset before training. At test time a similar procedure is chosen but instead of picking one category for each image, all categories with at least one object in the image are chosen Michaelis et al. (2018b) and one (1-shot) or five (5-shot) reference images are provided. Predictions are assigned their corresponding category label and evaluation is performed using standard tools and metrics.
Implementation We implemented Siamese Faster R-CNN and Siamese RetinaNet in mmdetection v1.0rc Chen et al. (2019a), which improved performance by more than 30% over the original Siamese Mask R-CNN (Michaelis et al., 2018b, Table 4). We keep all hyperparameters the same as in the standard Faster R-CNN implementation of mmdetection. Due to resource constraints we reduce the number of samples per epoch to 120k for Objects365.
Hyperparameters Our model is derived from mmdetection v1.0rc Chen et al. (2019a) and uses the same hyperparameters as used for Faster R-CNN and RetinaNet1. Please note that the default settings for Pascal VOC differ slightly from those for COCO training. We use the COCO hyperparameters for experiments on COCO, LVIS and Objects365 and Pascal VOC settings for Pascal VOC.
Datasets We use the four datasets shown in Table 1: COCO Lin et al. (2014), Objects365 Shao et al. (2019), LVIS Gupta et al. (2019) and Pascal VOC Everingham et al. (2010). We use standard splits and test on the validation sets except for Pascal VOC where we test on the 2007 test set. Due to resource constraints, we evaluate Objects365 on a fixed subset of 10k images from the validation set.
Category splits Following common protocol for example-based detection Michaelis et al. (2018b); Shaban et al. (2017) we split the categories in each dataset into four splits using every fourth category as hold-out set and the other 3/4 categories for training. So on Pascal VOC there are 15 categories for training in each split, on COCO there are 60, on Objects365 274 and on LVIS 902. We train and test four models (one for each split) and report the mean over those four models, so performance is always measured on all categories. Computing performance in this way across all categories is preferable to using a fixed subset as some categories may be harder than others. During evaluation, the reference images are chosen randomly. We therefore run the evaluation five times, reporting the average AP50 over splits. The 95% confidence intervals for the average AP50 is below ±0.2%AP50 for all experiments.
1All details can be found in the respective configs: https://github.com/open-mmlab/ mmdetection/tree/5bf935e1b7621b234ddb34ef6c32b2b524243995/configs

heading: 4 RESULTS

heading: 4.1 GENERALIZATION GAP ON COCO AND PASCAL VOC
text: We start by showing that objects of held-out categories are detected less reliably on COCO and Pascal VOC. On both datasets, Siamese Faster R-CNN shows strong signs of overfitting to the training categories (figure 4 & Table 2): despite setting a new stat-of-the-art performance is much higher than for categories held-out during training (COCO: 49.7 → 22.8 %AP50; Pascal VOC: 82.7→ 37.6 %AP50). We refer to this drop in performance as the generalization gap. This result is consistent with the literature: Hsieh et al. (2019) – the previous state-of-the-art – report performance dropping 40.9→ 22.0 %AP50 on COCO (see Table 4 below). Some newer models reportedly close the gap on Pascal VOC Zhang et al. (2019); Hsieh et al. (2019); Li et al. (2020); we will discuss Pascal VOC further in the next section. Example predictions show good localization (bounding boxes) even for unknown objects in cluttered scenes while classification errors make up the majority of mistakes (figure 3).

heading: 4.2 PASCAL VOC IS TOO EASY TO EVALUATE ONE-SHOT OBJECT DETECTION MODELS
text: Having identified this large generalization gap, we ask whether the models have learned a useful metric for one-shot detection at all or whether they rely on simple dataset statistics. Pascal VOC contains, on average, only 1.6 categories and 2.9 instances per image. In this case, simply detecting all foreground objects may be a viable strategy. To test how well such a trivial strategy would perform, we provide the model with uninformative references (we use all-black images). Interestingly, this baseline performs very well, achieving 59.6 %AP50 on training and 33.2 %AP50 on held-out categories (Table 2). For held-out categories, the difference to an example-based search is marginal (33.2 → 37.6 %AP50). This result demonstrates that on Pascal VOC the model mostly follows a shortcut and uses basic dataset statistics to solve the task.
In contrast, COCO represents a drastic increase in image complexity compared with Pascal VOC: it contains, on average, 2.9 categories and 7.3 instances per image. As expected, in this case the trivial baseline with uninformative references performs substantially worse than the example-based search (training: 49.7 → 10.1 %AP50; held-out: 22.8 → 4.4 %AP50; Table 2). Thus, the added image complexity in COCO forces the model to use the reference image for classification but the small set of categories is not sufficient to prevent memorizing the training categories.

heading: 4.3 TRAINING ON MORE CATEGORIES REDUCES THE GENERALIZATION GAP
text: We now turn to our main hypothesis that increasing the number of categories used during training could close the generalization gap identified above. To this end we use Objects365 and LVIS, two fairly new datasets with 365 and 1203 categories, respectively (much more than the 20/80 in Pascal VOC/COCO). Indeed, training on these wider datasets improves the relative performance on the held-out categories from 46% on COCO to 76% on Objects365 and up to 89% on LVIS (figure 1). In absolute numbers this means going from a 26.9 %AP50 gap on COCO to a 4.6 %AP50 gap on Objects365 and a 3.5 %AP50 gap on LVIS (Table 3) in the one-shot setting. Increasing the number of references to five (5-shot) improves performance on all datasets but leaves relative performance unchanged (Table 3, right columns).
This effect is not caused simply by differences between the datasets, as the following experiment shows: For both datasets (LVIS and Objects365), we train models on progressively more categories. When training on less than 100 categories (resembling training on COCO), a clear generalization gap is visible on both LVIS and Objects365 (figure 5A: leftmost data points). Increasing the number of training categories leads to better performance on the held-out categories, while performance on the training categories stays the same (LVIS) or decreases (Objects365). The effect is the same in the 5-shot setting but with a better baseline performance (figure A.1 in Appendix).

heading: 4.4 THE NUMBER OF CATEGORIES IS THE CRUCIAL FACTOR
text: The results so far show that increasing the number of categories used during training reduces the generalization gap and improves performance. However, this effect could also be caused by the fact that with more categories there is also more data available. Consider the situation where we train on 10% of the categories (90 in the case of LVIS). As we sample these categories uniformly from the dataset, we use only approximately 10% of the total number of instances. To control for this confound, we created training sets that match the number of instances: in this case we use only 10% of the instances in the dataset but sample them uniformly from all 900 training categories.
The results can be seen in figure 5B. Our example from above with 10% of the data corresponds to the leftmost datapoint in both plots. The model trained with more categories (green) clearly outperforms the model with more instances per category (blue). The same performance gap can be seen for any fraction of the data. Thus, for a given budget of instances (labels) it is better to cover more categories than to collect as many samples per category as possible.

heading: 4.5 ONCE THE GENERALIZATION GAP IS CLOSED MORE POWERFUL MODELS BENEFIT NOVEL CATEGORIES
text: If models indeed learn the distribution over categories, stronger models that can learn more powerful representations should perform better on known and novel categories alike. We test this hypothesis in two ways: first, by replacing the standard ResNet-50 He et al. (2016) backbone with a more expressive ResNeXt-101 Xie et al. (2017); second, by using a three times longer training schedule.
The larger backbone does not improve performance on the held-out categories on COCO (Table 3). Instead the additional capacity is used to memorize the training categories, which is evident from the large improvement (6.7%AP50) in performance on the training categories, but only a small improvement (0.7%AP50) on the held-out categories. In contrast, on LVIS and Objects365 the gains of the bigger backbone are not confined to the training categories but apply to the one-shot setting as well. Only a small difference remains on Objects365 (3.0%AP50 vs. 1.4%AP50).
Longer training schedules show the same pattern. For COCO, performance on the training categories improves while performance on held-out categories even gets a bit worse on a 3x schedule (Table 3). In contrast, performance on LVIS and Objects365 improves for both training and held-out categories alike, suggesting that the models do not overfit only the training categories.

heading: 4.6 RESULTS HOLD FOR DIFFERENT MODEL CONFIGURATIONS
text: To test if our findings apply to single-stage detectors as well, we train and test Siamese RetinaNet on COCO, LVIS and Objects365 (Table 3). Results are very similar to Siamese Faster R-CNN. Siamese RetinaNet shows a slightly larger generalization gap on COCO (relative performance: Retina: 37%
vs. FRCNN: 46%) but results are very similar on LVIS (Retina: 87% vs. FRCNN: 89%) and Objects365 (Retina: 74% vs. FRCNN: 76%).
Taken together we observe the same patterns for single- and two-stage detectors with different backbones and learning rate schedules on two datasets (Objects365 and LVIS) for 1-shot and 5-shot evaluation. This suggests that our conclusions may extend to most object detection models and we can expect to significantly boost performance using the large toolboxes which exist for traditional object detection.

heading: 4.7 STATE-OF-THE-ART ON COCO USING LVIS
text: Using the insights from above, we now demonstrate state-of-the-art one-shot detection performance on COCO by training on a large number of categories. We use LVIS and create four splits which leave out all categories that have a correspondence in the respective COCO split. As LVIS is a re-annotation of COCO, this means that we expand the categories in the training set while training on the same set of images. Training with the more diverse LVIS annotations leads to a noticeable performance improvement from 22.8 to 25.0%AP50, which can be improved even further to 27.4%AP50 by using the stronger ResNeXt-101 backbone, outperforming the previous best model by 5.4%AP50 (Table 4). In relative terms that means going from 45% relative performance to 65%, thus substantially outperforming the previous best method (55% relative performance Hsieh et al. (2019)) both in absolute and relative terms. Visual inspection of the results (figure 6) shows cleaner predictions with less false positives especially for difficult reference images.

heading: 5 DISCUSSION
text: It has long been assumed and recently shown (Sbai et al., 2020; Jiang et al., 2020; Fan et al., 2020) that training with more categories improves few-shot learning performance. However the question whether this is due to better overall model performance or better generalization has not been answered so far. Our results show that the underlying mechanism is an improvement in generalization from 45% relative performance on COCO to 89% on LVIS. The effect is consistent for different detectors, backbone architectures and training schedules which suggests that the effect will hold for almost any model. If this trend continues with more categories object detection that generalizes to any object is within reach. This, however, does not mean that one-shot object detection is “solved”. There are at least three important steps to take:
First and foremost the performance of example-based object detectors has to improve significantly. Our experiments outline a path forward, demonstrating that methods that profit general object detection transfer to novel categories when the generalization gap is closed. Secondly, we have to better understand the mechanisms that lead to the generalization gap. Our results indicate that one of the main reasons is a shortcut Geirhos et al. (2020) - memorizing the training categories. That stronger models also perform better on novel categories with progressive closing of the gap is an indicator that the key issue was indeed overfitting. However more investigation will be required to determine which factors are important. Is it the sheer number of categories or is it their diversity, granularity, frequency? Or is the main factor semantic relationship as results from Sbai et al. (2020) and Jiang et al. (2020) suggest? Finally we have to find a way to transfer this success to smaller datasets with less categories. While we achieve a new state-of-the-art on COCO the generalization gap there (69%) is still larger than on LVIS (89%).

heading: 5.1 FUTURE DATASETS SHOULD FOCUS ON THE DIVERSITY OF CATEGORIES.
text: Our findings have important implications for the design of future datasets. For the goal of generalization a broader range of categories is helpful at any dataset size (figure 5B: green curve above blue curve at any data fraction), while from a certain point onward more examples per category lead to diminishing returns (figure 5B: green curve flattens out). At a time where few-shot and long-tail problems become more important in computer vision this suggest that future data collection and annotation efforts should focus more on a broad set of categories and less on the number of instances for each of those categories.
An open question is, how broad datasets have to be. Despite being a big step forward, training on LVIS still leaves a small generalization gap that widens when using stronger models. In other words: some amount of overfitting on the training categories remains. The good news is that we don’t see a saturation (figure 5B: dark blue curves still rise at the maximum number of categories) so further increasing the number of categories should reduce the remaining gap.

heading: 5.2 THE BIGGER PICTURE
text: Our insight that applying existing methods on larger and more diverse datasets can lead to unexpected capabilities is mirrored in other areas. This phenomenon has been observed time and again and was termed the “unreasonable effectiveness of data” Halevy et al. (2009); Sun et al. (2017) or the “bitter lesson” Sutton (2019). It played a key role in the breakthrough of DNNs thanks to ImageNet Russakovsky et al. (2015); Krizhevsky et al. (2012) as well as recent results on gameplay Berner et al. (2019) or language modelling Brown et al. (2020). Recently Kolesnikov et al. (2019) and Radford et al. (2021) achieve impressive results demonstrating strong performance at one-shot and zero-shot ImageNet classification. As in our study, simple methods (transfer learning in Kolesnikov et al. (2019) and unsupervised image captioning in Radford et al. (2021)) on large and diverse datasets led to results that are far better than what one would have expected: Achieving ResNet performance with 10 Kolesnikov et al. (2019) respectively zero Radford et al. (2021) annotated samples per class in their case; 89% relative performance on LVIS in our case. We hope that by building on this insight we can soon move from trying to solve few-shot learning towards using few-shot learning to solve other problems.

heading: A APPENDIX
text: A.1 ADDITIONAL FEW-SHOT RESULTS
We provide five-shot results for the experiments in figure 5 in figure A.1.

Review summaries:
This paper studies one-shot 2D object detections. The major conclusion is that when keeping the number of training images fixed, increasing the number of training categories can significantly increase the one-shot performance.  This paper demonstrated this conclusion empirically by doing controlled experiments on COCO, Objects365, and LIVS.   Inspired by this observation, this paper improves the state-of-the-art one-shot detection performance on COCO from 22.0 to 27.5 AP50 by training on LIVS.  Other two related conclusions in this paper: - PASCAL VOC is not suitable for evaluating one-shot object detection algorithms. The reason may be that the number of instances per image is low(2.9 ins/img on average). The algorithm only needs to recognize foreground objects rather than objects of target categories.  - Only when the training data is challenging enough, increasing the model size and training time can help improve one-shot performance.   

- The paper considers the problem of one-shot object detection, meaning, the model is asked to detect unseen categories, based on only one provided a template.  - The main discovery made by the authors is that, to generalise better, the model should be trained with data from as many categories as possible, given the same budget on number of samples for training.  - Architecture-wise, a Siamese Faster R-CNN is adapted. 

This paper studies the effect of category number in the one-shot object detection task. In the testing of one-shot detection, there exists a performance gap between the base (training) classes and held-out classes. It is claimed that this performance gap can be largely closed by increasing the number of categories used for training. And the number of categories is more crucial than the number of samples per category. Experiments are conducted on VOC, COCO, Object365, and LVIS using a Siamese-style detector to verify the claims.

This paper shows that the key to reduce the generalization gap between base classes and novel classes is to increase the number of training categories, instead of training samples. The authors did many experiments on four existing datasets (PASCAL, COCO, Objects365, and LVIS) with Siamese Faster R-CNN to verify this point. Experiments show that with more categories in the training set, the generalization gap will be nearly closed. Finally, the author proposes that future data sets should focus on the diversity of categories.