D2-Net: A Trainable CNN for Joint Detection and Description of Local Features

Mihai Dusmanu, Ignacio Rocco, Tomás Pajdla, Marc Pollefeys, Josef Sivic, Akihiko Torii, Torsten Sattler

TL;DR

This paper introduces D2-Net, a novel convolutional neural network (CNN) that jointly detects and describes local features in images. By unifying these two tasks within a single network and postponing detection to a later stage, D2-Net achieves state-of-the-art performance in challenging scenarios like day-night image matching and indoor visual localization, outperforming traditional methods.

What Problem Does This Paper Address?

Establishing reliable pixel-level correspondences between images is a fundamental problem in computer vision, crucial for applications like 3D reconstruction, visual localization, and image retrieval. Traditional methods often rely on a "detect-then-describe" pipeline, where a feature detector identifies interest points (keypoints) based on low-level image structures (like corners or blobs), and then a separate process extracts descriptors for these keypoints. This approach struggles under difficult imaging conditions, such as drastic illumination changes or in scenes with repetitive textures, because the low-level features used by detectors are highly sensitive to these variations, leading to unstable keypoint detections. While dense descriptor extraction can improve robustness, it comes at a significant cost in terms of matching speed and memory. This paper aims to bridge this gap by developing a sparse feature method that is both robust to challenging conditions and efficient.

Methods

The core innovation of D2-Net is its "describe-and-detect" approach, implemented using a single CNN. Instead of a two-stage pipeline, D2-Net extracts dense feature maps from an input image using a CNN. These feature maps serve a dual purpose:

  • Description: Slices through the feature maps at a specific pixel location are used as local descriptors. These descriptors are L2-normalized for comparison.
  • Detection: The feature maps are interpreted as detection response maps. Detections are made by identifying local maxima across these maps, but crucially, this process is designed to be trainable and back-propagatable.

To enable training, a "soft" detection mechanism is introduced, involving soft local-maximum scores and channel selection scores. These are combined to produce a soft detection score for each pixel. The training loss is a joint formulation that optimizes both descriptor distinctiveness (using a triplet margin ranking loss) and keypoint repeatability. For improved robustness to scale changes, a multiscale approach is employed during testing by constructing an image pyramid.

Datasets

  • Training: The MegaDepth dataset, a large-scale dataset of 196 scenes reconstructed from over a million internet photos, was used to extract pixel-wise correspondences for training.
  • Evaluation:
    • HPatches dataset: Used for evaluating image matching performance under illumination and viewpoint changes.
  • Aachen Day-Night dataset: Used for evaluating visual localization under challenging day-night illumination changes.
  • InLoc dataset: Used for evaluating visual localization in complex indoor scenes.
  • Local Feature Evaluation Benchmark (Madrid Metropolis, Gendarmenmarkt, Tower of London): Used for evaluating performance in 3D reconstruction.

Key Insights and Ideas

  • Postponing Detection is Key: The paper strongly argues that detecting features based on low-level image structures is a bottleneck for robustness. By delaying detection and coupling it tightly with description, D2-Net achieves more stable keypoints.
  • Unified Network for Detection and Description: Using a single CNN for both tasks allows for shared representations and a joint optimization objective, leading to more effective features.
  • Soft Detection for Trainability: The introduction of soft detection mechanisms is crucial for enabling end-to-end training of the joint detection and description pipeline.
  • Descriptive Power of Deeper CNN Layers: Leveraging feature maps from deeper layers of a CNN allows D2-Net to base both detection and description on higher-level image information, contributing to its robustness.

Key Results

  • State-of-the-Art Performance: D2-Net achieves state-of-the-art results on the challenging Aachen Day-Night and InLoc datasets for visual localization.
  • Competitive Image Matching: It demonstrates competitive performance on the HPatches dataset, outperforming other methods under stricter matching thresholds.
  • Robust 3D Reconstruction: D2-Net performs comparably to state-of-the-art local features in 3D reconstruction tasks, showing its suitability even with less precisely localized keypoints.
  • Efficiency: Despite its robustness, D2-Net requires significantly less memory than dense feature methods.

Limitations and Future Work

  • Keypoint Accuracy: The authors acknowledge that their features are less accurately localized compared to traditional detectors. They suggest future work could involve increasing the spatial resolution of feature maps or regressing more accurate pixel positions.
  • Ratio Test Impact: The paper notes that D2 features don't filter as well with the standard Lowe's ratio test as some other methods, which can impact 3D reconstruction performance by discarding correct matches. They suggest not using the ratio test for localization and potentially incorporating a ratio test-like objective into the loss for SfM.
  • Training Data Bias: The authors suspect a bias in their training data (fewer large viewpoint changes) might explain slightly weaker performance on viewpoint sequences.
  • Future Directions: Increasing keypoint accuracy, exploring alternative backbone architectures (though VGG16 was found to be superior in their experiments), and further refining the loss function are mentioned as future work.

Summary updated

BibTeX
@inproceedings{dusmanu2019d,
  author = {Mihai Dusmanu and Ignacio Rocco and Tomás Pajdla and Marc Pollefeys and Josef Sivic and Akihiko Torii and Torsten Sattler},
  title = {{D2-Net: A Trainable CNN for Joint Detection and Description of Local Features}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2019},
  doi = {10.1109/cvpr.2019.00828},
}
Figure