22
Image Segmentation using a Genetic Algorithm and Hierarchical Local Search Mark W. Hauschild, Sanjiv Bhatia, and Martin Pelikan Missouri Estimation of Distribution Algorithms Laboratory (MEDAL) Department of Mathematics and Computer Science University of Missouri, St. Louis, MO [email protected] http://medal-lab.org M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Image segmentation using a genetic algorithm and hierarchical local search

Embed Size (px)

DESCRIPTION

This paper proposes a hybrid genetic algorithm to perform image segmentation based on applying the q-state Potts spin glass model to a grayscale image. First, the image is converted to a set of weights for a q-state spin glass and then a steady-state genetic algorithm is used to evolve candidate segmented images until a suitable candidate solution is found. To speed up the convergence to an adequate solution, hierarchical local search is used on each evaluated solution. The results show that the hybrid genetic algorithm with hierarchical local search is able to efficiently perform image segmentation. The necessity of hierarchical search for these types of problems is also clearly demonstrated.

Citation preview

Page 1: Image segmentation using a genetic algorithm and hierarchical local search

Image Segmentation using aGenetic Algorithm and

Hierarchical Local Search

Mark W. Hauschild, Sanjiv Bhatia, and Martin Pelikan

Missouri Estimation of Distribution Algorithms Laboratory (MEDAL)Department of Mathematics and Computer Science

University of Missouri, St. Louis, MO

[email protected]

http://medal-lab.org

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 2: Image segmentation using a genetic algorithm and hierarchical local search

Motivation

I Image segmentation important in image processing.I Often used as a preliminary step.I Can emphasize boundaries between objects.I Locate distinct objects in images.

I Image segmentation is challengingI Difficult to succeed across diverse images.I Even a relatively small image has a large number of points.I Large number of locally optimal segmentations.I Ideally want it done automatically.

I The purpose of this paperI Use Potts spin glass model to define image segmentation as

optimization problem.I Use a steady-state genetic algorithm with hierarchical local

search to solve the problem.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 3: Image segmentation using a genetic algorithm and hierarchical local search

Outline

I Image segmentation as Potts spin glass.I Algorithm

I Steady-state genetic algorithm.I Crossover operator.I Hierarchical local search.

I Experiments.

I Conclusions and future work.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 4: Image segmentation using a genetic algorithm and hierarchical local search

q-state Potts Model

I Origin in physics.

I Spins arranged on a 2D or 3D lattice.

I Each spin sj can have up to q states.

I Edges have weights that define relationships betweenneighboring spins.

I Energy defined as

E = −∑〈i,j〉

Ji,jδ(si, sj) ,

where δ(si, sj) = 1 if si = sj , and δ(si, sj) = 0 if si 6= sj .

I Usual task is to minimize the total energy of the system.

I To minimize energy, neighboring spins si and sj should beequal if Ji,j > 0; otherwise the spins should be different(ideally). Larger Ji,j values are more important than smaller.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 5: Image segmentation using a genetic algorithm and hierarchical local search

Mapping Image Segmentation to Potts model

I Each pixel corresponds to one spin.

I The value of the spin defines the pixel’s segment.

I Map grayscale image to a set of couplings {Ji,j} betweenneighboring pixels:

Ji,j = 1− ∆i,j

θ∆avg,

whereI ∆i,j is absolute difference between neighbors,I ∆avg is average difference between all neighbors in the image,I θ = 1 controls sensitivity to changes in intensity.

I Small differences between neighbors imply a large coupling(meaning that the neighbors should be in the same segment).

I Large differences between neighbors imply a small coupling(meaning that the neighbors should be in different segments).

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 6: Image segmentation using a genetic algorithm and hierarchical local search

Mapping Image Segmentation to Potts model

I Image segmentation using Potts modelI Number q of states in Potts model = number of segments.I Each pixel’s state defines its segment.I Minimizing energy corresponds to segmentation so that similar

neighbors belong to the same segment (and dissimilarneighbors belong to different segments).

I Can apply any optimizer (e.g. simple genetic algorithm).I But naive implementations won’t work too well

I High dimensionality.I Large number of local optima.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 7: Image segmentation using a genetic algorithm and hierarchical local search

Genetic Algorithm

I RepresentationI Segmentations represented by strings.I One character for each pixel in the image (long strings).I Each character can take q values (q=number of segments).

I Steady-state hybrid GA with small population.I Initial population of strings represents random segmentations.I Each iteration selects two random parents from population.I Parents are combined using crossover to create new string.I Local search used to improve the resulting string.I Candidate replaces the worst parent if it’s better.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 8: Image segmentation using a genetic algorithm and hierarchical local search

Algorithm

I Two details left to discuss:I Crossover operator.I Local search and hierarchical local search.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 9: Image segmentation using a genetic algorithm and hierarchical local search

Crossover Operator

I Creates new segmentation c from segmentations a and b.

I Select randomly rectangular region.

I c takes content of rectangular region from a.

I c takes the rest from b.I Selecting rectangular region

I Picks a random pixel for center of region to swap.I Size of swap region for image of size x× y is

√x/2×

√y/2.

I Other scenarios possible.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 10: Image segmentation using a genetic algorithm and hierarchical local search

Transforming Solutions for Crossover

I Similar segmentations have often different strings (renamingsegments produces extremely different strings).

Image a Image b

I Crossover without transforming parents leads to poor resultsbecause of excessive disruption and ineffective juxtaposition.

I Resolution: Transform parents by renumbering segmentsI Calculate conditional probabilities that a segment i in parent a

is represented by segment j in parent b for all i and j.I Use greedy algorithm to renumber each segment in parent a to

the most likely segment it represents in b.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 11: Image segmentation using a genetic algorithm and hierarchical local search

Difficulties with Simple Local Search

I Problems have large number of variables in each solution.

I Advantageous to use local search to speed optimization up.I First attempted to use bit-flip hill climbing (HC)

I Would get stuck at poor local optimum, even for images whereeach segment consisted of a single color (easy to segment).

I Led to actual degradation of performance.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 12: Image segmentation using a genetic algorithm and hierarchical local search

Difficulties with Simple Local Search: Illustration

Initial image Random segmentation

Segmentation after bit-flip HC

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 13: Image segmentation using a genetic algorithm and hierarchical local search

Hierarchical Local Search

I Developed hierarchical local search to tackle this challenge.

I Start with simple bit-flip hill climbing.

I Treat each connected segment as one variable (character).I Each iteration

I Try to change each connected segment (connected region ofpixels assigned 1 segment number) to another color.

I Accept the best change (if improvement).I Terminate when no more improvement possible.

I Regions increase in size (regions merge over time).

I Implementation can be done efficiently.

I Important: Deals with the problem of simple HC, leading to amuch more efficient search for good segmentations.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 14: Image segmentation using a genetic algorithm and hierarchical local search

Steps of Hierarchical Local Search

Step = 1

Step = 100

Step = 50

Step = 143

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 15: Image segmentation using a genetic algorithm and hierarchical local search

Demonstration of Importance of Hierarchical LS

g = 1, no LS

g = 1, DHC

g = 1, HLS

g = 100, no LS

g = 100, DHC

g = 100, HLS

g = 1000, no LS

g = 1000, DHC

g = 1000, HLS

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 16: Image segmentation using a genetic algorithm and hierarchical local search

Experimental Setup

I Number of segments set to q = 4.

I Population size set to N = 50.

I Input images converted to 8-bit grayscale for 256 distinct graylevels before generating the weight matrix.

I Two different digital images were examinedI House image of size 150× 100 pixels.I Dog image of size 160× 128 pixels.

I For each image:I Find final resulting segmented image using hybrid GA.I Examine image after coloring regions based on average color of

that region in original image.I Compare the results to meanshift segmentation.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 17: Image segmentation using a genetic algorithm and hierarchical local search

House Image using Hybrid GA

Initial image Segmented image

Average color

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 18: Image segmentation using a genetic algorithm and hierarchical local search

House Image using Mean-Shift Segmentation

Intermediate Final, 17 colors

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 19: Image segmentation using a genetic algorithm and hierarchical local search

Dog Image using Hybrid GA

Initial image Segmented image

Average color

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 20: Image segmentation using a genetic algorithm and hierarchical local search

Dog Image using Mean-Shift Segmentation

Intermediate Final, 26 colors

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 21: Image segmentation using a genetic algorithm and hierarchical local search

Conclusions

I Described a hybrid GA to perform image segmentation.

I Hierarchical local search proposed to improve efficiency.

I Transformation used to lower disruption due to crossover.

I Resulting hybrid GA was able to efficiently segment images.

I Results also show the necessity of hierarchical local searchwhere simple bit-flip local search actually led to performancedegradation.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search

Page 22: Image segmentation using a genetic algorithm and hierarchical local search

Acknowledgments

I Support was provided byI NSF grants ECS-0547013 and IIS-1115352.I ITS at the University of Missouri in St. Louis.I University of Missouri Bioinformatics Consortium.

M. Hauschild, S. Bhatia and M. Pelikan Image Segmentation using GA and Hierarchical Local Search