Evolution of Mona Lisa Via Genetic Programming
mhelander writes "In his weblog Roger Alsing describes how he used genetic programming to arrive at a remarkably good approximation of Mona Lisa using only 50 semi-transparent polygons. His blog entry includes a set of pictures that let you see how 'Poly Lisa' evolved over roughly a million generations. Both beautiful to look at and a striking way to get a feel for the power of evolutionary algorithms."
Is the source code available for this? It'd be a fun project to learn from and play around with.
Genetic Algorithms are like the AI equivalent of text editors... everybody has spent a weekend writing one at some point.
How we know is more important than what we know.
I would've liked to see it done with triangles... complex polygons just feels a bit like cheating. Not that it isn't super cool.
On reddit, someone posted another neat GA algorithm which evolves a car to match terrain:
http://www.wreck.devisland.net/ga/
One individual trying to improve itself isn't evolution, it's simulated annealing. Just because you call your parameters "DNA" it doesn't turn it into genetic programming.
Genetic programming requires a population and a crossover operation.
Wont evolution speed up as the organism becomes more complex ? It took over a billion years for a single cell to evolve into a complex organism. But it took only 30000 years for us to jump from cave paintings to space travel. Do such leaps happen in such evolutionary algorithms ?
Wait...let me see if I've got this right.
1) Take a random group of polygons
2) Randomly change those polygons until they're more like the Mona Lisa
3) Repeat
And people are surprised that the end result is something that looks more like the Mona Lisa than when he started?
As someone who has written a few genetic algorithms for optimization in systems I've engineered, this really shows off the inherent power. Yeah, its not going to get a perfect answer, but sometimes its quicker and easier to get genetically optimized than to do the optimization by hand. After reading Selfish Gene and doing GA's, it really gave be an appreciation for the beauty of evolution and its mechanism.
Its not genetic programming because theres only phenotype being evaluated each generation(the image). If the algorithm had 10 individual sets that traded polygons somehow, with a tendency for the pictures closer to the Mona Lisa to get reproduction preference, then it would be genetic.
Evolution with a comparison function is called intelligent design. Here for example is the code snipped that created man (from the good book):
... ...
while(strcmp(image(man),image(god)))
{
free(man);
man=(man_t*)malloc(sizeof(man_t));
}
bless(man);
...you'll love Picbreeder: picbreeder.org
I did something very similar. Instead of random polygons, I used random circles. I would choose the best and then clone it... adding a random circle to each.
http://www.eigenfaces.com/
An interesting thing, I found, was to take a handful of low-quality creations and "average" them out. You end up with more detail.
I think it's cheating to use convex polygons, why not use complex polygons then you could probably do it with 5 polygons?
“Common sense is not so common.” — Voltaire
Sorry, but this is hill climbing, pure and simple. The (very cool) result was achieved by introducing random changes ("mutations", if you like) into a "state" or "temporary solution" (the set of polygons), and keeping the new state only if it increases a target function (the similarity to a target image).
The name "genetic algorithm" is actually used for a more complex situation, more reminiscent of our own genetics: the algorithm maintains a pool of states or temporary solutions, selects two (or more) of them with probability proportional to their target-function score, and then randomly recombines them, possibly with "mutations", to generate a new state for the pool. A low-scoring state is probably removed, to keep the pool at constant size.
Quite possibly, a genetic algorithm would do an even better job here, as it could quickly find, for example, two states which each approximates a different half of the image.
Could this be used as a new way to compress pictures? I would guess the compression itself would be computationally expensive, but the compression would be amazing.
Yes, I'm left. You have a problem with that?
Yeah, you forgot to tick "Post Anonymously"...
Each generation is a population of 20. A given generation is a combination of a weighted breeding of the previous generation based on success plus some random mutation.
I ran it 3 times for a substantial amount of time. It always started from a population where most or all of the cars failed. It always evolved to one where most(all?) succeeded, in that they ran for the full ~10s without toppling and crashing. It was extremely effective, though it required a bit of patience.
One singular exceptional population member doesn't ensure that all of the next generation will be exception, we're not talking about cloning. You would expect it to be possible to have an aberration like that, but not necessarily common.
If I'm interpreting the plot correctly, the x axis is iteration and the y is the success metric. I'm assuming the lower line is the population average while the higher is the best of that generation. You can see both of them grow. On a population where you have one exceptional success, you see the one line spike high above the other.
Then life would have stopped with bacteria.
Had this consumer sheep instead opted to use a superior, Open Source operating system, then he could have posted the source code to Sourceforge or something similar, and had the community as a whole inspect the source.
What's stopping him from doing this using Windows?
This would have led to an algorithm that would have required less generations, and used less polygons.
Really? I never knew Windows caused bad algorithms.
I'm as anti-big corporation and anti-Microsoft as anyone I know, but I'm getting a little tired of these posts that have no thought added. .NET is about as close to open as anything that Microsoft has developed. Just because Microsoft didn't make Mono doesn't mean that they are against it... they just have no business reason to create something that the open source community can do.
.NET/Mono are excellent runtimes, and C# is a very good and powerful language. Multiple languages compile to the same bytecode so that practically anyone can jump in and start. And it gives a great alternative to Java.
All my liberal friends think I'm a conservative, all my conservative friends think I'm a liberal.
Finally we have definitive proof that the Mona Lisa evolved from simple polygons instead of being "intelligently designed" by that fictional Leonardo guy.
Support Right To Repair Legislation.
It did. We're just a very complex bacteria colony.
ftfa: So what do you think?
She still wouldn't date someone on /.
Having to work for a living is the root of all evil.