31
Robust model fitting by RANSAC Tekla Tóth (materials: based on Dániel Baráth’s work) 3D Computer Vision – 2021. 09.24.

Robust model fitting by RANSAC

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Robust model fitting by RANSAC

Robust model fitting by RANSAC

Tekla Tóth

(materials: based on Dániel Baráth’s work)

3D Computer Vision – 2021. 09.24.

Page 2: Robust model fitting by RANSAC

Outline

• Motivation

• RANdom SAmple Consensus (RANSAC) algorithm

• Line fitting in 2D

• General solution

• Parameter settings

• Pros and Cons

• Techniques to optimize the performance

2

Page 3: Robust model fitting by RANSAC

Motivation

3

Page 4: Robust model fitting by RANSAC

Motivation

4

Page 5: Robust model fitting by RANSAC

Motivation

5

Page 6: Robust model fitting by RANSAC

6

• Standard Single Class Single Instance Fitting Problem (SCSI)

• Robust Single Class Single Instance Fitting Problem (R-SCSI)

• Single Class Multiple Instance Fitting Problem (SCMI)

• Multiple Class Multiple Instance Fitting Problem (MCMI)

Taxonomy of Geometric Estimation Problems

Page 7: Robust model fitting by RANSAC

7

• detection of geometric primitives

• epipolar geometry estimation

• detection of planar surfaces

• multiple motion segmentation

• Interpretation of lidar scans

Single/Multi-Class S/M-Instance Fitting Applications

Page 8: Robust model fitting by RANSAC

The Standard SCSI Problem –2D Line Fitting

8

• Data points:

• Goal: Find the line with parameters which “best fits” these points.

Page 9: Robust model fitting by RANSAC

Finding Line: Line Parametrization

• Line parametrization – homogeneus

• Line parametrization – radial

9

Page 10: Robust model fitting by RANSAC

• Line parameters:

• Point on the line:

• Point not on the line:

• Signed distance from line:

10

The Standard SCSI Problem –2D Line Fitting

Note:

Page 11: Robust model fitting by RANSAC

11

• Data points:

• Goal: Find the line with parameters which “best fits” these points.

• As optimization: Find best line with parameters as:

• For : solvable by SVD

The Standard SCSI Problem –2D Line Fitting

Page 12: Robust model fitting by RANSAC

Standard Model Fitting - Formulation

12

Notes:

• justified as maximum-likelihood method for noise with normal distribution

• used by Gauss ~ 1800

• Laplace considered, in the late 1700’s, the sum of absolute differences

Line fitting – Least Squares:

Page 13: Robust model fitting by RANSAC

Line Fitting with Outliers - Least squares fit

13

Page 14: Robust model fitting by RANSAC

Line Fitting with Outliers - Least squares fit

14

Page 15: Robust model fitting by RANSAC

The SCSI Model Fitting Problem – Robust Loss

15

LSQ

RANSAC

truncated LSQ

• Line fitting – Least Squares:

• Line fitting – Robust:

Page 16: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

16

• Select sample of m points at random

Page 17: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

17

• Select sample of m points at random

• Estimate model parameters from the data in the sample

Page 18: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

18

• Select sample of m points at random

• Estimate model parameters from the data in the sample

• Evaluate the error (residual) for each data point

Page 19: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

19

• Select sample of m points at random

• Estimate model parameters from the data in the sample

• Evaluate the error (residual) for each data point

• Select data that support the current hypothesis

Page 20: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

20

• Select sample of m points at random

• Estimate model parameters from the data in the sample

• Evaluate the error (residual) for each data point

• Select data that support the current hypothesis

• Repeat sampling

Page 21: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

21

• Select sample of m points at random

• Estimate model parameters from the data in the sample

• Evaluate the error (residual) for each data point

• Select data that support the current hypothesis

• Repeat sampling

Page 22: Robust model fitting by RANSAC

Random Sample Consensus - RANSAC

• Select sample of m points at random

• Estimate model parameters from the data in the sample

• Evaluate the error (residual) for each data point

• Select data that support the current hypothesis

• Repeat sampling

22

Page 23: Robust model fitting by RANSAC

RANSAC[Fischler and Bolles 1981]

23

SAMPLING

VERIFICATIONSO-FAR-THE-BEST

Cost function forsingle data point x

Page 24: Robust model fitting by RANSAC

How many samples?

24

Page 25: Robust model fitting by RANSAC

RANSAC – Probabilistic Quality Guarantee:• N Number of points

• Q Number of inliers, Q = N – J*

• m Size of sample

• ϵ = Q/N Inlier ratio

Probability of all-inlier (uncontaminated) sample:

Hitting at least one all-inlier sample with probability h requires drawing

k ≥ log(1 – h) / log (1 – ϵm) samples.

On average, one in 1/P samples is all-inlier.25

Page 26: Robust model fitting by RANSAC

RANSAC termination - How many samples?

26

computed for η = 0.95

Inlier ratio 𝜖 = 𝑄/𝑁 [%]

Size

of

the

sam

ple

m

Page 27: Robust model fitting by RANSAC

RANSAC termination - How many samples?

27

computed for η = 0.95

Inlier ratio 𝜖 = 𝑄/𝑁 [%]

Size

of

the

sam

ple

m

Eg.: • Line: m = 2• Plane: m = 3• Sphere: m = 4• Ellipse: m = 5

Page 28: Robust model fitting by RANSAC

RANSAC Notes

28

Pros

• extremely popular• Google Scholar:

• used in many applications

• percentage of inliers not needed and not limited

• a probabilistic guarantee for the solution

• mild assumptions: sigma is known

Cons

• slow if inlier ratio low

• It was observed experimentally that RANSAC takes several times longer than theoretically expected

• due to noise

• not every all-inlier sample generates a good hypothesis

Page 29: Robust model fitting by RANSAC

RANSACcase closed? NO

29

State-of-the-art RANSAC

Cost function forsingle data point x

Page 30: Robust model fitting by RANSAC

RANSAC Upgrades

• Cost function: MSAC, MLESAC, Huber loss, …

• Outlier threshold sigma: Least median of Squares, MINPRAN, MAGSAC, …

• Correctness of the results. Degeneracy. Solution: DegenSAC.

• Accuracy (parameters are estimated from minimal samples). Solution: Locally Optimized RANSAC, Graph-Cut RANSAC

• Speed: Running time grows with 1. number of data points,

2. number of iterations (polynomial in the inlier ratio) • Addressing the problem: RANSAC with SPRT (WaldSAC), PROSAC

30

Page 31: Robust model fitting by RANSAC

Thank You!

31