Initial results

4500 generations of evolving a picture of my cat, Alfie

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.

Evolved images of Charles Darwin

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.

Comments

Love it!

Was inspired to improve on this. The problem with genetic algorithms is that they take forever to process since the search domain is not linear.

I tried reducing it to a tile-set and then find a good enough solution for each tile. Improved things pretty much I must say!

https://www.youtube.com/watch?v=GS66PC6za7k

Post new comment

The content of this field is kept private and will not be shown publicly.