Neural Codes for Image Retrieval

Artem Babenko, Anton Slesarev, Alexandr Chigorin, Victor Lempitsky

TL;DR

This paper demonstrates that the internal activations of deep convolutional neural networks (CNNs), dubbed "neural codes," serve as powerful and highly compressible descriptors for image retrieval. By fine-tuning these networks on domain-specific data and applying discriminative dimensionality reduction, the authors achieve state-of-the-art performance for compact global image descriptors.

What Problem Does This Paper Address?

In 2014, deep learning was already transforming image classification, but the field of image retrieval—finding images of the same specific object or scene (e.g., the Eiffel Tower) across a large database—still relied heavily on "shallow" hand-crafted features like SIFT, Fisher Vectors, and VLAD.

The authors set out to answer three critical questions:

  1. Can features learned for general classification (like ImageNet) be "recycled" for specific image retrieval tasks?
  2. Does retraining a network on domain-specific images (like landmarks) significantly boost retrieval accuracy?
  3. How well do these high-dimensional neural activations hold up under extreme compression?

Methods

The researchers utilized a standard CNN architecture (an AlexNet-style model with five convolutional and three fully connected layers) to extract holistic image descriptors.

Fig. 1. The convolutional neural network architecture used on our experiments. Purple nodes correspond to input (an RGB image of size 224 × 224) and output (1000 class labels). Green units correspond to outputs of convolutions, red units correspond to the outputs of max pooling, and blue units correspond to the outputs of rectified linear (ReLU) transform. Layers 6, 7, and 8 (the output) are fully connected to the preceding layers. The units that correspond to the neural codes used in our experiments are shown with red arrows. Stride=4 are used in the first convolutional layer, and stride=1 in the rest.

Key methodological contributions include:

  • Neural Code Extraction: Instead of using the final classification output, they extracted activations from the top layers ($L^5, L^6, L^7$).
  • Domain Adaptation: They retrained the ImageNet-initialized network on two specialized datasets: one for landmarks and one for small household objects.
  • Compression Strategies: They compared standard Principal Component Analysis (PCA) against a discriminative dimensionality reduction approach. The latter learns a projection matrix $W$ specifically designed to minimize the distance between "matching" pairs of images (different views of the same object) while maximizing the distance between non-matches.

Datasets

The study evaluated performance across several industry-standard benchmarks:

  • INRIA Holidays: Vacation photos of various scenes.
  • Oxford Buildings & Oxford 105K: Landmark photos with a large set of "distractor" images.
  • University of Kentucky Benchmark (UKB): Indoor photos of 2,550 different objects.

Additionally, the authors introduced a new Landmarks dataset for retraining, consisting of ~214,000 images across 672 classes, semi-automatically collected via Yandex image search and Wikipedia.

Key Insights and Ideas

  • The "Goldilocks" Layer: Higher isn't always better. The authors found that Layer 6 (the first fully connected layer) generally performed best. Layer 5 is often too focused on low-level textures, while Layer 7 can become too specialized for the original classification task, losing the fine-grained geometric information needed for retrieval.
  • Universality vs. Specificity: Neural codes are remarkably "universal." A network trained to distinguish between breeds of dogs can still do a decent job finding buildings. However, "fine-tuning" on a related domain (e.g., landmarks) provides a massive performance boost.
  • Graceful Degradation: Unlike traditional descriptors (like Fisher Vectors), neural codes are incredibly resilient to compression. You can squash a 4096-dimensional vector down to 128 dimensions with virtually no loss in accuracy.
Fig. 2. A retrieval example on Holidays dataset where Layer 5 gives the best result among other layers, presumably because of its reliance on relatively low-level texture features rather than high level concepts. The left-most image in each row corresponds to the query, correct answers are outlined in green.

Key Results

The quantitative results established neural codes as a new frontrunner for compact descriptors:

  • Retraining Impact: On the Oxford Buildings dataset, retraining on landmarks boosted the mean Average Precision (mAP) of Layer 6 features from 0.435 to 0.545.
  • State-of-the-Art Compactness: When compressed to 128 dimensions, the landmark-retrained neural codes achieved 0.557 mAP on Oxford, outperforming compressed VLAD (0.448) and Triangulation Embedding (0.433).
  • Extreme Compression: Using discriminative reduction, the authors achieved a respectable 0.368 mAP on Oxford using only 16 dimensions.
Quantitative comparison of neural codes against traditional state-of-the-art holistic descriptors.

Limitations and Future Work

  • Resolution Bottleneck: The network requires images to be downsampled to 224x224, which discards fine-grained texture information that could be useful for distinguishing very similar objects.
  • Training Objectives: The authors suggest that training the network directly for retrieval (e.g., using a Siamese architecture) rather than classification might yield even better descriptors.
  • Post-hoc vs. Integrated Compression: While they used post-hoc PCA, they noted that dimensionality reduction could be built directly into the network architecture as a bottleneck layer.

Summary updated

BibTeX
@inproceedings{babenko2014neural,
  author = {Artem Babenko and Anton Slesarev and Alexandr Chigorin and Victor Lempitsky},
  title = {{Neural Codes for Image Retrieval}},
  booktitle = {European Conference on Computer Vision},
  year = {2014},
  doi = {10.1007/978-3-319-10590-1\_38},
}
Figure