At this project we tried to find image segmentation using Evolutionary Algorithm. We focused on 128*128 gray scale images and used our algorithm to separate the image in to two segments. Potential solution represented as matrix such that the value of every index at the matrix can be either 1 or 0.
In order to find segmentation using Evolutionary Algorithm, we must define the follow:
Individual
First generation population
Fitness function
Selection
Recombination
Mutation
Evolution steps
As mentioned, every individual in the population represented as a binary matrix, so the two segments can easily be distinguished.
In order to start with population that could evolve to satisfying segmentation maps, every individual in the first generation contain random circles (with random radius and random center) and random rectangles (with random width, length and center), when.
The score of segmentation map determinates according to two criteria:
The variance of the pixels value at every segment.
The values of partial derivative at the boundary points (by the andaxes).
So we can apply the principle of the Natural Selection in our algorithm,
at each generation the top individuals join
the next generation as they are. For the last the following is
processed:
Until the population is complete:
4 random individual picked and
the best one (by the fitness function) chosen as parent A.
In the same way parent B is
chosen. After both parents are chosen we recombine them to a new individual
that take part in the new generation.
After both parents are chosen, we randomly chose a pivot (between 0 and, where and are binary matrixes)
and axis (either or
). Their offspring compound from the first columns of and the other from, if the chosen axis is. If the chosen axis is, compound from the first rows from and the other from . After the offspring is compound, with
some probability mutation will occur.
We mutate individuals in 4 ways:
Add a random circle (random
center and radius) of a random segment (0, 1).
Add a random rectangle (random
center, width and length) of a random segment (0, 1).
Smooth the segmentation map with
Gaussian kernel.
At a random point of segment, find – in a
random orientation (right-left, up-down) – boundary point and extend the segment at the
boundary point.
Instead of creating the first generation and evolving according to the
original image, we let the individuals evolve as follow:
We lower the resolution of the original image (128*128), to 8*8 image,
16*16 image, 32*32 image and 64*64 image.
The first generation population created as 8*8 binary matrix
and evolve generations to fit
the resized image.
After generations every
individual in the population transform to 16*16 binary matrix.
The updated individuals evolve for generations to fit
the 16*16 resized image.
In the same way the individuals evolve for generations to fit
32*32 resized image, generations to fit
the 64*64 resized image and finally generations to fit
the original image.
For image, population
size, generation total amount
of.
Creating the
initial population.
For every generation;
Ranking
all the population
for every individual;
Pick
parents
Merge
Mutate
Total running time
- . Theoretically the running time
seems effective. But in order to achieve a satisfying result should be at least, so the real running time.
Demonstration of the evolution steps:
|
|
|
The original image. We used
population size 400. Total amount of 400 generations. mutation probability
0.3 |
20 generation of evolution
according to 8*8 resized image. |
40 generation of evolution according
to 16*16 resized image. |
|
|
|
80 generation of evolution
according to 32*32 resized image. |
100 generation of evolution
according to 64*64 resized image. |
160 generation of evolution
according to original image. |
Result on an image with
noise:
|
|
Original 128*128 image with noise. |
The best solution after 400
generations, with population size 400 .mutation probability 0.3. |
As in real life evolution is a long time
process with respect to the input. (E.g. human evolution is very slow) hence
our algorithm requires an impractical amount of generation and population size
to achieve a satisfying result when dealing with large images.
Although finding image segmentation
is hard problem and we show a polynomial solution, in
order to deal with more complex images a lot of work is still ahead.
Flight of the FINCH through the Java
Wilderness;
Michael Orlov and Moshe Sipper.
Perceptual
Organization I - Edge aggregation case study; Ohad Ben-Shahar (Course lecture
notes).
Perceptual Organization IV -
Segmentation; Ohad Ben-Shahar (Course lecture
notes).