CVPR 2021 Image Matching Challenge: A Look Back at the Algorithm That Won Both Tracks

Drawing on an article we previously wrote for the company, we’ve put together a summary of some experiments and takeaways from our recent competition run. Copyright: Megvii. Original article:https://www.zhihu.com/question/32066833/answer/2041516754

Image Matching is one of the most fundamental techniques in computer vision. It associates local information at corresponding locations in two images by matching sparse or dense features. Image Matching is widely used in robotics, autonomous vehicles, AR/VR, image and product retrieval, fingerprint recognition, and more.

At the recently concluded CVPR 2021 Image Matching competition, Megvii’s 3D team took two first-place finishes and one second-place finish. This article presents their approach, experiments, and takeaways.

Competition Overview

Image matching involves identifying and aligning content or structures with identical or similar attributes in two images at the pixel level. In general, the images to be matched depict the same or similar scenes or objects. Other types of image pairs may also be matchable if they share shapes or semantic information.

Image Matching Challenge

The Image Matching Challenge (IMC) was again divided into two tracks: unlimited keypoints and restricted keypoints. The number of keypoints that could be extracted per image was under 8k and 2k, respectively.

This year’s IMC used three datasets: Phototourism, PragueParks, and GoogleUrban. These datasets differ considerably, so algorithms need to generalize well. The organizers wanted to find a method that performed well on all three datasets, so the final ranking was based on the average rank across them.

For each dataset, the organizers used two evaluation tasks, Stereo and Multiview, and calculated the rank for each task separately.

  • Stereo: Match two images, then estimate the F matrix and compute the resulting pose error.
  • Multiview: Group small subsets of images into bags, use the bags to build a reconstruction, and use the 3D model to compute pose errors between images.

The competition workflow is shown below:

SimLoc Match

SimLoc also covers a variety of scenes. Unlike the IMC datasets, it is synthetic, which makes it possible to obtain exact ground truth.

The competition uses three metrics, with the matching success rate determining the final ranking. The three metrics are:

  • Number of inliers (higher is better)
  • Matching success rate: the number of inlier matches divided by the total number of submitted matches (higher is better)
  • Number of negative matches: when two images have no overlapping regions, fewer reported matches are better

Approach

Data Analysis

We began by analyzing the competition’s three datasets.

  • Check whether there is a gap between the validation and test sets
  • Analyze image widths and heights in each dataset to determine the target size for resizing

Pipeline


Our competition pipeline has six stages: preprocessing, keypoint detection, keypoint location refinement, multi-scale or multi-angle descriptor extraction, Guided matching, and RANSAC based on adaptive FH.

Preprocessing


The IMC tracks limit the number of keypoints, so where those points are located matters. Dynamic objects such as pedestrians and vehicles, as well as areas such as the sky, contribute little to pose estimation through matching and can even make it worse. We therefore used a segmentation network to mask them out and skipped the masked regions during keypoint extraction.

Once we started using the segmentation network for preprocessing, we noticed two issues.

  • First, the segmentation network wasn’t precise enough where buildings met the sky. It sometimes masked parts of building edges, which hurt matching. After masking out dynamic objects, we therefore applied morphological erosion to the masked regions to preserve details along building edges.
  • Second, the segmentation network didn’t reliably distinguish between people and statues. When it masked out pedestrians, it also masked out statues. In some scenes, such as those in the Lincoln dataset, keypoints on statues are important for matching. To address this, we trained a classification network to distinguish statues from pedestrians, allowing us to mask out pedestrians while keeping statues.

Preprocessing improved performance on the Phototourism validation set by 1.1% on Stereo and 0.3% on Multiview.

Keypoint Extraction

Adapt Homographic

We applied 100 homography transformations to produce 100 transformed images. We then used SuperPoint to extract keypoints from each image, yielding n keypoint heatmaps. We combined these n heatmaps into a final heatmap and selected keypoints from it as needed. This lets us extract more keypoints and improves their placement.

Using Adapt Homographic improved performance on the Phototourism validation set by 1.7% on Stereo and 1.3% on Multiview.

Refinement

SuperPoint returns keypoints with integer coordinates. We use soft argmax refinement with a radius of 2 to localize the keypoints more accurately at the subpixel level. On the Phototourism validation set, this refinement improved performance by 0.8% on the Stereo task and 0.35% on the Multiview task.

NMS


We observed that keypoints extracted by DISK tend to cluster, leaving some areas without any keypoints.

To address this, we increased the NMS radius from 3 to 10. As the figure shows, using a larger radius reduced clustering. It also improved performance by 0.57% on the Stereo task in the PragueParks validation set.

Pyramid Descriptor && Guided Pyramid Matching

Analyzing Corner Cases

After setting up the baseline, we randomly sampled images from the test set to analyze corner cases. We found that poor matches generally occurred under one or both of the following conditions:

  • Large differences in scale
  • Large rotation angles

To address these corner cases, we used pyramid descriptor extraction and a guided matching strategy.

We extract descriptors at different scales and angles using the same set of keypoints. In other words, we detect the keypoints in a single image, then map them onto the transformed images and extract descriptors at the corresponding locations.

For matching, we first set a threshold t. If the number of matches exceeds t, we use the matches at the original scale or angle. If it falls below t, we combine matches across multiple scales or angles.

These changes improved matching in the corner cases described above.

These strategies yielded an average improvement of 0.4% across the Stereo and Multiview tasks on the validation sets of all three datasets.

Retrain SuperGlue

We also retrained SuperGlue in two ways. First, we reproduced the official SuperPoint+SuperGlue method. Second, we trained DISK+SuperGlue using DISK, a better-performing feature extractor. On the YFCC validation set, DISK+SuperGlue performed about 4% better than the official SuperPoint+SuperGlue method.

On the competition datasets, DISK+SuperGlue performed well on Phototourism but less well on the other two datasets. One possible reason is that DISK was trained on Megadepth and may have overfit to building imagery. SuperPoint, by contrast, was trained on COCO, which contains a wider variety of scenes and may help it generalize better.

Finally, in the 8k track (unlimited keypoints), we used an ensemble of SuperPoint+SuperGlue and DISK+SuperGlue. The ensemble performed better than either method alone.

MethodsPhototourismPragueParksGoogleUrban
StereoMultiviewStereoMultiviewStereoMultiview
SP-SG(4K)0.603570.782900.797660.504990.412120.32472
DISK-SG(8K)0.61955 ↑0.775310.720020.485480.38764 0.26281
SP-DISK-SG0.63975 ↑0.78564 ↑0.80700 ↑0.498780.43952 ↑0.33734 ↑

RANSAC && Adapt FH

We first tried several RANSAC methods, including OpenCV’s built-in RANSAC, DEGENSAC, and MAGSAC++. In our experiments, DEGENSAC performed best.

However, when DEGENSAC estimates the F matrix, it can run into planar degeneracy, as shown here.

To address planar degeneracy, we drew inspiration from ORB-SLAM and designed an adaptive FH strategy. The algorithm is as follows:

Application: AR Navigation

Megvii places a strong emphasis on putting cutting-edge algorithms to work in real-world applications. The Image Matching technology described in this article is already used in several projects, including the S800V SLAM robot and AR navigation.

One example is Megvii’s indoor visual positioning and navigation project. Using technologies such as large-scale SfM sparse point cloud reconstruction and Image Matching, Megvii’s 3D team made it possible to get accurate positioning and AR navigation in complex indoor environments using only a smartphone camera. Compared with conventional indoor positioning solutions such as GPS and Bluetooth, the system delivers centimeter-level mapping accuracy and sub-meter positioning accuracy without requiring additional hardware to be installed throughout the space. This meets customers’ requirements for high accuracy and ease of deployment and maintenance. Megvii has already won several contracts for indoor positioning and navigation in large facilities.

To let people try the technology for themselves, Megvii rolled out MegGo, its indoor visual positioning and navigation app, for internal use. It supports positioning and navigation throughout the company’s work areas. Even in an unfamiliar part of the office, this digital “tour guide” can quickly and accurately lead you to a meeting room or another destination. Visitors to Megvii can also download MegGo on their phones to try it out. The examples below show visual positioning and AR navigation in MegGo, respectively.

[gif-player id=”3304″]
Visual Positioning

[gif-player id=”3305″]
AR Navigation

Future Work

  • Incorporate reinforcement learning when retraining the entire pipeline.
  • Improve DISK’s ability to generalize by training it on more datasets.
  • Use a Refinements network to refine keypoint locations.

References

1. D. DeTone, T. Malisiewicz, and A. Rabinovich, “SuperPoint: Self-supervised interest point detection and description,”CoRR, vol. abs/1712.07629, 2017.
2. M. Tyszkiewicz, P. Fua, and E. Trulls, “DISK: Learning local features with policy gradient,” Advances in Neural Informa-tion Processing Systems, vol. 33, 2020.
3. K. He, G. Gkioxari, P. Dollár, and R. B. Girshick,“Mask R-CNN,” CoRR, vol. abs/1703.06870, 2017.
4. H. Zhao, J. Shi, X. Qi, X. Wang, and J. Jia, “Pyramid scene parsing network,” in CVPR, 2017.
5. P.-E. Sarlin, D. DeTone, T. Malisiewicz, and A. Rabinovich, “SuperGlue: Learning feature matching with graph neural networks,” in CVPR, 2020.
6. D. Mishkin, J. Matas, and M. Perdoch, “Mods: Fast and robust method for two-view matching,” Computer Vision and Image Understanding, 2015.
7. C. Campos, R. Elvira, J. J. Gomez, J. M. M. Montiel, and J. D.Tardós, “ORB-SLAM3: An accurate open-source library for visual, visual-inertial and multi-map SLAM,” arXiv preprint arXiv:2007.11898, 2020.

Add a Comment

Your email address will not be published. Required fields are marked *