Crafting and learning for image matching
presented by Dmytro Mishkin
joint work with
Anastasia Mishchuk, Milan Pultar, Filip Radenovic, Daniel Barath, Michal Perdoch, Jiri Matas
1 2019.07.06, Odesa, EECVC
image matching presented by Dmytro Mishkin joint work with - - PowerPoint PPT Presentation
Crafting and learning for image matching presented by Dmytro Mishkin joint work with Anastasia Mishchuk, Milan Pultar, Filip Radenovic, Daniel Barath, Michal Perdoch, Jiri Matas 1 2019.07.06, Odesa, EECVC What is image matching? The task
presented by Dmytro Mishkin
joint work with
Anastasia Mishchuk, Milan Pultar, Filip Radenovic, Daniel Barath, Michal Perdoch, Jiri Matas
1 2019.07.06, Odesa, EECVC
between camera poses
2019.07.06, Odesa, EECVC 2
ORB-SLAM2: an Open-Source SLAM System for Monocular, Stereo and RGB-D Cameras, arXiv 2016
Structure-from-Motion Revisited, 2016 COLMAP
3 2019.07.06, Odesa, EECVC
Daniel DeTone, Tomasz Malisiewicz, Andrew Rabinovich MagicLeap SLAM
Image retrieval 2.0
4 2019.07.06, Odesa, EECVC Google Landmark Retrieval challenge 2019 winner
2019.07.06, Odesa, EECVC 5
Images from Aberman et al. “Neural Best-Buddies: Sparse Cross-Domain Correspondence”, SIGGRAPH 2018
Alexander Shekhovtsov (2017) and Tolga Birdal (2018)
2019.07.06, Odesa, EECVC 6
7 2019.07.06, Odesa, EECVC
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
Image credit: Andrea Vedaldi, ICCVW 2017
Single feature visualization
2019.07.06, Odesa, EECVC 8
Try yourself: https://github.com/ducha-aiki/matching-strategies-comparison
2019.07.06, Odesa, EECVC 9
Recovered 1st to 2nd image projection, ground truth 1st to 2nd image project, inlier correspondences
2019.07.06, Odesa, EECVC 10
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
2019.07.06, Odesa, EECVC 11 Image credit: forums.fast.ai
Planar surface or static camera → use homography Image with dominant plane → use homography Not sure what to use? → try homography first.
2019.07.06, Odesa, EECVC 12
static scene. A corresponding point lies somewhere on a line in the other image. Where on the line - depends
homography
assumed)
Image credit: https://en.wikipedia.org/wiki/Epipolar_geometry
2019.07.06, Odesa, EECVC 13 Image credit: https://scipy-cookbook.readthedocs.io/items/RANSAC.html
OpenCV functions: cv2.findHomography() cv2.findFundamentalMatrix() We will publish soon a python package, which is 2..5 times faster and have an additional tricks inside https://github.com/ducha-aiki/pyransac (save this link, the repo is private now, will clean-up and open next week)
2019.07.06, Odesa, EECVC 14
OpenCV finds 31 wrong inliers in 0.018s. CMP RANSAC finds 6 wrong inliers in 0.004s. See the same pattern in img1: 3 corrs in line + group. RANSAC H is prone to such case
2019.07.06, Odesa, EECVC 15
CMP RANSAC + transfer check: finds 48 correct inliers in 0.005s. 𝐼2−1 = 𝐼1−2
−1
Check #inliers consistent in opposite direction Python CMP RANSAC package will be available soon
2019.07.06, Odesa, EECVC 16
2019.07.06, Odesa, EECVC 17
2019.07.06, Odesa, EECVC 18
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
2019.07.06, Odesa, EECVC 20
Features from img1 are matched to features from img2 You can see, that it is asymmetric and allowing “many-to-one” matches
2019.07.06, Odesa, EECVC 21
Features from img1 are matched to features from img2 OpenCV RANSAC failed to find a good model with NN matching Found 1st image projection: blue, ground truth: green, Inlier correspondences: yellow
2019.07.06, Odesa, EECVC 22
Features from img1 are matched to features from img2 Only cross-consistent (mutual NNs) matches are retained.
2019.07.06, Odesa, EECVC 23
OpenCV RANSAC failed to find a good model with MNN matching No one-to-many connections, but still bad Found 1st image projection: blue, ground truth: green , inlier correspondences: yellow Features from img1 are matched to features from img2 Only cross-consistent (mutual NNs) matches are retained.
2019.07.06, Odesa, EECVC 24
1stNN 2ndNN 2ndNN 1stNN 2ndNN 1stNN
1stNN/2ndNN > 0.8, drop 1stNN/2ndNN < 0.8, keep Features from img1 are matched to features from img2
discard
keep
2019.07.06, Odesa, EECVC 25
NN SNN SNN NN SNN NN
NN/SNN > 0.8, drop NN/SNN < 0.8, keep OpenCV RANSAC found a model roughly correct No one-to-many connections, but still bad Found 1st image projection: blue, ground truth: green , inlier correspondences: yellow
1st geometrically inconsistent nearest neighbor ratio (FGINN) strategy
2019.07.06, Odesa, EECVC 26
SNN ratio is cool, but what about symmetrical, or too closely detected features? Ratio test will kill them. Solution: look for 2nd nearest neighbor, which is far enough from 1st nearest.
Mishkin et al., “MODS: Fast and Robust Method for Two-View Matching”, CVIU 2015
1st geometrically inconsistent nearest neighbor ratio (FGINN) strategy
2019.07.06, Odesa, EECVC 27
SNN ratio is cool, but what about symmetrical, or too closely detected features? Ratio test will kill them. Solution: look for 2nd nearest neighbor, which is far enough from 1st nearest.
Mishkin et al., “MODS: Fast and Robust Method for Two-View Matching”, CVIU 2015
SNN vs FGINN
2019.07.06, Odesa, EECVC 28
Mishkin et al., “MODS: Fast and Robust Method for Two-View Matching”, CVIU 2015
SNN: roughly correct FGINN: more correspondences, better geometry found
2019.07.06, Odesa, EECVC 29
Recall, that FGINN is still asymmetric: Matching (Img1 → Img2) ≠ (Img2 → Img1) We can do both (Img1 → Img2) and (Img2 → Img1) and keep all FGINNs (union)
2019.07.06, Odesa, EECVC 30 Yi et al. Learning to Find Good Correspondences https://arxiv.org/abs/1711.05971
Input: matches (x1, y1, x2, y2) [ N x 4 ] Output: scores [ N x 1 ]
2019.07.06, Odesa, EECVC 31
CVPR 2019 competition https://image-matching-workshop.github.io/ Evaluation Stereo: features ⇨ matching ⇨ ⇨ OpenCV RANSAC ⇨ pose estimation
Participants
Metric: # of precise enough recovered camera poses (mAP @ 15°)
2019.07.06, Odesa, EECVC 32
Mishchuk et.al. Working hard to know your neighbor’s margins: Local descriptor learning loss. NIPS 2017
33 2019.07.06, Odesa, EECVC
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
HardNet: lets use it for training CNNs!
34
2019.07.06, Odesa, EECVC
Tian et al (CVPR 2017).
36
2019.07.06, Odesa, EECVC
37
2019.07.06, Odesa, EECVC
HardNet vs SIFT descriptor
2019.07.06, Odesa, EECVC 38
Mishkin et al., “MODS: Fast and Robust Method for Two-View Matching”, CVIU 2015
SIFT: 71 inliers HardNet: 121 inliers
39
1.5 … 2 times better than rootSIFT:
2019.07.06, Odesa, EECVC
GeoDesc: same architecture, special loss and sampling utilizing 3d reconstruction data. 40
Luo et.al, ECCV 2018
2019.07.06, Odesa, EECVC
Leveraging Outdoor Webcams for Local Descriptor Learning Milan Pultar, Dmytro Mishkin, Jiří Matas
41 2019.07.06, Odesa, EECVC
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
42
○
Split further into folders by year
○
Image timestamp in GMT
○
GPS info not always available
43
Camera 1001 Camera 1002 Images - 2011 Images - 2013 Images - 2010 Images - 2011
44
45
46
Sky segmentation in the wild: An empirical study.
(https://github.com/kuangliu/torchcv)
(by looking at the corresponding outputs)
47
Imagenet classification with deep convolutional neural networks.
Repeat
48
○
MODS often outputs homography matrix only for small part of image
○
Need for final manual check
○
Run registration on pairs of images
○
If a single fail -> remove the whole view
49
○
Dynamic scenes
○
Cloud-dominated scenes
○
Views with very similar content
50
51
○
○
Precise registration is important
52
HPatches matching task, full split
as source for patches
from the same image
53
HPatches matching task, full split
illumination changes (to the best of our knowledge)
HardNetPS in full split
for evaluation of robustness to lighting and season-related conditions
55
56 2019.07.06, Odesa, EECVC
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
2019.07.06, Odesa, EECVC 57
Detector: x, y, scale Should we rotate patch? Should we deform patch? Handcrafted: dominant orientation Learned orientation: CNN
Yi et al. Learning to Assign Orientations to Feature Points CVPR 2016
2019.07.06, Odesa, EECVC 58
DoG + HardNet matches +FGINN union + RANSAC. Found 1st image projection: blue, ground truth: green , inlier correspondences: yellow Dominant gradient orientation: 123 inliers Learned orientation: 140 inliers Constant orientation: 181 inliers
59 2019.07.06, Odesa, EECVC
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
Mishkin et.al. Repeatability Is Not Enough: Learning Affine Regions via Discriminability. ECCV 2018 60 2019.07.06, Odesa, EECVC
2019.07.06, Odesa, EECVC 61
FGINN union + RANSAC. Found 1st image projection: blue, ground truth: green , inlier correspondences: yellow
DoG + HardNet 2.0: 123 inliers DoG + AffNet + HardNet 2.0: 165 inliers
62
and hardest-in-batch negative examples
2019.07.06, Odesa, EECVC
2019.07.06, Odesa, EECVC 63
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
significantly better for practical purposed have been proposed
2019.07.06, Odesa, EECVC 64
Stylianou et.al, WACV 2015. Characterizing Feature Matching Performance Over Long Time Periods
2019.07.06, Odesa, EECVC 65
DoG filter is a simple blob template
https://docs.opencv.org/3.4.3/da/df5/tutorial_py_sift_intro.html
Gaussian scalespace, “stack of gradually smoothed versions” of original image
Detections on synthetic image
2019.07.06, Odesa, EECVC 66
FAST is a corner detector based on segment test
SuperPoint (CVPRW 2017) DELF (ICCV 2017) D2Net (CVPR 2019)
2019.07.06, Odesa, EECVC 67
Measurement region selector Measurement region selector
Matching
Descriptor Descriptor Detector Detector Geometrical verification (RANSAC)
2019.07.06, Odesa, EECVC 68
DeTone et al., SuperPoint: Self-Supervised Interest Point Detection and Description CVPRW2017
2019.07.06, Odesa, EECVC 69
Noh et al., SuperPoint: Large-Scale Image Retrieval with Attentive Deep Local Features ICCV 2017
“Attention” as weighting for global descriptor
2019.07.06, Odesa, EECVC 70
Dusmanu et al, D2-Net: A Trainable CNN for Joint Description and Detection of Local Features CVPR 2019
2019.07.06, Odesa, EECVC 71
SuperPoint: 51 inliers DoG + HardNet: 123 inliers D2Net: 26 inliers, incorrect geometry
2019.07.06, Odesa, EECVC 72
SIFT + SNN match + OpenCV RANSAC: 27 inliers SIFT + NoOri + HardNet + FGINN union match + CMP RANSAC: 179 inliers
2019.07.06, Odesa, EECVC 73
MODS handles angular viewpoint difference up to:
MODS: Fast and Robust Method for Two-View Matching, CVIU 2015,
Affine view synthesis
Images
Det1-Desc1 Det2-Desc2 Match RANSAC
Match! Not match? Try more view synthesis
Use global descriptor (ResNet101 GeM) + fast search (faiss)
2019.07.06, Odesa, EECVC 75
ducha_aiki ducha-aiki