AI | Artist? — Teaching art to AI.

Shaunak Inamdar
5 min readSep 12, 2020

Art is the representation of humanity’s mind, the most complex system known to man. It helps us understand who we truly are, and the world we live in.

It is a means for the artist to transcend the limitations of time and space and to partake of pleasures not found in the day to Creation of art has been often compared with the process of birth and death.

The word ‘Art’ is, however, most commonly associated with pieces of work in a gallery or museum, whether it’s a painting from the Renaissance or a modern sculpture. As a result, the creators of visual art have come to be valued highly in society. However, with the rapid evolution of artificial intelligence, researchers have begun developing algorithms that can learn and produce never-before-seen creative art pieces.

This is, for me, is highly controversial and extremely fascinating.

A Neural Algorithm of Artistic Style(N.A.A.S.) is a paper published by Leon A. Gatys, Alexander S. Ecker and Matthias Bethge is a fascinating paper published in 2015 where the authors take a jab at understanding and teaching a Deep Neural Network how human beings create and perceive artistic imagery.

It is by far the most interesting take on artificial artworks that I have ever seen. And in this blog I am going to try and explain the concepts behind this. ( To those of you who are unfamiliar with the concepts of AI and Deep Neural Networks, do not fret this is suitable for you also)

Gaty’s Algorithm of Artistic Style

The concept of “art” can be broken down into two parts — Content and Style. The content of visual art can be the message or the crux of the art piece. For example, in a painting, the content might be the object or the person or the scenery in the painting, and the style is the way the artist has described it. This maybe in the form of colors used, compositions produced, certain highlighted areas and similar characteristic features. Often these features are exclusive to an artist or a painter and is associated with famous artist who are famous because of their signature styles.

So, in order to learn art, one needs to learn style. Gatys’ algorithm takes in two images: the content image and the style image. As implied by their labels the algorithm processes the style images, extracts its style and weaves it into the content image. Thus producing a third, output image which is an amalgamation of both the input images.

This is done using a clever technique called feature extraction.

What it does is, it takes in the image and converts it into an array of numbers for the computer to process it. This array of numbers(which represent the inputted style image) are then passed into a Neural Network which identifies certain patterns in the image. The NN used is called a Convolutional Neural Network. This network consists of layers of small computational units which process visual information. This is done because our computers cannot process images and visual information the way our brains process them.

For the computer, the image is just a long list of random numbers. The CNN(Convolutional Neural Network) helps it make sense of all those numbers and identify some information. So, the CNN outputs whats called a feature-map of the input image: a differently filtered version of the input image.

Now, what our algorithm does is, it takes various different feature maps, all differently filtered images the display the various components of the input image and compares them with the content image.

The content image is also processed the same way.

The output image is produced by identifying matching patterns in the content image. The global composition of the content image remains the same, but the colors and patterns of the image are changed.

The rendered photograph looks like a love-child of the two input images. It contains the style and pattern and color palette of the style image, which is applied onto the base contents of the content image. Thus creating a unique piece of exceptional visual art birthed by artificial intelligence. Actually a marvelous process.

I am extremely excited to see how the implementation of algorithms accelerates and diversifies the process of art-creation.

Here is an example of how the process is executed.

The style image chosen by me is a famous artwork CompositionVII by Wassily Kandinsky, a famous abstract painter.

And the content image of my choice is the famous artwork by Banksy.

Upon execution of the algorithm, we get the following output image.

Here is a side-by-side comparison of these three images.

This is absolutely beautiful. The combination of the powerful graffiti art and an abstract expressionist painting which are more than a hundred years apart in time, gives rise to a new, unique piece of extremely beautiful visual art-work.This is an amazing example of the use of AI for art.

You can check out the code on GitHub and give it a try with your own images.

Thank you so much for reading :)

Follow me on GitHub, Instagram.

--

--

Shaunak Inamdar

Shaunak Inamdar is a CS undergrad with a passion for writing about technologies and making them accessible to a broader audience. www.shaunak.tech