Robust estimation techniques in computer vision Vasile Gui July - - PowerPoint PPT Presentation

robust estimation techniques in computer vision
SMART_READER_LITE
LIVE PREVIEW

Robust estimation techniques in computer vision Vasile Gui July - - PowerPoint PPT Presentation

Robust estimation techniques in computer vision Vasile Gui July 2019 UPT University 'Politehnica' Timisoara Goals of CV: evaluating and recognizing image content Prior to obtaining semantics from images, we need to extract: locations;


slide-1
SLIDE 1

Robust estimation techniques in computer vision

Vasile Gui July 2019 UPT

University 'Politehnica' Timisoara

slide-2
SLIDE 2

Goals of CV: evaluating and recognizing image content

Prior to obtaining semantics from images, we need to extract:

  • locations;
  • shapes of geometric objects in an image;
  • motions in a video sequence;
  • or projective transformations between images
  • f the same scene;
  • Etc.
slide-3
SLIDE 3

What have in common all these applications?

  • Presence of noise
  • Neighbourhood processing involved
slide-4
SLIDE 4

What have in common all these applications?

  • Presence of noise
  • Neighbourhood processing involved
  • The neighbourhood may contain more objects
  • Without prior segmentation it is unclear what

we measure in the window.

slide-5
SLIDE 5

What have in common all these applications?

  • Presence of noise
  • Neighbourhood processing involved
  • The neighbourhood may contain more objects
  • Without prior segmentation it is unclear what

we measure in the window.

  • RE can alleviate this chicken and egg problem.
slide-6
SLIDE 6

Some CV applications using RE

slide-7
SLIDE 7

Reconstruction: 3D from photo collections

YouTube Video

  • Q. Shan, R. Adams, B. Curless, Y. Furukawa, and S. Seitz, The Visual Turing Test

for Scene Reconstruction, 3DV 2013

From Svetlana Lazebnik

slide-8
SLIDE 8

Reconstruction: 4D from photo collections

YouTube Video

  • R. Martin-Brualla, D. Gallup, and S. Seitz, Time-Lapse Mining from Internet

Photos, SIGGRAPH 2015

From Svetlana Lazebnik

slide-9
SLIDE 9

Outline

  • Introducing RE from an image filtering perspective
  • M estimators
  • Maximum likelihood estimators (MLE)
  • Kernel density estimators (KDE)
  • The RANSAC family
  • Some examples and conclusions
  • Not a survey of RE in CV
  • Raising awareness about RE
slide-10
SLIDE 10

Robust estimation

A detail preserving image smoothing perspective

slide-11
SLIDE 11

Image smoothing filter goal: Generate a smoothed image from a noisy image

slide-12
SLIDE 12

Image smoothing filter goal: Generate a smoothed image from a noisy image Usual assumptions: – Noise is changing randomly - unorganized – Useful image part: piecewise smooth

slide-13
SLIDE 13

Smoothing filter approach: For each pixel: – Define a neighbourhood (window) – Estimate central pixel’s “true” value using all pixels in the window – Assumption: the estimate should be “similar” to pixels in the window – Filters differ in similarity definition

slide-14
SLIDE 14

What is the problem?

  • The processing window may contain more
  • bjects or distinctive parts of an object.
slide-15
SLIDE 15

What is the problem?

  • The processing window may contain more
  • bjects or distinctive parts of an object.
  • This violates the assumption of similarity with

central pixel.

slide-16
SLIDE 16

What is the problem?

  • The processing window may contain more
  • bjects or distinctive parts of an object.
  • This violates the assumption of similarity with

central pixel.

  • If we average pixels, we reduce the effect of

random noise…

slide-17
SLIDE 17

What is the problem?

  • The processing window may contain more
  • bjects or distinctive parts of an object.
  • This violates the assumption of similarity with

central pixel.

  • If we average pixels, we reduce the effect of

random noise…

  • but we blur the image and lose some

meaningful details.

slide-18
SLIDE 18

Some filter comparisons

Original noisy mean 5x5 binomial 5x5 median 5x5

slide-19
SLIDE 19

Why did the median filter a better job?

  • Preserving edges
  • Cleaning “salt and

pepper” noise

slide-20
SLIDE 20

Why did the median filter a better job?

  • Preserving edges
  • Cleaning “salt and

pepper” noise

  • Robust estimation

perspective of the question

slide-21
SLIDE 21

M estimator for filter design

Huber, P. J. (2009). Robust Statistics. John Wiley & Sons Inc.

Pixels: color vectors in a window: 𝐠𝑗 Estimated color: መ 𝐠 Residuals: 𝑠

𝑗 = 𝐠𝑗 − መ

𝐠 Loss function: 𝜍 𝑣 Minimize loss: መ 𝐠 = argminσ𝑗𝜗𝑋 𝜍(𝑠

𝑗)

slide-22
SLIDE 22

M estimator for filter design

Huber, P. J. (2009). Robust Statistics. John Wiley & Sons Inc.

Pixels: color vectors in a window: 𝐠𝑗 Estimated color: መ 𝐠 Residuals: 𝑠

𝑗 = 𝐠𝑗 − መ

𝐠 Loss function: 𝜍 𝑣 Minimize loss: መ 𝐠 = argminσ𝑗𝜗𝑋 𝜍(𝑠

𝑗)

Least squares (LS) loss: 𝜍 𝑣 = 𝑣2

slide-23
SLIDE 23

M estimator for filter design

Huber, P. J. (2009). Robust Statistics. John Wiley & Sons Inc.

Pixels: color vectors in a window: 𝐠𝑗 Estimated color: መ 𝐠 Residuals: 𝑠

𝑗 = 𝐠𝑗 − መ

𝐠 Loss function: 𝜍 𝑣 Minimize loss: መ 𝐠 = argminσ𝑗𝜗𝑋 𝜍(𝑠

𝑗)

Least squares (LS) loss: 𝜍 𝑣 = 𝑣2 Solution: መ 𝐠 = σ𝑗𝜗𝑋 𝐠𝑗/ σ𝑗𝜗𝑋 1 i.e. the mean

slide-24
SLIDE 24

M estimator for filter design

Weighted LS: 𝜍 𝑣𝑗 = 𝑥𝑗(𝑣𝑗)2 Solution: መ 𝐠 = σ𝑗𝜗𝑋 𝑥𝑗𝐠𝑗/σ𝑗𝜗𝑋 w𝑗 i.e. the weighted mean

slide-25
SLIDE 25

M estimator for filter design

Weighted LS: 𝜍 𝑣𝑗 = 𝑥𝑗(𝑣𝑗)2 Solution: መ 𝐠 = σ𝑗𝜗𝑋 𝑥𝑗𝐠𝑗/σ𝑗𝜗𝑋 w𝑗 i.e. the weighted mean

  • Can be any convolution filter, including

binomial, if weights depend on distance to window center.

slide-26
SLIDE 26

M estimator for filter design

Weighted LS: 𝜍 𝑣𝑗 = 𝑥𝑗(𝑣𝑗)2 Solution: መ 𝐠 = σ𝑗𝜗𝑋 𝑥𝑗𝐠𝑗/σ𝑗𝜗𝑋 w𝑗 i.e. the weighted mean

  • Can be any convolution filter, including

binomial, if weights depend on distance to window center.

  • Weights for the bilateral filter depend on

distance in space-value domain from central pixel.

slide-27
SLIDE 27

M estimator for filter design

Absolute value loss: 𝜍 𝑣 = 𝑣 Suppose gray value images, so the loss function has derivative – sign(u).

slide-28
SLIDE 28

M estimator for filter design

Absolute value loss: 𝜍 𝑣 = 𝑣 Suppose gray value images, so the loss function has derivative – sign(u). Solution: σ𝑗𝜗𝑋 I(መ f > f𝑗) = σ𝑗𝜗𝑋 I(መ f < f𝑗), Equal number of lower and higher values than the estimate, i.e. the median: middle of the ordered set.

slide-29
SLIDE 29

Why did the median filter outperform convolution filters?

slide-30
SLIDE 30

Why did the median filter outperform convolution filters? Outlier samples in the filtering window have less influence on the median than on the weighted mean.

slide-31
SLIDE 31

Why did the median filter outperform convolution filters? Outlier samples in the filtering window have less influence on the median than on the weighted mean. Influence function (IF) of a linear filter:

du u d u ) ( ) (  = 

2

( ) ( ) 2 u w u u w u   =  = 

slide-32
SLIDE 32

Why did the median filter outperform convolution filters? Outlier samples in the filtering window have less influence on the median than on the weighted mean. Influence function (IF) of a linear filter: Any sample can have unbounded effect on the estimate (not robust!)

du u d u ) ( ) (  = 

2

( ) ( ) 2 u w u u w u   =  = 

slide-33
SLIDE 33

Why did the median filter outperform convolution filters? Outlier samples in the filtering window have less influence on the median than on the weighted mean. Influence function (IF) of a linear filter: Any sample can have unbounded effect on the estimate (not robust!) Higher residual sample - higher influence (!!!)

du u d u ) ( ) (  = 

2

( ) ( ) 2 u w u u w u   =  = 

slide-34
SLIDE 34

Loss function and IF of the median filter Bounded (and equal) influence of all samples.

( ) | | 1, ( ) ( ) 0, 1, u u u u sign u u u   =    = = =  −  

slide-35
SLIDE 35

Loss function and IF of the median filter Bounded (and equal) influence of all samples. Brake down point (BP): number of points arbitrarily deviated causing arbitrarily big estimation error. Median BP: 50%.

( ) | | 1, ( ) ( ) 0, 1, u u u u sign u u u   =    = = =  −  

slide-36
SLIDE 36

Loss function and IF of the median filter Bounded (and equal) influence of all samples. Brake down point (BP): number of points arbitrarily deviated causing arbitrarily big estimation error. Median BP: 50%. Linear filters: 0%: one very bad outlier is enough … Note, the vector median is a different story.

( ) | | 1, ( ) ( ) 0, 1, u u u u sign u u u   =    = = =  −  

slide-37
SLIDE 37

Should we always use the sample median?

slide-38
SLIDE 38

Should we always use the sample median?

  • When data do not contain outliers the mean

has better performance.

slide-39
SLIDE 39

Should we always use the sample median?

  • When data do not contain outliers the mean

has better performance.

  • We want estimators combining the low

variance of the mean at normal distributions with the robustness of the median under contamination.

slide-40
SLIDE 40

Should we always use the sample median?

  • When data do not contain outliers the mean

has better performance.

  • We want estimators combining the low

variance of the mean at normal distributions with the robustness of the median under contamination.

  • Let us compare the two filters also from the

maximum likelihood perspective!

slide-41
SLIDE 41
slide-42
SLIDE 42
slide-43
SLIDE 43

How can we design robust loss functions?

slide-44
SLIDE 44

How can we design robust loss functions?

  • We need a way to cope with the presence of
  • utlier data, while keeping the efficiency of a

classical estimator for normal data.

slide-45
SLIDE 45

How can we design robust loss functions?

  • We need a way to cope with the presence of
  • utlier data, while keeping the efficiency of a

classical estimator for normal data. Two types of approaches:

  • 1. Shaping the ρ(u) function
  • 2. Analysis of the set of residuals
slide-46
SLIDE 46

1.Shaping the ρ(u) function We want to give less influence to points with residuals beyond “some value”.

slide-47
SLIDE 47

Huber ρ and ψ functions

Ricardo A. Maronna, R. Douglas Martin and V´ıctor J. Yohai, Robust Statistics: Theory and Methods , 2006 John Wiley & Sons

( )

2 2

2

k

x if x k x k x k if x k     =  −   

( ) ( ) ( ) ( )

, ,

k

x if x k k x sign x k if x k k x sign x       =      =

Quadratic loss for small residuals Linear loss for large residuals

slide-48
SLIDE 48

Lots of robust loss functions have been studied. How to choose best parameters for a loss function?

slide-49
SLIDE 49
  • 2. Analysis of the set of residuals

Order statistics approaches

slide-50
SLIDE 50
  • 2. Analysis of the set of residuals

Order statistics approaches

  • L estimators: linear combination on ordered

statistics set x(i).

  • Samples weighted according to position in
  • rdered set
slide-51
SLIDE 51
  • 2. Analysis of the set of residuals

Order statistics approaches

  • L estimators: linear combination on ordered

statistics set x(i).

  • Samples weighted according to position in
  • rdered set

y x(1) x1 x2 xN . . .

  • rdering

x(2) x(N) . . . a1 a2 aN weights

y = a1x(1) + a2 x(2)+...+ aN x(N)

ak

k N =

=

1

1

slide-52
SLIDE 52

L estimator examples. 𝑏𝑗 = 𝐽(𝑛 < 𝑗 ≤ 𝑜 − 𝑛)/(𝑜 − 2𝑛)

a1=1

Min = morphological erosion

. . . . . .

aN=1

Max = morphological dilation

. . . . . .

am=1

Median Trimmed mean

. .

slide-53
SLIDE 53

The trimmed mean

  • Let and
  • The β-trimmed mean is defined by
  • is the sample mean after the m largest and the m

smallest samples have been discarded

  • Half percentage of discarded samples: β

lj 𝑦𝛾 = 1 𝑂 − 2𝑛 ෍

𝑗=𝑛+1 𝑂−𝑛

𝑦 𝑗

𝛾 ∈ ) [0,0.5 𝑛 = 𝑗𝑜𝑢 𝛾 𝑂 − 1

x

slide-54
SLIDE 54
  • Limit cases

– β=0 → the sample mean – β →0.5 → the sample median

The trimmed mean – cont.

slide-55
SLIDE 55
  • Limit cases

– β=0 → the sample mean – β →0.5 → the sample median

– Adaptive trimmed mean:

  • The trimmed mean – cont.

Variance β

slide-56
SLIDE 56
  • Limit cases

– β=0 → the sample mean – β →0.5 → the sample median

– Adaptive trimmed mean:

  • – RE of variance: median of absolute deviations:

MAD = median(ri)

– BP of β % trimmed mean = β %

The trimmed mean – cont.

Variance β

slide-57
SLIDE 57

M estimation and the mean shift filter Weighted LS loss with weights depending on closeness to estimate (not just position in the window):

ˆ ( ) ( ) ˆ ( ) ˆ ˆ ( ) w w w w = − − = −

 

y y

y x y x y y x x y

Pixel: 𝐲 =

𝐲𝑡 𝐠(x𝑡)

slide-58
SLIDE 58

M estimation and the mean shift filter Weighted LS loss with weights depending on closeness to estimate (not just position in the window): Needs iterations to be solved because the weights depend on the unknown estimate!

ˆ ( ) ( ) ˆ ( ) ˆ ˆ ( ) w w w w = − − = −

 

y y

y x y x y y x x y

Pixel: 𝐲 =

𝐲𝑡 𝐠(x𝑡)

slide-59
SLIDE 59

Mean shift iterations are similar with M estimators Minimize loss <–> maximize probability density

slide-60
SLIDE 60

Mean shift iterations are similar with M estimators Minimize loss <–> maximize probability density Algorithm: gradient ascent to find maxima of the kernel probability density estimate (KDE)

slide-61
SLIDE 61

Mean shift iterations are similar with M estimators Minimize loss <–> maximize probability density Algorithm: gradient ascent to find maxima of the kernel probability density estimate (KDE) Fukunaga 1975, Comaniciu & Meer 2002 Mean shift used for filtering, segmentation, tracking…

slide-62
SLIDE 62

Mean shift iterations are similar with M estimators Minimize loss <–> maximize probability density Algorithm: gradient ascent to find maxima of the kernel probability density estimate (KDE) Fukunaga 1975, Comaniciu & Meer 2002 Mean shift used for filtering, segmentation, tracking… 𝑥 ො 𝐲 − 𝒛 = 𝑕(||ො 𝐲 − 𝒛||/ℎ)

g: derivative of the density interpolation kernel h: scale (degree of smoothing) Radially symmetric distance metric here

slide-63
SLIDE 63

Mean shift iterations are similar with M estimators

slide-64
SLIDE 64

What if we have more than just 50% outliers? This situation occurs often in key point based image registration.

slide-65
SLIDE 65

How do we build a panorama?

  • Detect feature points in both images
  • Find corresponding pairs
slide-66
SLIDE 66

Matching with Features

  • Detect feature points in both images
  • Find corresponding pairs
  • Use these pairs to align images
slide-67
SLIDE 67

Can we beat the 50% BP of the median?

slide-68
SLIDE 68

Can we beat the 50% BP of the median?

  • If outliers do not conspire, it should be possible

slide-69
SLIDE 69

Can we beat the 50% BP of the median?

  • If outliers do not conspire, it should be possible

  • Probability density mode definition does not

imply majority!

slide-70
SLIDE 70

Can we beat the 50% BP of the median?

  • If outliers do not conspire, it should be possible

  • Probability density mode definition does not

imply majority!

  • Needing a good search strategy (and good

parameter setting). Better than an (inspired) initial guess.

slide-71
SLIDE 71

Can we beat the 50% BP of the median?

  • If outliers do not conspire, it should be possible

  • Probability density mode definition does not

imply majority!

  • Needing a good search strategy (and good

parameter setting). Better than an (inspired) initial guess.

  • Random sample consensus (RANSAC) approach.
  • Especially designed in the CVIP community.

Along with Hough, MINPRAN etc.

  • M. A. Fischler, R. C. Bolles. Random Sample Consensus: A Paradigm for Model Fitting with

Applications to Image Analysis and Automated Cartography. Comm. of the ACM, Vol 24, pp 381-395, 1981.

slide-72
SLIDE 72

RANSAC is also a voting approach like mode detection. Using a sampling strategy for optimization.

slide-73
SLIDE 73

RANSAC is also a voting approach like mode detection. Using a sampling strategy for optimization. Randomly select a minimum size subset of points to generate a solution:

  • Generate many potential solutions.
  • Select the solution with the best consensus.
  • Best consensus means maximum inliers (within

defined limits), i.e. maximum density in the solution space.

slide-74
SLIDE 74

RANSAC is also a voting approach like mode detection. Using a sampling strategy for optimization. Randomly select a minimum size subset of points to generate a solution:

  • Generate many potential solutions.
  • Select the solution with the best consensus.
  • Best consensus means maximum inliers (within

defined limits), i.e. maximum density in the solution space. Developments: MLESAC, NAPSAC, PROSAC… We used KDE with RANSAC (softer thresholds)

slide-75
SLIDE 75

RANSAC

  • Repeat N times:
  • Draw s points uniformly at random
  • Fit line to these s points
  • Find inliers to this line among the remaining points (i.e., points

whose distance from the line is less than t)

  • If there are d or more inliers, accept the line and refit using all

inliers

slide-76
SLIDE 76

Model fitting example

Detect lines using RANSAC…

slide-77
SLIDE 77

RANSAC for line fitting example

Source: R. Raguram

slide-78
SLIDE 78

RANSAC for line fitting example

Least-squares fit

Source: R. Raguram

slide-79
SLIDE 79

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

Source: R. Raguram

slide-80
SLIDE 80

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

Source: R. Raguram

slide-81
SLIDE 81

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

  • 3. Compute error

function

Source: R. Raguram

slide-82
SLIDE 82

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

  • 3. Compute error

function

  • 4. Select points

consistent with model

Source: R. Raguram

slide-83
SLIDE 83

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

  • 3. Compute error

function

  • 4. Select points

consistent with model

  • 5. Repeat

hypothesize- and-verify loop

Source: R. Raguram

slide-84
SLIDE 84

84

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

  • 3. Compute error

function

  • 4. Select points

consistent with model

  • 5. Repeat

hypothesize- and-verify loop

Source: R. Raguram

slide-85
SLIDE 85

85

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

  • 3. Compute error

function

  • 4. Select points

consistent with model

  • 5. Repeat

hypothesize- and-verify loop Uncontaminated sample

Source: R. Raguram

slide-86
SLIDE 86

RANSAC for line fitting example

  • 1. Randomly

select minimal subset of points

  • 2. Hypothesize a

model

  • 3. Compute error

function

  • 4. Select points

consistent with model

  • 5. Repeat

hypothesize- and-verify loop

Source: R. Raguram

slide-87
SLIDE 87

Choosing the parameters

( ) ( )

( )

s

e p N − − − = 1 1 log / 1 log

( )

( )

p e

N s

− = − − 1 1 1

proportion of outliers e

s 5% 10% 20% 25% 30% 40% 50% 2 2 3 5 6 7 11 17 3 3 4 7 9 11 19 35 4 3 5 9 13 17 34 72 5 4 6 12 17 26 57 146 6 4 7 16 24 37 97 293 7 4 8 20 33 54 163 588 8 5 9 26 44 78 272 1177

Source: M. Pollefeys

  • Initial number of points s
  • Typically minimum number needed to fit the model
  • Distance threshold t
  • Choose t so probability for inlier is p (e.g. 0.95)
  • Zero-mean Gaussian noise with std. dev. σ: t2=3.84σ2
  • Number of samples N
  • Choose N so that, with probability p, at least one random sample is

free from outliers (e.g. p=0.99) (outlier ratio: e)

slide-88
SLIDE 88

Other RE applications

– Detail preserving image filtering – Background estimation for video surveillance – Finger detection and tracking for human computer interface – Posterior attenuation feature extraction for steatosis rating

slide-89
SLIDE 89

Detail preserving image smoothing

Multiscale mode filter - Improves mean shift filter

Gui - EUSIPCO 2008

slide-90
SLIDE 90

Background segmentation in videos

slide-91
SLIDE 91

Background segmentation in videos

Assumptions: Static camera The background is what we see “most frequently” at each location Approaches: Parametric density estimation: MoG Non-parametric: KDE

)} ( max{ arg x b p =

slide-92
SLIDE 92

HMI based on finger detection and tracking

Using histograms of l and 𝜒 to find fingerlet density modes Fast,1D subspace search Fingerlet feature

slide-93
SLIDE 93

Any questions, please?

Robust posterior attenuation feature extraction for steatosis rating

slide-94
SLIDE 94

Conclusions

  • M estimators more general than MLE
  • KDE: similar with M but with probabilistic view
  • RANSAC and related algorithms: a powerful search method
  • Principles from robust estimation worth to be kept in mind for

successfully solving a large variety of CV problems.

slide-95
SLIDE 95

Thank you for your attention! Questions?