Skip to main content

Modern Evolution Strategies for Creativity

In this article, we revisit evolutionary strategy algorithms for computational creativity and look at how they improve quality and efficiency in generating art.
Created on May 24|Last edited on February 9
Evolutionary algorithms have been used in the digital art scene since the 1970s, with one popular application of genetic algorithms being to optimize the procedural placement of vector graphic primitives to resemble a given painting. In recent years, deep learning-based approaches have also been proposed to generate procedural drawings, which can be optimized using gradient descent.
In the paper Modern Evolution Strategies for Creativity: Fitting Concrete Images and Abstract Concepts, the authors revisit the use of evolutionary algorithms for computational creativity. The authors observe that, when tasked with the placement of shapes, modern Evolution Strategies (or ES algorithms) offer large improvements in both quality and efficiency compared to traditional genetic algorithms and are even comparable to gradient-based methods.
In the above-linked paper, the authors demonstrate that Evolution Strategy is also well-suited for optimizing the placement of shapes to fit the CLIP model, and can produce diverse, distinct geometric abstractions aligned with human interpretation of language. Such an alignment is due to the use of CLIP trained on an aligned real-world text-image dataset. Interestingly, the results produced by the proposed method resemble Abstract Expressionism and Minimalist Art.

👉 Try Concrete Image Fitting on Google Colab

👉 Try Abstract Concept Fitting on Google Colab

Table of Contents




The Proposed Modern Evolutionary Strategy fitting the painting Mona Lisa by Leonardo Da Vinci
1



Evolutionary Strategy and CLIP fit the concept represented in the Input Text Prompt.
1

This article was written as a Weights & Biases Report which is a project management and collaboration tool for machine learning projects. Reports let you organize and embed visualizations, describe your findings, share updates with collaborators, and more. To know more about reports, check out Collaborative Reports.
💡



The Proposed Evolution Strategies for Creativity

The proposed method synthesizes painting by placing transparent triangles using the Evolution Strategy approach. The overall idea of the proposed architecture is as follows:
  • A configuration of triangles can be represented in a parameter space which composes of the positions and colors of triangles. Concretely, a configuration of NN triangles is parameterized by a collection of (x1,y1,x2,y2,x3,y3,r,g,b,a)\left(x_{1}, y_{1}, x_{2}, y_{2}, x_{3}, y_{3}, r, g, b, a\right) for each of the triangles, which are vertex coordinates and the RGBA color, totally making 10N10N parameters.
  • We render such a configuration onto a canvas.
  • Then we calculate the fitness of the rendered canvas based on how well it fits a target image or a concept in the form of a text prompt.
  • The Evolution Strategy algorithm keeps a pool of candidate configurations and uses mutations to evolve better ones measured by the said fitness.
  • In the Evolution Strategy, all the parameters are updated, and a fixed hyper-parameter is used, which is the number of triangles NN.
  • In order to have better creative results, the authors use a modern Evolution Strategy algorithm, Policy Gradients with Parameter-based Exploration or PGPE, optimized by the ClipUp.

Evolutionary Strategy in Practice

The authors note that, in practice, a few decisions should be made so the whole pipeline can work reasonably well:
  • They augment the rendered canvas by random cropping in calculating the fitness and average the fitness on each augmented canvas, as used in the case of VQGAN + CLIP. This would prevent the rendered canvas from overfitting and increase the stability in the optimization.
  • The triangles are rendered on top of a background with a uniform distribution noise. Mathematically, this equals modeling the uncertainty of parts in the canvas not covered by triangles with a max-entropy assumption and using the Monte Carlo method for approximation.
  • The maximal alpha value for each triangle is limited to 0.10.1, which prevents front triangles from (overly) shadowing the back ones.

What Exactly Does "Fitting" Mean Here?

Due to the Evolution Strategy being orthogonal to the concrete fitness evaluation, we are left with many free choices regarding what counts as fitting. The authors consider two main kinds of fitness:
  • Fitting a concrete image: The pixel-wise L2 loss between the rendered canvas and the target image is the fitness. This is demonstrated by the lower branch in the aforementioned figure describing the proposed architecture.
  • Fitting a concept: The authors represent the concept as a text prompt and embed the text prompt using the text encoder in CLIP. The rendered canvas is then embedded using the image encoder available in CLIP. Since the CLIP models are trained so that both embedded images and texts are comparable under cosine distance for similarity, such distance can be used as the fitness.
The proposed Evolution Strategy approach for Computational Creativity
Note that since the Evolution Strategy algorithm provides black-box optimization, the renderer, does not necessarily need to be differentiable like the fitness computation.
💡



Result

Fitting Concrete Target Image

In this section, we'd like to showcase the performance of the proposed architecture in fitting a concrete target image. In doing so, the model takes the lower branch in the architecture of the proposed method (as shown in the aforementioned schematic of the proposed architecture). We showcase the fitting of the architecture on several target images for 2000 iterations starting with 50 triangles in the table shown below.

Result of Concrete fitting on several target images
7

Note that the tables shown above were created using Weights & Biases Tables. The Table is a great data visualization tool that lets you iterate on datasets and understand model predictions. To know more about how to use Tables effectively, you can check out the official documentation.
💡

Fitting Abstract Concept With CLIP

Now, let's look at the performance of our method configured to fit an abstract concept represented by language. In doing so, the model takes the upper branch in the architecture of the proposed method, as shown in the aforementioned schematic of the proposed architecture.

Fitting an abstract concept represented by language
10


In order to reproduce the results as shown above using Weights & Biases, you can run the Google Colab notebooks for fitting concrete images and fitting abstract concepts. The notebooks are inspired by the original implementation by the authors.
💡



Conclusion

In this article, we discuss the paper Modern Evolution Strategies for Creativity: Fitting Concrete Images and Abstract Concepts, in which the authors revisit evolutionary algorithms for computational creativity by proposing to combine Modern Evolution Strategy algorithms with the drawing primitives of triangles inspired by the minimalism art style. A few takeaways:
  • The proposed method offers considerable improvements in quality and efficiency compared to traditional genetic algorithms and is comparable to gradient-based methods.
  • The authors also demonstrate that the Evolution Strategy algorithm could produce diverse, distinct geometric abstractions aligned with human interpretation of language and images.
  • The authors observe that the Modern Evolution Strategy approach produces very different and sometimes better results compared to gradient-based methods, arguably due to the intrinsical behavior of the optimization mechanism. However, it remains an open problem to understand how in a general setting, the Modern Evolution Strategy approach compares with gradient-based methods.
  • The way the authors deal with evolutionary algorithms provides insight into a different paradigm that can be applied to computational creativity.
  • The authors note that widely adopted gradient-based methods are fine-tuned for specific domains, i.e., diff rendering for edges, parameterized shapes, or data-driven techniques for rendering better textures. Each of the applications requires tunes and tweaks that are domain-specific and hard to transfer. In contrast, the Modern Evolution Strategy approach is agnostic to the domain, i.e., how the renderer works.
  • The authors envision that approaches inspired by Evolution Strategies could potentially unify various domains with significantly less effort for adaptation in the future.



Similar Reports


Iterate on AI agents and models faster. Try Weights & Biases today.