Top Banner
Genetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1
48

Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Mar 06, 2018

Download

Documents

hathuy
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Genetic Algorithms for Vision and Pattern Recognition

Faiz Ul Wahab

11/8/2014 1

Page 2: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Objective

• To solve for optimization of computer vision problems using genetic algorithms

11/8/2014 2

Page 3: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Timeline

• Problem: Computer Vision

• Genetic Algorithms(GA)

• Solution by Genetic Algorithms

• Results and Discussions

• Questions?

11/8/2014 3

Page 4: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Registration of Images

• Registration Problem is one of the fundamental problems in computer vision

11/8/2014 4

Page 5: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Registration of Images to Images

11/8/2014 5

Page 6: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Registration of Images to 3D Models

11/8/2014 6

Page 7: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Applications

• Augmented Reality

• Image Guided Surgery

• Rendering real objects in gaming environments

11/8/2014 7

Page 8: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Registration of Images to 3D Models[1]

• Goal: make textured 3D models

11/8/2014 8

Page 9: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

How to do that?

• Sampling: Slice the 3D model

• Define cost function

• Solve for the optimization

11/8/2014 9

Page 10: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Define Cost Function

• 18 parameters

• K(3x2)

• R(3x2)

• T(3x2)

11/8/2014 10

Page 11: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Cost Function

𝐶 𝑃1, 𝑃2 =1

|𝑃| 𝐼1 𝑃1𝑿 − 𝐼2 𝑃2𝑿

2

𝑿∈𝑃

• 𝑃1, 𝑃2 are the projection matrices

• P is the number of points in 3D model

• 𝐼𝑖 𝑃𝑿 is the color of point X on the image

11/8/2014 11

Page 12: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Why genetic algorithms?

• Unpredictable shape of cost function

• Local minima failure by using:

– Newton method

– Levenberg-Marquardt(LM)

– BGFS variable metric method

11/8/2014 12

Page 13: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Genetic Algorithms[2][3]

Review

11/8/2014 13

Page 14: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Theory Of Evolution

• Organisms evolve to fit into the environment

• Only the best individuals are kept by nature

Oh seriously…

• From a set of random solutions only the best ones are picked

11/8/2014 14

Page 15: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Purpose of Genetic Algorithms

“Genetic Algorithms are good at taking large, potentially huge

search spaces and navigating them, looking for optimal

combinations of things, solutions you might not otherwise find in

a lifetime.”

11/8/2014 15

Page 16: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Example Problem I

y = f(x)

Finding the maximum (minimum) of some function (within a defined range).

11/8/2014 16

Page 17: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

17 x y

z

11/8/2014

Page 18: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Problem?

• Numbers from 1..100

• Find the set of numbers that give a sum of 313

• Any ideas??

11/8/2014 18

Page 19: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Genetics - Promo

• A gene is hereditary unit of inheritance

• Multiple genes are stringed together to form chromosomes

• A gene, if expressed in an organism in called a trait

• Offsprings inherit traits from their parents

• A gene may get mutated during mating process

11/8/2014 19

Page 20: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

How is the process done?

• Genetic algorithm (GA) introduces

– the principle of evolution genetics into search among possible solutions to given problem

• To simulate the process in natural systems

• How: by the creation within a machine a population of individuals

11/8/2014 20

Page 21: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

21

Genetic Algorithms: Process

11/8/2014

Page 22: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Parameters of GA

• Fitness Function

• Mechanism of selection

• Crossover

• Mutation

11/8/2014 22

Page 23: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Fitness Function

• Evaluates how good an individual is

• Computes this for each individual in a population

• Fitness function is application dependent

• Examples: Mean squared error, Classification rate

11/8/2014 23

Page 24: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Mechanism of Selection

• Parent/Survivor Selection

– Roulette Wheel Selection

– Tournament Selection

– Rank Selection

– Elitist Selection

11/8/2014 24

Page 25: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Roulette Wheel Selection

• Main idea: better individuals get higher chance

• Individuals are assigned a probability of being selected based on their fitness.

pi = fi / fj

– pi probability that individual i will be selected

– fi is the fitness of individual I

– fj represents the sum of all the fitness(s) of the individuals with the population

11/8/2014 25

Page 26: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Roulette Wheel: Mechanism

11/8/2014 26

Page 27: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Tournament Selection

• Binary tournament

– Two individuals are randomly chosen; the fitter of the two is selected as a parent

• Larger tournaments

– n individuals are randomly chosen; the fittest one is selected as a parent

27 11/8/2014

Page 28: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Other Methods

• Rank Selection

– Each individual in the population is assigned a numerical rank based on fitness, and selection is based on this ranking.

• Elitism

– Reserve k slots in the next generation for the highest scoring/fittest chormosomes of the current generation

28 11/8/2014

Page 29: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Crossover

• Generating offspring from two selected parents

– Single point crossover

– Two point crossover (Multi point crossover)

– Uniform crossover

29 11/8/2014

Page 30: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

One Point Crossover

• Choose a random point on the two parents

• Split parents at this crossover point

• Create children by exchanging tails

30 11/8/2014

Page 31: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

One Point Crossover

• Choose a random point on the two parents

• Split parents at this crossover point

• Create children by exchanging tails

31

Parent 1: X X | X X X X X Parent 2: Y Y | Y Y Y Y Y Offspring 1: X X Y Y Y Y Y Offspring 2: Y Y X X X X X

11/8/2014

Page 32: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Uniform Crossover

• A random mask is generated

• The mask determines which bits are copied from one parent and which from the other parent

• Bit density in mask determines how much material is taken from the other parent

32

Mask: 0110011000 (Randomly generated)

Parents: 1010001110 0011010010

Offspring: 0011001010 1010010110

11/8/2014

Page 33: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Mutation

• Alter each gene independently with a probability pm

• pm is called the mutation rate

33 11/8/2014

Page 34: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Summary – Reproduction cycle

• Select parents for producing the next generation

• For each consecutive pair apply crossover with probability pc , otherwise copy parents

• For each offspring apply mutation (bit-flip with probability pm)

• Replace the population with the resulting population of offsprings

34 11/8/2014

Page 35: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

How to solve cost?

𝐶 𝑃1, 𝑃2 =1

|𝑃| 𝐼1 𝑃1𝑿 − 𝐼2 𝑃2𝑿

2

𝑿∈𝑃

• 𝑃1, 𝑃2 are the projection matrices

• P is the number of points in 3D model

• 𝐼 𝑃𝑿 is the color of point X on the image

11/8/2014 35

Page 36: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Initial Settings for GA[1]

• Initial estimation of projection matrices by manual registration

• This acts as initial population of the genetic algorithm

11/8/2014 36

Page 37: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Pipeline for Images to 3D Models

11/8/2014 37

Page 38: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Results

11/8/2014 38

Page 39: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Results

11/8/2014 39

Page 40: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Discussions: Preservation

0

1

2

3

4

5

6

7

8

9

10

Shell Bear Frog

Simple GA

Steady State

11/8/2014 40

Page 41: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Discussions: Selections Criteria

0

1

2

3

4

5

6

7

8

Shell Bear Frog

Roulette Wheel

Tournament

Uniform

11/8/2014 41

Page 42: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Discussions: Mutations

0

1

2

3

4

5

6

7

Shell Bear Frog

Gaussian

Flip

Swap

11/8/2014 42

Page 43: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Discussions: Crossover

0

2

4

6

8

10

12

Uniform Even-Odd One-Point Two-Point Partial-Match Order Blend Arithmetic

Shell

Bear

Frog

11/8/2014 43

Page 44: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Discussions: P(Mutation)

0

2

4

6

8

10

12

Shell Bear Frog

0.1

0.3

0.5

11/8/2014 44

Page 45: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Discussions: P(CrossOver)

0

1

2

3

4

5

6

7

8

Shell Bear Frog

0.9

0.7

0.5

11/8/2014 45

Page 46: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Summary

• Genetic Algorithms useful for solving optimization problems

• Four elements:

– Fitness Function

– Mechanism of Selection

– Crossover Mechanism and Frequency

– Mutation Mechanism and Frequency

• Important! Problem representation for GA

11/8/2014 46

Page 47: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Bibliography

1. Janko, Z., Chetverikov, D., Ekart, A., Using Genetic Algorithms in Computer Vision: Registering Images to 3D Surface Model, Acta Cybernetica, 2007.

2. Eiben, A., Smith, J., Introduction to Evolutionary Computing, Springer, 2008.

3. http://www.cs.cmu.edu/afs/cs/project/theo-20/www/mlbook/ch9.pdf

11/8/2014 47

Page 48: Genetic Algorithms for Vision and Pattern Recognition · PDF fileGenetic Algorithms for Vision and Pattern Recognition Faiz Ul Wahab 11/8/2014 1

Questions

11/8/2014 48