Computing the stereo matching cost with a convolutional neural network

Jure Zbontar, Yann LeCun

Abstract: We present a method for extracting depth information from a rectified image pair. We train a convolutional neural network to predict how well two image patches match and use it to compute the stereo matching cost. The cost is refined by cross-based cost aggregation and semiglobal matching, followed by a left-right consistency check to eliminate errors in the occluded regions. Our stereo method achieves an error rate of 2.61% on the KITTI stereo dataset and is currently (August 2014) the top performing method on this dataset.

Introduction

Stereo matching is a fundamental task in computer vision, aimed at calculating the disparity—or horizontal shift—between corresponding pixels in a rectified image pair. This disparity is inversely proportional to the depth of objects in a scene. Reconstructing 3D scenes from 2D images hinges on the accuracy of the matching cost, a numerical value representing the likelihood that a pixel in the left image corresponds to a specific pixel in the right image.

Historically, researchers relied on hand-crafted mathematical formulas like the Sum of Absolute Differences (SAD) or the Census Transform. However, these traditional metrics often struggle with reflective surfaces, textureless regions, and complex lighting. This paper by Jure Žbontar and Yann LeCun represents a landmark moment where deep learning began to replace these hand-designed pipelines with a deep Convolutional Neural Network (CNN) trained to learn similarity metrics directly from data.

Methodology

Siamese CNN Architecture

The core innovation is an 8-layer Siamese network designed to compare image patches. The network takes two $9 \times 9$ image patches as input. The first three layers are shared, processing the left and right patches independently with the same weights to extract high-level features. These features are then concatenated and fed through four fully connected layers to produce the final matching cost.

The Siamese CNN architecture used to compute the matching cost between left and right image patches.

To manage the computational load of processing every pixel, the authors applied the initial layers convolutionally over the entire image and utilized $1 \times 1$ convolutions to replace fully connected layers, reducing redundant calculations.

The Stereo Pipeline

The CNN does not produce the final depth map in isolation. Its output serves as the initialization for a traditional stereo refinement pipeline:

  • Cross-based Cost Aggregation: Smoothing costs based on neighboring pixel intensities.
  • Semiglobal Matching (SGM): Enforcing smoothness constraints to ensure depth consistency across adjacent pixels.
  • Refinement: A series of post-processing steps, including a left-right consistency check to handle occlusions, subpixel enhancement, and bilateral filtering to sharpen object boundaries.

Experimental Results

The method was rigorously tested on the KITTI Stereo Dataset, which consists of real-world driving scenes. The model was trained on 45 million image patches extracted from 194 training pairs, using LIDAR data as ground truth.

Performance and Insights

At the time of publication (August 2014), this method was ranked #1 on the KITTI leaderboard, achieving an error rate of 2.61%. This was a significant improvement over the previous state-of-the-art error rate of 2.83%.

Qualitative results on the KITTI dataset showing input images (left) and the resulting disparity maps (right).

Key insights from the study include:

  • Learning the Metric: Similarity is better learned than designed; the CNN can ignore lighting changes or focus on structural patterns that traditional metrics miss.
  • Data Scaling: The authors demonstrated a nearly linear relationship between the number of training stereo pairs and the reduction in error, suggesting that stereo matching scales exceptionally well with more data.
  • Near-Matches: Including "positive" training examples that were slightly offset from the true disparity improved the robustness of the subsequent cost aggregation steps.

Discussion and Limitations

The primary limitation of this approach is its computational cost. Processing a single image pair took approximately 100 seconds on a high-end GPU, which is far from the real-time requirements of autonomous vehicles. Additionally, the method still relies on a complex, multi-stage classical pipeline. This work proved that swapping the weakest link of a classical pipeline with a neural network could yield massive gains, setting the stage for the eventual rise of fully end-to-end deep stereo networks.

Summary updated

BibTeX
@inproceedings{zbontar2015computing,
  author = {Jure Zbontar and Yann LeCun},
  title = {{Computing the stereo matching cost with a convolutional neural network}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2015},
  url = {https://openreview.net/forum?id=HJbY_CZObS},
}
Figure