Efficient On-the-fly Category Retrieval using ConvNets and GPUs

07/17/2014 ∙ by Ken Chatfield, et al. ∙ University of Oxford 0

We investigate the gains in precision and speed, that can be obtained by using Convolutional Networks (ConvNets) for on-the-fly retrieval - where classifiers are learnt at run time for a textual query from downloaded images, and used to rank large image or video datasets. We make three contributions: (i) we present an evaluation of state-of-the-art image representations for object category retrieval over standard benchmark datasets containing 1M+ images; (ii) we show that ConvNets can be used to obtain features which are incredibly performant, and yet much lower dimensional than previous state-of-the-art image representations, and that their dimensionality can be reduced further without loss in performance by compression using product quantization or binarization. Consequently, features with the state-of-the-art performance on large-scale datasets of millions of images can fit in the memory of even a commodity GPU card; (iii) we show that an SVM classifier can be learnt within a ConvNet framework on a GPU in parallel with downloading the new training images, allowing for a continuous refinement of the model as more images become available, and simultaneous training and ranking. The outcome is an on-the-fly system that significantly outperforms its predecessors in terms of: precision of retrieval, memory requirements, and speed, facilitating accurate on-the-fly learning and ranking in under a second on a single GPU.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 2

page 4

page 7

page 9

page 10

page 12

page 13

page 14

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

On-the-fly learning offers a way to overcome the ‘closed world’ problem in computer vision, where object category recognition systems are restricted to only those pre-defined classes that occur in the carefully curated datasets available for training – for example ImageNet 

[1] for object categories or UCF-101 [2] for human actions in videos. What is more, it offers the tantalising prospect of developing large-scale general purpose object category retrieval systems which can operate over millions of images in a few seconds, as is possible in the specific instance retrieval systems [3, 4, 5, 6, 7] which have reached the point of commercialisation in products such as Google Goggles, Kooaba and Amazon’s SnapTell.

Current on-the-fly systems typically proceed in three stages [8, 9, 10, 11]: first, training data for the user query are compiled, commonly by bootstrapping the process via text-to-image search using e.g. Google Image Search as a source of training images; second, a classifier or ranker is learnt for that category; third, all images/videos in a dataset are ranked in order to retrieve those containing the category. The aim is for these stages to happen on-line in a matter of seconds, rather than hours.

Previous methods for on-the-fly learning have been limited by the retrieval-performance/memory/speed trade off. In particular, very high-dimensional feature vectors were required for state-of-the-art classification performance 

[12, 13, 14], but this incurred both a severe memory penalty (as features for the dataset need to be in memory for fast retrieval) and also a severe speed penalty (as computing a scalar product for high-dimensional features is costly) both in training and ranking. Despite the excellent progress in compression methods for nearest neighbour search by using product quantization [15] or binary encoding [16, 17], compromises still had to be made.

Fig. 1: Live on-the-fly system web frontend. From entering a novel text query to viewing the results page, the entire process takes 1–2 seconds.

In this paper we show that in the context of on-the-fly category retrieval, Convolutional Networks (ConvNets) [18] with GPU training [19] can significantly improve on all three of: retrieval precision, memory requirements, and ranking speed. The whole pipeline, from computing the training image features and learning the model to scoring and ranking the dataset images is implemented on the GPU and runs in a highly-parallel, online manner. We thus demonstrate a system that is able to go from a cold-query to results in a matter of second(s) on a dataset of million(s) of images (some screenshots of our live on-the-fly retrieval system and web frontend are shown in Figure 1).

In terms of retrieval performance, we build on the recent research that shows that deep ConvNet features significantly outperform shallow features, such as Fisher Vectors [13, 12], on the image classification task [19, 20, 21]. However, our contributions go further than simply using ConvNet features in an on-the-fly architecture: we take full advantage of the GPU computation for all retrieval stages, in parallel with downloading the new training images on the CPU. This novel GPU-based architecture allows a time budget to be set, so that an SVM, trained on the available images within the time limit, can be used to (re-)rank the dataset images at any stage of the process (for instance, every s). This architecture is in strong contrast to the standard on-the-fly architectures [8], where SVM training only begins once all training images have been downloaded and processed, and ranking follows after that.

We start by conducting a comprehensive evaluation of the performance of ConvNet-based image features for category-based image retrieval. Given the lack of evaluation data suitable for the assessment of large-scale retrieval performance, we compose our own by taking a standard medium-scale object category recognition benchmark (PASCAL VOC 2007 

[22]) and then optionally adding a large number of distractor images to take the dataset size to 1M+ images. We evaluate over these two datasets under variation in training data – either using VOC training images (i.e. a curated dataset) or using images from Google Image search (i.e. the type of images, possibly with label noise, that will be available for the real-world on-the-fly system). Full details are given in Section 2.

With our goal being ranking of millions of images on a conventional GPU-equipped PC, we then investigate, in Section 3, how retrieval performance is affected by using low-dimensional features (still originating from a ConvNet) over these scenarios. Low-dimensional features (e.g. hundreds of components rather than thousands) have two advantages: they use less memory, and scalar products are faster, both in training and ranking. We cover a spectrum of methods for achieving a low-dimensional descriptor, namely: (i) reducing the dimensionality of the last ConvNet layer; (ii) product quantization of the ConvNet features and (iii) binarization of the ConvNet features. It is shown that a combination of a low-dimensional final ConvNet feature layer with product quantization produces features that are both highly-compact and incredibly performant.

Finally, based on these investigations, we propose a GPU architecture for on-the-fly object category retrieval in Section 4, highly scalable, capable of adapting to varying query complexity and all running on a single commodity GPU.

2 Evaluating Large-scale Object Category Retrieval

This section describes the evaluation protocol used to assess the performance of the image representations described in Section 3 and of the on-the-fly training architecture introduced in Section 4. We begin by describing the datasets used for evaluation, and then describe the three different scenarios in which these datasets are used, with each subsequent scenario moving closer to modelling the conditions experienced by a real-world large-scale object category retrieval system.

One difficulty of evaluating a large-scale object category retrieval system is the lack of large-scale datasets with sufficient annotation to assess retrieval performance fully, in particular to measure recall. The PASCAL VOC dataset [22] provides full annotation for a set of twenty common object classes, facilitating evaluation using common ranking performance measures such as mean average precision (mAP), but is much too small (10k images) to evaluate the performance of a real-world system. Conversely, the ILSVRC dataset [1], while being much larger (1M+ images), does not have complete annotation of all object categories in each image. Therefore, ranking performance (e.g. recall or mAP) cannot be measured without further annotation, and only object category classification metrics (such as top-N classification error per image), which do not accurately reflect the performance of an object category retrieval

scenario, can be used. Additionally, in this work we use the ImageNet ILSVRC-2012 dataset to pre-train the ConvNet, so can not also use that for assessing retrieval performance.

As a result, for evaluation in this paper, we use a custom combination of datasets, carefully tailored to be representative of the data that could be expected in a typical collection of web-based consumer photographs:

Pascal Voc 2007

[22] is used as our base dataset, with assessment over seventeen of its twenty classes (‘people’, ‘cats’ and ‘birds’ are excluded for reasons explained below). We use the provided train, validation and test splits.

Mirflickr-1m

[23, 24] is used to augment the data from the PASCAL VOC 2007 test set in our later experiments, and comprises 1M unannotated images (aside from quite noisy image tags). The dataset represents a snapshot of images taken by popularity from the image sharing site Flickr, and thus is more representative of typical web-based consumer photography than ImageNet, which although also sourced from Flickr was collected through queries for often very specific terms from WordNet. In addition, MIRFLICKR-1M has been confirmed to contain many images of the twenty PASCAL VOC classes.

2.1 Evaluation Protocol

A linear SVM is trained for all classes, and used to rank all images in the target dataset. We are interested in evaluating the performance within an object category retrieval setting, and so measuring the ‘goodness’ of the first few pages of retrieved results is critical. We therefore evaluate using precision @ , where , on the basis that the larger the proportion of true positives for a given object category at the top of a ranked list the better the perceived performance.

Adopting such an evaluation protocol also has the advantage that we are able to use the 1M images from the MIRFLICKR-1M dataset despite the fact that full annotations are not provided. Since we only need to consider the top of the ranked list for each class during evaluation, we take can take a ‘lazy’ approach to annotating the MIRFLICKR-1M dataset, annotating class instances only as far down the ranked list as necessary to generate a complete annotation for the top- results (for more details of this procedure, refer to scenario 2 below). This avoids having to generate a full set of annotation for all 1M images.

2.2 Experimental Scenarios

Fig. 2: Data subsets used for evaluation. Using the example of the object category ‘dog’, the ranked lists used for evaluation in scenarios 2a+2b are compiled by combining the PASCAL VOC data with lazily annotated data from the MIRFLICKR-1M dataset.

2.2.1 Scenario 1: PASCAL VOC.

We train models for seventeen of the twenty VOC object classes (excluding ‘people’, ‘cats’ and ‘birds’) using both the training and validation sets. Following this, a ranked list for each class is generated using images from the test set and precision @ evaluated.

2.2.2 Scenario 2: Large-scale Retrieval.

Training is undertaken in the same manner as scenario 1, but during testing images are added from the MIRFLICKR-1M dataset. There are two sub-scenarios (using different subsets of the test data, summarised in Figure 2).

Scenario 2a –

we test using images from the PASCAL VOC test set (as in scenario 1) with the addition of the entirety of the MIRFLICKR-1M dataset. For each class, we remove all positive class occurrences in the ranked list which are retrieved from the MIRFLICKR-1M dataset using the lazy annotation described in Section 2.3, as the purpose of this scenario is to test how our features perform when attempting to retrieve a small, known number of class occurrences from a very large number of non-class ‘distractor’ images.111The prevalence of the PASCAL VOC classes ‘people’, ‘cats’ and ‘birds’ in the MIRFLICKR-1M data explains why we exclude them, as restricting the annotation of these classes to reasonable levels proved to be impossible.

Scenario 2b –

this time we exclude all images from the PASCAL VOC dataset, and instead evaluate precision @ solely over the MIRFLICKR-1M dataset, lazily annotating the retrieved ranked lists in each case as before. The purpose of this scenario is to test how our features perform over a real-world dataset with unknown statistics. In practice, it is an easier scenario than scenario 2a, since the MIRFLICKR-1M dataset contains many instances of all of the PASCAL VOC classes.

2.2.3 Scenario 3: Google Training.

Testing is the same as in scenario 2b, but instead of using PASCAL data for training, a query is issued to Google Image search for each of the PASCAL VOC classes, and the top images are used in each case as training data. This scenario assesses the tolerance to training on images that differ from the VOC and MIRFLICKR-1M test images: the Google images may be noisy and typically contain the object in the centre. It also mirrors most closely a real-world on-the-fly object category retrieval setting, as the queries in practice do not need to be limited to the PASCAL VOC classes. There are again two sub-scenarios, with different data used for the negative training samples in each case:

Scenario 3a –

the images downloaded from Google Image Search for all other classes, except for the current class, are used as negative training data (this mirrors the PASCAL VOC setup).

Scenario 3b –

a fixed pool of negative training images is used. These training images are sourced from the web by issuing queries for a set of fixed ‘negative’ query terms222miscellanea, random selection, photo random selection, random objects, random things, nothing in particular, photos of stuff, random photos, random stuff, things to both Google and Bing image search, and attempting to download the first results in each case. This same pool of negative training data is also used in Section 4.

2.3 Dataset Ground Truth Preparation

As described in Section 2.2, we use a combination of the PASCAL VOC 2007 dataset and MIRFLICKR1M dataset for evaluation. MIRFLICKR1M does not come with any annotation, apart from noisy flickr image tags, and so we add our own annotations for the twenty PASCAL VOC classes.

Despite the dataset containing 1M images, we can get away with annotating far less than this number given our chosen evaluation metric, precision @

with , which only requires the ground truth for the first items in the ranked list of each target class to compute. We therefore adopt a ‘lazy’ approach to annotation using our result ranked lists as a starting point.

The evaluation set (and thus the meaning of the ‘first images’) is different for each scenario, as shown in Figure 1 of the paper. Therefore, given any raw ranked list for class (which is a combination of results from both the PASCAL VOC and MIRFLICKR1M datasets) it suffices to annotate images which fall within the following ranges:

  • For Scenario 2a – the top images from: the PASCAL VOC dataset combined with all images from MIRFLICKR1M annotated as negative for the target class (these are ‘distractors’)
    excluding annotated positives for class from MIRFLICKR1M.

  • For Scenario 2b/3 – the top images from the MIRFLICKR1M dataset
    excluding all PASCAL VOC images.

The annotations we make for any particular method/scenario should be stored so that images do not need to be annotated more than once for different methods. We developed a web-based annotation tool to facilitate this processwhich allows positive annotations for a class to be shared across both methods and scenarios.

In total, 46,770 images from the MIRFLICKR1M dataset were annotated, with an average of annotations per class. These annotations will be made publicly available.

3 Retrieval Performance over Image Representations

In this section, we perform an evaluation of recent state-of-the-art image representations for the object category retrieval scenarios described in Section 2.2.

ConvNet-based features, which form the basis of our on-the-fly system described in Section 4, have been shown to perform excellently on standard image classification benchmarks such as PASCAL VOC and ImageNet ILSVRC [20, 25] [21, 26]. We therefore focus our evaluation on these features, employing 2048-dimensional ‘CNN M 2048’ image features of [21] as the baseline. We compare them to a more traditional shallow feature encoding in the form of the Improved Fisher Vector (IFV) [13]. Implementation details for ConvNets and IFV are given in Section 3.2. We explore the effects of reducing the dimensionality of our features on their retrieval performance using the following methods:

Lower-dimensional ConvNet output layer –

One way of reducing the dimensionality of ConvNet features consists in retraining the network so that the last fully-connected (feature) layer has a lower dimensionality. Following [21], we consider the ‘CNN M 128’ network configuration with a 128-dimensional feature layer. Using such network in place of the baseline ‘CNN M 2048’ can be seen as discriminative dimensionality reduction by a factor of 16.

Product quantization (PQ)

has been widely used as a compression method for image features [15, 27], and works by splitting the original feature into -dimensional sub-blocks, each of which is encoded using a separate vocabulary of cluster centres pre-learned from a training set. Here we explore compression using -dimensional sub-blocks.

Binarization

is performed using the tight frame expansion method of [28], which has been recently successfully applied to local patch and face descriptors [29, 30]. The binarization of zero-centred descriptors to binary codes is performed as follows:

(1)

where is the sign function: iff and otherwise, and the Parseval tight frame is computed by keeping the first

columns of an orthogonal matrix, obtained from a QR-decomposition of a random

matrix.

3.1 Results and Analysis

Fig. 3: Sample precision-rank curves and retrieved results for two queries ‘sheep’ and ‘motorbike’ over the combined VOC+MIRFLICKR data (Scenario 2a).

The results for all three experimental scenarios are presented in Table I. We discuss the results for each scenario below.

3.1.1 Scenario 1 (VOC Train/VOC Test).

The PASCAL VOC dataset does not pose any major challenges for any of our features, which is not surprising given the close to decade of research on representations which perform well on this dataset. Even for the most challenging classes (e.g. ‘potted plant’) IFV produces fairly good results, with the top 12 images being true positives (Prec @ 100 = 0.58), and the top 92 images being true positives in the case of our 2048-dimensional ConvNet features (Prec @ 100 = 0.83).

3.1.2 Scenario 2a (VOC Train/VOC+distractors Test).

Adding 1M distractor images from the MIRFLICKR-1M dataset has a significant impact on the results, with the task now being to retrieve true positives that constitute less than of the dataset. This is a more challenging scenario, and under this setting the superior performance of the ConvNet-based features, when compared to the state-of-the-art shallow representation (IFV), is much clearer to see. Some sample precision-rank curves for two queries, one particularly challenging (‘sheep’) and another less so (‘motorbike’) are shown in Figure 3. We can make the following observations:

IFV Performance –

It can be seen that IFV (I in Table I) performs the worst of all methods, despite being much higher dimensional () and taking much longer to compute () compared to our CNN-128 method (I). Nonetheless, even for challenging classes such as ‘sheep’ IFV manages to pull out a few true positives at the top of the ranked list. However, the relative performance drop with rank is much sharper than with the ConvNet-based methods.

Bursty Images –

comparing the top-ranked negatives of the FK-512 method (I) for ‘sheep’ to those of the CNN-2048 method (I), it can be seen that IFV appears to mistakenly rank highly ‘bursty’ images comprising repeating patterns or textures. This phenomenon is particularly evident for natural, outdoor scenes which explains why the performance drop of IFV is particularly severe in the ‘sheep’, ‘cow’ and ‘horses’ classes, as it appears that the ConvNet-based features are much more robust to such textured images, although the use of heavy PQ compression (e.g. the CNN-128-PQ-8 method I) starts to show some deterioration as a consequence of the retrieval of a smaller number of similarly ‘bursty’ images.

center VOC Only Large-scale Retr. Google Training Scenario [1] [2a] [2b] [3a] [3b] (a) FK 512 82.3 29.3 80.5 (b) CNN 2K 92.1 55.4 95.4 88.5 90.9 (c) CNN 2K PQ 90.7 55.1 96.4 88.2 91.9 (d) CNN 128 92.1 51.0 95.1 88.1 92.3 (e) CNN 128 noaug 88.8 45.4 93.1 87.1 91.1 (f) CNN 128 BIN 2K 91.5 52.3 94.0 89.6 (g) CNN 128 BIN 1K 90.0 50.1 94.0 89.5 (h) CNN 128 PQ 90.1 50.5 94.6 88.2 92.1 (i) CNN 128 PQ-8 88.8 47.4 93.1 87.7 91.1

TABLE I: Retrieval results (Mean Prec @ 100) for the evaluation scenarios described in section 2.2.
Diversity –

The diversity of the retrieved results is also much greater for ConvNet-based representations than for IFV, indicating that the classifier is able to make better generalisations using these features. For example, as seen in Figure 3, whereas the top four retrieved results for the query ‘motorbike’ for the FK-512 method (I) all show a rider in a similar pose, on a racing bike on a race track, the top four retrieved results for the CNN-2048 method (I) depict a variety of different motorcycles (road, racing, off-road) from several different angles.

For the most part, compression of the ConvNet features does not appear to reduce their diversity appreciably, with the top-ranked results for all ConvNet methods, whether compressed or not, appearing to exhibit a similar diversity of results.

Compression –

As mentioned above, the drop in performance in moving from ConvNet-based features to IFV is much greater than that incurred by any of the compression methods, and this seems to be strongly connected with the robustness of the ConvNet-based features, whether compressed or not, to the kind of ‘bursty’ textured images which IFV is susceptible to. This is remarkable given that comparing the size of the largest uncompressed ConvNet representation CNN-2048 (I) to the smallest PQ-compressed one, CNN-128-PQ-8 (I), there is a size difference. In the case of the CNN-128-BIN-2K method (I), the mPrec @ 100 actually increases marginally when compared to the non-compressed codes (I) which, when visually inspecting the rankings, again can be explained by the additional robustness brought by compression.

center Dim Compression New Dim Storage Comp. Time (bytes) / 1M ims. / im (s) (a) 83,968 312.8 GB 10.32 (b) 2048 7.63 GB 0.35 (0.061) (c) 2048 PQ 4 dims/sq (16) 512 488 MB + 0.061 (d) 128 488 MB 0.34 (0.061) (e) 128 noaug 488 MB 0.083 (0.024) (f) 128 BIN 2048 dims (64) 8 (2048 bits) 7.63 MB + 0.38 ms (g) 128 BIN 1024 dims (128) 4 (1024 bits) 3.81 MB + 0.22 ms (h) 128 PQ 4 dims/sq (16) 32 30.5 MB + 3.9 ms (i) 128 PQ 8 dims/sq (32) 16 15.3 MB + 2.0 ms

TABLE II: Dimensionality, storage requirements and computation time for all image representations. The rows in this table correspond to those in Table I. Timings for compression methods are specified as additional time added to the total feature encoding time, and those in parenthesis indicate GPU timings where applicable.

Fig. 4: Difference between retrieved results when training using VOC data and Google training data. Results are shown over the MIRFLICKR-1M dataset (Scenarios 2b and 3b).

The binary representations (I & I), combined with a linear SVM, also exhibit competitive performance despite a memory footprint lower even than the PQ-compressed codes. The ranking of such features can also be significantly sped-up using hardware-accelerated Hamming distance computation. Nonetheless, the use of binary features requires a different ranking model, and so its application is left for future work. The fact that the ConvNet features are very sparse, with the CNN-128 representation typically being over zeros, is one reason why they are so amenable to compression, and it is possible that with compression methods geared specifically to capitalise on this sparsity even higher compression ratios could be achieved.

3.1.3 Scenario 2b (VOC Train/MIRFLICKR Test).

Given that the MIRFLICKR-1M dataset contains many instances of all of the PASCAL VOC classes, moving to testing solely on MIRFLICKR leads to a jump in performance of the results across all methods. Nonetheless, this scenario provides a closer representation of the performance of a real-world on-the-fly object category retrieval system, given that the image statistics of the MIRFLICKR-1M dataset are not known in advance.

3.1.4 Scenario 3a (Google Train/MIRFLICKR Test).

Switching to noisy training images from Google rather than the pre-curated PASCAL VOC training images as expected results in a small drop () across the board for all methods. However, the precision at the top of the ranking remains subjectively very good. Nonetheless, as shown in Figure 4, the actual images returned from the dataset are very different, which reflects the differences in the training data sourced from Google Image search versus that from the curated dataset. For example, a query for ‘chair’ returns predominantly indoor scenes with regular dining-table chairs when using VOC training data, and more avant-garde, modern designs, generally centred in the frame when using Google training data.

3.1.5 Scenario 3b (Google Train + negative pool/MIRFLICKR Test).

In this scenario, we switch to using a fixed pool of negative data sourced from a set of ‘negative’ queries, and it can be seen how this improves the results by up to . This may be a result of the larger negative training pool size ( images vs. images when using queries for all other VOC classes to provide the negative data as we do in Scenario 3a). Given the assumed lack of coverage in the fixed negative image pool (as it is sourced by issuing queries for deliberately non-specific terms to facilitate its application to as broad a range of queries as possible), this suggests that to a certain extent lack of diversity can be made up for by using a larger number of negative training images.

3.2 Implementation Details

Our implementation of IFV and ConvNet image representations follows that of [21]. In more detail, for IFV computation we use their setting ‘FK IN 512 (x,y)’, which corresponds to: (i) dense rootSIFT [31] local features with spatial extension [32], extracted with 3 pixel step over 7 scales ( scaling factor); (ii) Improved Fisher vector encoding [13] using a GMM codebook with 512 Gaussians; (iii) intra normalisation [33] of the Fisher vector.

Our ConvNet training and computation framework is based on the publicly available Caffe toolbox 

[34]. The two ConvNet configurations, considered in this paper (‘CNN M 2048’ and ‘CNN M 128’) are pre-trained on the ImageNet ILSVRC-2012 dataset using the configurations described in [21]333http://www.robots.ox.ac.uk/~vgg/software/deep_eval/

. Namely, they contain 5 convolutional and 2 fully-connected layers, interleaved with rectification non-linearities and max-pooling. The stack of layers is followed by a 1000-way soft-max classifier, which is removed after pre-training is finished (turning a ConvNet from an ImageNet classifier to a generic image descriptor). The only difference between the two ConvNets is the dimensionality of the second fully-connected layer, which is 2048 for ‘CNN M 2048’ and 128 for ‘CNN M 128’.

In order to provide a similar setup to our on-the-fly architecture in Section 4, which uses a linear predictor

learnt using SVM hinge loss and a quadratic regulariser, as our learning stage we use a standard linear support vector machine implementation. The

parameter is determined using the VOC validation set for scenario 1, and fixed at 0.25 for all other experiments.

4 On-the-fly Architecture

Fig. 5: Architecture of our on-the-fly object category retrieval system. The entire framework aside from the image downloader is resident on the GPU, with data stored in GPU memory outlined in green. Its operation is split into two stages: (i) iterative training, as initiated by a user text query and (ii) periodic model testing to obtain a ranking over the target dataset (refer to the text for further details).

Having evaluated various image representations in Sect. 3, we now describe the architecture of the object category retrieval system, which fully exploits the advantages of ConvNet image representations. From the user experience point of view, the main requirement to our system is instant response: the first ranking of the repository images should be obtained immediately (in under a second), with a potential improvement over time. This dictates the following design choice: downloading the training images from the Internet should be carried out in parallel with training a model on the already downloaded images in the on-line fashion. As a result, at any point of time, the current model can be used to perform ranking of the dataset images.

For this approach to work, however, image representation should satisfy the following requirements: (i) highly discriminative, so that even a handful of training samples are sufficient to learn a linear ranking model; (ii) fast-to-compute, to maximise the amount of training data processed within the allocated time budget; (iii) low memory footprint, to allow for storing large-scale datasets in the main memory, and ranking them efficiently. As has been demonstrated in Sect. 3, a ConvNet image representation is a perfect match for these requirements. Indeed, pre-training on a large image collection (ImageNet) leads to highly discriminative representation, and even a few training samples are sufficient for training an accurate linear model; ConvNet features can be computed very quickly on the highly-parallel GPU hardware; they have low dimensionality (even without PQ compression) and can be instantly scored using a linear model on the GPU.

Our on-the-fly architecture is illustrated in Fig. 5. It is divided into the CPU-based front-end (which controls the graphical user interface and downloads the training images from the Internet) and the GPU-based back-end, which continually trains the ranking model on the downloaded images and periodically applies it to the repository. The category retrieval is carried out as follows.

Off-line (pre-processing). To allow for fast processing, the ConvNet features for the target dataset images are pre-computed off-line, using the CNN-128 architecture. We also prepare the fixed negative image pool for all queries by issuing our negative pool queries (see Section 2.2) to both Bing and Google image search, and downloading the returned URLs. The negative image feature features are also pre-computed. The memory requirements for storing the pre-computed features are as follows: 488 MB for the MIRFLICKR-1M dataset and 78 MB for the pool of 16K negative features. It is thus feasible to permanently store the features of both negative and dataset images in the high-speed GPU memory even without compression of any kind (a consumer-grade NVIDIA GTX Titan GPU, used in our experiments, is equipped with 6GB RAM). As noted in Section 2, the ConvNet features can be compressed further by up to using product quantization without significant degradation in performance, making datasets of up to 160M images storable in GPU memory, setting 1GB aside for storage of the model (compared to 10M images without compression), and more if multiple GPUs are used. Many recent laptops are fitted with a GPU containing similar amounts of memory, making our system theoretically runnable on a single laptop. Furthermore, whilst storing the target repository on the GPU is preferable in terms of the ranking time, in the case of datasets of 1B+ images, it can be placed in the CPU memory, which typically has larger capacity.

On-line (CPU front-end). Given a textual query, provided by a user (e.g. in a browser window), the front-end starts by downloading relevant images, which will be used as positive samples for the queried category and fed to the GPU back-end. At regular time intervals, the front-end receives a ranked list of dataset images from the back-end, and displays them in the user interface.

On-line (GPU back-end). The GPU back-end runs in parallel with the front-end, and is responsible for both training the ranking model and applying it to the dataset. Training an -regularised linear SVM model is carried out using the mini-batch SGD with Pegasos updates [35]: at iteration , the learning rate is , where is the -norm regularisation constant, set to in our experiments. Each batch contains an equal amount of positive and negative samples; the total batch size was set to in our experiments. The training commences as soon as the first positive image has been downloaded and is received from the front-end, after which random crops are taken each iteration from the pool of positive training images downloaded so far. The front-end in the meantime will continue downloading new images from the Internet, constantly increasing the size of the positive image pool and the diversity of the extracted crops. We note that while the positive image features need to be computed on-the-fly, this is very quick in the case of ConvNets. Ranking takes place using the current SVM model every seconds (we used ). As mentioned above, the pre-computed dataset features are pre-stored on a GPU, so the scores for 1M images are computed in s. The 1M scores are then ranked (also on GPU, s) and the list of the top-ranked images is passed to the front-end to be displayed to the user. All components of the GPU back-end are implemented within the same framework, derived from Caffe [34].

4.1 System Performance

                    

Fig. 6: Precision @ 100 against training time for four queries using our on-the-fly architecture. The number of images in the dynamically expanding positive image training pool over time is also marked on the plot. The top-4 returned images for the ‘sheep’ query at the first four time-steps (up to 0.73s) is shown to the right. False positives are outlined in red, and new images in the top-4 at each time step are outlined in blue. Even for this moderately challenging query, the model settles in under a second.

In order to evaluate the real-world performance of the system, we ran queries for several PASCAL VOC classes and tracked how the performance (measured in terms of Precision @ 100) evolved over time. To simulate the latency introduced by downloading images from the Internet, we limited the rate of positive images entering the network to 12 images/second (which is what we found to be a typical average real-world rate on our test system). These images were sampled randomly from the top-50 image URLs returned from Google Image search.

The results of these experiments for four classes are shown in Figure 6. Even for some of the most challenging PASCAL VOC classes ‘sheep’ and ‘softa’, the performance converged to its final value in seconds, and as can be seen from the evolving ranking at each time-step the ordering at the top of the ranking generally stabilizes within a second, showing a good diversity of results. For easier classes such as ‘aeroplane’, convergence and stabilization occurs even faster.

In real terms, this results in a typical query time for our on-the-fly architecture, from entering the text query to viewing the ranked retrieved images, of 1–2 seconds and often less to complete convergence and stabilization of results. However, one of the advantages of our proposed architecture is that it is adaptable to differing query complexity, and we can return good results early whilst still continuing to train in the background if necessary, exposing the classifier to an expanding pool of training data as it is downloaded from the web and updating the ranked list on-the-fly.

4.2 Impact of Training Image Count

Fig. 7: Evolution of performance with increasing number of positive training images. Results are presented for two of the queries presented in Section 4 of the paper. (a) shows the performance (measured as Prec @ 100), (b) the number of new true positives entering the ranking (top 100) as the number of training images increases, (c) shows the minimum initial ranking position of any of those true positives, (d) shows the head of the ranked list after N=1..5 images have been added, and (e) shows the mean change in ranking position for all images in the top 100.

In this section, we present further more detailed analysis of the changes that occur as more training images are fed into the network, to supplement those described above for the two most challenging classes ‘sheep’ and ‘sofa’. The motivation is to determine the role of the size of the positive training image pool in the performance of the system. Note that to this end the experimental setup is slightly different to the previous section, as after inputting each training image into the system we waited for the output classifier to stabilize. We analyse the impact on each class in turn, referring to Figure 7.

Considering first the ‘sheep’ class, with only a single training image 70% of the final performance (as measured by precision @ 100) is reached, and the top of the ranked list contains many sheep. However, most of the highly ranked images are of horned sheep, suggestive of the bias introduced by training only on a single image. As the number of training images is increased to 2, the top-ranked images become much more diverse, with this translating into a further final small jump in performance as the third training image is fed into the network.

The ‘sofa’ class provides an example of how the architecture deals with a more challenging query, with a larger degree of intra-class appearance variation. In this case, a single training image clearly does not suffice, as the ranked list returned for a single training image has performance close to random, with no sofas retrieved. However, this very quickly changes as a second image is fed into the network, with 35 new true positives entering the top 100. Following this exposure, the top retrieved images are greatly improved, mostly being of sofas. Feeding five images into the network yields a further modest increase in diversity at the top of the ranked list.

In both cases, for this dataset any new true positives introduced to the top 100 after the introduction of the third or fourth training images have a very high initial position () and the mean change in ranking position is very low () suggesting that a coarse model can be trained with relatively few images, and improvements after this time predominantly effect the tail of the ranked list. This suggests that even when initially a very small number of training images are available, a user interface where the head of the ranked list is presented to the user almost immediately (trained on the small amount of training data which is available) whilst training continues in the background to refine the tail of the ranked results is possible. Such a restriction does not apply in our case, since as mentioned in Section 4.1 in general we have 30+ training images available to us within a few seconds of launching a query.

4.3 Novel On-the-fly Queries

Fig. 8: Sample results for queries outside of the twenty PASCAL VOC classes. False positives are outlined in red.

Although experimental results have thusfar only been presented for the PASCAL VOC classes, the advantage of an on-the-fly architecture is that no limitation is imposed on the object categories which can be queried for, as a new classifier can be trained on demand (in our case using Google Image search as a ‘live’ source of training data). We present some additional selected results of the on-the-fly system in Figure 

8, using the same setup as in Scenario 3b and query terms disjunct from the twenty PASCAL VOC classes to test its performance for such novel on-the-fly queries. It can be seen that the architecture is very much generalisable to query terms outside of the PASCAL category hierarchy.

Some queries such as ‘lion’ were particularly challenging for shallow feature representations such as Fisher Kernel, due to the repeating thick fur pattern and bushes present in many of the training images retrieving a large number of the bursty images described in Section 3.1. However, ConvNet-based features appear to be much more robust to this effect, with precision @ 100 of 1.0. The architecture is also capable of returning more abstract concepts such as ‘cityscape’ or ‘forest’ in addition to more concrete objects such as ‘cake’ and ‘truck’ (shown in the figure).

Finally, even when querying MIRFLICKR1M for the relatively obscure ‘capybara’ (Figure 8), the returned false positives all fit within a tight configuration of classes of very similar appearance (‘otter’, ‘squirrel’, ‘meercat’) and, of course, the composition of the MIRFLICKR1M dataset is unknown, so it could be that there are very few images of ‘capybara’ in the dataset.

5 Conclusion

In this paper we have presented a system for on-the-fly object category retrieval, which builds upon the recent advances in deep convolutional image representations. We demonstrated how such representations can be efficiently compressed and used in a novel incremental learning architecture, capable of retrieval across datasets of 1M+ images within seconds and running entirely on a single GPU.

For larger datasets the CPU, or multiple GPU cards, could be employed for ranking once the classifier has been learnt on the GPU. Along with further investigation of how the diversity of the ranked results changes over time, this is the subject of future work.

Acknowledgements

This work was supported by the EPSRC and ERC grant VisRec no. 228180. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the GPUs used for this research.

References

  • [1] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei, “Imagenet: A large-scale hierarchical image database,” in Proc. CVPR, 2009.
  • [2] K. Soomro, A. R. Zamir, and M. Shah, “UCF101: A dataset of 101 human actions classes from videos in the wild,” CoRR, vol. abs/1212.0402, 2012.
  • [3] J. Sivic and A. Zisserman, “Video Google: A text retrieval approach to object matching in videos,” in Proc. ICCV, vol. 2, 2003, pp. 1470–1477.
  • [4] D. Nister and H. Stewenius, “Scalable recognition with a vocabulary tree,” in Proc. CVPR, 2006, pp. 2161–2168.
  • [5] J. Philbin, O. Chum, M. Isard, J. Sivic, and A. Zisserman, “Object retrieval with large vocabularies and fast spatial matching,” in Proc. CVPR, 2007.
  • [6] H. Jégou, M. Douze, and C. Schmid, “Hamming embedding and weak geometric consistency for large scale image search,” in Proc. ECCV, 2008, pp. 304–317.
  • [7] H. Jégou, M. Douze, C. Schmid, and P. Pérez, “Aggregating local descriptors into a compact image representation,” in Proc. CVPR, 2010.
  • [8] K. Chatfield and A. Zisserman, “Visor: Towards on-the-fly large-scale object category retrieval,” in Proc. ACCV, ser. Lecture Notes in Computer Science.   Springer, 2012.
  • [9] B. Fernando and T. Tuytelaars, “Mining multiple queries for image retrieval: On-the-fly learning of an object-specific mid-level representation,” in Proc. ICCV, 2013.
  • [10] Y. Liu, D. Xu, I. W. Tsang, and J. Luo, “Using large-scale web data to facilitate textual query based retrieval of consumer photos,” in Proceedings of the 17th ACM International Conference on Multimedia, ser. MM ’09, 2009, pp. 55–64.
  • [11] O. M. Parkhi, A. Vedaldi, and A. Zisserman, “On-the-fly specific person retrieval,” in International Workshop on Image Analysis for Multimedia Interactive Services.   IEEE, 2012.
  • [12] K. Chatfield, V. Lempitsky, A. Vedaldi, and A. Zisserman, “The devil is in the details: an evaluation of recent feature encoding methods,” in Proc. BMVC., 2011.
  • [13] F. Perronnin, J. Sánchez, and T. Mensink, “Improving the Fisher kernel for large-scale image classification,” in Proc. ECCV, 2010.
  • [14] F. Perronnin, Z. Akata, Z. Harchaoui, and C. Schmid, “Towards good practice in large-scale learning for image classification,” in Proc. CVPR, 2012, pp. 3482–3489.
  • [15] H. Jégou, M. Douze, and C. Schmid, “Product quantization for nearest neighbor search,” IEEE PAMI, 2011.
  • [16]

    A. Torralba, R. Fergus, and W. T. Freeman, “80 million tiny images: a large dataset for non-parametric object and scene recognition,”

    IEEE PAMI, 2008.
  • [17] M. Raginsky and S. Lazebnik, “Locality sensitive binary codes from shift-invariant kernels,” in NIPS, 2009.
  • [18] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based learning applied to document recognition,” Proceedings of the IEEE, vol. 86, no. 11, pp. 2278–2324, 1998.
  • [19]

    A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet classification with deep convolutional neural networks,” in

    NIPS, 2012, pp. 1106–1114.
  • [20] M. D. Zeiler and R. Fergus, “Visualizing and understanding convolutional networks,” CoRR, vol. abs/1311.2901, 2013.
  • [21] K. Chatfield, K. Simonyan, A. Vedaldi, and A. Zisserman, “Return of the devil in the details: Delving deep into convolutional nets,” in Proc. BMVC., 2014.
  • [22] M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman, “The PASCAL Visual Object Classes (VOC) challenge,” IJCV, vol. 88, no. 2, pp. 303–338, 2010.
  • [23] M. J. Huiskes and M. S. Lew, “The mir flickr retrieval evaluation,” in MIR ’08: Proceedings of the 2008 ACM International Conference on Multimedia Information Retrieval, 2008.
  • [24] M. J. Huiskes, B. Thomee, and M. S. Lew, “New trends and ideas in visual concept detection: The mir flickr retrieval evaluation initiative,” in MIR ’10: Proceedings of the 2010 ACM International Conference on Multimedia Information Retrieval, 2010, pp. 527–536.
  • [25] J. Donahue, Y. Jia, O. Vinyals, J. Hoffman, N. Zhang, E. Tzeng, and T. Darrell, “Decaf: A deep convolutional activation feature for generic visual recognition,” CoRR, vol. abs/1310.1531, 2013.
  • [26] A. Razavian, H. Azizpour, J. Sullivan, and S. Carlsson, “CNN Features off-the-shelf: an Astounding Baseline for Recognition,” CoRR, vol. abs/1403.6382, 2014.
  • [27] J. Sánchez and F. Perronnin, “High-dimensional signature compression for large-scale image classification,” in Proc. CVPR, 2011.
  • [28] H. Jégou, T. Furon, and J.-J. Fuchs, “Anti-sparse coding for approximate nearest neighbor search,” in Proc. ICASSP, 2012, pp. 2029–2032.
  • [29] K. Simonyan, A. Vedaldi, and A. Zisserman, “Learning local feature descriptors using convex optimisation,” IEEE PAMI, 2014.
  • [30] O. M. Parkhi, K. Simonyan, A. Vedaldi, and A. Zisserman, “A compact and discriminative face track descriptor,” in Proc. CVPR.   IEEE, 2014.
  • [31] R. Arandjelović and A. Zisserman, “Three things everyone should know to improve object retrieval,” in Proc. CVPR, 2012.
  • [32] J. Sánchez, F. Perronnin, and T. Emídio de Campos, “Modeling the spatial layout of images beyond spatial pyramids,” Pattern Recognition Letters, vol. 33, no. 16, pp. 2216–2223, 2012.
  • [33] R. Arandjelović and A. Zisserman, “All about VLAD,” in Proc. CVPR, 2013.
  • [34]

    Y. Jia, “Caffe: An open source convolutional architecture for fast feature embedding,”

    http://caffe.berkeleyvision.org/, 2013.
  • [35]

    S. Shalev-Shwartz, Y. Singer, and N. Srebro, “Pegasos: Primal estimated sub-gradient SOlver for SVM,” in

    Proc. ICML, vol. 227, 2007.