RANSAC-Flow: Generic Two-Stage Image Alignment

Xi Shen, François Darmon, Alexei A. Efros, Mathieu Aubry

TL;DR

RANSAC-Flow is a generic, two-stage framework for dense image alignment that combines the robustness of parametric methods with the precision of deep learning. By first using RANSAC to find coarse homographies and then refining the result with a self-supervised flow network, it achieves state-of-the-art results across diverse tasks ranging from autonomous driving (KITTI) to historical art analysis.

What Problem Does This Paper Address?

Image alignment—the process of overlaying two images of the same scene—is a cornerstone of computer vision, essential for tasks like panorama stitching and optical flow. Traditionally, researchers have split into two camps:

  1. Parametric methods: These assume a global transformation (like a homography) and use RANSAC to find it. They are robust to large movements but fail when the scene isn't a flat plane.
  2. Non-parametric methods: These (like optical flow) try to match every pixel. They are precise but usually fail if the images have large displacements or significant lighting/style changes.

The authors address the lack of a "generic" aligner that can handle both large viewpoint changes and fine-grained pixel matching across different domains (e.g., matching a photo to a painting).

Methods

The authors propose a hybrid two-stage process:

  • Stage 1: Coarse Alignment (Parametric). The system extracts deep features (from a ResNet-50) at multiple scales. It uses RANSAC to estimate one or more homographies. A key innovation here is "Multi-H": the algorithm can iteratively find multiple homographies to account for different planes in a 3D scene (e.g., the ground vs. a building wall).
  • Stage 2: Fine Alignment (Non-parametric). Once the images are coarsely aligned, a deep network predicts a dense flow field to fix local misalignments.
  • Self-Supervised Learning: The network doesn't need labeled data. It trains by optimizing a Structural Similarity (SSIM) metric and a cycle-consistency loss (ensuring that warping from image A to B and back to A returns you to the start).
  • Matchability Mask: The network also predicts which pixels can be matched, allowing it to ignore occlusions or regions that don't appear in both images.

Datasets

The model was trained on MegaDepth (internet photos of landmarks) and evaluated on a wide variety of benchmarks:

  • KITTI 2015: For unsupervised optical flow.
  • Hpatches: For dense correspondences.
  • YFCC100M: For two-view geometry estimation.
  • Aachen Day-Night: For visual localization in challenging lighting.
  • Brueghel Dataset: A unique application involving the alignment of near-duplicate 16th-century artworks to study the artist's copy process.

Key Insights and Ideas

  • Complementary Strengths: The "aha moment" is that RANSAC is great at "getting close" even with massive viewpoint shifts, while deep flow networks are great at "finishing the job" without needing the "brightness constancy" assumption (which fails when comparing a sketch to an oil painting).
  • SSIM over Brightness: By using SSIM instead of simple pixel-intensity differences, the model becomes much more robust to changes in illumination and artistic style.
  • Iterative Homographies: Instead of trying to find one perfect global transform, the "Multi-H" approach acknowledges that real-world 3D scenes are complex and better represented as a collection of planes.

Key Results

  • Geometry Estimation: On the YFCC100M dataset, RANSAC-Flow outperformed the recent OANet by a large margin in recovering camera poses, despite being an unsupervised method.
  • Art Analysis: The paper demonstrates the first fine-grained alignment of artworks on the Brueghel dataset. It successfully identified which parts of a painting were copied "spatially consistently" and which parts were shifted or modified by the artist.
  • Efficiency: The approach is relatively fast; for certain tasks, it took roughly 4 seconds per pair, compared to 16–23 seconds for competing methods like EpicFlow.

Limitations and Future Work

  • Occlusions: Like most flow-based methods, RANSAC-Flow struggles in occluded regions and at image boundaries where pixels simply don't have a match in the other frame.
  • Semantic vs. Geometric: The authors focus on images of the same physical scene. Extending this to "semantic alignment" (e.g., matching a cat to a dog) remains a separate, more difficult challenge.
  • Supervision: While the flow network is unsupervised, the initial feature extractor used (ResNet-50) was pre-trained on ImageNet, though the authors show that self-supervised features (MoCo) work nearly as well.

Summary updated

BibTeX
@inproceedings{shen2020ransac,
  author = {Xi Shen and François Darmon and Alexei A. Efros and Mathieu Aubry},
  title = {{RANSAC-Flow: Generic Two-Stage Image Alignment}},
  booktitle = {European Conference on Computer Vision},
  year = {2020},
  url = {https://openreview.net/forum?id=xeE-t65sbfQi},
}
Figure