The document discusses genetic algorithms and their application to image classification. It describes how genetic algorithms use genes, chromosomes, and a fitness function to evolve solutions to problems over multiple generations. Specifically, it proposes using genetic algorithms to classify images by shape, color, and size based on a chromosome encoding these attributes. While genetic algorithms are not typically suited to image classification, this approach could offer an easily extensible class list through its use of SVG files.
2. Computer Science to Evolutionary Computation
Within the vast field of computer science under it’s vast array of potential
applications there exists the branch of artificial intelligence.
George Bora (UTCN) Genetic Algorithms December 4, 2013 2 / 20
3. Computer Science to Evolutionary Computation
Within the vast field of computer science under it’s vast array of potential
applications there exists the branch of artificial intelligence.
One of the sub-branches of artificial intelligence is evolutionary
computation which seeks to achieve continuous optimization and
combinatorial optimization by incorporating knowledge of natural evolution
processes.
George Bora (UTCN) Genetic Algorithms December 4, 2013 2 / 20
4. Basic Concepts from Biology
The basic building blocks for evolutionary computation, which have kept
their names from their native science, are as follows:
genes
allele
chromosome
individual
mapping
mutation and crossover
fitness function
George Bora (UTCN) Genetic Algorithms December 4, 2013 3 / 20
5. Genes
The element from which this method derives it name, as genes are the
basic building blocks of life.
George Bora (UTCN) Genetic Algorithms December 4, 2013 4 / 20
6. Genes
The element from which this method derives it name, as genes are the
basic building blocks of life.
So too in our search for the solution for various problems, genes are the
basic elements we switch around and juggle with in order to arrive at a
more optimum solution.
George Bora (UTCN) Genetic Algorithms December 4, 2013 4 / 20
7. Allele
If genes are the basics of the solution in theory, alleles are the values
encoded in genes are the ones we use in practice, when developing
software which uses genetic programming.
George Bora (UTCN) Genetic Algorithms December 4, 2013 5 / 20
8. Allele
If genes are the basics of the solution in theory, alleles are the values
encoded in genes are the ones we use in practice, when developing
software which uses genetic programming.
When the time has passed and the solution must effectively be built or
instantiated it is the allele which forms the blue print we go by.
George Bora (UTCN) Genetic Algorithms December 4, 2013 5 / 20
9. Allele
If genes are the basics of the solution in theory, alleles are the values
encoded in genes are the ones we use in practice, when developing
software which uses genetic programming.
When the time has passed and the solution must effectively be built or
instantiated it is the allele which forms the blue print we go by.
In the original vision for genetic algorithms there was only 1 allele per
gene, which was a binary value and was stored in a 1 bit, as the field
progressed all of those constrictions have been lifted.
George Bora (UTCN) Genetic Algorithms December 4, 2013 5 / 20
10. Chromosome and Individual
As in nature an animal can not have it’s information encoded in a single
gene, in programming a solution which warrants genetic algorithms is not
simple enough as to be composed on 1 gene.
George Bora (UTCN) Genetic Algorithms December 4, 2013 6 / 20
11. Chromosome and Individual
As in nature an animal can not have it’s information encoded in a single
gene, in programming a solution which warrants genetic algorithms is not
simple enough as to be composed on 1 gene.
Chromosomes are the collection of genes, which make up the blueprint
from which we will map our solution and create the individual.
George Bora (UTCN) Genetic Algorithms December 4, 2013 6 / 20
12. Chromosome and Individual
As in nature an animal can not have it’s information encoded in a single
gene, in programming a solution which warrants genetic algorithms is not
simple enough as to be composed on 1 gene.
Chromosomes are the collection of genes, which make up the blueprint
from which we will map our solution and create the individual.
If the chromosomes are the blue prints the individual is the ”end product”,
to make an analogy with software engineering, and individual is to a class
what a instance is to a object.
George Bora (UTCN) Genetic Algorithms December 4, 2013 6 / 20
13. Mapping
The process by which we construct a individual from the chromosome we
have generated is called mapping, it is one of the important elements
(alongside chromosome structure and fitness functions) we must consider
before we implement our design.
George Bora (UTCN) Genetic Algorithms December 4, 2013 7 / 20
14. Mapping
The process by which we construct a individual from the chromosome we
have generated is called mapping, it is one of the important elements
(alongside chromosome structure and fitness functions) we must consider
before we implement our design. Mapping and it’s complexity is often tied
with how we define our alleles,genes and chromosome as well as our
genetic operations, a great deal of planning being required in order to
produce the best possible algorithm.
George Bora (UTCN) Genetic Algorithms December 4, 2013 7 / 20
15. Crossover
Crossover is one of the fundamental operations within the toolbox of
genetic algorithms, and one of the most important methods by which we
can combine existing chromosomes to form new ones in the search for a
fit enough solution.
George Bora (UTCN) Genetic Algorithms December 4, 2013 8 / 20
16. Crossover
Crossover is one of the fundamental operations within the toolbox of
genetic algorithms, and one of the most important methods by which we
can combine existing chromosomes to form new ones in the search for a
fit enough solution. It involves separating each chromosome which takes
part into two parts, and then recombining parts from the different old
chromosomes to form the new set of chromosomes.
George Bora (UTCN) Genetic Algorithms December 4, 2013 8 / 20
17. Mutation
Mutation is the changing of the allele of a gene to another one of it’s
possible values.
George Bora (UTCN) Genetic Algorithms December 4, 2013 9 / 20
18. Mutation
Mutation is the changing of the allele of a gene to another one of it’s
possible values. This operation permits genetic algorithms to potentially
escape from local optimum solutions, a very important characteristic in the
field of artificial intelligence.
George Bora (UTCN) Genetic Algorithms December 4, 2013 9 / 20
19. Fitness Function
Via crossover and mutation we can create whole populations of
individuals, potential solutions, and so the question arises when do we
stop the evolutionary cycle?
George Bora (UTCN) Genetic Algorithms December 4, 2013 10 / 20
20. Fitness Function
Via crossover and mutation we can create whole populations of
individuals, potential solutions, and so the question arises when do we
stop the evolutionary cycle? The answer being when we have reached a
certain vicinity of an ideal solution, but for this we need to evaluate how
close is any one individual to satisfying our demands and being the sought
after solution.
George Bora (UTCN) Genetic Algorithms December 4, 2013 10 / 20
21. Fitness Function II
The implementation of the fitness function changes from one class of
problems to another, standardization being much more difficult than with
genes, and is one of the most time consuming elements of genetic
programming.
George Bora (UTCN) Genetic Algorithms December 4, 2013 11 / 20
22. Fitness Function II
The implementation of the fitness function changes from one class of
problems to another, standardization being much more difficult than with
genes, and is one of the most time consuming elements of genetic
programming.
Writing the fitness function, which when given a chromosome will return
how fit or close to the ideal it is, is one of the hardest yet essential tasks in
developing a solution with genetic programming as it is the only way to
close the loop and choose a final solution.
George Bora (UTCN) Genetic Algorithms December 4, 2013 11 / 20
23. Genetic Algorithms vs Genetic Programming
Within this field there exist two very different paradigms, genetic
algorithms and genetic programming the most visible difference between
them being the structure of the chromosomes they produce.
George Bora (UTCN) Genetic Algorithms December 4, 2013 12 / 20
24. Genetic Algorithms vs Genetic Programming
Within this field there exist two very different paradigms, genetic
algorithms and genetic programming the most visible difference between
them being the structure of the chromosomes they produce.
Genetic algorithms work with a chromosome which is linear and often fixed
in length, making them ideal for tunning the behavior of various solutions.
George Bora (UTCN) Genetic Algorithms December 4, 2013 12 / 20
25. Genetic Algorithms vs Genetic Programming
Within this field there exist two very different paradigms, genetic
algorithms and genetic programming the most visible difference between
them being the structure of the chromosomes they produce.
Genetic algorithms work with a chromosome which is linear and often fixed
in length, making them ideal for tunning the behavior of various solutions.
Genetic programming instead uses a tree-structured chromosome variable
in size, which allows it to generate the structure of the solution as well as
the behavior.
George Bora (UTCN) Genetic Algorithms December 4, 2013 12 / 20
26. The problem
The creation of a algorithm which is capable of classifying a target image,
returning information about the general structure, size and color (the
pre-defined classes) of the object present in the image.
George Bora (UTCN) Genetic Algorithms December 4, 2013 13 / 20
27. The problem
The creation of a algorithm which is capable of classifying a target image,
returning information about the general structure, size and color (the
pre-defined classes) of the object present in the image.
Requirements:
1 the use of genetic computing within the solution
2 as high of a success rate as possible
George Bora (UTCN) Genetic Algorithms December 4, 2013 13 / 20
28. Image classification
Image recognition, which can be classified as a sub-field of computer
vision, is a field concerned with the identification of objects and entities
within images.
George Bora (UTCN) Genetic Algorithms December 4, 2013 14 / 20
29. Image classification
Image recognition, which can be classified as a sub-field of computer
vision, is a field concerned with the identification of objects and entities
within images.
Image classification is a classical image recognition problem in which the
task is to assign labels to images based their content or metadata.
George Bora (UTCN) Genetic Algorithms December 4, 2013 14 / 20
30. The classes
The labels we apply are called classes and for this algorithm we have
defined 3 great families of classes:
form classes: for now we have defined classes for circles,
triangles(isosceles) and circles although additions to these are
relatively easy to add due to our use of genetic algorithms
color classes: right now only red, green and blue are implemented
although using the rgb format is also possible.
size classes: chosen arbitrarily.
George Bora (UTCN) Genetic Algorithms December 4, 2013 15 / 20
31. The chromosome
The chromosome is fairly simplistic being formed out of:
a gene encoding the form.
a gene encoding the color.
a gene encoding the size.
George Bora (UTCN) Genetic Algorithms December 4, 2013 16 / 20
32. Genes and Allele
The genes governing shapes at the moment can have the following
values: circle, triangle and square all identified by numeric codes.
George Bora (UTCN) Genetic Algorithms December 4, 2013 17 / 20
33. Genes and Allele
The genes governing shapes at the moment can have the following
values: circle, triangle and square all identified by numeric codes. The
genes governing color at the moment can accept any color defined by the
SVG standard although they can also handle rgb codes, which would
require 3 separate genes.
George Bora (UTCN) Genetic Algorithms December 4, 2013 17 / 20
34. Genes and Allele
The genes governing shapes at the moment can have the following
values: circle, triangle and square all identified by numeric codes. The
genes governing color at the moment can accept any color defined by the
SVG standard although they can also handle rgb codes, which would
require 3 separate genes.
The genes governing size are again numeric codes which represent hard
coded categories of size.
George Bora (UTCN) Genetic Algorithms December 4, 2013 17 / 20
35. Mapping
The mapping process is the most intensive one, in terms of time and lines
of code needed, followed closely by calculating the fitness function.
The process consists of:
creating a SVG file from the chromosome requires only the standard
Java standard file API.
converting said .svg file to the .png (raster) format as the image we
are trying to classify will be a raster image, requires calls to the
Inkscape API via Java’s system API.
George Bora (UTCN) Genetic Algorithms December 4, 2013 18 / 20
36. Fitness function
As the result of the mapping is a image of a similar raster format like the
one we seek to classify, the fitness function simply does a naive
comparison of the two images bit by bit.
George Bora (UTCN) Genetic Algorithms December 4, 2013 19 / 20
37. Fitness function
As the result of the mapping is a image of a similar raster format like the
one we seek to classify, the fitness function simply does a naive
comparison of the two images bit by bit.
It then normalizes the bit difference to a range between 0 and 1, as
required by the genetic algorithm, this fitness being then used in the
standard manner for deciding which chromosomes pass into the next
generation.
George Bora (UTCN) Genetic Algorithms December 4, 2013 19 / 20
38. The cons
This procedure has a number of weak points:
genetic algorithms traditionally aren’t suited to image classification.
the speed of this procedure, is very low due to the calls to Inkscape
and the creation of numerous files (can be improved).
the fitness function relies on a very sensible and naive image
comparison method (can be improved).
George Bora (UTCN) Genetic Algorithms December 4, 2013 20 / 20
39. The pros
A number of points in it’s favour
the available class list, due to the classes being written in SVG, is
very easily extendable.
in it’s current form it requires only Java and Inkscape (a very available
software).
there are a large number of image comparison methods which can be
used for the fitness function.
George Bora (UTCN) Genetic Algorithms December 4, 2013 21 / 20
40. The End
Thank your for your attention !
George Bora (UTCN) Genetic Algorithms December 4, 2013 22 / 20
41. The End
Thank your for your attention !
Any questions ?
George Bora (UTCN) Genetic Algorithms December 4, 2013 22 / 20