Docsity

Lecture Slides on SIFT Features – Computer Vision | EECS 841, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
EECS 841: Computer Vision
Brian Potetz
Fall 2008
Lecture #36: SIFT Features
!"#$%&'$()$*+,%$-
.
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
16
17
18
19
20
21
22
23
24
25
26
Thanksgiving
Break
27
Thanksgiving
Break
28
Thanksgiving
Break
29
30
1
Projects Due
2
3
Project
Presentations
4
5
Project
Presentations
6
!&//$01$%()$2%+,/
•!345(4$21&-$0
–627+%(89:$;(<=>?$"1()$"9/,+@9,(A-9*(89"2'(!"2'$B
3,72-+2,1(4$21&-$0C(DEEE(
F9**9,(G$1#9%0(9A(!12@0@"2'(
3,A$-$,"$(+,(F9*H&1$-(I+0+9,
•J-2%+$,1(6$0"$,1
–K#$,(LMNO(+0(0*991#
•P$'+$A(L-9H2/2@9,
–L9:$-A&';(>&1("2,(>$(0'9:;("2,(A2+'(A9-(/-2H#0(:+1#(
@/#1('99H0
•J-2H#(F&10
–)$01-+"@7$('+*+12@9,0(9,(2''9:2>'$(H91$,@2'(A&,"@9,0
•!2*H'+,/
–F2,(>$(0'9:;(#2-%(19(%$1$"1("9,7$-/$,"$
Q
24
CHAPTER 1. SAMPLING METHODS
1. Initialize
2. For .
–Sample .
–Sample .
.
.
.
–Sample .
.
.
.
–Sample .
Figure 1.14: Psuedo-code for the Gibbs sampling algorithm.
the distribution is an invariant of each the Gibbs sampling steps individually, and hence of
the whole Markov chain. This follows from the fact that when we sample from the
marginal distribution is clearly invariant since the values of the are unchanged.
Also, each step by definition samples from the correct conditional distribution . Since
these conditional and marginal distributions together specify the joint distribution, we see that the
joint distribution is itself invariant.
The second requirement to be satisfied in order that the Gibbs sampling procedure samples
from the correct distribution is that it be ergodic. A sufficient condition for ergodicity is that none
of the conditional distributions be anywhere zero. If this is the case then any point in space
can be reached from any other point in a finite number of steps involving one update of each
of the component variables. If this requirement is not satisfied, so that some of the conditional
distributions have zeros, then ergodicity,if it applies, must beproven explicitly.
The distribution of initial states must also be specified in order to complete the algorithm, al-
though samples drawn after many iterations should become independent of this distribution. Of
course successive samples from the Markov chain will be highly correlated, and so to obtain sam-
ples which are nearly independent it will be necessary to sub-sample the sequence.
Where appropriate we can generalize the Gibbs procedure slightly to sample from sets of vari-
ables, conditioned on the remaining variables, at each step. Note that these sets do not need to be
disjoint.
Wecan obtain the Gibbs sampling procedure as a particular instance of the Metropolis-Hastings
algorithm as follows. Consider a Metropolis-Hastings sampling step involving the group of vari-
able in which the remaining variables remain fixed, and forwhich the transition probability
is given by . We note that since these components are unchanged by
the sampling step. Also, . Thus the factor which determines the acceptance
probability in the Metropolis-Hastings (??) is given by
(1.54)
Thus the Metropolis-Hastings steps are always accepted, and therefore this choice of proposal dis-
tribution corresponds to the Gibbs sampling algorithm.
The practical applicability of Gibbs sampling depends on the ease with which samples can be
Gibbs Sampling
5
Goal: Given a multidimensional distribution, try to draw samples from it.
If I can accumulate a large database of samples, I can easily find the most
likely sample, or the expected value of some variable.
Gibbs Sampling: Guess x1 using the marginal P(x1).
Then guess x2 using the conditional P(x2|x1).
Then guess x3 using the conditional P(x3|x1, x2). Etc.
Gibbs Sampling
6
Gibbs Sampling: Guess x1.using the marginal P(x1).
Then guess x2 using the conditional P(x2|x1).
Then guess x3 using the conditional P(x3|x1, x2). Etc.
Gibbs sampling is especially suited to graphical models, where
conditional independencies are known.
Bayes Net
P(x1|X\x1) depends only on
parents, children, and coparents
MRF
P(x1|X\x1) depends only
on immediate neighbors
1.3. GIBBS SAMPLING
25
drawn from conditional distributions .In the case of graphical models, the conditional
distributionsfor individual nodes depend only onthe variables in the corresponding Markov blan-
kets, as illustrated in Figure ??. For directed graphs, a very broad choice of conditional distribu-
(a) (b)
Figure1.15: The Gibbs sampling requires samples to be drawn from the conditional distribution of
avariable conditioned on the remaining variables. For graphical models, this conditional distribu-
tionis a function only of the states of the nodes in the Markov blanket. In the case of an undirected
graph (a) this comprises the set of neighbours while for a directed graph (b) the Markov blanket
comprises the parents,the children and the co-parents.
tions for the individual nodes conditioned on their parents will lead to conditional distributions
for Gibbs sampling which are log concave. The adaptive rejection sampling methods discussed
in Section ?? thereforeprovide a framework for Monte Carlo sampling from directed graphs with
broadapplicability.
As with the Metropolis algorithm, we can gain some insight into the behaviour of Gibbs sam-
plingby investigating its application to a Gaussian distribution. Consider a correlated Gaussian in
twovariables, as illustrated in Figure ??, having a conditional distribution of width and a marginal
distribution of width . The typical step size is governed by the conditional distributions and will
beof order . Since the state evolves according to a random walk, the number of steps needed to ob-
tain independent samples from the distribution will be of order . Of course if the Gaussian
distribution were uncorrelated then the Gibbs sampling procedurewould be optimally efficient.
Forthis simple problem we could rotatethe coordinate system in order to decorrelate the variable,
however,in practical applications it will generally be infeasible to find such transformations.
One approach to reducingrandom walk behaviour in Gibbs sampling is called over-relaxation.
In its original form this applies to problems for which the conditional distributions are Gaussian.
This representsa more general class of distributions than the multi-variate Gaussian, since for ex-
amplethe non-Gaussian distribution has Gaussian conditional distributions.
At each step of the Gibbs sampling algorithm the conditional distribution for a particular compo-
nent has some mean and some variance . In the over-relaxation framework the value of
is replacedwith
(1.55)
where isa Gaussian random variate with zero mean and unit variance, and isa parameter such
that . For the method is equivalent to standard Gibbs sampling. When is
negativethe step is biased to the opposite side of the mean. It is easily seen that this step leaves the
desired distribution invariant since if has mean andvariance , then so too does . Also it
is clearthat if the original Gibbs sampling is ergodic, then the over-relaxedversion will be ergodic
pf3
pf4
pf5

Partial preview of the text

Download Lecture Slides on SIFT Features – Computer Vision | EECS 841 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

EECS 841: Computer Vision

Brian Potetz

Fall 2008

Lecture #36: SIFT Features

Sunday Monday Tuesday Wednesday Thursday Friday Saturday

Thanksgiving

Break

Thanksgiving

Break

Thanksgiving

Break

Projects Due

Project

Presentations

Project

Presentations

– 627+%(89:$;(<=>?$"1()$"9/,+@9,(A-9*(89"2'(!"2'$B

3,72-+2,1(4$21&-$0C(DEEE(

F9**9,(G$1#9%0(9A(!12@0@"2'(

3,A$-$,"$(+,(F9*H&1$-(I+0+9,

• J-2%+$,1(6$0"$,

– K#$,(LMNO(+0(0*991#

• P$'+$A(L-9H2/2@9,

– L9:$-A&';(>&1("2,(>$(0'9:;("2,(A2+'(A9-(/-2H#0(:+1#(

@/#1('99H

• J-2H#(F&

– )$01-+"@7$('+*+12@9,0(9,(2''9:2>'$(H91$,@2'(A&,"@9,

• !2*H'+,/

– F2,(>$(0'9:;(#2-%(19(%$1$"1("9,7$-/$,"$ Q

24 CHAPTER 1. SAMPLING METHODS

1. Initialize

2. For.

- Sample. - Sample.

- Sample.

- Sample.

Figure 1.14: Psuedo-code for the Gibbs sampling algorithm.

the distribution is an invariant of each the Gibbs sampling steps individually, and hence of

the whole Markov chain. This follows from the fact that when we sample from the

marginal distribution is clearly invariant since the values of the are unchanged.

Also, each step by definition samples from the correct conditional distribution. Since

these conditional and marginal distributions together specify the joint distribution, we see that the

Gibbs Sampling

Goal : Given a multidimensional distribution, try to draw samples from it.

If I can accumulate a large database of samples, I can easily find the most

likely sample, or the expected value of some variable.

Gibbs Sampling: Guess x 1 using the marginal P(x1).

Then guess x 2 using the conditional P(x 2 |x 1 ).

Then guess x 3 using the conditional P(x 3 |x 1 , x 2 ). Etc.

1.3. GIBBS SAMPLING 25

drawn from conditional distributions distributions for individual nodes depend only on the variables in the corresponding Markov blan-. In the case of graphical models, the conditional kets, as illustrated in Figure ??. For directed graphs, a very broad choice of conditional distribu-

(a) (b)

Figure 1.15: The Gibbs sampling requires samples to be drawn from the conditional distribution of a variable conditioned on the remaining variables. For graphical models, this conditional distribu- tion is a function only of the states of the nodes in the Markov blanket. In the case of an undirected graph (a) this comprises the set of neighbours while for a directed graph (b) the Markov blanket comprises the parents, the children and the co-parents. tions for the individual nodes conditioned on their parents will lead to conditional distributions for Gibbs sampling which are log concave. The adaptive rejection sampling methods discussed in Section broad applicability. ?? therefore provide a framework for Monte Carlo sampling from directed graphs with pling by investigating its application to a Gaussian distribution. Consider a correlated Gaussian in^ As with the Metropolis algorithm, we can gain some insight into the behaviour of Gibbs sam- two variables, as illustrated in Figure distribution of width. The typical step size is governed by the conditional distributions and will ?? , having a conditional distribution of width and a marginal be of order tain independent samples from the distribution will be of order. Since the state evolves according to a random walk, the number of steps needed to ob-. Of course if the Gaussian distribution were uncorrelated then the Gibbs sampling procedure would be optimally efficient. For this simple problem we could rotate the coordinate system in order to decorrelate the variable,

Gibbs Sampling

Gibbs Sampling: Guess x 1 .using the marginal P(x1).

Then guess x 2 using the conditional P(x 2 |x 1 ).

Then guess x 3 using the conditional P(x 3 |x 1 , x 2 ). Etc.

Gibbs sampling is especially suited to graphical models, where

conditional independencies are known.

Bayes Net

P(x 1 |X\x 1 ) depends only on

parents, children, and coparents

MRF

P(x 1 |X\x 1 ) depends only

on immediate neighbors

1.3. GIBBS SAMPLING 25

drawn from conditional distributions distributions for individual nodes depend only on the variables in the corresponding Markov blan-. In the case of graphical models, the conditional kets, as illustrated in Figure ??. For directed graphs, a very broad choice of conditional distribu-

(a) (b)

Figure 1.15: The Gibbs sampling requires samples to be drawn from the conditional distribution of a variable conditioned on the remaining variables. For graphical models, this conditional distribu- tion is a function only of the states of the nodes in the Markov blanket. In the case of an undirected graph (a) this comprises the set of neighbours while for a directed graph (b) the Markov blanket comprises the parents, the children and the co-parents. tions for the individual nodes conditioned on their parents will lead to conditional distributions for Gibbs sampling which are log concave. The adaptive rejection sampling methods discussed in Section broad applicability. ?? therefore provide a framework for Monte Carlo sampling from directed graphs with pling by investigating its application to a Gaussian distribution. Consider a correlated Gaussian in^ As with the Metropolis algorithm, we can gain some insight into the behaviour of Gibbs sam- two variables, as illustrated in Figure distribution of width. The typical step size is governed by the conditional distributions and will ?? , having a conditional distribution of width and a marginal be of order tain independent samples from the distribution will be of order. Since the state evolves according to a random walk, the number of steps needed to ob-. Of course if the Gaussian distribution were uncorrelated then the Gibbs sampling procedure would be optimally efficient. For this simple problem we could rotate the coordinate system in order to decorrelate the variable,

(a) (b) (c) Fig. 7. The three learned potential functions for filters. (a) D. (b) — x. (c) — y. Dashed curves are the fitting functions:

(a) y 1 a f x = 2.1 1a - 1 f / e 1 +b x/ 4.8g^ 1.32j. (b) y 2 a f x = 1.25 1a - 1 f / e 1 +b x/ 2.8g^ 1.5j. (c) y 3 a f x = 1.95 1a - 1 f / e 1 +b x/ 2.8g^ 1.5j.

Fig. 8. A typical sample of p 3 (I) (256 ¥ 256 pixels). 3.2.2 Experiment II It is clear that we need large-scale filters to do better. Rather than using the large scale Gabor filters, we chose to use — x and scale invariant property that we find in natural images. — y on four different scales and impose explicitly the Given an image pyramid in the same way as before. Let I defined on an N ¥ N lattice I [ s ], s (^) = 0, 1, 2, 3 be L , we build a four layers of the pyramid. Let Hx , s ( z , x , y ) denote the histo- gram of We ask for a probability model — x I [ s ]( x , y ) and Hy , s ( z , x , y ) the histogram of p ( I ) which satisfies — y I [ s ]( x , y ).

E p a f I H x s , c z x y , , h = m a f z , " z "c x y , hŒ L s , s =0 1 2 3, , ,

E p a f I H y s , c z x y , , h = m a f z , " z "c x y , hŒ L s , s =0 1 2 3, , ,

where Ls is the image lattice at level s , and m a f z is the aver-

age of the observed histograms of natural images at all scales. This results in a maximum en- — x I [ s ]^ and — y I [ s ]^ on all 44 tropy distribution ps ( I ) with energy of the following form, U (^) s (^) s x y Lx s x^ sx y (^) y s y^ sx y s

a f^ I^ =^ Â=^30 b  ,g Œ l^ , e —^ I^ c ,^ hj +^ l ,e — I c ,hj^.^ (12)

Gibbs Sampling

An image drawn from a MRF with large graph cliques

Prior Learning and Gibbs Reaction-Diffusion

Song Chun Zhu and David Mumford 8

Prior Learning and Gibbs Reaction-Diffusion

Song Chun Zhu and David Mumford

ZHU AND MUMFORD: PRIOR LEARNING AND GIBBS REACTION-DIFFUSION

filter LG d 2 i of widow size 7 ¥ 7 pixels as the reaction filter

F 1 a f^2 at level one of the image pyramid, and we set ( a = - 6.0,

b = 10, g = 2.0) for y 1 a f^2 b g x. The differences between these

three patterns are caused by xo in y 1 a f^2 b g x. xo = 0 forms the

patterns with symmetric appearances for both black and

white parts as shown in Fig. 14a. As xo becomes negative,

black blobs begin to form as shown in Fig. 14b, where xo = - 6,

and positive xo generates white blobs in the black back-

ground as shown in Fig. 14c, where xo = 6. The general

smoothness appearance of the images is attributed to the

diffusion filter. Fig. 14d is generated with two reaction fil-

ters: LG d 2 i at level one and level two, respectively, there-

fore the Grade creates blobs of mixed sizes. Similarly we

selected one cosine Gabor filter Gcos (4, 30 o ) (size 7 ¥ 7 pixels

oriented at 30 o ) at level one as the reaction filter F 1 a f^2 for

Fig. 14e where ( a = - 3.5, b = 10, g = 2.0, xo = 0) for y 1 a f^2 b g x.

Fig. 14f is generated with two reaction filters Gcos (4, 30 o ),

Gcos (4, 60 o ) at level one, where ( a = - 3.5, b = 10, g = 2.0, xo = - 3)

for y 1 a f^2 b g x and y 1 a f^3 b g x.

It seems that the leopard blobs and zebra stripes are

among the most canonical patterns which can be gener-

ated with easy choices of filters and parameters. As

shown in [40], the Gibbs distribution are capable of mod-

eling a large variety of texture patterns, but filters and

different forms for y ( x ) have to be learned for a given

texture pattern.

5 IMAGE ENHANCEMENT AND CLUTTER REMOVAL

So far we have studied the use of a single energy function

U ( I ) either as the log likelihood of a probability distribution

at I or as a function of I to be minimized by gradient de-

scent. In image processing, we often need to model both the

underlying images and some distortions, and to maximize a

posterior distribution. Suppose the distortions are additive,

i.e., an input image is,

I in^ =

In many applications, the d

i.i.d. Gaussian noise, but c

trees in front of a building o

will be very hard to handl

segmentation algorithms.

We propose to model clu

tion, which can be learned

the minimax entropy theor

image I. Thus an extra pyram

needed in a Gibbs distribu

The resulting posterior dist

form with potential function

U *( I ) = U C ( I in^ - I ; L

where U C () is the potential o

Fig. 15. The computational schem

Thus the MAP estimate o

experiments which follow,

for minimization, a variant o

d I t = -— U *^ a

where w ( x , y , t ) is the standar

w x y t c , , h ~ N d m b x y ,

T ( t ) is the “temperature” w

the random fluctuation. Un

approaches a global minimu

The analyses of convergenc

in [14], [10], [8]. The compu

process is notorious, but, fo

fast decrease of temperatur

very much.

5.1 Experiment I

In the first experiment, we t

be an i.i.d. Gaussian noise

performance of the three p

whose potential functions ar

Fig. 14. Leopard blobs and zebra stripes synthesized by Grades.

Gibbs Sampling

Troubles with Gibbs Sampling:

• First few samples reflect the starting position. How many to discard?

Burn-in phase

Gibbs Sampling

Troubles with Gibbs Sampling:

• First few samples reflect the starting position. How many to discard?

• Can get stuck in one mode of a multimodal distribution

Gibbs sampling always moves at right angles

Gibbs Sampling

Troubles with Gibbs Sampling:

• First few samples reflect the starting position. How many to discard?

• Can get stuck in one mode of a multimodal distribution

Why ever go here?

Object Recognition

Bag of Words

Bag of Words

Some features may encode negative space, or conjunctions

Approaches Considered So Far...

• Normalized Correlation

– Slow. Brittle. Sensitive to changes in illumination,

rotation, viewpoint, pose...

• PCA

– Slow. Brittle. Sensitive to changes in illumination,

rotation, viewpoint, pose...

• Deformable Templates

– Depends only/primarily on edge information alone.

– Invariant to rotation in the image plane, but not

viewpoint invariant.

Approaches Considered So Far...

• Normalized Correlation

– Slow. Brittle. Sensitive to changes in illumination,

rotation, viewpoint, pose ...

• PCA

– Slow. Brittle. Sensitive to changes in illumination,

rotation, viewpoint, pose ...

• Deformable Templates

– Depends only/primarily on edge information alone.

– Invariant to rotation in the image plane, but not

viewpoint invariant.

Approaches Considered So Far...

• Normalized Correlation

– Slow. Brittle. Sensitive to changes in illumination,

rotation, viewpoint, pose ...

• PCA

– Slow. Brittle. Sensitive to changes in illumination,

rotation, viewpoint, pose ...

• Deformable Templates

– Depends only/primarily on edge information alone.

– Invariant to rotation in the image plane, but not

viewpoint invariant.

Let’s define image features that are highly

distinctive (discriminative), but also as

insensitive to rotation & pose as possible.

Invariant local features

– Invariant to affine transformations, or changes

in camera gain and bias

SIFT Features

SIFT Features

The input image is first convolved with the Gaussian

nction using to give an image A. This is then

peated a second time with a further incremental smooth-

g of to give a new image, B, which now has an

ffective smoothing of. The difference of Gaussian

nction is obtained by subtracting image B from A, result-

g in a ratio of between the two Gaussians.

To generate the next pyramid level, we resample the al-

ady smoothed image B using bilinear interpolation with a

ixel spacing of 1.5 in each direction. While it may seem

ore natural to resample with a relative scale of , the

nly constraint is that sampling be frequent enough to de-

ct peaks. The 1.5 spacing means that each new sample will

e a constant linear combination of 4 adjacent pixels. This

efficient to compute and minimizes aliasing artifacts that

ould arise from changing the resampling coefficients.

Maxima and minima of this scale-space function are de-

rmined by comparing each pixel in the pyramid to its

eighbours. First, a pixel is compared to its 8 neighbours at

e same level of the pyramid. If it is a maxima or minima

t this level, then the closest pixel location is calculated at

e next lowest level of the pyramid, taking account of the

.5 times resampling. If the pixel remains higher (or lower)

an this closest pixel and its 8 neighbours, then the test is

peated for the level above. Since most pixels will be elim-

ated within a few comparisons, the cost of this detection is

mall and much lower than that of building the pyramid.

If the first level of the pyramid is sampled at the same rate

s the input image, the highest spatial frequencies will be ig-

ored. This is due to the initial smoothing, which is needed

provide separation of peaks for robust detection. There-

re, we expand the input image by a factor of 2, using bilin-

ar interpolation, prior to building the pyramid. This gives

n the order of 1000 key points for a typical pixel

age, compared to only a quarter as many without the ini-

al expansion.

.1. SIFT key stability

o characterize the image at each key location, the smoothed

age A at each level of the pyramid is processed to extract

age gradients and orientations. At each pixel, , the im-

ge gradient magnitude, , and orientation, , are com-

uted using pixel differences:

he pixel differences are efficient to compute and provide

fficient accuracy due to the substantial level of previous

Figure 1: The second image was generated from the first by

rotation, scaling, stretching, change of brightness and con-

trast, and addition of pixel noise. In spite of these changes,

78% of the keys from the first image have a closely match-

ing key in the second image. These examples show only a

subset of the keys to reduce clutter.

maximum possible gradient value. This reduces the effect

of a change in illumination direction for a surface with 3D

relief, as an illumination change may result in large changes

to gradient magnitude but is likely to have less influence on

gradient orientation.

Each key location is assigned a canonical orientation so

that the image descriptors are invariant to rotation. In or-

der to make this as stable as possible against lighting or con-

trast changes, the orientation is determined by the peak in a

histogram of local image gradient orientations. The orien-

tation histogram is created using a Gaussian-weighted win-

dow with of 3 times that of the current smoothing scale.

These weights are multiplied by the thresholded gradient

values and accumulated in the histogram at locations corre-

sponding to the orientation,. The histogram has 36 bins

covering the 360 degree range of rotations, and is smoothed

prior to peak selection.

The stability of the resulting keys can be tested by sub-

jecting natural images to affine projection, contrast and

brightness changes, and addition of noise. The location of

SIFT Features

1. Locate prominent, unusual image features

- Locate features in scale-space, so each feature has

a location and a spatial scale/size.

2. Identify the overall orientation of each feature

3. Describe the appearance of each feature

expand

expand

expand

Gaussian Pyramid Laplacian Pyramid

The Laplacian Pyramid

3) Describe Feature Appearance

SIFT feature vector

! Note: this is somewhat simplified; there

are a number of somewhat ad hoc steps,

but the whole thing works pretty well

SIFT feature vector

! Note: this is somewhat simplified; there

are a number of somewhat ad hoc steps,

but the whole thing works pretty well

3) Describe Feature Appearance

SIFT feature vector

! Note: this is somewhat simplified; there

are a number of somewhat ad hoc steps,

but the whole thing works pretty well

SIFT feature vector

! Note: this is somewhat simplified; there

are a number of somewhat ad hoc steps,

but the whole thing works pretty well

1. Divide neighborhood into 4x4 regions

2. Within each region, compute gradient

orientation at 4x4 = 16 locations.

Construct a histogram of orientations,

weighted by location & gradient

magnitude.

All orientations are relative to feature

orientation.

3. SIFT descriptor contains 16 histograms

of 8 bins each. 128 values total.

Object Recognition Using SIFT

• Naive approach

requires finding the

Euclidean distance (in

128 dimensions)

between all pairs.

1. For each feature in the input, find the nearest

feature in the template

Object Recognition Using SIFT

• Naive approach

requires finding the

Euclidean distance (in

128 dimensions)

between all pairs.

• Improve search by

1000x by storing

template features in a

k-d tree.

1. For each feature in the input, find the nearest

feature in the template