Friday, 18th September 2009
After some false starts with mutations not being saved (I forgot that in Python, a list of lists needs to be explicitly copied), I finally got a program running using Pygame. Then I spent several hours watching an image of my cat (what else), slowly evolve. After a while I decided I wanted to experiment with changing the parameters for the program so I wanted a standard image for all my tests. I wanted to start with a greyscale image to keep things simple at first, but the cat picture was a bit too dark and indistinct. I decided on a famous photo of Charles Darwin, which seemed appropriate. I got a smallish (152 x 200 pixels) version to speed up computation.
Below are two images evolved over ~150,000 generations; one image is made up of 128 circles, the other from 256 circles. The images are far from exact replicas of the original, though I think they are recognisably Darwin. To me, the images look a bit like impressionistic reproductions of the original, and from a distance of 4-5m (or 40-50cm without my glasses), both images are almost indistinguishable from the original. The overall shape and shading of the evolved images is approximately right, while the details are missing. As you might expect, the image built from 256 circles has more details (specifically the eyes and nose) than the image built from 128 circles.
In the first runs through my evolutionary search for an approximation of Darwin, I had no way of saving the result. I later started to record every genome that was more successful that its predecessor. As a result I can re-run an evolution path at an accelerated rate. In one run of evolving 256 circles for ~150,000 generations, 3010 daughter genomes were 'fitter' (i.e. less distant from the image of Charles Darwin), than the preceding genome. I generated and saved the 3010 images corresponding to each of these genomes (luckily they are very small PNG files), then imported them into ImageJ as an Image Sequence. This created a huge stack of images, which I saved as a QuickTime movie, showing 24 images per second.