



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




∇f (x, y) = 0
The Newton’s method for solving g(x) = 0, is given by :
g(x) ≈ g(a) + g′(a)(x − a) =0 [where a is an initial guess]
or, x =a −
g(a) g′(a)
This can be interpolated to the following for nth^ value of x :
or,xn+1 = xn − g(xn) g′(xn)
[For x 0 = a]
Since our function comprises of two variables x, y let us suppose : ~r =
x y
and let r~ 0 =
a b
be our initial guess. Then :
∇f (x, y) ≈ ∇f (a, b) + ∇(∇f (a, b))(~r − r~ 0 ) = 0 or,∇f (x, y) ≈ ∇f (a, b) + ∇^2 f (a, b)(~r − r~ 0 ) = 0
Now, ∇^2 f (x, y) =
[ (^) ∂ (^2) f ∂x^2
∂^2 f ∂x∂y ∂^2 f ∂y∂x
∂^2 f ∂y^2
= Hf (x, y) which is the Hessian of f (x, y). From the above we could conclude
that :
∇f (x, y) ≈ ∇f (a, b) + Hf (x, y)(~r − r~ 0 ) = or, ~r = r~ 0 − Hf (a, b)−^1 ∇f (a, b) (1)
We could generalize from (1) for Xn and Yn : [ xn+ yn+
xn yn
− [Hf (xn, yn)]−^1 ∇f (xn, yn) [F or
x 0 y 0
a b
The minimum of f (x, y) can be approximated by iterating the following sequence: [ Xn+ Y n + 1
Xn Y n
− αn∇f (Xn, Yn)
where
a b
Comparing this sequence to (2), it is clear that they are equivalent when αn = [Hf (Xn, Yn)]−^1. In the previous problem we were using Newton’s method to find a zero of the gradient. This of course will lead us to a stationary point which would be a minimum value. So it should be expected that Newton’s method, applied to the gradient would be related to a method for approximating a minimum. This method is the Steepest Descent.
(a) ∇f (~x) if f (~x) = bT^ ~x For the sake of simplicity, let us assume:
~b =
b 1 b 2
, ~x =
x 1 x 2
Therefore,
f (~x) = ~bT^ ~x = b 1 x 1 + b 2 x 2 (4)
Now, ∇f (~x) =
[ (^) ∂f (~x) ∂x 1 ∂f (~x) ∂x 2
Taking partial derivatives on (4) wrt x 1 , x 2 we get:
∇f (~x) =
b 1 b 2
= ~bT
We could easily infer from the above that for ~b =
b 1 b 2 .. . bn
and ~x =
x 1 x 2 .. . xn
The gradient ∇f (~x) is given by : ∂f (~x) ∂x 1 ∂f (~x) ∂x 2 .. . ∂f (~x) ∂xn
b 1 b 2... bn
= ~bT^ (5)
(b) ∇f (~x) if f (~x) = ~xT^ A~x Let us suppose A =
a 1 , 1 a 1 , 2 a 2 , 1 a 2 , 2
Therefore using (3) we have,
f (~x) = ~xT^ A~x
=
x 1 x 2
a 1 , 1 a 1 , 2 a 2 , 1 a 2 , 2
x 1 x 2
= a 1 , 1 x 12 + (a 1 , 2 + a 2 , 1 )x 1 x 2 + a 2 , 2 x 22 (6)
The gradient ∇f (~x) is given by : [ (^) ∂f (~x) ∂x 1 ∂f (~x) ∂x 2
2 a 1 , 1 x 1 (a 1 , 2 + a 2 , 1 )x 2 (a 1 , 2 + a 2 , 1 )x 1 2 a 2 , 2 x 2
2 a 1 , 1 (a 1 , 2 + a 2 , 1 ) (a 1 , 2 + a 2 , 1 ) 2 a 2 , 2
x 1 x 2
x 1 x 2
= 2A~x [As A is symmetric, AT^ = A] (7)
The above relation could be generalized an nxn symmetric matrix A and n dimensional column vectors ~x and ~b.
(c) Find the Hessian of g(x) = XT^ Ax − bT^ x The Hessian of g(x),
H(g)i,j (~x) =
∂xi
∂xj
g(~x) = ∇^2 g(~x)
However from (5) and (7), we could conclude : ∇g(~x) = 2A~x − bT So, ∇^2 g(~x) = 2A Thus, Hg(~x) = 2A
f (x, y) ⊗ g(x + p, v + q) =
p
q
f (x, y)g(x + p, y + q) (8)
The Maximum Average Correlation Height (MACH) filter is used in Automatic Target Recognition applications. This is an extremely useful tool to recognize objects viewed from different orientations. Following are the steps that are employed to implement the filter:
1 % Program t o implement MACH f i l t e r − a p p l i c a t i o n o f MAP 6398 P r o j e c t 2 c l o s e a l l ; 3 c l e a r a l l ; 4 5 ∆ = 0. 0 0 0 5 ; 6 7 % C r e a t e s e t s o f f i l t e r : we d i v i d e t h e t r a i n i n g d a t a s e t i n t o c l a s s e s. The 8 % e l e v a t i o n r a n g e o f t h e d a t a s e t i s 0 , 3 , 6.. 90 and t h e azimuth i s 0 , 3 , 6 − 9 % 357. Let us s e l e c t a f i l t e r f o r a s e t t h a t c o v e r s 6 d e g r e e s ( e l e v a t i o n 10 % r a n g e ) and a l l a n g l e s i n azimuth r a n g e. 11 kcnt = 1 ; 12 13 f o r i c n t = 0 : 3 : 9 0 14 % X i s F o u r i e r t r a n s f o r m e d v e r s i o n o f x 15 % The 48 d e g r e e o r i e n t a t i o n s a r e not t h e r e − This i s j u s t a c r u d e h a c k. 16 % There a r e i n s u c f f i c i e n t data f o r azimuth a n g l e s 69 and 72 17 i f ( i c n t == 48 | | i c n t == 6 9 | | i c n t == 7 2 ) 18 c o n t i n u e ; 19 end 20 21 f o r j c n t = 0 : 4 5 : 3 5 7 22 % A workaround f o r g e t t i n g boundary v a l u e azimuths 23 i f ( j c n t == 3 1 5 ) 24 [ x X] = g e t I n p u t M a t r i c e s ( [ i c n t , i c n t ] , [ j c n t , 3 5 7 ] ) ; 25 e l s e 26 [ x X] = g e t I n p u t M a t r i c e s ( [ i c n t , i c n t ] , [ j c n t , j c n t + 4 5 ] ) ; 27 end 28 29 % Obtain t o t a l number o f p i x e l s i n each i m a g e. Obtain 30 % number o f images f o r t h i s c l a s s 31 [ nPix nImg ] = s i z e (X ) ; 32 33 % i n o r d e r t o s i m p l i f y t h e f i l t e r c r e a t i o n , we o n l y e x t r a c t t h e phase 34 % component o f a l l t h e complex e n t r i e s i n X and s t o r e i t i n PX. This i s 35 % a l s o d e s c r i b e d i n t h e Amplitude n o r m a l i z a t i o n s e c t i o n ( 6 ) o f t h e P a p e r. 36 PX = a n g l e (X ) ; 37 % Get a v e r a g e image i n s p a t i a l domain , t h i s i s nPix X 1 38 xavg = mean ( x , 2 ) ; 39 % Obtain t h e a v e r a g e phase from t h e F o u r i e r t r a n s f o r m e d i m a g e. This i s a 40 % nPix X 1 matrix 41 PXavg = mean (PX, 2 ) ;
42 43 % Compute t h e Average S i m i l a r i t y measure e x p r e s s i o n 44 SPX = z e r o s ( nPix , 1 ) ; 45 f o r l c n t = 1 : nImg 46 P X d i f f = PX( : , l c n t ) − PXavg ; 47 SPX = SPX + c o n j ( P X d i f f ). * P X d i f f ; 48 end 49 SPX = SPX/nImg ; 50 % Compute h f o r each s e t o f t r a i n i n g i m a g e s. h i s hence a nPix x [ number o f 51 % s e t s o f t r a i n i n g images ] 52 h ( : , kcnt ) = ( 1. / (SPX + ∆* o n e s ( nPix , 1 ) ) ). * xavg ; 53 kcnt = kcnt +1; 54 j c n t = j c n t + 4 5 ; 55 end 56 end 57 %Number o f f i l t e r s 58 n f i l t = kcnt −1; 59 60 % T e s t i n g i f t h e code works 61 % Given an image : f i n d out t h e n e a r e s t one f i t e r c l a s s t h a t has 62 % c o r r e l a t i o n s output s i m i l a r t o i t 63 64 fnames = ' /home/ subh / c o u r s e s /map6398/ p r o j e c t s / p r o j e c t −2/ d a t a s e t /. i s 4 ' ; 65 data = ' /home/ subh / c o u r s e s /map6398/ p r o j e c t s / p r o j e c t −2/ d a t a s e t / ' ; 66 row = 1 2 8 ; 67 c o l = 1 2 8 ; 68 d = row c o l ; 69 70 % Pick an image randomly from t h e d a t a s e t 71 f i l e s = d i r ( fnames ) ; 72 f l i d x = f i n d (¬ [ f i l e s. i s d i r ] ) ; 73 nImg = l e n g t h ( f l i d x ) ; 74 i d x = l e n g t h ( f l i d x ) − round ( nImg* rand ( 1 ) ) ; 75 76 flname = f i l e s ( f l i d x ( i d x ) ) .name ; 77 d i s p ( flname ) ; 78 79 % Load image 80 f d = f o p e n ( s t r c a t ( data , flname ) , ' r ' , ' l ' ) ; 81 img = f r e a d ( fd , [ 1 5 1 2 * 5 1 2 ] , ' u b i t 8 ' ) ; 82 f c l o s e ( f d ) ; 83 img = img ( 1 2 9 : end ) ; 84 img = r e s h a p e ( img , [ 1 0 0 1 0 0 ] ) ; 85 img = i m r e s i z e ( img , [ row c o l ] , ' b i c u b i c ' ) ; 86 X t e s t = r e s h a p e ( img , d , 1 ) ; 87 X t e s t = a n g l e ( f f t 2 ( X t e s t ) ) ; 88 % Computing t h e r e s p o n s e s o f t h e a m p l i t u d e n o r m a l i z e d t e s t image i n 89 % f r e q u e n c y domain with t h e s e t s o f f i l t e r 90 91 f o r i c n t =1: n f i l t 92 g ( : , i c n t ) = X t e s t. *h ( : , i c n t ) ; 93 r e s p ( : , i c n t ) = sum ( g ( : , i c n t ) ) ; 94 end 95 Cidx = f i n d ( r e s p==max( r e s p ) ) ; 96 % I n t e r p r e t i n g t h e i n d i c e s 97 % This i s t h e o r g a n i z a t i o n o f c l a s s e s : f o r each e l e v a t i o n t h e r e a r e 8 s e t s 98 % o f f i l t e r Cidx /8 would g i v e us t h e e l e v a t i o n c l a s s t h e f i l t e r b e l o n g s. 99 e C l a s s = 1 + ( Cidx / 8 ) * 3 ; 100 a C l a s s = 45 *mod( Cidx , 8 ) ; 101 d i s p ( e C l a s s ) ; 102 d i s p ( a C l a s s ) ;
Listing 1: Matlab script implementing MACH filter
Training image Filename Identified Elevation Identified Azimuth E06a258.is4 6.2500 270 E30a279.is4 53.5000 180 E84a135.is4 52 0 E63a336.is4 64.1250 335 E39a105.is4 41.2500 70 E03a168.is4 44.1250 135 E03a0.is4 8 0 E78a225.is4 80.1250 20 E00a300.is4 04.1250 235 E03a174.is4 5 180
The results are not entirely as expected. The deviations from the expected results could mainly be due to the unavailability of training images for certain images belonging to a particular set of orientations.