A B ROAD D ATASET IS A LL Y OU N EED FOR O NE -S HOT O BJECT D ETECTION
Anonymous authors
Paper under double-blind review
A BSTRACT
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 %AP 50 (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 ﬁndings 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.
[Figure]
I NTRODUCTION
It’s January 2021 and your long awaited household robot ﬁnally 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 ﬁx this.
They tell you that the ﬁx 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 ﬁlling 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 classiﬁer 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 (ﬁgure 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.
; Zhang et al.
; Fan et al.
; Li et al.
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 sufﬁcient 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 %AP(from 22 %AP 50 to 27.5 %AP 50 ) using annotations from LVIS.
R ELATED W ORK Object detection
Object detection - the task of detecting objects in complex, cluttered sceneshas seen huge progress since the widespread adoption of DNNs Girshick et al.
Ren et al.
; He et al.
; Lin et al. (2017a); Chen et al. (2019a); Wu et al.
; Carion et al.
Similarly the number of datasets has grown steadily, fueled by the importance this task has for computer vision applications Everingham et al.
; Russakovsky et al.
; Lin et al.
; Zhou et al.
; Neuhold et al.
; Krasin et al.
; Gupta et al.
; Shao et al.
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.
; Vinyals et al.
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.
; Kolesnikov et al.
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 ﬁrst is inspired by continual learning: incorporate a set of new categories with only a few labeled images per category into an existing classiﬁer Kang et al.
Yan et al.
; Wang et al.
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, ﬁgure 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.
; Zhang et al.
; Fan et al.
Osokin et al.
; Li et al.
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.
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 sufﬁcient 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 inﬂuence of the training data was mostly observed indirectly, e.g. through better performance on datasets with more categories such as tiered ImageNet vs. mini ImageNet.
We here ﬂip the focus demonstrating that signiﬁcant progress can be made by keeping the algorithm the same and only changing the training data.
Concurrent studies conﬁrm this ﬁnding that more categories help few-shot object detection Fan et al.
and few-shot image classiﬁcation Sbai et al.
; Jiang et al.
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).
E XPERIMENTS 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).
Brieﬂy, it consists of a feature extractor, a matching step and a standard region proposal network and bounding box head (ﬁgure 2).
The feature extractor (called backbone in object detection) is a standard ResNet-50 with feature pyramid networks
He et al.
; 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 classiﬁed as containing an object from the reference
[Figure]
class or something else (other object or background).
Box coordinates are reﬁned 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 uniﬁed RetinaHead to jointly propose and classify bounding boxes.
To counter the effect of too many negative samples, the classiﬁer 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 ﬁve (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 RetinaNet 1 .
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.
Objects365 Shao et al.
LVIS Gupta et al.
and Pascal VOC Everingham et al.
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 ﬁxed 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 ﬁxed subset as some categories may be harder than others.
During evaluation, the reference images are chosen randomly.
We therefore run the evaluation ﬁve times, reporting the average AP 50 over splits.
The 95% conﬁdence intervals for the average AP 50 is below ± 0 .
2% AP 50 for all experiments.
[Table]
(cid:88)
[Figure]
R ESULTS 4. G ENERALIZATION GAP ON COCO AND P ASCAL VOC
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 overﬁtting to the training categories (ﬁgure 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 % AP 50 ; Pascal VOC: 82 . 7 → 37 .
6 % AP 50 ).
We refer to this drop in performance as the generalization gap .
This result is consistent with the literature: Hsieh et al.
the previous state-of-the-art – report performance dropping 40 .
9 → 22 . 0 % AP 50 on COCO (see Table 4 below).
Some newer models reportedly close the gap on Pascal VOC Zhang et al.
Hsieh et al.
; 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 classiﬁcation errors make up the majority of mistakes (ﬁgure 3).
4. P ASCAL VOC IS TOO EASY TO EVALUATE ONE - SHOT OBJECT DETECTION MODELS
Having identiﬁed 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 % AP 50 on training and 33 . 2 % AP 50 on held-out categories (Table 2).
For held-out categories, the difference to an example-based search is marginal ( 33 . 2 → 37 . 6 % AP 50 ).
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 % AP 50 ; held-out: 22 . 8 → 4 . 4 % AP 50 ; Table 2).
Thus, the added image complexity in COCO forces the model to use the reference image for classiﬁcation but the small set of categories is not sufﬁcient to prevent memorizing the training categories.
[Table]
4. T RAINING ON MORE CATEGORIES REDUCES THE GENERALIZATION GAP
[Figure]
We now turn to our main hypothesis that increasing the number of categories used during training could close the generalization gap identiﬁed 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 (ﬁgure 1).
In absolute numbers this means going from a 26 . 9 % APgap on COCO to a 4 .
6 % AP 50 gap on Objects365 and a 3 . 5 % APgap on LVIS (Table 3) in the one-shot setting.
Increasing the number of references to ﬁve (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 (ﬁgure 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 (ﬁgure A.1 in Appendix).
4. T HE NUMBER OF CATEGORIES IS THE CRUCIAL FACTOR
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.
[Table]
The results can be seen in ﬁgure 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.
4. O NCE THE GENERALIZATION GAP IS CLOSED MORE POWERFUL MODELS BENEFIT NOVEL CATEGORIES
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: ﬁrst, by replacing the standard ResNet-50 He et al.
(2016) backbone with a more expressive ResNeXt-
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 % AP 50 ) in performance on the training categories, but only a small improvement ( 0 .
7 % AP 50 ) on the held-out categories.
In contrast, on LVIS and Objects365 the gains of the bigger backbone are not conﬁned to the training categories but apply to the one-shot setting as well.
Only a small difference remains on Objects365 ( 3 . 0 % AP 50 vs. 1 . 4 % AP 50 ).
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 overﬁt only the training categories.
4. R ESULTS HOLD FOR DIFFERENT MODEL CONFIGURATIONS
To test if our ﬁndings 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% [Figure]
Elephant
R e s N e tT r a i n e d o n C
O C O
R e s N e
X t32 x 4 d
T r a i n e d o n L V
I S
[Figure]
[Figure] [Figure] [Figure] [Table]
[Figure] [Figure]
[Figure] [Figure]
[Table]
[Figure]
[Table] [Figure]
[Figure] [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
bbox heads.
*Michaelis
), ** Hsieh
, *** Chen et
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 signiﬁcantly boost performance using the large toolboxes which exist for traditional object detection.
4. S TATE - OF - THE - ART ON COCO USING LVIS
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 .
% AP 50 , which can be improved even further to 27 .
4 % AP 50 by using the stronger ResNeXt-101 backbone, outperforming the previous best model by 5 . 4 % AP 50 (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.
both in absolute and relative terms.
Visual inspection of the results (ﬁgure 6) shows cleaner predictions with less false positives especially for difﬁcult reference images.
D ISCUSSION
I 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 signiﬁcantly.
Our experiments outline a path forward, demonstrating that methods that proﬁt 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 overﬁtting.
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 ﬁnd 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%).
5. F UTURE DATASETS SHOULD FOCUS ON THE DIVERSITY OF CATEGORIES .
Our ﬁndings 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 (ﬁgure 5B: green curve above blue curve at any data fraction), while from a certain point onward more examples per category lead to diminishing returns (ﬁgure 5B: green curve ﬂattens 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 overﬁtting on the training categories remains.
The good news is that we don’t see a saturation (ﬁgure 5B: dark blue curves still rise at the maximum number of categories) so further increasing the number of categories should reduce the remaining gap.
5. T HE BIGGER PICTURE
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.
; 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.
; Krizhevsky et al.
(2012) as well as recent results on gameplay Berner et al.
(2019) or language modelling Brown et al.
Recently Kolesnikov et al.
(2019) and Radford et al.
(2021) achieve impressive results demonstrating strong performance at one-shot and zero-shot ImageNet classiﬁcation.
As in our study, simple methods (transfer learning in Kolesnikov et al.
and unsupervised image captioning in Radford et al.
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.
respectively zero Radford et al.
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.
A A PPENDIX A. A DDITIONAL FEW - SHOT RESULTS
We provide ﬁve-shot results for the experiments in ﬁgure 5 in ﬁgure A.1.
[Figure]