More selected projects

ADAPTIVE CAMOUFLAGE AND MORPHOLOGY OF INVERTEBRATES

ADAPTIVE CAMOUFLAGE AND MORPHOLOGY OF INVERTEBRATES is a genetic algorithm that mimics the ability of biological organisms to adapt to their environment. The program simulates how a simple invertebrate species acclimatises to different ecosystems by changing its size, shape and colouration.

produced by: Eevi Rutanen

 
Concept and background research

The main inspiration for this piece was the genetic algorithm framework developed by Daniel Shiffman (2012). Shiffman’s framework is well suited for the evolutionary adaptation of discrete and quantitative variables, which can be unequivocally compared to determine the fitness of the genotype. However, I wanted to develop a genetic algorithm that works directly with the visual phenotype by using pixel data as its input. Aesthetically I was inspired by the camouflaging techniques of different organisms, as well as the evolution of military camouflage patterns.

 

 

  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image

Images:
Peacock flounder (Brocken Inaglory, 2010. Wikimedia Commons).
Six-colour desert camouflage pattern, 1980’s USA (Pretzelpaws, 2009. Wikimedia Commons).
Waffen-SS summer uniform pattern, 1932 Germany (Mediatus, 2010. Wikimedia Commons).
Airman Battle Uniform digital tiger stripe pattern, 2008 USA (TravisAF, 2009. Wikimedia Commons).

 
Technical

For eight different ecosystems—grassland, desert, marine, forest, tundra, freshwater, parasitic and urban—the algorithm displays fifteen generations of evolution. Every ecosystem has optimal values for the size and shape of the species, as well as a distinctive backdrop to which the organism tries to camouflage itself.

The first generation of 300 individuals is randomly generated with a solid colour, size and shape. Each individual’s 
fitness is determined by how well its colour matches to the environment, and how close the size and shape are to the optimal values. Depending on their fitness, the individuals populate the mating pool, so that the individuals with the best fitness are more likely to reproduce. The offspring inherits parts of its genome from both of the parents. After the reproductive stage, the population consists of 300 members of the new generation, and the natural selection begins again. For every generation the program prints statistics to the console, and displays one random member in the visualisation. If the population’s overall fitness is so insufficient that the mating pool does not have enough genetic material, the population goes extinct and a new population is generated randomly again.

The fitness of the camouflage is calculated by comparing the RGB values of the individual phenotype’s pixels with the pixels of the backdrop. If the match is sufficient, the area with the matching pixels is drawn with the individual’s inherited colour. The final phenotype of the individual is drawn by masking the camouflage pattern with the genetically determined shape.

It turned out that comparing every pixel from every 300 members of the population for 120 generations was, first of all, very slow, and secondly, did not yield optimal results. The likelihood of all the pixels matching with the target image is so microscopical that the fitness was inclined to decrease with consecutive generations instead of increasing. For example, having a solid colour tended to have a higher fitness than an intricate, almost-matching pattern. By adjusting the variables, threshold values, source image resolution, and drawing resolution, I tried to find a balance between creating visually interesting results and having an adequately functioning genetic algorithm. To address the slow running time of the program, I first used 200x200 pixels as the target and result image size, and for the final piece increased the size to 500x500 pixels to produce a higher resolution.

 

 

  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image
  • gallery-image

Images: Experimenting with different methods of creating the camouflage pattern and masking the image.

 
References

Shiffman, D. (2012) The Nature of Code.
http://natureofcode.com/book/chapter-9-the-evolution-of-code/

The font used in the artwork and the video is Spot Mono Light by Schick Toikka.