3D Vision Marc Pollefeys, Viktor Larsson Spring 2020 Schedule Feb - - PowerPoint PPT Presentation

3d vision
SMART_READER_LITE
LIVE PREVIEW

3D Vision Marc Pollefeys, Viktor Larsson Spring 2020 Schedule Feb - - PowerPoint PPT Presentation

3D Vision Marc Pollefeys, Viktor Larsson Spring 2020 Schedule Feb 17 Introduction Feb 24 Geometry, Camera Model, Calibration Mar 2 Features, Tracking / Matching Mar 9 Project Proposals by Students Mar 16 Structure from Motion (SfM) +


slide-1
SLIDE 1

3D Vision

Marc Pollefeys, Viktor Larsson

Spring 2020

slide-2
SLIDE 2

Feb 17 Introduction Feb 24 Geometry, Camera Model, Calibration Mar 2 Features, Tracking / Matching Mar 9 Project Proposals by Students Mar 16 Structure from Motion (SfM) + papers Mar 23 Dense Correspondence (stereo / optical flow) + papers Mar 30 Bundle Adjustment & SLAM + papers Apr 6 Student Midterm Presentations Apr 13 Easter break Apr 20 Multi-View Stereo & Volumetric Modeling + papers Apr 27 3D Modeling with Depth Sensors + papers May 4 3D Scene Understanding + papers May 11 4D Video & Dynamic Scenes + papers May 18 papers May 25 Student Project Demo Day = Final Presentations

Schedule

slide-3
SLIDE 3

3D Vision – Class 6

Bundle Adjustment and SLAM

  • [Triggs, McLauchlan, Hartley, Fitzgibbon, Bundle Adjustment – A Modern

Synthesis, Int. Workshop on Vision Algorithms, 1999]

  • [Montemerio, Thrun, Koller, Wegbreit, FastSLAM: A Factored Solution to the

Simultaneous Localization and Mapping Problem, AAAI 2002]

  • Section 2.5 from [Lee, Visual Mapping and Pose Estimation for Self-Driving

Cars, PhD Thesis, ETH Zurich, 2014] Slides : Gim Hee Lee

slide-4
SLIDE 4

Lecture Overview

  • Bundle Adjustment in Structure-from-

Motion

  • Simultaneous Localization & Mapping

(SLAM)

4

slide-5
SLIDE 5

Recap: Structure-From-Motion

  • Two views initialization:

– 5-Point algorithm (Minimal Solver) – 8-Point linear algorithm – 7-Point algorithm

E → (R,t)

5

slide-6
SLIDE 6

Recap: Structure-From-Motion

  • Triangulation: 3D Points

E → (R,t)

6

slide-7
SLIDE 7

Recap: Structure-From-Motion

  • Subsequent views: Perspective pose estimation

(R,t) (R,t) (R,t)

7

slide-8
SLIDE 8

Recap: Structure-From-Motion

slide-9
SLIDE 9

Bundle Adjustment

  • Refinement step in Structure-from-Motion.
  • Refine a visual reconstruction to produce jointly
  • ptimal 3D structures P and camera poses C.
  • Minimize total re-projection errors .

ij

x

( )



i j W i j ij X

ij

C P x

2

, argmin 

ij

z  z 

j

P

( )

j j C

X , 

i

C

ij

z 

Cost Function: ] , [ C P X =

9

slide-10
SLIDE 10

Bundle Adjustment

  • Refinement step in Structure-from-Motion.
  • Refine a visual reconstruction to produce jointly
  • ptimal 3D structures P and camera poses C.
  • Minimize total re-projection errors .

ij

x

z 

j

P

( )

j j C

X , 

i

C

ij

z 

Cost Function:



 

i j ij ij T ij X

z W z argmin

Measurement error covariance

:

1 − ij

W ] , [ C P X =

10

( )

X f

slide-11
SLIDE 11

Bundle Adjustment

  • Minimize the cost function:
  • 1. Gradient Descent
  • 2. Newton Method
  • 3. Gauss-Newton
  • 4. Levenberg-Marquardt

( )

X f

X

argmin

11

slide-12
SLIDE 12

Bundle Adjustment

  • 1. Gradient Descent

12

Initialization:

X X k =

Compute gradient:

g X X

k k

 − 

( )

WJ Z X X f g

T X X

k

 =   =

=

Update:

Slow convergence near minimum point!

Iterate until convergence : Step size

X J   = 

: Jacobian

slide-13
SLIDE 13

Bundle Adjustment

  • 2. Newton Method

13

2nd order approximation (Quadratic Taylor Expansion):

K K

X X T X X

H g X f X f

= =

+ +  +    

2 1

) ( ) ( Find that minimizes !

K

X X

X f

=

+ ) ( 

( )

k

X X

X f H

=

 +  =

2 2

:  

Hessian matrix

slide-14
SLIDE 14

Bundle Adjustment

  • 2. Newton Method

14

Differentiate and set to 0 gives:

g H

1 −

− =  Computation of H is not trivial and might get stuck at saddle point!

Update:

 + 

k k

X X

slide-15
SLIDE 15

Bundle Adjustment

  • 3. Gauss-Newton

15



   + =

i j ij ij ij T

X W Z WJ J H

2 2

WJ J H

T

Normal equation:

Z W J WJ J

T T

 − = 

Update:

 + 

k k

X X

Might get stuck and slow convergence at saddle point!

slide-16
SLIDE 16

Bundle Adjustment

16

  • 4. Levenberg-Marquardt

Regularized Gauss-Newton with damping factor .

( )

Z W J I WJ J

T T

 − = +   : → 

Gauss-Newton (when convergence is rapid)

:  → 

Gradient descent (when convergence is slow)

LM

H

Adapt λ during optimization:

  • Decrease λ when function value decreases
  • Increase λ otherwise
slide-17
SLIDE 17

Structure of the Jacobian and Hessian Matrices

  • Sparse matrices since 3D structures are locally
  • bserved.

17

slide-18
SLIDE 18

Efficiently Solving the Normal Equation

  • Schur Complement: Exploit structure of H

18

Z W J H

T LM

 − =  =

LM

H

3D Structures Camera Parameters

slide-19
SLIDE 19

Efficiently Solving the Normal Equation

  • Schur Complement: Exploit structure of H

19

Z W J H

T LM

 − = 

3D Structures Camera Parameters

s

H

=

LM

H

SC

H

T SC

H

C

H

slide-20
SLIDE 20

Efficiently Solving the Normal Equation

  • Schur Complement: Obtain reduced system

20

Z W J H

T LM

 − =        =            

C S C S C T SC SC S

H H H H    

3D Structures Camera Parameters

Multiply both sides by:

      −

I H H I

S T SC 1

      − =             −

− − 1 1 S T SC S C S C S SC S T SC C SC S

H H H H H H H H     

slide-21
SLIDE 21

Efficiently Solving the Normal Equation

  • Schur Complement: Obtain reduced system

21

      − =             −

− − 1 1 S T SC S C S C S SC S T SC C SC S

H H H H H H H H     

1 1

) (

− −

− = −

S T SC S C C SC S T SC C

H H H H H H   

First solve for from:

C

Schur Complement (Sparse and Symmetric Positive Definite Matrix) Easy to invert a block diagonal matrix

Solve for by backward substitution.

SC

slide-22
SLIDE 22

Efficiently Solving the Normal Equation

  • Use sparse matrix factorization to solve system
  • 1. LU Factorization
  • 2. QR factorization
  • 3. Cholesky Factorization
  • Iterative methods
  • 1. Conjugate gradient
  • 2. Gauss-Seidel

22

1 1

) (

− −

− = −

S T SC S C C SC S T SC C

H H H H H H    b Ax = 

Don’t solve as x=A-1b: A is sparse, but A-1 is not!

QR A =

LU A =

T

LL A =

Solve for x by forward- backward substitutions

slide-23
SLIDE 23

Problem of Fill-In

24

slide-24
SLIDE 24

Problem of Fill-In

  • Reorder sparse matrix to minimize fill-in.
  • NP-Complete problem.
  • Approximate solutions:

1. Minimum degree 2. Column approximate minimum degree permutation 3. Reverse Cuthill-Mckee. 4. …

25

( )( )

b P x P AP P

T T T

=

Permutation matrix to reorder A

slide-25
SLIDE 25

Problem of Fill-In

26

slide-26
SLIDE 26

Robust Cost Function

  • Non-linear least squares:
  • Maximum log-likelihood solution:
  • Assume that:

1. X is a random variable that follows Gaussian distribution. 2. All observations are independent.

27

 

ij ij ij T ij X

z W z argmin ) | ( ln

  • argmin

X Z p

X

( )

        − − = −

ij ij ij T ij ij X X

z W z c Z X p exp ln argmin ) | ( ln argmin

  =

ij ij ij T ij X

z W z argmin

slide-27
SLIDE 27

Robust Cost Function

  • Gaussian distribution assumption is not true in

the presence of outliers!

  • Causes wrong convergences.

28

slide-28
SLIDE 28

29

( )

 

   

ij ij ij T ij X ij ij ij X

z S z z argmin argmin 

Robust Cost Function scaled with

ij

W

ij

" 

  • Similar to iteratively re-weighted least-squares.
  • Weight is iteratively rescaled with the attenuating

factor .

  • Attenuating factor is computed based on current

error.

ij

" 

Robust Cost Function

slide-29
SLIDE 29

Cauchy Distribution

30

(.)  (.) " 

Reduced influence from high errors Gaussian Distribution Influence from high errors

Robust Cost Function

slide-30
SLIDE 30

Robust Cost Function

31

Outliers are taken into account in Cauchy!

slide-31
SLIDE 31

State-of-the-Art Solvers

  • Google Ceres:

– https://code.google.com/p/ceres-solver/

  • g2o:

– https://openslam.org/g2o.html

  • GTSAM:

– https://collab.cc.gatech.edu/borg/gtsam/

  • Multicore Bundle Adjustment

– http://grail.cs.washington.edu/projects/mcba/

32

slide-32
SLIDE 32

Lecture Overview

  • Bundle Adjustment in Structure-from-

Motion

  • Simultaneous Localization & Mapping

(SLAM)

33

slide-33
SLIDE 33

Simultaneous Localization & Mapping (SLAM)

  • Robot navigates in unknown environment:

– Estimate its own pose – Acquire a map model of its environment.

  • Chicken-and-Egg problem:

– Map is needed for localization (pose estimation). – Pose is needed for mapping.

  • Highly related to Structure-From-Motion.

34

slide-34
SLIDE 34

Full SLAM: Problem Definition

35

Robot poses Observations Map landmarks u1 u2 u3 Control actions

slide-35
SLIDE 35

Full SLAM: Problem Definition

36

( )

 

= = −

=

M i K k jk ik k i i i X,L X,L

l x z p u x x p X p U Z L X p

1 1 1

) , | ( ) , | ( ) ( argmax , | , argmax

  • Maximum a Posteriori (MAP) solution:
slide-36
SLIDE 36

37

( )

 

= = −

=

M i K k jk ik k i i i X,L X,L

l x z p u x x p X p U Z L X p

1 1 1

) , | ( ) , | ( ) ( argmax , | , argmax       − − =

 

= = − K k jk ik k M i i i i X,L

l x z p u x x p

1 1 1

) , | ( ln ) , | ( ln argmin

Negative log- likelihood

Likelihoods:

} ) , ( exp{ ) , | (

2 1 1

i

i i i i i

x u x f u x x p

 − −

− − 

Process model

} ) , ( exp{ ) , | (

2

k

k jk ik jk ik k

z l x h l x z p

− − 

Measurement model

Full SLAM

slide-37
SLIDE 37

Full SLAM

38

      − − =

 

= = − K k ik ik k M i i i i X,L X,L

l x z p u x x p U Z L X p

1 1 1

) , | ( ln ) , | ( ln argmin ) , | , ( argmax

Putting the likelihoods into the equation:

      − + − =

 

=  =  − K k k ik ik M i i i i X,L X,L

k i

z l x h x u x f U Z L X p

1 2 1 2 1

) , ( ) , ( argmin ) , | , ( argmax

Minimization can be done with Levenberg- Marquardt (similar to bundle adjustment problem)!

slide-38
SLIDE 38

39

( )

Z W J I WJ J

T T

 − = +  

Jacobian made up of , , ,

x f   u f   x h   l h  

Weight made up of ,

i

k

Normal Equations: Can be solved with sparse matrix factorization or iterative methods

Full SLAM

Solving the full SLAM problem rather expensive for larger scenes

slide-39
SLIDE 39
  • Estimate current pose and full map :
  • Inference with:
  • 1. (Extended) Kalman Filter (EKF SLAM)
  • 2. Particle Filter (FastSLAM)

Online SLAM: Problem Definition

40

1 2 1

... ) , | , ( ) , | , (

 

=

t t

dx dx dx U Z L X p U Z L x p 

t

x L

Previous poses are marginalized out

slide-40
SLIDE 40

EKF SLAM

  • Assumes: pose and map are random

variables that follow Gaussian distributions.

  • Hence,
  • (Extended) Kalman Filter iteratively

– Predicts pose & map based on process model – Corrects prediction based on observations

41

t

x L

) , Ν( ~ ) , | , (   U Z L x p

t

Mean Error covariance

slide-41
SLIDE 41

42

) , (

1 −

=

t t t

u f  

t T t t t t

R F F +  = 

−1

Prediction:

Process model Error propagation with process noise Kalman gain Update mean

1

) (

+   =

t T t t t T t t t

Q H H H K

t t t t

y K + =  

t t t t

H K I  − =  ) (

Correction:

) (

t t t

h z y  − =

Measurement residual (innovation) Update covariance

t t t

x h H   = ) (

Measurement Jacobian

1 1)

, (

− −

  =

t t t t

x u f F 

Process Jacobian

EKF SLAM

slide-42
SLIDE 42

Structure of Mean and Covariance

43

                        =                        =

2 2 2 2 2 2 2 1

2 1 2 2 2 1 2 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1

,

N N N N N N N N N N N

l l l l l l yl xl l l l l l l yl xl l l l l l l yl xl l l l y x yl yl yl y y xy xl xl xl x xy x t N t

l l l y x                                      

          

             

Covariance is a dense matrix that grows with increasing map features! True robot and map states might not follow unimodal Gaussian distribution!

slide-43
SLIDE 43

Particle Filtering: FastSLAM

  • Particles represents samples from the

posterior distribution .

  • can be any distribution (need not

be Gaussian).

44

) , | , ( U Z L x p

t

) , | , ( U Z L x p

t

slide-44
SLIDE 44

FastSLAM

45

} , ... , , , , {

, , , 2 , 2 , 1 , 1

         =

m t N m t N m t m t m t m t m t m t

x p   

Each particle represents:

Robot state Landmark state (mean and covariance)

) , | ( ~

1 t t t m t

u x x p x

Sample the robot state from the process model

) , | (

, t m t m t n

z x L p

N Kalman filter Landmark updates

) , | (

m t m t t m t

x L z p w 

Weight update

Resampling based on current state

slide-45
SLIDE 45

FastSLAM

  • Many particles needed for accurate results.
  • Computationally expensive for high state

dimensions.

46

slide-46
SLIDE 46
  • Constraints: Relative pose estimates from 3D structure.
  • Don’t update 3D structure (fixed wrt. to some pose).
  • Optimizes poses as
  • Can be used to minimize loop-closure errors.

47

ij j i ij X

ij

v v h z

2

) , ( argmin

Pose-Graph SLAM

Robot pose Measured constraint Relative transformation between poses

slide-47
SLIDE 47

Summary

  • Bundle Adjustment

– Refine 3D points and poses in Structure-From-Motion. – Efficient computation by exploiting structure & sparsity. – Core step in every Structure-From-Motion (SFM) pipeline.

  • Simultaneous Localization and Mapping

– Very similar to Incremental SFM. – Typically includes some motion model. – Two general approaches to SLAM:

  • (Local) Bundle Adjustment (not discussed in lecture)
  • Filter-based techniques (EKF SLAM, FastSLAM)

– Pose-Graph SLAM (loop-closure handling)

48

slide-48
SLIDE 48

Feb 17 Introduction Feb 24 Geometry, Camera Model, Calibration Mar 2 Features, Tracking / Matching Mar 9 Project Proposals by Students Mar 16 Structure from Motion (SfM) + papers Mar 23 Dense Correspondence (stereo / optical flow) + papers Mar 30 Bundle Adjustment & SLAM + papers Apr 6 Student Midterm Presentations Apr 13 Easter break Apr 20 Multi-View Stereo & Volumetric Modeling + papers Apr 27 3D Modeling with Depth Sensors + papers May 4 3D Scene Understanding + papers May 11 4D Video & Dynamic Scenes + papers May 18 papers May 25 Student Project Demo Day = Final Presentations

Schedule

slide-49
SLIDE 49

Next week: Midterm Presentations Reminder: Prepare short presentation (3-5min) for Monday!