Joint Spatial and Layer Attention for Convolutional Networks

Tony Joseph, Konstantinos G. Derpanis, Faisal Z. Qureshi

TL;DR

This paper introduces a novel "layer-spatial attention" mechanism for Convolutional Neural Networks (CNNs) that dynamically selects both the most informative CNN layers and specific spatial regions within those layers to process. This approach significantly improves performance on challenging computer vision tasks like 6-DoF camera localization and indoor scene classification by allowing the network to intelligently focus its computational resources.

What Problem Does This Paper Address?

Traditional Convolutional Neural Networks (CNNs) process information through a fixed, hierarchical sequence of layers. While deeper layers capture more abstract features, and earlier layers retain finer spatial details, the optimal features for a given task might be distributed across various levels of abstraction and spatial locations. Prior methods often relied on manually selecting a single, typically high-level, feature layer for downstream tasks. This paper addresses the limitation of this fixed layer selection by proposing an attention mechanism that can dynamically choose which CNN layers and which spatial regions within those layers are most relevant for the task at hand, mimicking human visual attention more closely.

Methods

The core innovation is a joint layer-spatial attention mechanism integrated into a CNN architecture. This mechanism operates sequentially over a fixed number of steps, managed by a Convolutional LSTM (Conv-LSTM).

  • Layer Attention ("What"): At each step, a discrete selection mechanism chooses which CNN layer to attend to. This is implemented using a Gumbel-Softmax distribution, which allows for end-to-end training of this discrete selection process. The goal is to identify the layer that contains the most salient information for the current task.
  • Spatial Attention ("Where"): Once a layer is selected, a soft attention mechanism is applied to pinpoint specific spatial regions within that layer's feature map. This is adapted from existing work on visual attention for image captioning, but here it's integrated with the layer selection.
  • Conv-LSTM Integration: The Conv-LSTM acts as the sequential controller, aggregating information from the attended layers and spatial locations over multiple time steps. The hidden states from each step are then concatenated and used for the final prediction (regression or classification).

The authors use GoogLeNet as the base CNN for feature extraction and augment it with their attention modules.

Datasets

The proposed method was evaluated on standard benchmarks for two tasks:

  • 6-DoF Camera Localization:
    • Cambridge Landmarks
    • 7-Scenes
    • TUM Munich Large-Scale Indoor (TUM-LSI)
  • Indoor Scene Classification:
    • MIT-67 Indoor Scenes

Key Insights and Ideas

  • Task-dependent feature selection is crucial: The optimal features for different tasks (and even different instances within a task) are not static and can be found across various levels of feature abstraction and spatial locations.
  • Layer and spatial attention are complementary: Combining both "what" (layer) and "where" (spatial) attention mechanisms leads to superior performance compared to using either alone or relying on manually selected layers.
  • Dynamic attention mimics human vision: The sequential probing of layers and spatial regions is inspired by human visual processing, suggesting this approach can lead to more robust and efficient visual understanding.
  • Gumbel-Softmax enables end-to-end training of discrete choices: This technique is key to learning which CNN layers to attend to without requiring explicit supervision for layer selection.

Key Results

  • Camera Localization: The proposed method achieved significant improvements over state-of-the-art baselines, reducing median error by 12.3% to 25.1% for position and 1.79% to 13.9% for orientation across various datasets. For example, on TUM-LSI, it reduced the median error by 25.1% for position and 1.79% for orientation compared to LSTM-PoseNet.
  • Indoor Scene Classification: The approach improved mean accuracy by 3.4% over the baseline on the MIT-67 dataset.
  • Qualitative Results: Visualizations show that the attention mechanism effectively captures both low-level (e.g., corners, textures) and high-level (e.g., objects, scene structures) features relevant to the tasks.

Limitations and Future Work

  • Computational Cost: While the attention mechanism dynamically focuses resources, the sequential nature of the Conv-LSTM and the need for multiple feature embeddings can increase computational overhead compared to a single-pass CNN. The authors note that selecting a sparse set of layers is a practical choice to manage training time.
  • Generalizability: The authors suggest that their attention approach is general and could be useful for other vision tasks beyond localization and classification.
  • Further Exploration: The paper mentions that using different base CNN architectures could potentially yield further improvements, but the focus was on demonstrating the efficacy of their attention mechanism. The ablation studies also hint at the importance of the number of Conv-LSTM steps for optimal performance on different tasks.

Summary updated

Abstract

In this paper, we propose a novel approach that learns to sequentially attend to different Convolutional Neural Networks (CNN) layers (i.e., ``what'' feature abstraction to attend to) and different spatial locations of the selected feature map (i.e., ``where'') to perform the task at hand. Specifically, at each Recurrent Neural Network (RNN) step, both a CNN layer and localized spatial region within it are selected for further processing. We demonstrate the effectiveness of this approach on two computer vision tasks: (i) image-based six degree of freedom camera pose regression and (ii) indoor scene classification. Empirically, we show that combining the ``what'' and ``where'' aspects of attention improves network performance on both tasks. We evaluate our method on standard benchmarks for camera localization (Cambridge, 7-Scenes, and TUM-LSI) and for scene classification (MIT-67 Indoor Scenes). For camera localization our approach reduces the median error by 18.8\% for position and 8.2\% for orientation (averaged over all scenes), and for scene classification it improves the mean accuracy by 3.4\% over previous methods.
BibTeX
@inproceedings{joseph2019joint,
  author = {Tony Joseph and Konstantinos G. Derpanis and Faisal Z. Qureshi},
  title = {{Joint Spatial and Layer Attention for Convolutional Networks}},
  booktitle = {BMVC},
  year = {2019},
  url = {https://openreview.net/forum?id=v5SEjNu99M},
}
Figure