Nir Rachmel | Project 3 + Generative Art

by nir @ 5:24 am 1 March 2012

Evolution of ideas.

My initial idea for this project was to simulate a line or a crowd, by implementing a combination of flocking / steering algorithms. I planned to set some ground rules and test how the crowd behaves when interesting extreme characters enter the crowd and behave completely differently. Will the crowd learn to adapt? Will it submit to the new character?

After playing around with ToxicLibs to generate the queue, I thought about an idea that interested me more, so I only got as far as modeling one of the queues:

William Paley

William Paley was a priest, who lived back in the 19th century. He coined one of the famous argument in favor of god’s existance and the belief that everything we see is designed for a purpose (by god, of course). As a rhetoric measure, he used to talk about a watch, and how complicated and synchronized need all its parts be for it to function well. In a similar fashion, are all other things we see around us on earth and beyond.

I wanted to use this lab assignment to play with evolution and see if I can create a set of rules that will generate a meaningful image out of a pool of randomly generated images. Following Daniel Shiffman’s book explanation about genetic algorithms, I designed a program that tries to generate a well-known image from a pool of randomly generated images. The only “cheat” here is that the target image was actually used to calculate the fitness of the images throughout the runtime of the program. Even with that small “cheat”, this is not an easy task! There are so many parameters that can be used to fine-tune the algorithm:
1. Pool size – how many images?
2. Mating pool size –  How many images are in the mating pool. This parameter is especially important for a round where there are some images with little representation. If the mating pool is small, they will be eliminated and vice versa.
3. Mutation rate – is a double sided knife, as I have learned. Too much mutations, and you never get to a relatively stable optimum. Too little mutation, and you get nowhere.
4. Fitness function – This is the hardest part of the algorithm. To come up with criteria that measures what is “better” than another. As explained above, for this lab I knew what is my target, so I could calculate the fitness much easier. I used color distance for that: For each pixel in the image, I compared the three colors with the other image. The closer you are, the more fitness you have, and bigger your chances to mate for the next round.
5. Last,but not least – performance. These algorithms are time consuming and cpu consuming. When trying an image of 200×200, the computer reacted really slowly. I ended up with an optimum of 100px square images for the input assignment.

Following is a short movie that shows one run of the algorithm. The image is never drawn right. There are always fuzzy colors and in general it looks “alive”.

The End.

1 Comment

  1. You’re right that the genetic algorithm doesn’t come across in the “survival of the fittest” sense, but the evolution in the images is really interesting.
    The results are “unremarkable”, but that’s not so important. It’s clear that you learned a bunch of stuff.
    I didn’t see much variation. But maybe that’s because I’m farther away. Cool concept.

    I originally thought that the 100 separate images would morph into a single image rather tha 100 copies of the same. How would that change things?

    like how what actually happened wasn’t as you had anticipated. Your algorithm seems like its working and it seems like it’s doing the best that it can. I guess there is a value for having such a surprise!

    Ah, you would enjoy this:
    “Genetic Algorithm” + “Mona Lisa”
    http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/
    http://blog.nihilogic.dk/2009/01/genetic-mona-lisa.html
    https://www.youtube.com/watch?v=A8x4Lyj33Ro
    +1, this is a great genetic algorithm example

    It sounds like your “problem” is just that in a 100×100 image there are too many dimensions. If I understand correctly, each pixel is basically a gene. I’m not sure how you’re mating images, but I suspect if you had some way to swap large sections of genome, the results would be better. Mutations should also probably be slight color shifts in one direction or another, rather than complete new random values.
    You might also want to include an option to generate new images asexually, so just copy the genome and mutate it, instead of combining parents. Maybe 20% of each generation. < good idea
    But all that said, the noisy images aren't a bad result, and are probably a more interesting result than if you arrived at exactly the starting image.

    I'm wondering if you could use this methodology for morhing Warhol's serial silkscreens …. perhaps a riff on the irrelevance of 'serial' in an era where 'growth' or 'evolution' are becoming more standard means of production.

    I dont totally get how this qualifies as evoltion…evolution necessarily has no predefined solution, but this algorithm explicitly seeks one? It's an awesome project still, but the watchmaker analogy is confusing me a bit.

    you sound dissapointed that you didn't achieve an exact replica through evolution, but I think the result is visually interesting

    You evolved pointilism! Fantastic!
    **Yes. Very cool. I don't think it is a bad thing that you didn't end up with the exact image. I think it keeps it from looking aesthetically like a canned video effect.

    Comment by admin — 29 March 2012 @ 7:00 am

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2023 Interactive Art and Computational Design, Spring 2012 | powered by WordPress with Barecity