Object Recognition Presentation Fourier PSO-exact Recognition using Particle Swarm Optimization ......

27
Slide Slide 1 1 WSC 11 WSC 11 Object Recognition using Particle Swarm Optimization on Fourier Descriptors Muhammad Sarfraz Ali Taleb Ali Al-Awami King Fahd University of Petroleum and Minerals KFUPM # 1510, Dhahran 31261, Saudi Arabia E-mail: [email protected]

Transcript of Object Recognition Presentation Fourier PSO-exact Recognition using Particle Swarm Optimization ......

Slide Slide 11WSC 11WSC 11

Object Recognition using Particle Swarm Optimization

on Fourier Descriptors

Muhammad SarfrazAli Taleb Ali Al-Awami

King Fahd University of Petroleum and MineralsKFUPM # 1510, Dhahran 31261, Saudi Arabia

E-mail: [email protected]

Slide Slide 22WSC 11WSC 11

Outline• Introduction• Statement of the Problem• Methodology• Solution (Algorithm)

• Experiments & Results• Particle Swarm Optimization (PSO)• Conclusion

Slide Slide 33WSC 11WSC 11

Introduction

Answer

Database of Fourier

Descriptors

F-16B-747M-52………...……

ClassifierContour shape

Input shape

Slide Slide 44WSC 11WSC 11

Introduction• Object recognition is the ultimate goal for many

image analysis and computer vision applications.

• Among the many cues proposed, such as color, texture and others, shape is the most common and dominant feature

• Many Shape models have been studied whose imaging conditions and object appearance are restricted or well controlled.

Slide Slide 55WSC 11WSC 11

Introduction

• The main difficulty lies in view variability associated with the images of the given object.

• The previous work in view of invariant object recognition can be classified into 3 approaches

– Using invariants– Part decomposition– Alignment

• Fourier Descriptors are popular invariants that are invariant to 2D transformations.

Slide Slide 66WSC 11WSC 11

Statement of the problem

• To Recognize the Objects such as Airplanes which are invariant to translation, rotation and scaling in 2-dimension.

• To recognize the objects in case of noise and occlusion.

Slide Slide 77WSC 11WSC 11

Methodology• Getting Bitmap Image

• Removing Noise

Slide Slide 88WSC 11WSC 11

Methodology

• Extracting Outline

Slide Slide 99WSC 11WSC 11

Methodology : Fourier Descriptors

• Find the boundary of the image using the algorithm

• Convert the x, y coordinates in the contour to a one-dimensional vector by treating them as a complex pair. That is: U(n) = X(n) + i * Y(n).

• Perform the Fast Fourier Transform on U and take the absolute value to create a new vector Awhich is the magnitude of the coefficients.

Slide Slide 1010WSC 11WSC 11

Methodology : Fourier Descriptors …..• The Fourier

transform of a continuous function of a variable u is given by the equation:

• When dealing with discrete images the Discrete Fourier Transform (DFT) is used:

• The variable u is complex, so by using the expansion:e[-j A] = cos (A) – j. sin (A) where A = 2πu/x and N is the number of equally spaced samples, one can have:

For Digital Images

Using expansion

( ) ( ) 2j uxF u f u e dxπ∞

−∞= ∫

( ) ( )2

1

0

1j x

NN

xF u f u e

N

π−−

=

⎛ ⎞= ⎜ ⎟⎝ ⎠

( ) ( ) ( ) ( )( )1

0

1 ) . cos .sinN

xF u f x jy Ax j Ax

N

=

⎛ ⎞= + −⎜ ⎟⎝ ⎠

Slide Slide 1111WSC 11WSC 11

Methodology : Fourier Descriptors ……

• The simple geometric transformations of the Fourier transforms

-Translation: u(n)+t a(k)+tδ(k)

-Rotation : u(n)ejθ a(k)ejθ

-Scaling: su(n) sa(k)

-Starting point: u(n-t) a(k) ej2∏tk/N

Slide Slide 1212WSC 11WSC 11

Methodology : Fourier Descriptors ……

The Fourier transform:

The magnitude is independent of the phase, and so unaffected by rotation.

The complex coefficients are called Fourier descriptors (FD) of the boundary.

The magnitude completely defines the shape (according to Zahn and Roskies).

( ) ( ) 121

0

NN

x

xj

eufN

uFπ−

∑−

=⎟⎠⎞

⎜⎝⎛=

Slide Slide 1313WSC 11WSC 11

Methodology : Fourier Descriptors ……

• Throw away A(0) since it is the DC component; that is, it represents only the translation of the contour.

• Truncate A(>6) since higher frequency components don't add much to the shape.

• Normalize the remaining magnitudes by dividing each element of A by A(0).

• Reason: when a shape is scaled by a constant factor (alpha), the magnitude of each of the coefficients in the resulting FFT is also multiplied by alpha.

• To remove alpha from the equation, we simply divide by a number, A(0), which is known to be a product of alpha.

• The FD of the test object is compared with each object of the training set

• The object with the least Euclidean distance in the training set will be the recognized object.

Slide Slide 1414WSC 11WSC 11

Methodology : Similarity Measures

• If two shapes, A and B, produce a set of values represented by a(i) and b(i) then the distance between them can be given as c(i) = a(i) – b(i).

• If a(i) and b(i) are identical then c(i) will be zero.

• If they are different then the magnitudes of the components in c(i) will give a reasonable measure of the difference.

Slide Slide 1515WSC 11WSC 11

Methodology : Similarity Measures

• Euclidean Distance (ED)

• Percentage Error (PE)( )( )∑

=

n

i ibic

1

( )∑=

n

i

ic1

2

Slide Slide 1616WSC 11WSC 11

SolutionALGORITHM• Clean up the image of noise by using a

median filter and then removing all but the

• largest of the objects in the scene.• Find the boundary of the image.• Convert the x, y coordinates in the

contour to a one-dimensional vector by treating them as a complex pair. That is: U(n) = X(n) + i * Y(n).

• Perform the Fast Fourier Transform on Uand take the absolute value to create a new vector A which is the magnitude of

Slide Slide 1717WSC 11WSC 11

Experiments & ResultsFourier Descriptors under different transformations

Slide Slide 1818WSC 11WSC 11

Experiments & Results 1a: Euclidean Measure

• Comparison of results for 100 model objects

• T: Transformations

• N: Noise• O: Occlusion

23.33%93.75%95%40

23.33%93.75%95%29

23.33%93.75%93.33%22

18.33%93.75%90%8

20%93.75%93.33%11

8.33%93.75%83.33%6

5%75%71.67%4

OcclusionNoiseTransformationsNo. of FDsused

Base Case

Slide Slide 1919WSC 11WSC 11

• Using Euclidean distance

Experiments & Results 1a: Euclidean Measure

Recognition Rate for Different Number of FDs

0.00

10.00

20.00

30.00

40.00

50.00

60.00

70.00

80.00

90.00

100.00

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57

No. of FDs

Rec

ogni

tion

Rat

eg

XmationNoiseOcclusion

Slide Slide 2020WSC 11WSC 11

Experiments & Results 1b: Percentage of Error Measure

• Comparison of results for 100 model objects

• T: Transformations• N: Noise• O: Occlusion

Base Case

11.33%81.25%62.25%40

11.67%81.25%68.33%29

6.67%81.25%68.33%22

8.33%81.25%75%16

13.33%81.25%86.67%9

11.67%81.25%80%6

8.33%87.5%70%4

OcclusionNoiseTransformationsNo. of FDsused

Slide Slide 2121WSC 11WSC 11

• Using Percentage of Errors

Experiments & Results1b: Percentage of Error Measure

Recognition Rate for Different Number of FDs

0.00

10.00

20.00

30.00

40.00

50.00

60.00

70.00

80.00

90.00

100.00

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57

No. of FDs

Rec

ogni

tion

Rat

e

XmationNoiseOcclusion

Slide Slide 2222WSC 11WSC 11

Particle Swarm Optimization (PSO)

• J= - H + α sum(D)

• vid = w*vid + c1*rand( )*(pid-xid) + c2*Rand( )*(pgd-xid)

• xid = xid + vid pid = pbest

• pgd = gbest

Slide Slide 2323WSC 11WSC 11

Particle Swarm Optimization (PSO)

• The PSO algorithm is described as follows:– Define the problem space and set the boundaries, i.e. equality and

inequality constraints.– Initialize an array of particles with random positions and their

associated velocities inside the problem space.– Check if the current position is inside the problem space or not. If not,

adjust the positions so as to be inside the problem space.– Evaluate the fitness value of each particle.– Compare the current fitness value with the particles’ previous best

value (pbest[]). If the current fitness value is better, then assign the current fitness value to pbest[] and assign the current coordinates to pbestx[][d] coordinates.

– Determine the current global minimum among particle’s best position.– If the current global minimum is better than gbest, then assign the

current global minimum to gbest[] and assign the current coordinates to gbestx[][d] coordinates.

– Change the velocities according to Eqns. (4) or (6).– Move each particle to the new position according to Eqn. (5) and return

to Step 3.– Repeat Step 3- Step 9 until a stopping criteria is satisfied.

Slide Slide 2424WSC 11WSC 11

Particle Swarm Optimization (PSO)

0.0143 0.0195 0.0138 0.1742 0.1083 0.3051 0.2216

0 0.1515 0.5409 0.2698

0.0002 0.0020 0.0009 0.0015 0.0001 0.0036

0.0005 0.0048 0.0041 0.0079 0.0296 0.0152

0.1033 0.4004 0.4368 0.5681 0.6245 0.9140 0.8876 0.2022 0.3879 0.4992 0.5281

0.0009 0.0035 0.0024 0.0328 0.0000 0.0156 0.0394 0.0651 0.0000 0.00000.0000

Optimized Weights obtained

11661111No. of FDs

Considered

X, O, NOXXXTraining set*

54321Experiment No.

*X = transformed objects, O = occluded objects, N = noisy objects

Slide Slide 2525WSC 11WSC 11

Particle Swarm Optimization (PSO)

*X = transformed objects, O = occluded objects, N = noisy objects

25%20%20%23.3325%O

87.5%87.5%87.593.75%93.75%N

98.33%90%95%95%93.33%XRecognition

Rate

106 6117 No. of FDsUsed

11661111No. of FDs

Considered

X, O, NOXXXTraining set*

54321Experiment No.

Slide Slide 2626WSC 11WSC 11

Conclusion• Fourier descriptors were found to be able to recognize at a higher

rate if we use nine or more Fourier descriptors. This trend is seen to continue when the size of the database is increased from 15 to 45 to 60.

• Most cumulative combinations of Fourier descriptors are able to recognize most of the images correctly for samples without noiseor occlusion.

• It is noted that if an image is recognized, it is recognized by most cumulative combinations of Fourier descriptors, and if it is notrecognized, then it is not recognized by almost all cumulative combinations of Fourier descriptors.

• Noise (salt and pepper) with density of ten percent has a minimal effect on the recognition ability of Fourier descriptors. When we use eight or more Fourier descriptors, the accuracy level does not drop if we add ten percent salt and pepper noise to the images.

• Occlusion brings down the recognition rate of Fourier descriptors from 80-90 percent to around 20%.

• The Fourier descriptors show a steady increase in accuracy levelas the number of Fourier descriptors used increases. It then stabilizes at same level for nine to eleven descriptors.

• Using PSO to find the most suitable descriptors and to assign weights for these descriptors improves dramatically the recognition rate using the least number of descriptors.

Slide Slide 2727WSC 11WSC 11