Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group –...

18
Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    218
  • download

    0

Transcript of Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group –...

Page 1: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Scale Invariant Object Detection using a Hybrid Genetic Algorithm –

Fuzzy Logic Approach

Group – 9Ayesha Farrukh [04030004]

Junaid Akhtar [04030019]

Page 2: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Progress

Matlab Implementation – Brute force Template Matching

Initialize Population Crossover Mutation Fitness Function

Page 3: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Brute Force Results

Reference Image

Template

(145, 171)

Page 4: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Cross Correlation Surface

Page 5: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Correlation Surface [zoomed in]

Peak value at: (145, 171)Value = 0.9666

Page 6: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Tic-Toc

This operation took 152.01 seconds

Page 7: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Other Matlab Functions Explored

DEC2BIN BIN2DEC RAND CORR2

Page 8: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

GA Pseudocode StartGA( img, template )

// Initialize a random population of individuals P = initPopulation ( populationSize, imgDimension, scaleDimension );

// Evaluate fitness of all initial individuals of population [fitnessP, fuzzyClassifictaionP ] = calcFitness ( P, img , template );

// test for termination criterion: (Correlation Value > THRESHOLD) WHILE not done do

// select a sub-population for offspring production selectedP = selectparents( P );

// Crossover [newP] = crossover( selectedP );

// Mutate x OR y OR scale value randomly [mutatedP] = mutate( newP );

// Evaluate fitness of new calcFitness( mutatedP );

// select the survivors from actual fitness P = survive( P, mutatedP );

END

Page 9: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Chromosome Definition

000110001 011111100 1001x = 49 y = 252 Index of Scale to

Use

Page 10: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

512 x 512 Reference Image

Page 11: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Template Image

Page 12: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Scale

imresize Bicubic Interpolation for resizing the template

image

Page 13: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Initial Population function [initialPopulation, lengthImageDimension, lengthMaxScale] = initialize(populationSize, imageDimension,

maxScale)

binaryImageDimension = dec2bin(imageDimension); binaryMaxScale = dec2bin(maxScale);

lengthImageDimension = length(binaryImageDimension); lengthMaxScale = length(binaryMaxScale);

bitsInitialPopulation = (2 * lengthImageDimension) + lengthMaxScale; initialPopulation = zeros(populationSize, bitsInitialPopulation);

for i = 1:populationSize xLocation = round(imageDimension*rand); xLocation = dec2bin(xLocation); initialPopulation(i,length(binaryImageDimension) - length(xLocation) + 1 :length(binaryImageDimension)) = xLocation -

48; yLocation = round(imageDimension*rand); yLocation = dec2bin(yLocation); initialPopulation(i,(2*length(binaryImageDimension)) - length(yLocation) + 1 :2*length(binaryImageDimension)) =

yLocation - 48; scale = round(maxScale*rand); scale = dec2bin(scale); initialPopulation(i,bitsInitialPopulation - length(scale) + 1 : bitsInitialPopulation) = scale - 48; end

Page 14: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Select Parents

Sort the current Population according to their respective fitness values

Select the best

Page 15: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

CalculateFitness

Use corr2 function to calculate fitness for each individual

Classify each individual using Fuzzy classifiers: Negative, Low, & Positive correlation

Page 16: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Crossover function [newPopulation] = crossover(selectedPopulation)

sizeSelectedPopulation = size(selectedPopulation,1); sizeIndividual = size(selectedPopulation,2);

count = 1;

while count < sizeSelectedPopulation crossoverPoint = round(sizeIndividual*rand) newPopulation(count,:) = selectedPopulation(count,:); newPopulation(count+1,:) = selectedPopulation(count+1,:); newPopulation(count,crossoverPoint:sizeIndividual) =

selectedPopulation(count+1,crossoverPoint:sizeIndividual); newPopulation(count+1,1:crossoverPoint-1) =

selectedPopulation(count,1:crossoverPoint-1); count = count + 2; end

Page 17: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Mutate( P )

For each member of the selected population ‘P’

Randomly decide whether or not to mutate

Randomly decide index of bit to mutate

Perform mutation

0011000111111100100100

0011000111111100100100

0011000101111100100100

Page 18: Scale Invariant Object Detection using a Hybrid Genetic Algorithm – Fuzzy Logic Approach Group – 9 Ayesha Farrukh [04030004] Junaid Akhtar [04030019]

Next Episode

Integrate the components Compile Results on Different Images Use information generated during fuzzy

classification to improve matching time Compare Tic-Toc Results for time Compare FLOPS for memory