Genetic Styles

This guy’s about to play a game of life or death!

Charles Darwin meets Deep Art Effects

In 1859 Charles Darwin released his theory of natural selection, commonly known as “survival of the fittest”. There’s a concept in computer science called a Genetic Algorithm (GA). This does for computers what natural selection does for life on earth and you can apply it to style selection in a useful and creative way.

If you’ve read about the Command Line Interface you’ll know you can add all 68 styles to an image and the theory behind the vast number of possibilities that gives you (if you’ve not read it as that helps with this stuff).

What happens if you limit yourself to picking four styles at random from the 68 available? This is like running through the first four from the randomly selected list. There can’t be much you can do with four styles can there? Well, there are 64 left over – there’s a bit hint 🙂

Given four styles you can create four “sets” of one style, 12 sets of two styles, 24 sets of three styles and 24 sets of four styles for a total of 64 ways to chose any number of styles from four. Again the numbers rapidly get stupidly big very quickly (5 = 325, 6 = 1,956 for example), 64 options is a nice, manageable, number to chose one from.

Survival of the Fittest

Or in this case survival of the best result from the 64 we have to chose from. If you don’t like any of them just generate another set of styles for your starting position (it’s at the end of this)

This process, as noted above, limits your choices quite drastically. This is by design as you now get to chose one of those 64 and have it ‘live’ while the others ‘die’ – you can always bring one back to life of there’s a hard choice to make 🙂

Now you can take your survivor and run it through another set of styles to see what happens choosing which ‘live’ or ‘die’ at your whim.

Every new generation of the 64 candidates will produce different outcomes for you to chose from, you can get some really imaginative results driven by your personal choices using this method.

See it in action

So we start with the bloke at the top of the page and apply Colorful, Mosaic 1, Abstract and Epoch to him which gives us 64 images randing from one to four styles applied.

Some weeks ago we did this exact same process by hand. Manually it was both very confusing and thus error prone not to mention tedious and repetitive as you can possibly imagine. By hand this takes an hour of constanly loading, styling and saving images – Command Line Interface and a script make it a 15 minute job while you do something else.

A lot of these look very similar, they’re meant to. You’ll find one, or more, that stand out from the crowd and deserve more attention. Lets pick one and give it another go!

Round 2

We decided we liked 1243-bloke.jpg which looks like this…

We rename the image as chosen-bloke1.jpg and run him through the mill again.

This time out ‘survivor’ gets Newspaper, Abstract 3, Ukiyo-e and Mixture thrown at him and we end up with this lot…

 

We end up with 0231-chosen-bloke1.jpg as our favourite ready to dive in again… but not today… Anyway – here’s the one chosen for the next round – one day…

 

Try it yourself

The form below works exactly the same as the one on Command Line Interface does so read that to get an idea of how to use the results.

Exactly the same as before you need your original image, DeepArtEffectsCli.exe and the batch file the form generates for you again. The filenames are a bit different this time, they’re coded as to which styles were applied. The which digit = what style information is at the top of the command list you get when you press the button below.

For example the first run above had this at the top…

REM 0 = Nothing applied

REM 1 = Colorful applied
REM 2 = Mosaic 1 applied
REM 3 = Abstract 1 applied
REM 4 = Epoch applied

Above we mentioned that the image we chose from the first batch was 1243-bloke.jpg. Looking at the notes from the batch file this means that bloke.jpg had Colorful -> Mosaic 1 -> Epoch -> Abstract 1 applied in that order.

Some images start with one or more zeros – this simply denotes that no further styles were applied.

What are you waiting for – go grab your script and give it a go!

Directory :
FileName :

[wpedon id=360]