510 likes | 754 Views
Genetic Programming for Image Processing. Brian A. Smith 2007.04.18. Natural Evolution. Requirements for evolution: Representation Selection Pressure Recombination Diversity. Natural Evolution. Representation: DNA
E N D
Genetic Programming for Image Processing Brian A. Smith 2007.04.18
Natural Evolution Requirements for evolution: • Representation • Selection Pressure • Recombination • Diversity
Natural Evolution • Representation: DNA • Selection Pressure: Survival, Reproduction (determined implicitly by environment) • Recombination: Mating, Replicating • Diversity: Population
Natural Evolution:Panthera leo • Representation: • Linear DNA • Diploid cells • Selection Pressure: • Rate of Reproduction • Recombination: • Sexual reproduction • Diversity • Prides, with some inter-pride exchange Image courtesy of Wikimedia Commons. (CCA 2.0 License, author: “yaaaay”)
Natural Evolution: Streptococcus pyogenes • Representation: • Circular DNA • Monoploid cells • Selection Pressure: • Rate of Reproduction • Recombination: • Binary fission (asexual) • Diversity • Very little • Occasional mutations Image courtesy of Center for Disease Control and Prevention, via Wikipedia. (Public domain image)
Artificial Evolution: Genetic Algorithms • Genetic algorithms are arguably the simplest class of evolutionary algorithms • GAs make use of simple representation, reproduction, and diversity mechanisms • These aspects are usually independent of the problem domain
Artificial Evolution: Genetic Algorithms • Representation: Linear chromosome (array of values) • Selection Pressure: Explicit fitness function, Selection algorithms • Recombination: Crossover, Mutation • Diversity: Fixed-size population
Artificial Evolution: Genetic Algorithms • Representation: Linear chromosome (array of values) 0 1 1 0 1 1 0 1 0 1 0 1 0.5 1.2 0.0 0.2 1.0 -2.1 -1.0 0.5 -0.3 0.6 3.1 0.2
Artificial Evolution: Genetic Algorithms • Representation: Linear chromosome (array of values) Chromosome can be Boolean-valued, integer-valued, real-valued, complex-valued, etc.
Artificial Evolution: Genetic Algorithms • Selection Pressure: Explicit fitness function Fitness function is problem-specific. The only limits are those of imagination and practicality. The fitness function usually assigns a real-valued fitness score that does not change.
Artificial Evolution: Genetic Algorithms • Selection Pressure: Selection algorithms Selection algorithms are usually applied to choose which individuals reproduce… and sometimes which individuals are culled.
Artificial Evolution: Genetic Algorithms • Selection Pressure: Selection algorithms Common selection algorithms include: Roulette wheel selection, Rank-based selection, and Tournament selection (my favorite).
Artificial Evolution: Genetic Algorithms • Recombination: Crossover Parent 0 One-point Xover Parent 1
Artificial Evolution: Genetic Algorithms • Recombination: Crossover Parent 0 One-point Xover Parent 1 Child 0 Child 1
Artificial Evolution: Genetic Algorithms • Recombination: Crossover Parent 0 Two-point Xover Parent 1 Child 0 Child 1
Artificial Evolution: Genetic Algorithms • Recombination: Crossover Parent 0 Uniform Xover Parent 1 Child 0 Child 1
Artificial Evolution: Genetic Algorithms • Recombination: Mutation Parent 0 Point Mutation Child 0
Artificial Evolution: Genetic Algorithms • Recombination: Duplication Parent 0 Used for Elitism Child 0
Artificial Evolution: Genetic Algorithms • Diversity: Fixed-size population Generational GAs use individuals from current generation to create an entirely new generation of the same size. Steady-state GAs replace individuals one or two at a time.
GA Example: Noise Reduction Images courtesy of me.
GA Example: Noise Reduction • Reasonable choices: • Pick a window size of n×n • Use a real-valued chromosome of length n2 • Use a blending crossover • Use a modest mutation operator • Apply mask to noisy images • Set fitness to the Euclidean distance between original images and noisy images
GA Example: Noise Reduction • Would we expect the evolved solution to work well for B&W noise? • Would we expect the evolved solution to work well for images from other domains?
GA Example: Noise Reduction • “You get what you evolve for!” • So write your fitness function carefully. • Diversity is very important.
GA Example: Noise Reduction • Barring some much more creative way of using the linear chromosome, we can’t evolve a simple median filter using this representation. • Wouldn’t it be nice if we could evolve algorithms instead of masks or arrays?
Artificial Evolution: Genetic Programs • Genetic programs are a (slightly) more complex class of evolutionary algorithms. • The main difference is in the representation, which allows for arbitrarily complex algorithms to evolve.
Artificial Evolution: Genetic Programs • Representation: Program tree ^ * z if 4 if>0 y ~ 1 x exp y x x
Artificial Evolution: Genetic Programs • Representation: Program tree The user must specify a function set and a terminal set. ^ if ~ x y z | v 1 0 A Boolean function set A Boolean terminal set
Artificial Evolution: Genetic Programs • Representation: Program tree Chromosome can be Boolean-valued, integer-valued, real-valued, complex-valued, etc. Chromosome can also be null-valued: where nodes perform some action (such as moving a robot forward) but have no return value.
Artificial Evolution: Genetic Programs • Representation: Program tree Chromosome can also be strongly-typed: where multiple node types are used subject to some constraints.
Artificial Evolution: Genetic Programs • Selection Pressure: Explicit fitness function • Problem specific, same as GA • Selection Pressure: Selection algorithms • Same as GA
Artificial Evolution: Genetic Programs • Recombination: Crossover Parent 0 Parent 1
Artificial Evolution: Genetic Programs • Recombination: Crossover Parent 0 Parent 1 Child 0 Child 1
Artificial Evolution: Genetic Programs • Recombination: Crossover Because crossover does not preserve the morphology of the tree, diversity is not as important in the GP paradigm.
Artificial Evolution: Genetic Programs • Recombination: Mutation Grow an entire new subtree Parent 0 Child 0
Artificial Evolution: Genetic Programs • Diversity: Population Generational and steady-state populations are common. Same as GA.
GP Example: Landslide Detection • From Rosin and Hervás’ 2002 paper Image Thresholding for Landslide Detection by Genetic Programming.
GP Example: Landslide Detection • Focused on the task of identifying landslide areas in an image using “before” and “after” satellite images from Veneto, Italy. • Desired output is a binary image with the pixels in the landslide area colored black and all other pixels white. • Previous work using more conventional image processing techniques were unsatisfactory.
GP Example: Landslide Detection Images from Rosin and Hervás (2002).
GP Example: Landslide Detection • Representation: Real-valued program tree • Function set: *, +, -, /, abs, sigmoid, min, max • Terminal set: random constants, difference image pixel values, smoothed difference values, pixel values from various other transforms • Maximum depth: 7
GP Example: Landslide Detection • Interpretation: Positive = landslide Negative = no landslide 0? (not reported in paper) • Fitness function: % of correctly classified pixels • Selection algorithms: Not reported in paper • Recombination: Standard Xover and mutation
GP Example: Landslide Detection • Diversity: Generational GP • Population size: 20,000 • # of generations: 200-300
GP Example: Landslide Detection • Results: best-of-run • s10 is Gaussian smoothing with st. dev. of 10 • o15 is “opened” image with a 15x15 mask • dt is distance transformed pixel value • difference is the difference image pixel value
GP Example: Landslide Detection Best-of-run result on entire image Ground truth Images from Rosin and Hervás (2002).
GP Example: Landslide Detection • Problems with the methodology: • Very few details, would be difficult to reproduce • Only used a portion (3%) of a single image for training • Used the same image for evaluation!!! • Did not report fitness scores for experiments, rely instead on the reader’s subjective measure of accuracy
GP Example: Landslide Detection • Strong points of the research: • Shows benefit of using pre-processed inputs • Evolved “better” classifier than the authors were able to design themselves • Shows that intuitive understanding of final result is unnecessary
Concluding points • Evolutionary algorithms such as GP may be suitable for evolving, rather than designing, image processing algorithms • Evolutionary algorithms are not guaranteed to produce an optimal solution • Evolutionary algorithms may take a long time (hours, days, or even weeks) to complete
Resources • Dawkins, Richard. 1976. The Selfish Gene. Oxford University Press, Oxford, UK. • Introduces Dawkin’s selfish gene theory, which argues that the gene- not the individual or the species- is the unit of evolutionary selection. Extremely important for understanding natural evolution, with some ramifications for artificial evolution, as well. • Eiben, A.E. and J.E. Smith, ed. 1998. Introduction to Evolutionary Computing. Springer-Verlag, Berlin, Germany. • Provides very brief introductions to all of the major classes of evolutionary algorithms. Good for breadth, but not for depth.
Resources • Goldberg, D.E. 1989. Genetic Algorithms in Search, Optimization, and Machine Learning. Addison-Wesley. • The “bible” of the simple GA. Focuses on the Boolean (bit string) representation and gives theoretic justifications for its success. • Holland, J.H. 1975. Adaptation in Natural and Artificial Systems. The University of Michigan Press, Ann Arbor, MI. • From the man who is credited with inventing the genetic algorithm and birthing the field of evolutionary algorithms. (Though I have read that von Neumann suggested the idea of evolutionary algorithms in a letter decades earlier.) This work is the foundation of all future GA work.
Resources • Koza, J.R. 1992. Genetic Programming: On the Programming of Computers by Means of Natural Selection. MIT Press, Cambridge, MA. • Introduces the genetic program. Some earlier work can arguably be said to fall under the title “genetic program,” but Koza was the first to treat it as a rigorous methodology. The work is a tour de force in the technique, using GPs to efficiently solve a broad range of problems. 800+ pages, but it reads very quickly. • Koza, J.R. 1992. Genetic Programming II: Automatic Discovery of Reusable Programs. MIT Press, Cambridge, MA. • Introduces the automatically defined function. ADFs allow for the evolution of functions with arbitrary arguments. Dramatically improves the performance of GPs in a number of domains.