Original PDF
Chapter 02

Background

Our research is located at the intersection of a number of fields: Deep Learning (DL); Computational Art and Design (CAAD); and Artistic, Expressive Human-Computer Interaction (AE-HCI).

As we mentioned in the previous chapter, we define Creative DL as the intersection of Deep Learning and Computational Art and Design — in other words, the application of DL techniques to the production of artistic works and creative media. We include both technical DL research within this field, and the artistic and/or design practices and research.

At the start of our research in 2014, there was not much activity within Creative DL. Today, this is a very active and rapidly growing area of research and practice. Within this area, our research focuses on introducing Artistic, Expressive Human-Computer Interaction; which we believe is still practically non-existent in this context. To be more precise, we investigate this through Meaningful Human Control and Realtime Continuous Control for performative interaction, which we discuss in section 1.3: Meaningful Human Control and section 1.4: Visual instruments: Realtime Continuous Control respectively.

In this chapter, we will provide the necessary history, terminology, definitions, and technical foundations that we will build upon in the remainder of this thesis.

We first discuss classes of models, namely discriminative and generative models. Since we spend a significant portion of this thesis working with generative models, we will spend some time laying the foundations of generative models in this chapter.

We follow this with a very brief history. We follow a number of independent threads which have separate origins, and eventually converge and merge. We consider 2015 to be the year that DL burst into the collective consciousness of artists, designers and creatives around the world — which led to the birth of Creative DL. This was initially fuelled by the viral online release of Deepdream (Mordvintsev et al., 2015) in June 2015, and its prevalent popularity on both social and mainstream media. This was shortly followed by the similarly viral online release and immense popularity of Neural Style Transfer (Gatys et al., 2015a) only a few months later, and Deep Convolutional Generative Adversarial Networks (DCGAN) (Radford et al., 2015), only a few months after that. Andrej Karpathy's open-source character-level language model Char-RNN (Karpathy, 2015a), based on (Graves, 2013), further cemented interest in DL within those with artistic and creative interests. This is not to say that no research was taking place within this field prior to 2015. However, 2015 was indeed the year that the relatively independent trajectories of DL and CAAD became much more intertwined.

We follow these threads, discussing both artistic and technical contributions. We do not attempt a thorough survey of DL. Instead we provide a very brief overview of key technical innovations, focusing on those events with significant cultural impact. In other words, these are key milestones within DL research that left the confines of academia and industry, and reached broader audiences toaffect the practices and discourse within the arts and creative sectors. These include Deepdream, Char-RNN, Neural Style Transfer, DCGAN, Pix2Pix, CyleGAN, AlphaGo, AlphaZero, Sketch-RNN, ProGAN, BigGAN, GANBreeder, ArtBreeder, StyleGAN and StyleGAN2.

Finally, we present in more technical detail, an introduction to Deep Learning as will be necessary to parse this thesis. We start with the basics of Machine Learning, Artificial Neural Networks, loss functions, gradient descent and backpropagation, all the way through to modern deep architecture and methods that we use in this thesis, such as Convolutional Neural Networks (CNN), Variational Auto-Encoders (VAE), Deep Convolutional Generative Adversarial Networks (DCGAN), Long Short-Term Memory (LSTM) Recurrent Neural Networks (RNNs), and Monte Carlo Tree Search (MCTS).

2.1 Generative models

Before we go deeper into any of the topics, we will first define a few key concepts that will come up frequently in our discussion. We will regularly refer back to these ideas and build upon them in the following sections.

First, we discuss the two primary classes of Machine Learning models: discriminative vs generative. And then, since the majority of this thesis deals with generative models, we will examine them in more detail. We will leave implementation-level technical details for a later section, and discuss them in section 2.3: Introduction to Deep Learning. In this section, we will cover only how and what they can be used for.

Discriminative models learn to predict some output 𝒚, given an input 𝒙. More formally speaking, they model P(𝒚|𝒙). These can be used for classification purposes, where the model predicts a vector of probabilities over a number of class labels. In this case, the model only learns the boundaries between classes. Discriminative models can also perform regression, where the model predicts some real values. For example, what actions to take in a given situation, how much to steer an autonomous vehicle, what the price of a particular house might be given some conditions etc. A regression model might also predict the parameters of a parametric probabilistic model, for example a Gaussian Mixture Model (GMM) (Bishop, 1994).

In chapter 3: Realtime sequence generation with continuous control, we investigate how deep discriminative models can be used to generate images. In the chapters following that, we investigate a number of different generative deep models.

Generative models try to model observations by learning the joint distribution of the data. More formally speaking, they model P(𝒙,𝒚). In other words, generative models try to model the underlying dynamic processes that gives rise to the observations. When we take a sample from this distribution, we are effectively executing the function which models that dynamic process. Therefore, this generates new data that should be structurally and statistically similar to the observations. This also implies, that when we manipulate parameters of the generative model, we are manipulating parameters of the dynamic process. Therefore, this generates varying outputs that are consistent with the world from which the observations came from.

There are many different deep generative architectures, and in section 2.3: Introduction to Deep Learning, we will discuss a number of these in more technical detail. For now, we present some common characteristics.

2.1.1 Unconditional generative models

When we train a generative model on a dataset, for example consisting of many images, the model learns a function G that maps some vector 𝒛 to an output 𝒚 that resembles the training examples. In the architectures that we work with in this thesis, 𝒛 is typically sampled from a standard normal distribution 𝒩(0,1). This can be expressed more formally as

G:𝒛↦𝒚where 𝒛~𝒩(0,1)
(2.1)

𝒛 is a vector, with a dimensionality typically in the range 128–512 in the examples that we work with in this thesis. This is a compact, latent representation of the output 𝒚, which might have a dimensionality many orders of magnitude higher. For example a 1024x1024 pixel colour image has a dimensionality of 1024*1024*3=3145728. Yet it can be represented with a latent vector in 512 dimensions. This is effectively a compression ratio of 6144:1. For the generative model to learn such compact representations, the dataset must have significant amounts of structure and regularities. Furthermore, the model's architecture must be designed specifically to maximise the ability of the network to identify and model these regularities and features. This is one of the major reasons as to why this is currently such an active area of research, and why there are so many different architectures available.

The generative model that we describe above in eqn. (2.1), in which the model's output is not conditioned on any extra information, is an unconditional generative model. To generate an output, we simply sample a random 𝒛~𝒩(0,1) and feed it through the model. In later sections, we will present a number of examples of unconditional generative models in subsection 2.3.17: Variational Auto-Encoders (VAE) and subsection 2.3.18: Deep Convolutional Generative Adversarial Networks (DCGAN).

2.1.2 Conditional generative models

It is also possible to condition the output of a generative model, on an additional input 𝒙. This is known as a conditional generative model, and it can be expressed more formally as

G:{𝒛,𝒙}↦𝒚where 𝒛~𝒩(0,1)
(2.2)

It is quite common for the conditioning input 𝒙 to be a class label. For example, if 𝒛0 represents a specific location in latent space, G(𝒛0,dog'</mtext><mo stretchy="false">&#x00029;</mo></mrow></math> would produce a specific image of a dog, that corresponds to that location <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><msub><mrow><mi>𝒛</mi></mrow><mn>0</mn></msub></mrow></math>, while <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow><mi>G</mi><mo stretchy="false">&#x00028;</mo><msub><mrow><mi>𝒛</mi></mrow><mn>0</mn></msub><mo>&#x0002C;</mo><mtext>cat') would produce an image of a cat, even though it is generating from the same latent representation. BigGAN (Brock et al., 2019) is an example of a conditional generative model, conditioned on class labels. Interestingly however, the authors note that class leakage may occur, whereby the visual characteristics of images from one class, might appear in the images generated when conditioned on another class, for example placing puppy eyes and nose on an image of a tennis ball.

Pix2pix (Isola et al., 2016), is a conditional generative model where the conditioning input 𝒙 is an image. This allows the model to generate new images, conditioned on an input image. We use this as a basis for the work that we present in chapter 5: Learning to see: Digital puppetry through realtime video transformation, where we present an application that we developed which uses a conditional generative deep model to transform a live video feed in realtime.

2.1.3 Latent manipulations

One of the major motivations behind research into deep generative architectures, is to ensure that the latent representations learnt by the model, are well structured and disentangled (Bengio et al., 2013; Ridgeway, 2016). This ensures that given a latent representation 𝒛 where G(𝒛) produces an output 𝒚, we can make certain meaningful manipulations on 𝒛 to produce a new latent representation 𝒛′, such that G(𝒛′) produces 𝒚′, which has some meaningful manipulations applied.

Latent representation recovery

Before we present examples of meaningful latent manipulations, we will first discuss the issue of obtaining latent representations to work with.

One of the simplest methods of obtaining latent representations, is to take random samples from the distribution. For the models that we work with, we typically choose the latent distribution during training, to be a standard normal distribution. For this reason, we can sample 𝒛~𝒩(0,1). Once we have one or more latent representations obtained in this manner, we can perform the latent manipulations that we describe below. However, taking random samples in this manner, does not allow us to find the latent representation of agiven data point. In other words, if for example, we are given an image, how can we find the latent representation of that image, such that we can apply meaningful latent manipulations to it?

There are a number of options with regards to addressing this.

Some generative models have encoders as part of their architecture. The encoder learns a function E, such that it can map an input 𝒙 to its latent representation 𝒛. The transformation of the entire network can then be represented as 𝒙↦𝒛↦𝒚. If the encoder and the generator are trained successfully, then the output of the Generator 𝒚≈𝒙, within the limitations of the generative capacity of the model, which in turn is dependent on many factors, such as the architecture, training hyperparameters, and size and diversity of the training data. A VAE is an example of a generative model with an encoder. We discuss VAEs in subsection 2.3.17: Variational Auto-Encoders (VAE), and build upon them in chapter 4: Hello World: Realtime interactive training as an informative and performative tool. Flow-based generative models also have encoders (Dinh et al., 2016; D. P. Kingma & Dhariwal, 2018), and while they do allow for the latent manipulations that we describe below, they do not learn compact latent representations. In this respect, they are computationally significantly more expensive than VAEs, and so for our research, we decided to focus on the latter.

GANs, typically do not have encoders. However, depending on the complexity of the architecture and training data, an additional encoder network can be trained. An example of this is VAE/GAN (Larsen et al., 2016). While this approach showed great potential to begin with, VAE/GANs turned out to be notoriously difficult to train, and they quite often fail to converge. For this reason, there is generally not much research in this direction.

A more popular and successful approach to integrating some kind of encoder into GANs, is using optimisation techniques to recover approximate latent representations (Lipton & Tripathi, 2017; Karras et al., 2020). These methods are particularly effective for data points that are known to be within the distribution. For example, given a powerful image based generative model such as StyleGAN2 (Karras et al., 2020) trained on faces, it is possible to recover a latent representation for an image of a face which is not in the training data, but is cropped and aligned in a similar manner to images of faces which are in the training data. For data points that are outside the distribution, the ability of these methods to recover latent representations depends again on the generative capacity of the model.

Once we have used any of these methods to obtain one or more latent vectors, we can use meaningful latent manipulations such as those detailed below, to produce new latent representations that can be run through the generative model to produce meaningfully manipulated outputs.

Semantic latent vectors

It has been observed that there are often certain directions in the latent space of a generative model, such that moving a latent representation in that direction, applies meaningful manipulations to the output data point. For example in Radford et al. (2015), the authors train a DCGAN on a large dataset of faces. They select a number of latent representations for images of faces wearing glasses, and they calculate the mean to obtain an average face-with-glasses latent vector 𝒛avg-face-with-glasses. They do the same to obtain an average face-without-glasses latent vector 𝒛avg-face-without-glasses. Subtracting one from the other produces a semantic vector 𝒛add-glasses=𝒛avg-face-with-glasses−𝒛avg-face-without-glasses which indicates the direction of adding glasses to a face, in the latent space. Adding this semantic vector 𝒛add-glasses to the latent representation of any new image of a face, produces a latent representation 𝒛new-face-with-glasses=𝒛new-face-without-glasses+𝒛add-glasses such that G(𝒛new-face-with-glasses) produces an image of that face wearing glasses, even if that image does not exist in the training set. The authors demonstrate this with other examples including smiling and rotating.

Using semantic vectors to meaningfully manipulate images is an area that shows great potential and is gaining popularity in recent years. The artist and educator Tom White was one of the first researchers to explore this artistically in his Smile Vector Twitter-bot (White, 2016b). In this project, White trains a VAE on images of faces, and identifies semantic latent vectors such as smiling. The public can interact with the Twitter-bot, to submit their own images. The bot adds and subtracts the Smile Vector to the user-submitted images, to make the faces smile more or less. As generative models, and DCGANs in particular, are starting to produce more realistic outputs, research in semantic latent vector discovery is growing (Simon, 2019; Abdal et al., 2019; Karras et al., 2019, 2020; Härkönen et al., 2020).

Latent interpolation

An important and related concept to semantic latent vectors, are latent interpolations. Interpolating between different latent representations, produces outputs which transform gradually and in some meaningful manner. For example, the intermediate latent representations zi that we obtain, when slowly interpolating from a latent representation 𝒛l of a face looking to the left, to the latent representation 𝒛r of a face looking to the right, will produces images of the face gradually turning from left to right. Likewise, slowly moving between the latent representations of a face frowning, to the same face smiling, effectively generates an animation of the face starting with a frown, and gradually smiling more and more. When we interpolate between very seemingly unrelated latent representations, the model produces outputs in accordance with the set of rules that it learnt, which may or may not make sense to us. For example, interpolating between the latent representation of a tree and a chair, will result in some kind of morphing images, which are difficult for us to predict, and depends entirely on the structure of the latent space. However, modern deep generative models are able to learn very well structured latent representations, such that these interpolations do produce remarkable results. In the case of image based generative models, fully leveraging the visual qualities of the images. We present some examples in chapter 6: Deep Meditations: Latent storytelling.

Latent walks

Videos of latent space interpolations have become very popular, as they can demonstrate the capabilities of the underlying generative model quite well. As a result, it is not uncommon for researchers who investigate novel generative architectures, to release latent space interpolation videos along with their researchFootnote 1.

Typically, these interpolation videos are created without much meaningful human intervention. This is to say, they tend to be either very short clips, simply morphing between two states such as smiling or not smiling. Or the longer clips tend to be entirely random walks. In other words, a number of random latent representations are sampled from the latent distribution, and then they are interpolated between. This is primarily because there are no tools currently available, which allow for the design of trajectories in the high-dimensional space of latent representations. This is a topic that we address in our work. Namely, we propose a method, and develop a tool, that allows users to construct very specific trajectories, such that users can tell stories in latent space with Meaningful Human Control over the narrative. We discuss this with more detail in chapter 6: Deep Meditations: Latent storytelling.

It's worth mentioning, that these latent manipulation methods that we describe above, are applicable to not only images, but they can be applied to potentially any domain. In GANSynth (Engel et al., 2019), the authors use latent manipulations on short clips of raw audio, to interpolate between the timbre and pitch of musical instruments. Skip-thought vectors (Kiros et al., 2015) are latent representations of entire sentences, and in the open-source demo neural-storyteller (Kiros, 2015), the author applies semantic latent manipulations to ordinary text, to manipulate them into the style of romance novels. For the purposes of our work that we present in this thesis however, we are currently focusing on images.

2.1.4 `Generative' terminology in different domains

It is important at this point, to take a slight digression, and discuss this terminology, especially in a cross-disciplinary context such as our research. The term generative is used frequently in this thesis. However, it refers to slightly different concepts in different domains, which are relevant to this thesis:

ML, inherits much of its terminology and concepts from statistics. This is also where the definition of generative model, as we described above originates.

In section 2.2: Very brief histories, we discuss the notion of generative art, and the broader notion of generative media, which includes art, music, design, architecture, poetry, text and any other creative medium. In the computer graphics literature, this is often referred to as procedural. In the art world, it is primarily known as generative, but can also be referred to as algorithmic art. Generative art or media, and generative models refer to very different concepts, which we will unpack shortly. However, before we do so, it is important to also mention another similar sounding, but conceptually distinct term.

In engineering, product design and architecture, generative design, refers to a process of iterative, parametric design involving constraints and goals. It is a family of methods used primarily for solving design and engineering problems. The designer will set constraints relating to materials, space, weight, volume, dimensions, and costs, along with functional and/or aesthetic objectives. Through an iterative process, the generative design system tries to optimize for a number of different solutions.

As we can see, these three definitions refer to quite different, but related concepts. Most notably, both generative models and generative design, can be included within generative media. In other words, an image sampled from a generative Machine Learning model, or produced through a generative design process, could be considered to be generative media or generative art. However, the reverse is not always true. For example, an image produced via particle systems, circle packing, and Delaunay triangulation, is considered generative media. But it is neither generative design, nor a generative model.

It's also important to bear in mind, that not all Machine Learning systems that produce generative media, are generative models. For example, a DCGAN that we will present shortly, is a generative model. Taking a random sample from the latent distribution, a multivariate Gaussian, produces an image. This is generative media, sampled from a generative model. However, Deepdream, as we will shortly discuss, is not a generative model. It is an algorithm in which we use a method known as activation maximization, on a discriminative model designed and trained for classification. We can generate images using Deepdream, so the system is generative, from a generative media point of view. However it is not a generative model, from a ML or statistics point of view.

These distinctions are subtle, but they become important when communicating with researchers and practitioners from different fields.

In this thesis, we do not touch upon generative design. This is because we are more interested in realtime, expressive interaction for artistic expression; while generative design is generally more focused on solving design problems with engineering constraints. However, both generative media and generative models are integral to our research. In this text, whenever we use the term generative model, we are explicitly referring to exactly that, a generative statistical model (or more specifically in our case, a generative Deep Neural Network). Whenever we use the term generative system, we are referring to a computational system which is capable of algorithmically generating media. This system may be a generative model, such as a DCGAN. Or it may be a system comprising of multiple components, one of which may be a non-generative Deep Neural Network, such as in the case of Deepdream.

2.2 Very brief histories

In this section, we discuss the separate histories of a number of different threads that relate to Deep Learning (DL), Computational Art and Design (CAAD), and Artistic, Expressive Human-Computer Interaction (AE-HCI). We initially trace these threads independently, and we follow them through where we observe points of convergence.

Within the greater context of art history, computational art makes a very recent appearance, spanning only a single human lifetime. Despite this, the genre has grown rapidly, and has expanded into many overlapping sub-genres. Just to name a few, these include generative art, new media art, interactive art, net art, post-internet art, digital art, software art, algorithmic art, data art, evolutionary art, robotic art, techno art, glitch art, video game art, bot art, AI art, and many more. In this section, we only touch upon aspects of computational art that connect themes which are directly relevant to our research, such as expressive interaction, Artificial Intelligence and Machine Learning. For a more comprehensive review of computational art in general, please refer to (Levin, 2000; Grierson, 2005; Bailey, 2020).

2.2.1 Generative art

The term generative art (and the broader term generative media — which includes art, music, design, architecture, poetry, text and any other creative medium), refers to works created as a result of working with rule-based and semi-or-fully autonomous systems. Instead of designing and producing the final artefact directly, the generative artist designs a process, which in turn produces the final artefact. The lineage of generative art exists outside of purely computational practices, and can be traced to composers such as Iannis Xenakis, Steve Reich, John Cage, Terry Riley, Brian Eno; and artists such as Lillian Schwartz, Sol Lewitt, Sonia Sheridan; Muriel Cooper and Nam June Paik. Generative art also includes artists working with biological systems, such as Tomás Saraceno's works with spiders and spider webs, and Heather Barnett's work with slime mould. It is worth noting, that the term generative art, is very different to the terms generative models — which we use frequently in this thesis — and generative design. To avoid confusion, we expand on this in subsection 2.1.4: ‘Generative' terminology in different domains.

As we mentioned in chapter 1: Introduction & Motivations, even before the concept of generative art existed, Lady Ada Lovelace had already foreseen in 1843, the impact that computers would have, in the creation of ‘algebraical patterns' and ‘elaborate and scientific pieces of music'. Indeed, the introduction of computers — first analog, and then digital — radically expanded the field of generative art, and led to the birth of may new genres, collectively known under the umbrella title of computational art.

The use of computers for the purposes of making art dates back to the 1950s and 1960s. John Whitney built DIY analog computers from World War II M5 and M7 targeting computers, and anti-aircraft machinery (Alves, 2005). With these DIY computers, Whitney created abstract, animated, visual works, which were not only pioneering technically, leading to the birth of computer graphics and special effects in scenes such as Stanley Kubrick's 2001: A Space Odyssey, but in addition they pioneered the field of computer-aided audio-visual composition (Grierson, 2005). His work continues in the tradition of experimental abstract animators and filmmakers such as Normal McLaren and Oskar Fischinger. Throughout the 1960s and 1970s, he was joined by software artists such as Paul Brown, Vera Molnar, Manfred Mohr, Lillian Schwartz, Frieder Nake, Grace Hertlein, Larry Cuba, George Nees and many more, collectively giving birth to the digital generative art movement.

2.2.2 AI and ML in art, pre-Deepdream

It was Harold Cohen's AARON software from 1973 (Cohen, 1973) which first explicitly brought Artificial Intelligence into the world of computer art. In this respect, it can be considered the first example of AI art. AARON was ostensibly a piece of software, written to understand colour and form. Cohen often spoke about the concept of training his software (Cohen, 1994). However, he uses the term rhetorically. The learning that takes place within AARON, is not what we consider to be true Machine Learning as we will discuss in the following sections. AARON does not learn through experience. AARON does not learn through observations, or analysing data. Instead, when Cohen wanted AARON to learn something new, and perform a particular new task, Cohen had to first analyse the task himself. Cohen identified the sets of rules that governed the behaviour that he wanted AARON to perform. And then he explicitly programmed those rules into AARON, so that AARON could perform the desired behaviour. Often, these were very complex sets of rules, that took years for Cohen himself to decipher and learn, before he could program them into AARON (Cohen, 2006).

As computers started becoming more accessible in the 1980s and 1990s, this brought a new generation of computer graphics artists working with Artificial Intelligence. These include William Latham and Stephen Todd (Todd & Latham, 1992), Karl Sims (Sims, 1994) and Scott Draves (Draves, 2005). Inspired by Darwinian evolution, these artists appropriated genetic algorithms, to pioneer the discipline of evolutionary art. Genetic algorithms do learn from experience, and are technically considered to be Machine Learning algorithms, and for this reason, these works from the 1980s and 1990s can be thought of as among the earliest examples of true Machine Learning based artworks.

During this same period, David Cope developed an algorithm for composing music. His Experiments in Musical Intelligence (EMI) began in 1981, and he developed it for many decades, until he eventually patented the algorithm Recombinant music composition algorithm (Cope, 2010). Using this algorithm, Cope generated musical sequences in the style of many classical composers, such as Bach, Vivaldi, Beethoven, Mozart, Chopin and Debussy. His latest software Emily Howell has albums being released under its name. The algorithm he uses is based on Markov chains, an early 20th century probabilistic model capable of capturing temporal patterns. We will leave the technical discussion for later sections,

Throughout the late 1990s and early 2000s, François Pachet, based at the Sony Computer Science Laboratory in Paris, developed the Continuator (Pachet, 2003). Also based on Markov models, this is an interactive musical system that is capable of learning in realtime, stylistic characteristics of music, such as rhythm, beat, and harmony. The system can improvise and accompany a live musician, or given a sequence of music, it can continue in a similar style.

2.2.3 Interactive media art

The artists mentioned above, were primarily concerned with the algorithmic creation of images and/or sound, and can be thought of as practicing in the lineage of generative art.

Since the 1960s, Myron Kruger was primarily interested in gesturally interactive computer artworks set in Responsive Environments. Kruger developed his large-scale immersive, responsive installations throughout the 1960s, 1970s and 1980s, culminating in his seminal artificial reality environment Videoplace (Krueger et al., 1985). Videoplace tracked users with cameras, enabling them to interact with virtual objects in the scene using projectors.

David Rokeby's Very Nervous System, first developed in 1986, explores similar themes of gestural full body interaction, in this case to generate music (Rokeby, 1986). Throughout the 1980s and 1990s, artists such as Ed Tannenbaum, Scott Snibbe, Michael Naimark, Golan Levin and Camille Utterback created interactive media artworks.

While many of these works might not be immediately considered AI based works, they use sensors, cameras, projections and robotics, to create immersive and interactive environments that respond intelligently to a users actions. They often incorporated complex algorithms, both on the input and sensing side, for example using computer vision or voice analysis techniques; and on the output side, for example mapping inputs to complex behaviours of images, sounds, or motors. And using these complex algorithms, they provide gestural and expressive interaction for the realtime creation and manipulation of images and sounds.

2.2.4 Visual instruments

We have already discussed Visual Instruments in section 1.4: Visual instruments: Realtime Continuous Control. Similar to Louis-Bertrand Castel’s Ocular harpsichord, many mechanical visual instruments were built throughout the 19th and early 20th century. These include Frederic Kastner’s Pyrophone in 1869, Bainbridge Bishop's high voltage powered light emitting pipe organ in 1877, Thomas Wilfred’s Clavilux in 1919, George Hall’s Musichrome and Charles Dockum’s MobilColor Projectors in the 1930s, and Oskar Fischinger’s Lumigraph in the 1940s. For a more in-depth discussion regarding these, please refer to (Levin, 2000). For a more in-depth discussion regarding video synthesizers such as the Bill-Etra or Paik-Abe, please refer to (Collopy, 2014).

2.2.5 Convergence

From the late 1990s onwards, we see an intersection in these initially disparate fields of computational art.

With the birth of the web, and the introduction of first Macromedia Director, and then Macromedia (Adobe) Flash, a new generation of digital generative artists blossomed. These include artists such as Lia, Joshua Davis, Jared Tarbell, Mario Klingemann, and many more.

Around the same time, John Maeda and his Aesthetics and Computation research group at MIT Media Lab developed the Design by Numbers program aimed at teaching programming to artists. Developing this further, and inspired by Muriel Cooper's Visual Language Workshop, Casey Reas and Ben Fry's open-source creative programming environment Processing was born in 2001.

With the introduction of these new artist-friendly programming environments, and perhaps more importantly —their respective communities, the generative and new media art movements converged and grew exponentially.

Initially, the majority of these artists and works were situated more in the lineage ofgenerative art. However, as more open-source tools and communities became available over the years, different technologies such as computer vision and physical computing became more accessible to a wider and more diverse audience. This encouraged the rapid growth of interactive media art in the early-mid 2000s. Some of these tools and communities include openFrameworks, Cinder, vvvv, Max/MSP/Jitter, PureData, SuperCollider, TouchDesigner, QuartzComposer, Threejs, p5js and many more.

2.2.6 Creative DL ← AI Art ∪ Creative AI

With the emergence of Deepdream, Neural Style Transfer, DCGANs and Char-RNN in 2015, Deep Learning become a dominant paradigm within CAAD, and Creative DL was born.

Over the next five years, alongside the technical innovations being developed by DL researchers; artists, designers and creative developers also became very interested in the field. The terms AI Art and Creative AI began to emerge, referring to both the methods, and the community of people who were interested in DL for artistic or other creative purposes. One could point out that there are subtle differences between AI Art, which is focused on more purely aesthetic applications, and Creative AI, which is broader and considers any creative applications including design and architecture.

Despite having ‘AI' in their names, these terms don't necessarily refer to ‘Artificial Intelligence' in the general sense, but are typically more focused on specific modern DL technologies. For this reason, in this thesis we group them under the single title Creative DL.

In this respect, the Creative DL community is very young. However, after a very rapid growth, today it is thriving. This rapid growth is due to a number of reasons.

The continual release of new technological innovations, and the accompanying viral social media response is most probably a strong driving force. We will summarise these in the next section. Another factor for the rapid growth is an increase in accessibility. Some of the key developments include the highly popular website Artbreeder (Simon, 2019), which we will discuss shortly; the Machine Learning For Artists (ML4A) initiative led by Gene Kogan Footnote 2, a collection of free educational resources devoted to familiarising artists with state-of-the-art deep DL; and DL based artist-in-residency programs such as Google's Artists & Machine Intelligence (AMI) and Arts & Culture residency. Finally, efforts from community leaders such as Luba Elliot and AIArtists.orgFootnote 3 helped organise and bring the community together and spread the word.

While the field is incredibly popular today, some of the earliest adopters of Creative DL (from a purely artistic perspective, we will cover more technical/creative developments shortly) include Addie Wagenknecht, Alex Champandard, Alex Mordvintsev, Alexander Reben, Allison Parrish, Anna Ridler, Gene Kogan, Georgia Ward Dyer. Golan Levin, Hannah Davis, Helena Sarin, Jake Elwes, Jenna Sutela, Jennifer Walshe, Joel Simon, JT Nimoy, Kyle Mcdonald, Lauren McCarthy, Luba Elliott, Mario Klingemann, Mike Tyka, Mimi Onuoha, Parag Mital, Pindar Van Arman, Refik Anadol, Robbie Barrat, Ross Goodwin, Sam Lavigne, Samim Winiger, Scott Eaton, Sofia Crespo, Sougwen Chung, Stephanie Dinkins, Tega Brain, Terence Broad and Tom White.

It is within the intersection of all of these threads that we situate our research, where we aim to bring more Meaningful Human Control, and Realtime Continuous Control to the methods available to artists, designers and creatives working within this area.

2.2.7 Creative Deep Learning — from a cultural perspective

The history of Deep Learning spans many fields, including not only Machine Learning and Artificial Intelligence; but also information theory, computational complexity theory, control theory, neuroscience, statistics, calculus, philosophy, psychology, cognitive science, and the social sciences.

For this reason, we will not attempt to present a historic survey of Deep Learning, and instead we will provide a very brief overview of the key technical innovations, from the point of view of artistic and cultural significance. In other words, below we identify a number of significant events and milestones within DL research, that left the confines of academia and industry, reached broader audiences through mainstream and social media, and affected the discourse within the arts and creative sectors. We focus primarily on visual outputs, as that is the focus of our thesis. This topic could become a thesis in itself, so we will keep it very brief and only provide the top-level headlines.

We will not discuss technical contributions or details in this summary, and we leave that for section 2.3: Introduction to Deep Learning. For a thorough historic survey of the topic, please see Schmidhuber (2015), and for more technical details, please see I. Goodfellow et al. (2016).

Deepdream (2015)

As we previously mentioned, the first significant milestone which brought DL into the imaginations of the mainstream creative world, came in 2015 with what was initially known as Inceptionism, and later rebranded as Deepdream (Mordvintsev et al., 2015).

Deepdream sits in a lineage of research that is centred around the quest to understand how deep image classification models work, by visualising their hidden layers or inverting them (Erhan et al., 2009; Simonyan et al., 2013; Zeiler & Fergus, 2013; Mahendran & Vedaldi, 2014; Dosovitskiy & Brox, 2015; Nguyen et al., 2015; Olah et al., 2017; Mordvintsev et al., 2018; Olah et al., 2018).

The Deepdream algorithm, uses a gradient ascent optimisation methodFootnote 4, similar to those we reference above, to generate images that maximise activity on particular hidden neurons or layers. The output generated by this process, is fed back into the system to create feedback loops that incrementally amplify the activity. Combining this with image transformations such as scale or translation, at every iteration, allows for the creation of endless fractal-like animations and ‘hallucinations' of abstract, but recognisable, imagery.

Still image from video “Deepdream is blowing my mind” (2015) by Memo Akten.
Figure 2.1 Still image from video “Deepdream is blowing my mind” (2015) by Memo Akten.

Creative Deep Learning as viral marketing campaign

Deepdream became incredibly viral and popular on social and mainstream media. For a brief moment during the summer of 2015, certain corners of the internet were flooded with the puppy-slugs and bird-lizards of DeepdreamFootnote 5, to which our own experiments did contributeFootnote 6. The first version of the code that was released was notoriously painful to setup due to a complex network of dependencies (colloquially known as dependency hell). However, shortly after, a slew of easy to use mobile apps, websites and business services were launched to ‘Deepdream-ify' user submitted imagesFootnote 7Footnote 8Footnote 9Footnote 10 with the hopes of cashing in on this new ‘AI powered art craze'.

Google themselves recognised the enormous PR and marketing potential of Deepdream, and quickly launched an exhibition in San Francisco, collaborating with the well-established Gray Area Foundation For The ArtsFootnote 11, a non-profit organisation with a mission to “apply art and technology to create social and civic impact through education, incubation and public events”.

This exhibition, called “DeepDream: The art of Neural Networks”, launched in February 2016. In fact, our own work “All watched over by machines of loving grace: Deepdream edition” (2015)Footnote 12 was included in this exhibition, and was the highest selling work at the auction, for $8000 (Fig. 2.2).

“All watched over by machines of loving grace: Deepdream edition” (2015) at the “DeepDream: The art of Neural Networks” exhibition at the Gray Area Foundation, February 2016.
Figure 2.2 “All watched over by machines of loving grace: Deepdream edition” (2015) at the “DeepDream: The art of Neural Networks” exhibition at the Gray Area Foundation, February 2016.

The exhibition further fuelled mainstream interest in Deep Learning, and gained significant attention from mainstream publications such as GizmodoFootnote 13, VoxFootnote 14, WiredFootnote 15, The Wall Street JournalFootnote 16, The Washington PostFootnote 17, The VergeFootnote 18, and The GuardianFootnote 19.

In fact, as we were involved in this exhibition, we are very aware of the intense amount of human labour and creative decisions involved in the production of these works. In that respect, our research in this thesis is in some way a reaction to this press, and specifically to the narrative that was constructed in the PR campaign promoted by Google.

As can be seen by looking at the headlines in Fig. 2.3, Google's PR campaign had clearly decided to spin the story such that “Google's AI is creating art”. This was further exacerbated by the fact that the stories themselves were mostly focused on Google's AI technologies, with very little mention of the artists, nor the exhibition's collaborating partner, The Gray Area Foundation For The Arts.

This would start a trend that would follow in subsequent years: using DNNs in the production of creative media such as images or sounds as material for online viral marketing. Nvidia's ProGAN (Karras et al., 2017), StyleGAN (Karras et al., 2019) and StyleGAN2 (Karras et al., 2020) are great examples of this. These are state-of-the-art generative image models that are currently able to produce the most cutting-edge and photo-realistic results within the field. The authors freely share their source code. However, needless to say, they suggest that in order to achieve the results that they demonstrate in their papers and videos, they recommend using Nvidia's DGX-1 with 8x Tesla V100 GPUs — Nvidia's own PC designed for Deep Learning, costing in the order of hundreds of thousands of dollars. Arguably, the cost of a small Deep Learning research team, combined with state-of-the-art results in image generation, and a hype-driven online community hungry for dazzling content, can be a very cost-effective form of PR and marketing.

Having said that, the research behind Deepdream itself is something that we do find fascinating, from multiple perspectives. This includes the point of view of trying to understand how and what DNNs learn from a technical perspective. This line of inquiry has led to equally fascinating research, often involving the same group of researchers (Olah et al., 2017; Mordvintsev et al., 2018; Olah et al., 2018). And we also find the research behind Deepdream fascinating from the point of view of using machines that learn, to reflect on how humans make sense of the world. A video and article that we wrote on this topic called “Deepdream is blowing my mind” (2015)Footnote 20 was shared widely on the internet, and we touch upon this in more detail throughout this thesis.

A selection of press covering the “DeepDream: The art of Neural Networks” exhibition at the Gray Area Foundation, February 2016.
Figure 2.3 A selection of press covering the “DeepDream: The art of Neural Networks” exhibition at the Gray Area Foundation, February 2016.

However, while we have experimented significantly with Deepdream, generating images in this manner is a painfully slow process, as it requires an optimisation consisting of many hundreds or even thousands of iterations just to produce a single image. While there is scope for Meaningful Human Control, it is very far from realtime, or continuous control. Furthermore, as a reaction to the press coverage of the “DeepDream: The art of Neural Networks” exhibition, we choose to focus our research specifically on the significance of the role of the human, in a collaborative relationship with a generative system powered by a Deep Neural Network. This is very much in contrast to the narrative put forward by Google's PR campaign, and absorbed by the mainstream media, that “Google's AI is making art”.

It is from this perspective, that Meaningful Human Control, andRealtime Continuous Control emerge as points of emphasis in this thesis.

Char-RNN

Another significant milestone came in 2015, in a different domain. While the underlying research is from 2013 (Graves, 2013), it was in 2015 that Andrej Karpathy published a very influential blog post with the title “The Unreasonable Effectiveness of Recurrent Neural Networks” (Karpathy, 2015a), and released an open-source LSTM RNN implementation for training character-level language models, which he called Char-RNN. This software was later ported to different frameworks, and has been used by countless people to generate text in the style of Shakespeare, cooking recipes, rap lyrics, Obama speeches, the bible, Seinfeld episodes, and many more (Karpathy, 2015b). This software was also used by researchers such as Sturm (2015) to generate midi notes in the style of folk music, and is used extensively by artists such as Ross GoodwinFootnote 21 and Allison ParishFootnote 22 to produce very creative, generative text works. In section 3.3: Realtime interactive text generation with RNN ensembles, we go back to the original research that Char-RNN was implemented from (Graves, 2013), and we develop a new version that interactively allows Realtime Continuous Control over the style of the text generated.

Neural Style Transfer (2015)

Yet another significant milestone came in 2015, in the form of Neural Style Transfer, which became popular on social media with the hashtag #StylenetFootnote 23

The basic idea behind Style Transfer, is to apply the style of one image, onto another image which provides the content. A typical example might be to apply the style from a Monet painting, to a photograph of a portrait or a landscape. In this case, the photograph will be transformed to look as if it were painted by Monet. While computational approaches to such artistic stylisations have a rich history (Hertzmann, 2001; Kyprianidis et al., 2013), a data-driven approach using DNNs were first demonstrated in (Gatys et al., 2015a). This original method of Neural Style Transfer, used an optimisation approach to generate an image, such that it satisfied both constraints of having stylistic information from the style image, and content information from the content image. In this respect, similar to Deepdream, generating images is again very slow, and generally takes in order of minutes for a single image. Furthermore, this method deals with a single style image. In other words, a photograph, can be stylised with only one style image.

In Deepdream, the majority of images generated share a very strong common aesthetic, namely puppy-slugs and bird-lizards. For this reason, while it became very popular incredibly quickly, its popularity — at least within the broader Creative DL community — faded equally quickly. However, Neural Style Transfer, allows for much easier customisation of the aesthetics, since the aesthetics is determined by the style image. In other words, simply selecting different style images, allows a user to radically alter the look of the generated images. For this reason, the popularity of Style Transfer did not diminish as quickly as Deepdream, and artists such as Sofia CrespoFootnote 24 and Chris RodleyFootnote 25 have developed unique techniques integrating Style Transfer into their practice to make works that carry their personal expressive signature.

Many improvements were developed such as fast style transfer (Johnson et al., 2016), multiple styles (Cui et al., 2017), texture synthesis (Risser et al., 2017), applications to videos (Ruder et al., 2016) and spherical images (Ruder et al., 2018). Image analogies, as first put forward by (Hertzmann, 2001), also beccame a popular area of research. This involves using low-colour semantic maps, to generate high-fidelity images such as photographs or paintings. For this reason, within the Style Transfer discourse, this became known as Semantic Style Transfer (Champandard, 2016).

This topic would later be taken over by a very different technical approach using GANs, which we will discuss shortly. And it is this implementation with GANs, that we build upon for the work that we present in chapter 5: Learning to see: Digital puppetry through realtime video transformation. Style Transfer has been adapted to run in realtime (Johnson et al., 2016), and versions of it can support multiple styles (Cui et al., 2017). However, they are still limited to the order of tens of different style images, while we are interested in the question regarding what can deep generative models learn across a dataset of tens of thousands of images. Furthermore, even if the number of style images were not an issue, typically within Neural Style Transfer, a user explicitly selects one or more images from which the style is extracted and used. In other words, the style of each image is modelled individually. However, in chapter 5: Learning to see: Digital puppetry through realtime video transformation, we are again interested in modelling the aesthetic qualities across the entire dataset of tens of thousands of images.

It is also worth noting, that the research being conducted with the field of Style Transfer, also served as inspiration for similar research in different domains. These include Neural Style Transfer for Audio Spectrograms (Verma & Smith, 2017), Time Domain Neural Audio Style Transfer (Mital, 2017), Style Transfer for Musical Audio Using Multiple Time-Frequency Representations (Barry & Kim, 2018), and Style Transfer for stories in text form (Kiros, 2015).

DCGAN (2015)

Generative Adversarial Networks (GANs) were first proposed as a means to avoid having to explicitly formulate a loss function, and instead, learn such a function via an additional DNN (I. J. Goodfellow et al., 2014).

While Goodfellow et al demonstrated their first GAN on toy problems in 2014, it was again in 2015 that Radford et al demonstrated results that were incredible for the time, and caught the public's imagination. Combining convolutional layersFootnote 26 with GANs, the researchers demonstrated the potential of Deep Convolutional Generative Adversarial Networks (DCGAN). A DCGAN is a deep generative model, as we discuss in section 2.1: Generative models, that is able to capture the distribution of a dataset of images, such that a number of meaningful manipulations are possible in a space of compact latent representations. Radford et al's DCGAN were relatively low quality, with image dimensions of only 64x64 pixels. Their model also suffered from typical GAN issues of the time, such as deformed outputs and instability during training. Despite this, the model did demonstrate many powerful latent manipulations as we describe in subsection 2.1.3: Latent manipulations. Inspired by this, research into GANs continued to intensify.

Some of the notable early adopters of unconditional DCGANs, in an artistic and creative context, are artists such as Anna Ridler, Robbie Barrat, Jake Elwes, Mike Tyka, and Gene Kogan, to name a few.

Within the Creative DL community today, unconditional DCGANs are undoubtedly the most popular method of producing visual content. Initially this was with Radford et al's original DCGAN, later ProGAN (Karras et al., 2017), BigGAN (Brock et al., 2019), StyleGAN (Karras et al., 2019) and at this moment in time, StyleGAN2 (Karras et al., 2020).

Pix2pix (2016), CycleGAN (2017)

Another significant milestone came a year after Radford et al's DCGAN, with a conditional GAN colloquially known as pix2pix, Image-to-Image Translation with Conditional Adversarial Networks (Isola et al., 2016). As we have described in subsection 2.1.2: Conditional generative models, pix2pix is a conditional GAN, where the conditioning input is an image. This allows the model to effectively transform an input image, into some kind of output image.

Pix2pix was shown to be very successful at learning various kinds of image mappings. These include Style Transfer-like transformations; image analogies (Hertzmann, 2001) as we mentioned above, transforming low-colour semantic maps into photographic detailed images; colouring black and white images; and transforming photographs between night and day, or different seasons.

For this reason, pix2pix also became quite popular among the early adopters of Creative DL. One of the famous early applications of pix2pix came in the form of an online edges2cats drawing application (Hesse, 2017). In this online app, users can sketch on-screen, and the application then tries to turn the simple line drawings into photorealistic images of cats. This further fuelled the popularity of pix2pix.

Pix2pix is also the architecture that we use in chapter 5: Learning to see: Digital puppetry through realtime video transformation. We develop a parametrisable, live video processing and transformation system. We implement a custom training pipeline that generates image pairs on the fly, greatly improving the Generator's ability to generalise to novel input images. We also introduce a realtime image processing pipeline, that exposes human-understandable parameters that can be manipulated continuously in realtime; and also transforms any input image to a space that allows the Generator network to further transform the image to a desired target image space.

One of the major constraints of Pix2pix, is that the training process requires hundreds, if not thousands, of matching pairs of images. In other words, the training data must consist of (input, target) image pairs, and the model tries to learn a mapping from the input image to target image. This is not always possible, and the following year, CycleGAN was released, addressing this issue by allowing unpaired image-to-image translation (Zhu et al., 2017).

Within the Creative DL community, while unconditional DCGANs and pix2pix are widely used, CycleGAN did not become as popular. Helena Sarin and Mario Klingemann are amongst notable artists who are using CycleGAN within their artistic practice.

AlphaGo (2016), AlphaZero (2018)

Another important milestone that came in 2016, is the super-human Go playing AI AlphaGo (Silver et al., 2016), which was later developed into the more diverse, super-human Go, Chess and Shogi playing AI AlphaZero (Silver et al., 2018).

Game-playing AI is not a topic that we generally touch upon in this thesis. And while this may not typically be considered a ‘creative output', we include it in this section for a number of reasons. First, an AI system such as AlphaGo beating human Go champions such as Lee Sedol and Fan Hui, is a very important milestone both culturally, and technically.

Second, it can be argued, that AI systems such as AlphaGo and AlphaZero, do exhibit creative behaviour in their decision making process. This is reflected in countless commentaries by domain experts such as Go 9-dan pro Michael Redmond, chess grandmaster Garry Kasparov, and many others.

Third, which is perhaps the most relevant reason, is that one of the underlying methods used in AlphaGo and AlphaZero, is very similar to a method that we developed and use in one of our early studies.

This method involves combining a Monte Carlo Tree Search (MCTS) driven agent, with a Convolutional Neural Network (CNN), to evaluate the state value at any given point in time during a simulation rollout.

The purpose of our AI agent is not to play games per se. Instead, we use an agent-based approach to collaborative, generative sketching, and we discuss this in section 3.2: Collaborative generative sketching with MCTS and CNNs.

Sketch-RNN (2017)

The agent-based collaborative, generative sketching method that we mention above, was not able to produce the realistic results that we were looking for, and we discuss the reasons for this in more detail. However, a year after our work, researchers from Google released Sketch-RNN (Ha & Eck, 2017). This is both a paper; and an accompanying online, collaborative, generative sketching applicationFootnote 27. The researchers use a very different technical approach to ours, however the motivations that they address, and the application that they build, are the same as we describe in our study. Namely, this is to build a generative system that is able to model and sketch images not as dense, pixel-based representations, but as sparse vector representations. And most importantly, to allow for a human to meaningfully interact with the system while it is sketching. We discuss all of these points in more detail in section 3.2: Collaborative generative sketching with MCTS and CNNs.

Progressive Growing of GANs, ProGAN (2017)

Another key milestone came in 2017, when researchers from Nvidia released seminal research known as Progressive Growing of GANs (ProGAN) (Karras et al., 2017). Their progressively growing architecture — combined with immense GPU requirements — allowed them to overcome the long standing issues with DCGANs not being able to capture cohesive structure at larger scales. The researchers were able to produce very realistic looking images at much higher resolution and quality compared to previous DCGANs. In just two years, DCGANs went from generating low quality, 64x64 pixel resolution images in (Radford et al., 2015); to very high quality, 1024x1024 pixel resolution images. With this, the focus of mainstream research began to shift. Up until this point, the majority of research within GANs were focused on the engineering side of trying to improve the quality and stability of GANs. Once Nvidia demonstrated that GANs could indeed produce high quality images, more research teams started to shift into investigating ways of allowing users to control what GANs produced.

ProGAN is one of the architectures that we use as a base in the research that we present in chapter 6: Deep Meditations: Latent storytelling, where we investigate methods of story telling and Meaningful Human Control over narrative in the latent space of a generative model. As we discussed in subsection 2.1.3: Latent walks, typically the videos produced using an image based DCGAN such as ProGAN, are random walks in latent space. In other words, a number of points are sampled randomly within the latent distribution of the model, and then these points are interpolated, and a video is produced. Effectively, this video has a random narrative. The problem that we seek to address in our study, is to devise a method that allows Meaningful Human Control over the narrative of a story constructed in the latent space of an unconditional generative model, such as ProGAN. In this respect, our method is not strongly reliant on ProGAN, but can and does work with other unconditional generative image models such as BigGAN (Brock et al., 2019), StyleGAN (Karras et al., 2019) and StyleGAN2 (Karras et al., 2020). However, we primarily use ProGAN, since it was the state-of-the-art unconditional generative image model at the time that we conducted this study.

BigGAN (2018)

Despite the incredible image quality exhibited by ProGAN, this is generally limited to cases where the dataset is relatively constrained in terms of diversity. In other words, it is possible to successfully train a ProGAN, on a dataset such as CelebA-HQ (Karras et al., 2017), consisting of tens of thousands of images of faces perfectly cropped and aligned in the same manner. In this case, such a ProGAN model is able to generate very believable samples at image resolutions as high as 1024x1024 pixels. However, incredibly diverse and complex datasets such as ImageNet (J. Deng et al., 2009), which consists of millions of images across thousands of different categories, still represent problems for ProGAN. This is to say that, ProGAN architecture is unable to model such a diverse dataset, and sampling from such a model, produces unrealistic images that do not represent the data distribution in terms of fidelity or variety.

In 2018, researchers at Google attempt to address this issue by investigating the impact of increasing scale. They leverage Google's compute resources to increase the parameter count by four-fold, and the batch-size by eight-fold, compared to the state-of-the-art at the time. The resulting model, colloquially known as BigGAN, demonstrates great potential in its ability to capture the data distribution, both in terms of variety, and fidelity, outputting images at resolutions up to 512x512 pixels without the need for progressively growing architecture. When the researchers released pretrained models, this again captured the attention and imagination of many artists, designers, and researchers from different disciplines, and BigGAN experiments became wildly popular on social mediaFootnote 28, some of which were our ownFootnote 29.

In addition to ProGAN, BigGAN is one of the architectures that we investigate in chapter 6: Deep Meditations: Latent storytelling. However, since training BigGAN is not possible with the hardware that we have access to, we test our methods on the pretrained model released by the researchers. This is in fact one of the motivations behind the method that we present. In that, we set out to devise a method that would work with pretrained models, when we do not have the possibility to train our own models.

GANBreeder (2018), ArtBreeder(2019)

BigGAN was also the catalyst for computational artist and designer Joel Simon's wildly successful and popular website ArtBreeder (Simon, 2019). Simon was initially inspired by the earlier large-scale online collaborative evolutionary art app Picbreeder (Secretan et al., 2008). On Picbreeder, users can browse parametrically generated images, and select their favourites in order to branch them. The selected images undergo subtle random mutations, and they evolve to produce new images. Most crucially, Picbreeder is also an online community whereby users can view and select from the images generated by other users. Across many generations and many users, entirely brand new images are created in a massive online collaboration.

Simon realised that a very similar massively collaborative evolutionary approach could apply to generative deep models, due to the fact that they possess a latent code 𝒛, which is in effect a very compact representation of the image, such that minor modifications to the latent code, results in minor modifications to the image generated. The first version of the online app came in 2018 with the name GANBreeder, and only supported the pre-trained BigGAN model as released by the researchers (Brock et al., 2019). Later renaming this to ArtBreeder in 2019, Simon added new StyleGAN and StyleGAN2 models trained on datasets such as portraits, anime, 3D characters, landscapes, and album covers. The current version of the website also provides the latent manipulation methods that we describe in subsection 2.1.3: Latent manipulations. All of these operations can be performed via a very simple-to-use online GUI, making the system very accessible. As a result, ArtBreeder is incredibly popular, and used widely by many people. According to the website, at the time of writing, over 72 million images have been generated using the online app.

StyleGAN (2019), StyleGAN2 (2020)

After ProGAN, researchers at Nvidia would go on to introduce two new architectures known as StyleGAN (Karras et al., 2019), and StyleGAN2 (Karras et al., 2020). In this research, they build upon their work in ProGAN to minimise undesirable artefacts in the images generated, as a result, producing even more realistic results. The biggest contribution however, comes in the form of an updated Generator architecture that learns to separate multi-scale attributes in an unsupervised manner. Inspired by the Style Transfer literature, StyleGAN and StyleGAN2 allow for the generation of random samples such that the content and style can be controlled independently. For example, when generating a sample of a random face from a model trained on portraits, we can sample a random face image, and then modify the high-frequency details such as hair or skin characteristics like wrinkles, freckles or colour, without affecting the underlying bone structure or pose. This is made possible via an additional embedding that the authors introduce known as 𝒘−space. This is an intermediate latent space whereby the original 𝒛-vector is fed through an additional mapping network f, to produce an array of 𝒘-vectors. As opposed to being conditioned on a single 𝒛-vector, as is typical in a DCGAN, each of the convolutional layers of the Generator is conditioned on a corresponding 𝒘-vector. As a result, manipulating multiple 𝒘-vectors instead of a single 𝒛-vector allows us to control the samples generated from the model in a much more precise mannner.

ArtBreeder leverages this and provides a very simple to use GUI which allows users to mix between the style and content of different samples independently.

The introduction of the StyleGAN architecture in 2019, marks another important milestone in which Meaningful Human Control is, perhaps for the first time, becoming a prominent area of research within creative generative DL. And as mentioend, in recent years, this is an area that is now gaining more interest from DL researchers (Park et al., 2019; Karras et al., 2019; Simon, 2019; Bau et al., 2019; Karras et al., 2020; Härkönen et al., 2020; Jiang et al., 2020; Broad et al., 2020).

2.2.8 Computational Creativity

As is sometimes typical in academia, separate fields might exist which at first glance may appear to be covering the same topics, but in fact, are asking subtly different questions, and as a result exist as parallel fields of research. Computational Creativity is such a field of research which is important to mention in the context of Creative DL. While there is indeed plenty of overlap between the fields of Computational Creativity, and Creative DL as we discussed above, they exist as distinct fields.

Computational Creativity is a slightly more mature field in comparison to Creative DL, as it is not focused on the technology of DL, in fact it is not focused on any technology at all, but is based around more of a philosophical question (Boden, 1998).

Whereas the field of AI was born questioning whether a machine can think, or exhibit intelligent behaviour (Turing, 1950), Computational Creativity questions whether a machine can be creative, or exhibit creative behaviour (Jordanous, 2014).

Computational Creativity research is not only concerned with the creative output of the algorithms or technical implementation details, but is equally — if not more — concerned with the philosophical, cognitive, psychological and semantic connotations of machines exhibiting creative behaviour, or acting creative. In (McCormack & D’Inverno, 2012) and related papers (Mccormack, 2014; McCormack et al., 2014), the authors ask — and attempt to answer — questions regarding computers and creativity, creative agency and the role of creative tools.

As part of the philosophical angle of Computational Creativity research, there is often an emphasis on fully autonomous systems. The field includes research into computational models of serendipity (Corneli et al., 2014), or software which exhibits intentionality, and is able to justify the decisions it makes when creating a piece of work by framing information in the context of the work (Colton & Wiggins, 2012). This can be thought of as analogous to an artist making deliberate, purposeful decisions at every step of the creative process. This aspect of computational creativity is sometimes referred to as strong computational creativity (Al-rifaie & Bishop, 2015) — analogous to John Searle's strong (vs weak) AI (Searle, 1980). The field is also accompanied by certain formalisms, proposed models and theories of creativity to ensure the systems' behaviour complies with what is thought to be ‘creative behaviour' (Colton et al., 2011). Within this context there has been research into systems that conceive fictional concepts (Cavallo et al., 2013), design video games (M. Cook et al., 2014), write poetry (Colton et al., 2012), and other inherently ‘creative' tasks.

We can summarise this by stating: the field of AI is interested in hypothesising, building and testing computational models of intelligence, while Computational Creativity is interested in hypothesising, building and testing computational models of creativity. In contrast, Creative DL is interested in developing and applying state-of-the-art DL techniques to the production of artistic works and creative media.

While we do find the research within Computational Creativity to be very intriguing, these discussions, particularly the formalisms and models of creativity, are not within the scope of our research.

It could be argued that our research is interested in weak computational creativity — particularly semi-autonomous, collaborative creativity where human interaction in the creation process is not only relevant, it is essential — to create interactive systems whereby the human user can guide the computationally creative system in realtime.

2.2.9 Machine Learning for Artistic, Expressive Human Computer Interaction (AE-HCI)

We feel that it is also important to take a moment to acknowledge the involvement of ML in the production of artistic works and creative media, prior to DL. This is a very rich field, especially within the areas of music and sound. Within these topics however, we will focus again on both Meaningful Human Control, and Realtime Continuous Control. One of the key areas that ML has contributed to within this intersection, is in the recognition and interpretation of gestures, and more broadly speaking, aiding Artistic Expressive Human Computer Interaction (AE-HCI) — Human Computer Interaction for artistic expression.

In our research, we do not set out to design generative systems which allow for embodied or gestural interaction per se. We do however, take the principles that we describe below as strong guidelines, and we see embodied and gestural interaction as an end goal. In other words, in our research, we seek to introduce modes of interaction which could relatively easily be translated into embodied and gestural interfaces. We reflect on these end goals in the subsequent chapters when we present each of our studies, and the modes of interaction that we have developed for them.

In (Dourish, 2001) Paul Dourish proposes new models for interactive system design. Embodied Interaction is interaction embodied in the environment, not just physically, but as a fundamental component of the setting. It is an interaction design that takes into consideration the ways we experience the everyday world. This philosophy is particularly applicable when designing gestural interfaces for artistic expression.

As mentioned before, Myron Kruger was also interested in exploring Responsive Environments, in which ‘interaction is a central, not peripheral issue' (Krueger et al., 1985). He saw potential in this area for the arts, education, telecommunications as well as general human-machine interaction and was motivated by creating playful environments which explore the perceptual process we use to navigate the physical world.

Human Computer Interaction for music — or Musician-Computer Interaction (MCI) (Gillian, 2011) — is one of the more academically established fields related to AE-HCI, more so than gestural Human Computer Interaction for visual composition. However, many of the requirements for interaction design and particularly gesture recognition are similar. Both require low-latency, realtime systems that can be configured on-the-fly. They need to be capable of detecting a wide range of gestures, some AE-HCI systems might concentrate on subtle finger movements, while others track whole bodies of multiple people. Furthermore, the ability to detect and respond to subtle variations in gestures is essential to convey expressivity (Caramiaux et al., 2014). Also, in performance situations, gesture recognition need not be generalised across different people, but training can be specific to the performing individual to maximise personal expression (Gillian, 2011).

Due to these similarities, in our research, Musician-Computer Interaction is taken as a base model for expressive gestural interaction, and will be built upon for general AE-HCI.

Gestures and `Expressive Gesture'

A survey of definitions of gesture, especially in relation to music can be found in (Cadoz & Wanderley, 2000). The authors conclude that the many proposed definitions do not adapt to gesture in music, but they purposefully avoid providing a new definition, focusing instead on which aspects of the various definitions might apply.

In (Camurri et al., 2004) the authors define Expressive Gesture as “responsible of [sic] the communication of information that we call expressive content” where “Expressive content concerns aspects related to feelings, moods, affect, intensity of emotional experience”. This is the definition of Expressive Gesture that is used in our thesis, complemented with the “natural, spontaneous gestures made when a person is telling a story”, as described in (Cassell & Mcneill, 1991). Particularly those with the semiotic classification of metaphoric, indicating abstract ideas (McNeill & Levy, 1980). A wider study of gesture expressivity and its dimensions — especially in the context of musical performance and Human Computer Interaction — can be found in (Caramiaux, 2015).

Gestural Interaction (and Gesture Recognition) for AE-HCI

Gestural interaction (and gesture recognition) is a very broad field. In this section, we focus on applications within AE-HCI, particularly in context of Machine Learning. Wider surveys can be found in (Mitra & Acharya, 2007; Gillian, 2011; LaViola Jr., 2014).

Artificial Neural Networks (ANN) are particularly useful for AE-HCI as they are able to map m-dimensional input vectors to n-dimensional output vectors with a learned non-linear function, allowing them to control complex parameter-sets simultaneously. This is especially useful in regression tasks, when manipulating continuous parameters of a generative visual or sonic model. They can be equally successful in classification tasks, for recognising gestures and triggering desired visual or sonic outputs. In 1992 Michael Lee et al used ANNs inside the MAX/MSP musical programming environment to investigate adaptive user interfaces for realtime musical performance (Lee et al., 1992). They were able to successfully recognise gestures from a number of devices including a radio baton and a continuous space controller. In 1993, Sidney Fels and Geoffrey Hinton used ANNs to map hand movements captured via a data-glove, to a speech synthesiser (Fels & Hinton, 1993). They achieved realtime results with a vocabulary of 203 gestures-to-words demonstrating the potential of Neural Networks for adaptive interfaces. Now, with many open-source implementations, and also integrated into Rebecca Fiebrink's Wekinator (R. Fiebrink et al., 2009) and Nick Gillian's GRTGui (Gillian, 2011), ANNs are widely used for creative gestural interaction.

Many other Machine Learning techniques have been used for gesture recognition, with different specific use cases. These include K-Nearest Neighbours, Gaussian Mixture Models, Random Forests, Adaptive Naive Bayes Classifiers and Support Vector Machines to classify static data; Dynamic Time Warping and Hidden Markov Models can be used to classify temporal gestures; Linear Regression, Logistic Regression and Multivariate Linear Regression can be used for real-valued outputs as opposed to classifying the input. A survey of Machine Learning techniques and applications for musical gesture recognition can be found in (Caramiaux & Tanaka, 2013).

As mentioned previously, in an artistic, performative context, detecting subtle variations of gestures is vital to conveying expressivity. In (Bevilacqua & Muller, 2005; Bevilacqua et al., 2009), Bevilacqua et al design continuous gesture followers that allow temporal gesture recognition in realtime while the gesture is still being performed. This algorithm returns time progression information and likelihood, enabling performers to alter speed and accuracy of the gesture to control parameters of their generative model.

In (Caramiaux et al., 2014; Caramiaux, 2015) Caramiaux et al develop systems that go beyond classification of the gestures, to characterise the qualities of the gesture's execution. They use computational adaptive models for identifying temporal, geometric and dynamic variations on the trained gesture. Returning this information in realtime to the performer as they are executing gestures, enables the performer to map the variations to parameters such as time-stretching samples, modulations, and volume or custom synth parameters.

In (Kiefer, 2014) Kiefer investigates the use of Echo State (Recurrent Neural) Networks (ESN) as mapping tools, to learn sequences of input gestures, and non-linearly map them to multi-parameter output sequences. The research concludes that ESNs demonstrate good potential in pattern classification, multi-parametric control, explorative and non-linear mapping, but there is room for improvement to produce more accurate results in some cases.

Interactive Machine Learning (IML)

As discussed above, ML offers very successful tools for the recognition of patterns and gestures. However using Machine Learning can be difficult and inaccessible to many, due to the technical knowledge and time required in building classifiers and setting up the signal processing pipeline (Fails et al., 2003).

Interactive Machine Learning (IML) is a family of human-in-the-loop techniques led by principles from Human Computer Interaction (R. A. Fiebrink, 2011).

While ML brings huge advancements to the fields of data analysis and pattern recognition, IML seeks to improve how ML systems can be used. Particularly, expanding its user-base from dedicated computer scientists and closely related disciplines, to a much wider audience. One of the ways in which this is made possible, is via a Graphical User Interface (GUI) front end to a ML backend, with data streamed live to and from the ML backend. In this case, the training and predictions can be performed in realtime, without writing any code making it a perfect choice for performance and AE-HCI.

Rebecca Fiebrink et al’s previously mentioned Wekinator software released in 2009 is an example of such an IML system aimed at musical performance (R. Fiebrink et al., 2009). Using a GUI, users are able to setup, train and modify parameters of an ANN. The software also allows other applications — such as existing music software, visual software, or other custom generative software — to stream data to the Wekinator using a UDP-based protocol commonly used in inter-app and inter-device communications called Open Sound Control (OSC) (Wright & Freed, 1997). As the Wekinator receives this data, it runs it through a Machine Learning model and streams back predictions in realtime. Using this tool, artists, musicians, dancers, performers and researchers from other fields can train and map gestures to arbitrary outputs, such as notes, effects, images and sounds with little-to-none technical Machine Learning experience and programming.

Nick Gillian's Gesture Recognition Toolkit (GRT) from 2011 (Gillian, 2011) provides similar functionality but with more emphasis on the signal processing / gesture recognition pipeline. It lacks built-in input functionality such as webcam or microphone inputs, but has a number of built-in pre-processing, feature extraction and post-processing algorithms. Examples for these are Fast Fourier Transform, Principal Component Analysis, various filters, derivatives, dead zones and more. In addition to being an open-source application, the underlying codebase is released as a C++ framework allowing it to be integrated into bespoke applications.

Tools like these enable both technical and non-technical users to quickly setup, train and test models for gesture recognition and gestural interaction. Without writing any code, users can start streaming input data from their sensors, and receive predictions in their application of choice, enabling them to gesturally create, manipulate and perform audio-visual media in realtime. An example of Fiebrink's Wekinator can be seen in the band 000000Swan's audio-visual shows gesturally driven using a Microsoft Kinect and commercially available sensor bow (Schedel et al., 2011). In addition, it has also been applied in contexts such as workshops with people with learning and physical disabilities (Katan et al., 2015).

2.3 Introduction to Deep Learning

In this section, we take a slightly more technical approach to Deep Learning. We introduce key concepts, concentrating on those that are most related to our research. Where relevant, we provide theoretical and mathematical foundations, which we will build upon in later chapters. We do not present the developments in a chronological order, neither do we discuss parallel or orthogonal developments. Instead, here we focus on only the technical foundations that will be necessary for the rest of this thesis. Where relevant, we also highlight key issues which we will address in later chapters. For more comprehensive technical explanations, please see I. Goodfellow et al. (2016), and for a thorough historic survey of Deep Learning, please refer to Schmidhuber (2015).

2.3.1 Overview

Deep Learning (DL) is a branch of Machine Learning (ML), which in turn is a branch of Artificial Intelligence (AI).

We will unpack these ideas more formally in the following sections. However, for the purposes of this introduction, we can loosely define Machine Learning, especially as it relates to our research, as: designing behaviours through examples (R. A. Fiebrink, 2011; Penny, 2017).

When we wish to design a system that performs a specific behaviour, a typical approach might be to explicitly implement the behaviour. In order to do this however, we would first need to identify exactly how the behaviour functions. For a very complex behaviour, we would need to break it down step by step, to the degree that we can implement it. Unfortunately, there are many situations where we simply might not know how a desired behaviour functions. For example, predicting which player is more likely to win during a game of Go, by looking at the state of the board, is not a behaviour that we currently know how to explicitly define. There are also many situations, where we might tacitly be aware of the behaviour, without being consciously and explicitly aware of the steps required to replicate it. For example, we can often easily recognise objects in images, and words in sounds. Yet, we might find it impossible to explicitly formulate behaviours which can identify those exact same objects and words.

In these situations, we can use Machine Learning algorithms to implement those behaviours, by providing examples of the desired behaviour.

In other words, the desired behaviour can be thought of as a function f, which maps an input 𝒙 to an output 𝒚. We can think of a non-ML approach, as manually identifying and implementing the function f. Whereas a ML approach, consists of providing examples of 𝒙 and 𝒚 to some learning algorithm, and the algorithm figures out what the function f should be.

Deep Learning is the application of this approach to very complex and high-dimensional data — such as images with millions of pixels or sounds with tens of thousands of samples per second — via deep parametrisable computation graphs that learn hierarchies of representations (LeCun, 2014; I. Goodfellow et al., 2016). In essence, these algorithms are capable of identifying complex relationships in vast amount of Big Data. They can recognise patterns and find regularities in data, that either we are aware of but unable to explicitly formulate, or we are not aware of at all. Thus, using DL enables us to create systems which exhibit more intricate and complicated behaviour than we would otherwise be able to implement.

Furthermore, even though the behaviour of these systems will be statistically consistent with the examples that we provide it, it is very probable that they will uncover patterns that we were unaware of. As a result, they are very likely to exhibit unexpected behaviour.

This is a quality of DL which is integral to our research. Our goal is to try and exploit and tame this unexpected behaviour, allowing human users to experiment with and explore this new terrain, while simultaneously providing enough meaningful control, such that they can also creatively express themselves, as opposed to producing entirely ‘random' outputs.

2.3.2 Machine Learning (ML)

More formally speaking, ML is a field of Artificial Intelligence that investigates computational systems that can improve their performance, on a particular task, as measured by a specific metric, as they gain more experience with that task (Mitchell, 1997). In this context, the term experience, refers to observations, examples, or in other words: data.

ML algorithms build models based on observations, and they effectively learn rules, or functions, to make optimal decisions or predictions. There are a very large number of different approaches that fall within the scope of ML. A very in-exhaustive list includes algorithms such as linear regression, logistic regression, polynomial regression, support vector machines, K-means, expectation maximisation, genetic algorithms, markov chains, decision trees, random forests, naive bayes, bayesian networks, Artificial Neural Networks, and many many more. Each of these methods, have qualities that make them more or less suitable to a particular problem. For example, we would choose a particular approach, depending on the complexity of the problem, the nature of the expected solution, and the number of data points available.

2.3.3 Artificial Neural Networks (ANN)

Artificial Neural Networks (ANN) are just one of these different approaches to Machine Learning. An ANN consists of a graph, a network of neurons (McCulloch & Pitts, 1943), very loosely inspired by biological Neural Networks. A numeric weight value is assigned to every connection in the network. Each neuron performs a weighted sum of all of its inputs, effectively a linear transformation, and optionally applies some non-linear activation function (such as tanh, sigmoid, ReLU etc), and then passes the result onto the next neuron in the network for a similar transformation.

A Neural Network acts as a function f, that when given an input 𝒙, computes an output 𝒚. The structure and shape of the network, and the activation functions used on each neuron, define the architecture of the ANN. The function f that the ANN computes, is defined by its architecture, and collectively, all of the weights of each connection. The weights of the ANN are also known as its parameters, and is typically denoted by 𝜣. In other words, we can define the function computed by the ANN as f(𝜣):𝒙↦𝒚. We will see in later sections, that the act of training an ANN, involves solving for the parameters 𝜣 in order to obtain a desired function.

2.3.4 Feed-forward (FNN) vs Recurrent Neural Networks (RNN)

When there are no cyclic connections in the graph, and data always flows in one direction, then the ANN is called a Feed-forward Neural Network (FNN). When there are cyclical connections, it is called a Recurrent Neural Network (RNN). RNNs allow the Neural Network to model temporal or sequential data. We will examine RNNs in more detail in subsection 2.3.19: Recurrent Neural Networks (RNN).

2.3.5 Layers

Typically, ANNs are neatly arranged in layers, as opposed to consisting of more unorganised layouts as is more common in biological neural networks. This makes it simpler to mathematically model and computationally implement ANNs, especially when using highly parallelised Graphics Processing Units (GPU) or Tensor Processing Units (TPU). Each layer — which might consist of thousands or even millions of neurons — can be treated as a single, high-dimensional, multi-variate unit. The ANN can be thought of as simply a chain of layers (or units). Each layer receives a single vector from the previous layer in the chain, and outputs a single vector to the next layer in the chain. The collection of weights between two adjacent layers, can be represented as a weights matrix. We can also clearly define the input layer as the first layer in the ANN which receives the inputs as a vector, the output layer as the results of the computation performed by the ANN, and any layers in between are called hidden layers.

2.3.6 Multi-Layer Perceptrons (MLP)

When an ANN is arranged in fully connected layers, with no cyclic connections, then the ANN is known as a Multi-Layer Perceptron (MLP) (Rumelhart et al., 1985). A simple example of this can be seen in Fig. 2.4.

A three-layer perceptron shown as individual neurons and as a compact network diagram.
Figure 2.4 a.) A three layer, feed-forward, Multi-Layer Perceptron with a single hidden layer. In this diagram, all of the neurons are displayed, and we can see that the network consists of 4 inputs and 3 outputs, and a 5 neuron hidden layer. b.) The same MLP, displayed with layers collapsed into multi-variate units allowing simpler visualisation, mathematical modelling and computational implementation using vectors. The dimensions of each layer is indicated with dim, 𝑾xh and 𝑾hy denote the weights of the connections from the input layer to the hidden layer, and hidden layer to the output layer respectively, 𝒃h and 𝒃y denote the bias vectors (which are typically included as parts of the weights or parameters) of the hidden layer and output layer respectively, and φ denotes the activation functions. c.) A Recurrent Neural Network, with a cyclic connection on the hidden layer.

Each layer of a MLP can be thought of as a multi-variate unit, which transmits a vector to the next layer, where the value of each layer is a function only of the previous layer's output. For a MLP with a single hidden layer such as the network presented in Fig. 2.4, this can be formulated as

𝒉
=φh(𝑾xh𝒙+𝒃h),
(2.3)
𝒚
=φy(𝑾hy𝒉+𝒃y),
(2.4)

where 𝒙,𝒉,𝒚 are respectively the input, hidden and output vectors. We adopt the notation 𝑾jk and 𝒃k to respectively denote the weights matrix from layer j to k and the bias vector for layer k, where the subscripts x, h, y respectively denote the input, hidden and output layers. φk is an element-wise (usually non-linear) activation function for layer k such as tanh, logistic sigmoid where φk(x)=1/1+e−x, or ReLU where φk(x)=max(0,x) (Nair & Hinton, 2010) or one of many others. This architecture forms the foundation for all of the architectures that we present in the following sections.

2.3.7 Universal function approximators, expressive power

When non-linear activation functions are not applied to any of the layers, then the entire MLP effectively acts as a linear transformation — which is not desirable if the data that the ANN is trying to model is non-linear. However, when non-linear activation functions are applied, then it has been shown that even a three-layer MLP, with a single hidden layer, can approximate any continuous function to an arbitrary desired level of accuracy (Hornik, 1991). For this reason, such Neural Networks are known as universal function approximators.

However, not any three-layer MLP can model any function. The expressive power of a Neural Network, is defined by its architecture (Lu et al., 2017). This poses one of the key challenges when working with ANNs, in that we must design a Neural Network architecture such that it provides sufficient expressive power for the data that we are trying to model.

Furthermore, in the context of learning, designing an architecture which provides sufficient expressive power is not our only challenge. Even in the situation that an ANN's architecture does provide the expressive power required to model a particular function, that does not guarantee that the ANN will be able to learn that function, especially from the data that we have available. We will explain the reasons in the following sections.

Note that in the case of an MLP, the architecture of the network can be simplified to thinking of the depth of the network (how many layers the network consists of), and its width (how many neurons are in each layer). These architectural variables, are collectively referred to as hyperparameters. (This term, helps distinguish them from the parameters of the Neural Network, which are its weights 𝜣).

2.3.8 Learning

As we mentioned previously, the function f that an ANN will compute, is determined by the network's architecture, and its weights 𝜣. Within the context of ML, we generally do not know what this function is. Instead, we have observations, i.e. training examples, which we wish to fit a function to. Typically, we construct an ANN with a pre-defined architecture, which we select based on experience (this is not always the case, we will expand on this in later sections). We then treat the weights of the ANN, as unknown parameters which we wish to solve for. We then solve for the weights of the network, such that the function that the network ultimately computes, fits the training examples.

In other words, we assume there is a function g, that governs the behaviour that gives rise to our training examples, the observations that we have made. We can think of this function g, as the ground truth. Our goal is to find the weights 𝜣 of an ANN, such that f(𝜣)≈g.

In this respect, we can frame learning, as a search problem. It is the process of finding the weights 𝜣, such that the outputs computed by an ANN when it receives some training examples, are as close as possible to the ground truth. In other words, training an ANN, typically consists of trying to find the weights 𝜣 that minimize some error between f(𝜣) and the ground truth g.

2.3.9 Loss functions

For this, we define a loss function ℒ, also known as a cost, error or objective function. This function will compute a quantitative metric for how close f(𝜣) approximates g. We can construct many different loss functions, depending on the nature of the problem that we are looking to solve, and the data that we are trying to model.

For example, given 𝒚, the output of an ANN for some given input 𝒙, and 𝒚^, the true value of the observation for the same input, some common loss functions that we use in our research can be formulated as

ℒMSE
=(𝒚−𝒚^)2(Mean Squared Error or L2 loss)
(2.5)
ℒMAE
=|𝒚−𝒚^|(Mean Absolute Error or L1 loss)
(2.6)
ℒCE
=−(𝒚^log(𝒚)+(1−𝒚^)log(1−𝒚))(Cross Entropy or Log loss)
(2.7)

Unsurprisingly, the loss function that we select, has a very significant impact on how quickly and efficiently the ANN learns, and the solution that it converges to. We discuss this in more detail in later sections, particularly in chapter 4: Hello World: Realtime interactive training as an informative and performative tool, where we present a software tool that we have developed, that performs realtime training on a live video feed. Our software allows us to select a loss function from a number of different options via a graphical user interface in realtime, while the network is training, and we can immediately observe the impact of the different loss functions.

Having defined a loss function, we can now formulate the act of learning, as an optimisation problem, and there are a number of methods for solving this. Stochastic, Monte Carlo methods and evolutionary algorithms are a few common examples. However, the most popular methods in use today, are based on gradient descent and backpropagation.

2.3.10 Gradient descent and backpropagation

Gradient descent, is an optimisation algorithm that tries to minimise some function, by iteratively following the function's gradient, the path of steepest descent. To be able to train an ANN using gradient descent, the loss function that we wish to minimise, and the entire chain of transformations as defined by the Neural Network, has to be end-to-end differentiable. The typical ANNs that are most popular today, including those that we use in our research, are as we described above: layered sequences of linear transformations, followed by simple non-linear activation functions. For this reason, they are indeed end-to-end differentiable.

The training process can then be summarized as: i) iteratively feed one or more training examples to an ANN to produce some outputs, ii) calculate and differentiate the loss with respect to the parameters 𝜣 to compute the gradient of the loss, a vector pointing in the direction of steepest descent, and finally iii) run a backwards pass through the network, and backpropagate the error. In other words, for every neural connection, compute the amount by which we should nudge each weight, such that the overall loss will move in the direction of the gradient. Running this process over many iterations — usually in the order of millions — optimally nudges the weights such that f(𝜣) approaches g.

A more detailed explanation is beyond the scope of this introduction, as we do not deviate from a typical gradient descent and backpropagation in this thesis. However, we will expand on this a little bit when we discuss training RNNs in subsection 2.3.19: Backpropagation Through Time, and again when we present our realtime training tool in chapter 4: Hello World: Realtime interactive training as an informative and performative tool. For more details on gradient descent and backpropagation in general, please refer to (I. Goodfellow et al., 2016).

2.3.11 Optimisation algorithms

Some of the typical challenges involved in an optimisation process as we describe above, is to find the global minimum as quickly as possible, without getting caught in local minima. There are many optimisation algorithms designed to tackle these issues, such as stochastic gradient descent, momentum, adagrad, adadelta, rmsprop, adam, adamax, nadam etc. And there are many variables which control the behaviour of these optimisers, such as learning rate, momentum, gradient clipping thresholds and numerous implementation specific variables. These are collectively included within the hyperparameters that we have already defined.

Just as we discussed with the loss function, the optimisation algorithm and the hyperparameters that we use, have a very significant impact on how quickly an ANN learns, and the solution that it converges to. For this reason, we developed the software tool that we present in chapter 4: Hello World: Realtime interactive training as an informative and performative tool. This software allows us to change not only the loss function in realtime during training, but also select between different optimisation algorithms, and adjust their hyperparameters in realtime too, allowing us to observe the results immediately.

2.3.12 Deep Neural Networks (DNN)

We have already established that even though a simple three-layer MLP with a single hidden layer is a universal function approximator, this does not imply that any three-layer MLP can necessarily approximate any function, of any complexity (Hornik, 1991). The expressive power of an ANN comes from its architecture. Furthermore, even if an ANN's architecture does provide sufficient expressive power to compute the function g which underlies some observations, it is not guaranteed that the ANN will be able to learn that function from the available training examples (Lu et al., 2017). In other words, in the context of learning, efficiency becomes key.

For example, a Neural Network with an architecture A1 might have one thousand parameters, while a much larger second Neural Network with an architecture A2 might have one billion parameters. It is very plausible that both of these architectures are perfectly capable of expressing some function g which underlies some observations. In other words, there exists a set of one thousand parameters 𝜣1 such that f1(𝜣1)≈g, and a set of one billion parameters 𝜣2 such that f2(𝜣2)≈g. However, in the case that we are given only 500 training examples, it is potentially more likely that training the network with architecture A1 will converge to a solution yielding the set of one thousand parameters 𝜣1 that approximate g. While training the network with architecture A2 might not converge to an accurate solution.

For this reason, architecture design and hyperparameter selection becomes crucial.

Deep Learning, is the name given to a family of methods, designed to tackle this issue.

A Deep Neural Network (DNN), is an ANN as we describe above, with many layers, in other words, with a large depth. In this case, each layer can be thought of as a parametrised, high-dimensional, non-linear transformation. And a DNN is then a chain of these transformations, that collectively learn a hierarchy of representations with varying levels of abstraction, in order to model some complex, high-dimensional data.

Deep Learning research, is primarily the study and exploration of different types of deep architectures for different types of tasks, and the accompanying algorithms and techniques that relate to the performance of these architectures, such as designing, training, testing, scaling, deploying etc.

There are many architectures studied within the framework of Deep Learning. Some of the architectures that we will cover in the following sections are: Convolutional Neural Networks (CNN), Variational Auto-Encoders (VAE), Deep Convolutional Generative Adversarial Networks (DCGAN), Pix2pix and Long Short-Term Memory (LSTM) Recurrent Neural Networks (RNN).

We have already described hyperparameters, as variables that drastically impact how and what a Neural Network learns. These include variables that relate to the architecture of the Neural Network, for example the number of layers, and the number of neurons in each layer. They also include the activation functions that are used on each layer. In addition, there are hyperparameters that relate to the optimisation process. For example the optimisation algorithm that is used, whether it be stochastic gradient descent with momentum, adagrad, adam, or one of many other algorithms. Furthermore, there are also the hyperparameters of these optimisation algorithms, such as learning rate, momentum, gradient clipping thresholds and many others. In later sections, we will see even more hyperparameters, such as the filter depth of Convolutional layers (subsection 2.3.15: Convolutional Neural Networks (CNN)), the bottleneck size in Auto-Encoders (subsection 2.3.16: Auto-Encoders (AE)), the regularisation weight in Variational Auto-Encoders (subsection 2.3.17: Variational Auto-Encoders (VAE)), and many more.

Learning these hyperparameters through an automated process, is currently not possible, although it is a very active area of research known as meta-learning, or learning to learn (Andrychowicz et al., 2016; Finn et al., 2017; Zoph et al., 2018; Rusu et al., 2019). Instead, optimal hyperparameters must be selected manually. And selecting hyperparameters, as optimally suited for the particular dataset and problem that we wish to address, is currently still a magical art. There are some guidelines on how to select some of the hyperparameters, based on previous experience, if the nature of the dataset and the problem that we are dealing with is similar to a previous problem that has already been solved. However, in general there are no clear rules as to how to select any of these hyperparameters.

For this reason, it is not uncommon to train hundreds of models, varying the hyperparameters slightly in each case, in order to find the optimal configuration of hyperparameters that result in a model that converges to a desirable solution. This is known as hyperparameter search. The hyperparameters can be varied by fixed intervals in each training session, resulting in a grid search, or they can be varied randomly, resulting in a random search (Bergstra & Bengio, 2012).

Addressing this problem, is one of the key motivations behind the work that we present in chapter 4: Hello World: Realtime interactive training as an informative and performative tool, where we develop a software tool that trains on a live video feed in realtime, while allowing us to modify any of the hyperparameters during the process, and immediately observe the results.

2.3.14 Classes of learning

Before we discuss deep architectures in more detail, we will first describe different modes of learning.

Supervised Learning

In supervised learning, a model is trained on labelled data where each training example is an (input, target) pair. During training the learning algorithm tries to find the parameters of the model 𝜣 which effectively implement the function that maps the input of each training pair to the associated ground truth target. For classification problems the target is usually a discrete class label, often represented as a one-hot vector (i.e. a vector where all elements are zero, except for the entry for the desired class, which is one). For regression problems the target is usually a real-valued vector (or tensor). Having (input, target) pairs makes it relatively straight forward to specify the objective function, as we simply need to calculate some kind of a difference between the model's output and the ground truth target, as we described in subsection 2.3.9: Loss functions. For this reason, supervised learning is currently one of the more popular and successful branches of ML. However, the training pairs often need to be manually associated by people. This makes them cumbersome and very time consuming to prepare. Online crowd-sourcing platforms such as Mechanical Turk have helped accelerate the preparation of large labelled datasets which is one of the reasons why we’re starting to see more success in this field (LeCun, 2014).

Unsupervised Learning

In unsupervised learning, training is performed on unlabelled data. Without an external supervisory signal it can be more ambiguous as to how to specify an objective function. For this reason, unsupervised learning is currently one of the big open problems in ML. A common objective in unsupervised learning is dimensionality reduction, including methods such as t-SNE (T-distributed Stochastic Neighbor Embedding) (Laurens van der Maaten & Geoffrey Hinton, 2008) or UMAP (Uniform Manifold Approximation and Projection) (McInnes et al., 2018). Another common objective is clustering. In this case, the learning algorithm tries to organise observations into groups based on similarities and regularities that it tries to identify across the entire dataset. In this thesis, we use two other types of unsupervised learning algorithms which we discuss in subsection 2.3.17: Variational Auto-Encoders (VAE) and subsection 2.3.18: Deep Convolutional Generative Adversarial Networks (DCGAN).

Semi-supervised Learning

A combination of the two — semi-supervised Learning — is used when some of the data is explicitly labelled, while some of it is not. In this case, during training, the learning algorithm tries to learn regularities in the data in an unsupervised manner, that allow it to cluster and classify the data. With this knowledge, the algorithm can then associate the unlabelled items with the correct labels based on the labelled data, and then proceed in a supervised manner.

Reinforcement Learning

Reinforcement learning (RL) is technically and conceptually quite different to the above classes of learning, as it is rooted in a different discourse, and therefore does not necessarily use the same language as Neural Networks. RL is a type of learning that is typically applied to an agent, operating within a Markov Decision Process (MDP) (Bellman, 1957), where there is a notion of time, and at each timestep, the agent can take actions and move between different states. The actions that the agent takes, is governed by a policy, and that policy can be controlled by anything ranging from a simple behaviour, to a complex DNN. The agent regularly receives reward signals from the environment. However, such a reward signal might not be an immediate reward for the most recent action taken by the agent, but instead might be a delayed reward for an action — or even a series of actions — taken by the agent much earlier on. Alternatively, the reward might even be related to ‘random' events outside of the agent's control or knowledge. Therefore, a major challenge in RL, is to solve the attribution problem of these delayed rewards. For this reason, RL is considered neither supervised (with a direct supervisory signal) nor unsupervised (with no supervisory signal). Instead it is a form of learning based on a delayed reward signal (Kaelbling et al., 1996). The general objective of a RL algorithm, is to learn a policy that maximises the agent's long term reward. This process involves a balance between exploration of new actions which have not yet been made, vs exploitation of actions which are known to reward higher than others. For this reason, RL can also be thought of as learning by trial and error.

In the following chapter section 3.2: Collaborative generative sketching with MCTS and CNNs, we present a method that we developed for interactive collaborative generative sketching with a Deep Neural Network, driven by Monte-Carlo Tree Search (MCTS). While MCTS is not considered typical RL, it has many similarities, and we unpack many of the concepts that we described in the previous paragraph in subsection 2.3.20: Monte Carlo Tree Search.

2.3.15 Convolutional Neural Networks (CNN)

Convolutional Neural Networks (CNN) are Neural Networks which consist of, and can learn, stacks of parametrisable convolution filters (LeCun et al., 1989; LeCun & Bengio, 1995). In Convolutional layers, neurons from one layer are not fully connected to all neurons in the next layer as they are in a typical MLP. Instead, small patches of neurons from one layer are connected to a single neuron in the next layer such that the operation performed by this group of connections acts like a convolution filter on that patch of neurons. Furthermore, this same pattern of connectivity with identical connection weights, is shared across the entire layer in a process known as weight sharing. This ensures that the same convolution filter is applied across the entire layer. In addition, this also ensures that the number of weights of the Neural Network is radically smaller compared to a Neural Network with similar connectivity that is not using weight sharing. This in turn radically aids training, encouraging convergence to a desirable solution in a much more efficient manner.

Multiple filters applied to the same input in a convolutional layer.
Figure 2.5 A Convolutional layer consisting of many filters, applied to an input. Image from Wikimedia Commons, licensed under CC BY-SA 4.0

CNNs are typically used for processing pixel-based raster images, and for this reason, they form the foundation for many of the architectures that we use in this thesis, and present in the following sections. Raster images are represented as a 2D grid — or matrix — of values. Greyscale images are represented as a matrix of real values. While colour images are represented as a matrix of (red, green, blue) tuples, or in other words, a tensor of rank 3, and dimensions (w, h, 3) where w and h are the width and height of the image, respectively. For this reason, we generally think of the inputs and outputs of Convolutional layers to be tensors, as opposed to the one-dimensional vectors that we think of in a more typical MLP. We also do not think of the neurons as arranged in linear layers, as they are in a typical MLP. Instead, we think of the neurons arranged in layers of grids, with small windows of connectivity between layers that are replicated across the width and height of each layer.

For example, in a single Convolutional layer which consists of a convolution window size of 3x3, only 9 weights are required to represent this filter across its entire input. However, if weight sharing were not used, this pattern of connectivity would require 9 weights per input neuron. In other words, if this convolutional layer were applied to an image with a width and height of 1024 pixels, it would require 9*1024*1024 ≈ 9.4 million weights instead of just 9!

CNNs have also been used in one dimension, to model raw audio (van den Oord, Dieleman, et al., 2016); and in three dimensions, to model 3D geometry using voxel representations (Z. Wu & Song, 2015). However, in this thesis we are primarily concerned with 2D images. For this reason, we focus on 2D CNNs.

At each Convolutional layer, small patches of the input are processed and condensed to a single value. For this reason, we can think of each Convolutional layer, as applying some learnt filter to its input, to extract some kind of feature. In addition, each Convolutional layer usually consists of many independently parametrised filters. Often called the filter depth of the Convolutional layer, the number of filters in a single layer is typically in the range 128 to 1024. As a result, applying such a Convolutional layer, simultaneously produces a large number of features. More formally, applying a Convolutional layer with a filter depth equal to d, to an image of dimensions (w, h), results in a tensor of dimensions (w, h, d). This can be seen in Fig. 2.5.

Across many layers, this results in an increasing effective receptive field, whereby a single neuron in some high layer, will have indirectly processed, and will contain information from, a very large patch of an input many layers down in the hierarchy of the Neural Network, perhaps even the entirety of the original input image.

In addition, it is often very useful to reduce the dimensions of the input. For example, in a discriminative model designed to classify images and assign probabilities based on a number of class labels, we require an architecture which reduces an image consisting of millions of pixels down to a handful of class probabilities. Or in an Auto-Encoder, which we discuss in the following section, we require an architecture that compresses a large image down to a narrow bottleneck. In these cases we apply some kind of subsampling operation. Traditionally this was a max-pool operation whereby the maximum value of a small window replaces the entire window. A typical window size in this case might be 2x2 pixels. This ensures that every time the max-pool is applied, the layer size halves in width and height. For example, 8 max-pool layers interspersed throughout a CNN with many Convolutional layers, can reduce an image of dimensions (256, 256) pixels, down to dimensions of (1, 1), by incrementally halving it at every stage. As we previously mentioned however, each convolution layer is typically a stack of many parametrised filters, for example with a depth of 512. For this reason, the output of such a CNN will in fact be a tensor of dimensions (1, 1, 512), where every value in this tensor each represents some different, independent piece of information about the entire image. This can be seen in Fig. 2.6.

The successive layers of a convolutional neural network processing an image.
Figure 2.6 Image from Wikimedia Commons, licensed CC under BY-SA 4.0

A more modern, equally effective and computationally more efficient method of reducing dimensions in this manner is to use strided convolutions. In this case, instead of centring the convolution filters on every pixel in an input layer, a number of pixels are skipped. Typically, the filter is centred on every other pixel, in both horizontal and vertical directions. This again halves the resolution at every application of the strided convolution. Generally, the size of the convolution windows are in the order of 3x3, 5x5, 7x7 etc. For this reason, the information in the pixels that are skipped are not ignored by the filter, as they are still included within the convolution windows of the neighbouring pixels. However, the convolutions are never centred on these particular pixels. This cuts down the processing time to one quarter, while simultaneously providing the desired dimensionality reduction.

Depending on the desired use case of the CNN, a number of fully connected layers might also be added after all of the Convolutional layers. For example, we can consider the case of a discriminative model designed to classify images. Using a number of strided Convolutional layers we can reduce the dimensions of an input image as we described above to a tensor of dimensions (1, 1, d), where d represents some arbitrary filter depth, such as 512. We can then treat this tensor as a linear layer, and fully connect it to one or more linear layers, as we would in a typical MLP. The final layer of the MLP would then output the class probabilities.

In fact, this highlights one of the greatest strengths of Deep Learning. In such an architecture, we can think of the MLP portion of the Neural Network as a simple three or four layer MLP that takes some compressed, abstracted, high-level representation of an image, and predicts class probabilities. The Convolutional layers leading up to the MLP are effectively an image processing pipeline that outputs those compressed, abstracted, high-level representations. The key point however, is that the entire chain consisting of all of the Convolutional layers and the MLP, is end-to-end differentiable and learnt in single training session. This avoids the potentially problematic hand-crafted feature engineering phase that we discussed in the previous chapter under section 1.2: Why Deep Learning?.

Since most of our work involves images, we often use Convolutional Neural Networks. More specifically, we use a number of different architectures, arranged in various different ways, which make use of Convolutional layers. We discuss these in the following sections.

2.3.16 Auto-Encoders (AE)

An Auto-Encoder is a Neural Network that tries to accurately reconstruct its inputs while passing data through a bottleneck. A simple example of such an architecture can be seen in Fig. 2.7. While this shows a very simple Auto-Encoder, with layers arranged as one-dimensional vectors, the layers can instead be Convolutional layers arranged in grids, as we describe in the previous section. Given a domain of inputs that contain significant amounts of structure and regularities, such as images of a particular category, we can for example successfully build and train Convolutional Auto-Encoders that compress colour images with width and height of 256 pixels (256*256*3=196,608 values) through a bottleneck of 128 dimensions, giving a compression ratio of 1536:1.

In order to successfully achieve this compression and reconstruction, the network has to learn how to compress the data in a meaningful manner. It has to learn how to build more concise and optimal representations, by identifying and exploiting salient features and regularities that occur in the data that is presented to it. Since no additional labels or training pairs are provided, training an Auto-Encoder is considered unsupervised learning.

An Auto-Encoder can be thought of as two Neural Networks back-to-back. The encoder is the portion of the network that learns a function E, which receives an input 𝒙 and maps that to a compressed, latent representation 𝒛 in the bottleneck layer. The decoder is the portion of the Neural Network that learns a function D, which maps a compressed, latent representation 𝒛, to an output 𝒙′. We use a loss function to ensure that 𝒙′≈𝒙. For example, using L2 loss we can formalise this as

E
:𝒙↦𝒛
(2.8)
D
:𝒛↦𝒙′
(2.9)
ℒ
=(𝒙−𝒙′)2
(2.10)
An encoder and decoder joined by a narrow layer of three neurons.
Figure 2.7 A simple Auto-Encoder. In this example, the input and output layers consist of 10 neurons, while the bottleneck layer consists of 3 neurons. To avoid clutter in the diagram, we have omitted drawing all of the connections. In a MLP Auto-Encoder, all of the layers are fully connected. In a Convolutional Auto-Encoder, the layers are arranged into grids as we describe in subsection 2.3.15: Convolutional Neural Networks (CNN)

There are currently no clear rules as to how to determine the optimal size of the bottleneck layer 𝒛. The dimensionality of 𝒛 is a new hyperparameter that we must find as we described previously in subsection 2.3.13: Hyperparameter search. As the regularity and similarities amongst the dataset increases, for example, in the case of a dataset consisting of only human faces, perfectly cropped and aligned in exactly the same manner, then we can afford to decrease the bottleneck size. As we encounter more variety in the dataset, we may have to increase the bottleneck size. Otherwise, we may find that the expressive power of the network is insufficient to successfully represent the full diversity of the dataset.

2.3.17 Variational Auto-Encoders (VAE)

Given suitable architecture, hyperparameters and training data, an Auto-Encoder may learn efficient representations in its bottleneck 𝒛. However, in a typical Auto-Encoder we have no control over how this space is distributed. The encoder may learn a mapping such that the training examples are located in distant remote corners of the space with vast ‘empty', unused stretches in between. In other words, an Auto-Encoder does not learn the distribution of the data and it is not a generative model. As a result of this, we are not able to generate new samples that resemble the training examples. Furthermore, having compressed a particular input 𝒙 to a more concise representation 𝒛, we cannot manipulate 𝒛 in any meaningful way to obtain outputs that have been meaningfully modified, as we discuss in subsection 2.1.3: Latent manipulations.

An encoder predicts a distribution, a latent vector is sampled, and a decoder reconstructs the input.
Figure 2.8 Variational Auto-Encoder. The output of the encoder network is the mean 𝝁 and standard deviation 𝝈 of a Normal distribution, from which a latent vector 𝒛 is sampled 𝒛~𝒩(𝝁,𝝈). This is then fed into the decoder network for decoding.

A Variational Auto-Encoder (VAE) addresses this issue by enforcing structure on the bottleneck via a regulariser. This regulariser ensures that the bottleneck converges towards a desired distribution (D. P. Kingma & Welling, 2013), which we typically select as a multi-variate standard normal distribution 𝒩(0,1). In this case, the encoder does not output a 𝒛 vector directly. Instead, it outputs a pair of mean 𝝁, and standard deviation 𝝈 vectors, with the same dimensions as 𝒛. Sampling from this Gaussian distribution, produces a 𝒛 vector that we can feed into the decoder network, to produce the final output. This is known as the reparametrisation trick of VAEs, and is illustrated in Fig. 2.8.

To ensure that the encoder's outputs 𝝁 and 𝝈 do converge to 𝒩(0,1), we add to the loss function the KL divergence between the encoder's outputs and 𝒩(0,1). In other words, we write the loss as a sum of two components. The first component is the reconstruction loss. This serves the same purpose as the loss in a standard Auto-Encoder in that it enforces the network to successfully reconstruct its inputs. The second component is the latent loss. This is the KL divergence which enforces the latent distribution, as output by the encoder, to converge to 𝒩(0,1). We can formulate this as

ℒ
=1N∑i=1N(ℒreconstruction(n)+ℒlatent(n))
(2.11)
ℒreconstruction(n)
=∑k=1K(xk(n)−x′k(n))2
(2.12)
ℒlatent(n)
=12∑j=1J(1+log(σj(n))2−(μj(n))2−(σj(n))2)
(2.13)
𝒛(n)
=μ(n)+σ(n)⊙ϵwhereϵ~𝒩(0,1)
(2.14)

where the superscript (n) denotes the nth training example, N is the number of training examples in the given iteration, the subscript k denotes the kth element of the current data point, K is the dimensionality of the input, J is the dimensionality of latent vector z, μ and σ denote the outputs of the encoder, and ⊙ is an element-wise multiplication,

Both the encoder and the decoder networks, are now probabilistic models. The encoder models the probability of P(𝒛|𝒙), while the decoder models P(𝒙|𝒛). Since the model has been trained enforcing a 𝒩(0,1) latent distribution, we can sample a random 𝒛~𝒩(0,1), and run this random 𝒛 through the decoder to generate new data consistent with the training examples. In other words, the VAE's decoder is a generative model, and we can benefit from the types of meaningful control that we discuss in subsection 2.1.3: Latent manipulations.

We use a VAE as the basis for our research in chapter 4: Hello World: Realtime interactive training as an informative and performative tool, where we present a software tool that can train in realtime on a live video feed while allowing for the realtime manipulation of a number of hyperparameters.

We noticed that the performance of the VAE was highly dependent on the dimensions of the inputs and the bottleneck. We observed that in certain cases the VAE was able to reconstruct its inputs very accurately, but the decoder was not able to generate samples that were consistent with the training examples when decoding a random 𝒛~𝒩(0,1). This implies that the latent distribution does not converge to 𝒩(0,1). In other cases we saw that decoding random 𝒛~𝒩(0,1) did produce very consistent samples, however, the VAE was unable to reconstruct its inputs accurately.

We found that this is due to an imbalance between the reconstruction loss and latent loss in eqn. (2.11), and at the time of our research, this was not mentioned in any literature, or the many open-source examples found on the internet. We implemented a solution whereby we normalise both the reconstruction loss and latent loss, dividing by the dimensionality of input and bottleneck layers respectively. We then weight the latent loss by a new hyperparameter WKL, which we include in our hyperparameter search. Our new formulation can be seen below.

ℒ
=1N∑i=1N(ℒreconstruction(n)+WKLℒlatent(n))
(2.15)
ℒreconstruction(n)
=1K∑k=1K(xk(n)−x′k(n))2
(2.16)
ℒlatent(n)
=1J 12∑j=1J(1+log(σj(n))2−(μj(n))2−(σj(n))2)
(2.17)

We found via a thorough hyperparameter search, that a WKL value in the range of 0.01–0.1 provides the most desirable results, depending on our priority. A higher value towards 0.1, provides higher quality random samples, while slightly compromising reconstruction quality. On the other hand, lower values towards 0.01, provides higher quality reconstructions, while slightly compromising random sample quality. Outside of this range, we found that the compromise was too large to be useful. But within this range, the overall quality was generally acceptable. Since this weighted sum is performed on normalised loss components, WKL is independent of input or bottleneck dimensions. We tested this on images, with many different datasets, assessing the reconstruction and random sample qualities visually.

This was also later examined independently by Higgins et al in their Beta-VAE (Higgins et al., 2017). The researchers propose a similar solution to ours, performing a weighted sum of the loss components. However, Higgins et al do not normalise the loss components before summing. They simply weight the latent loss by a hyperparameter β. While β does allow shifting balance between reconstruction quality vs random sample quality, it is still highly dependent on the input and bottleneck dimensions. We find this to be problematic, at least for our use case. If for example, we change the bottleneck dimensions, and the reconstructions comes out more blurry. We cannot be sure if this is directly a result of the bottleneck dimensions changing, and affecting the expressive power of the network, or because the balance of the latent loss to reconstruction loss has shifted dramatically. In other words, having found an optimal β value through trial and error, if we were to change the input or bottleneck dimensions, our optimal β would no longer perform in the same manner, and would not be optimal anymore. We would either have to find a new value through trial and error, or calculate by hand what the new optimal β should be, based on the old dimensions and new dimensions. For this reason, we prefer to weight the normalised loss components, by our WKL hyperparameter.

We discuss these experiments and our findings in more detail in chapter 4: Hello World: Realtime interactive training as an informative and performative tool.

2.3.18 Deep Convolutional Generative Adversarial Networks (DCGAN)

It's worth noting, that using L2 or L1 pixel-wise loss to compare images — for example, to compare the input image 𝒙 and output image 𝒙′ of a VAE — results in the model producing blurry images (I. Goodfellow et al., 2014; Theis et al., 2016; Larsen et al., 2016; Dumoulin et al., 2017). This is a known issue with using these loss functions on a per-element basis in raw data-space, and is in fact not limited to images. In the case of our own work with VAEs, we address this by implementing Multi-Scale Structural Similarity Index Measure (MS-SSIM) (Z. Wang et al., 2004) as a reconstruction loss. We discuss this in chapter 4: Hello World: Realtime interactive training as an informative and performative tool, and show that the results are far superior to using L1 or L2 pixel-wise loss. However, MS-SSIM is a metric that has been specifically designed to compare the similarity of images, and it cannot be used in other domains.

Connections between the generator and discriminator in a generative adversarial network.
Figure 2.9 Generative Adversarial Network

Generative Adversarial Networks (GAN) were introduced to address this issue on a more generic and theoretical level (I. Goodfellow et al., 2014). The motivation behind a GAN, is that instead of explicitly formulating a loss function to measure the similarity between data points — for example comparing a generated image to a real image, we introduce a second Deep Neural Network to learn such a metric. We construct a Generator network G which captures the distribution of the data, in that it learns to map a random noise vector 𝒛~𝒩(0,1) to some output 𝒚. We also construct a Discriminator Network D, which learns to distinguish between real samples — i.e. sampled from the training data — and fake — i.e. produced by the Generator network. Since we are primarily interested in images in this thesis, given a noise vector 𝒛, G(𝒛) will produce a fake image. And given some image 𝒙, D(𝒙) will output a single scalar that represents the probability that 𝒙 is real, i.e. taken from the training data. A high level schematic of this can be seen in Fig. 2.9.

In this case, the loss function of a GAN constitutes two parts. The Discriminator network is trained to guess whether a given sample is real or fake, in other words, to maximise the probability of correctly assigning the real or fake label to the samples provided. The Generator network is trained to generate samples which can fool the Discriminator, in other words, to minimise log(1−D(G(𝒛))). For this reason, the optimisation of a GAN is no longer a minimisation problem. Rather, it involves finding a Nash equilibrium of a non-convex minimax game with a value function V(G,D) given by (I. Goodfellow et al., 2014)

minGmaxDV(D,G)=𝔼𝒙~pdata(𝒙)[logD(𝒙)]+E𝒛~p𝒛(𝒛)[log(1−D(G(𝒛)))]
(2.18)

Just as we can include convolutional layers in VAEs, we can also include convolutional layers in the Generators and Discriminators of GANs. These are then called Deep Convolutional Generative Adversarial Networks (DCGAN). In this thesis, as we are focusing on pixel-based raster images, we are generally interested in architectures with 2D convolutions, and such 2D DCGANs have seen great progress in terms of resolution and quality in recent years, expanding from 64x64 pixels with many deformities (Radford et al., 2015), to 1024x1024 pixels with almost no undesirable artefacts (Karras et al., 2017, 2019, 2020). While we do not work with them in this thesis, GANs have also been used to model 3D voxel geometry (J. Wu et al., 2016; C. Lin et al., 2016; Gwak et al., 2017; Liu et al., 2017), and audio (Engel et al., 2019).

While GANs do demonstrate the ability to produce samples consistent with the training data, they can also be very difficult to train and suffer from a number of issues (Radford et al., 2015; Chen et al., 2016; Salimans et al., 2016; Berthelot et al., 2017; Arjovsky et al., 2017). For this reason, a vast amount of research has been conducted in recent years trying to improve the stability and quality of GAN training. As a result, many variations have been proposed. Colloquially known as The GAN Zoo, at the time of writing, there are over 500 GAN variations (Hindupur, n.d.)Footnote 30. Our research is not necessarily concerned with internal or training improvements to GANS per se, so we will not dwell on these variations.

Our research is concerned at a very high level with two broad categories of GANs. These reflect the classes of generative models that we discuss in subsection 2.1.2: Conditional generative models and subsection 2.1.1: Unconditional generative models.

In chapter 5: Learning to see: Digital puppetry through realtime video transformation, we investigate conditional DCGANs. In particular, we primarily work with pix2pix (Isola et al., 2016), although we also test our method with pix2pixHD (T. C. Wang et al., 2018).

In chapter 6: Deep Meditations: Latent storytelling, we investigate unconditional DCGANs. In particular, we primarily work with ProGAN (Karras et al., 2017), although we also test our method with BigGAN (Brock et al., 2019) and StyleGAN (Karras et al., 2019).

2.3.19 Recurrent Neural Networks (RNN)

One of the early studies that we present in section 3.3: Realtime interactive text generation with RNN ensembles, is an interactive character-level sequence model. For this we use a Long Short-Term Memory (LSTM) Recurrent Neural Network (RNN). In this section, we provide the necessary technical background for this architecture.

Comparison of a feed-forward multilayer perceptron and a recurrent neural network.
Figure 2.10 MLP and RNN with single hidden layer.

As we have briefly mentioned in subsection 2.3.4: Feed-forward (FNN) vs Recurrent Neural Networks (RNN), RNNs are ANNs with recurrent connections. While there are many different variations (Graves, 2008), a very simple RNN can be thought of as a MLP with recurrent connections on one or more layers. These recurrent connections carry information forward from previous timesteps, and allow the recurrent neurons to maintain an internal state. This enables RNNs to create and process memories from past inputs, learn temporal regularities and model non-linear dynamical systems (Graves, 2008; Sutskever, 2013). With a richer internal state and greater computational capacity than other sequence models such as Hidden Markov Models, RNNs can be seen as general purpose computers that can learn programs (Schmidhuber, 2012b; Graves et al., 2014; Schmidhuber, 2015).

More formally, the value of a recurrent layer at a particular timestep is also dependent on the state from the previous timestep. For a RNN with a single hidden layer as shown in Fig. 2.10, this can be formulated by augmenting eqn. (2.3) with

𝒉t
=f(𝒙t,𝒉t−1)
(2.19)
wheref(𝒙t,𝒉t−1)
=φh(𝑾xh𝒙t+𝑾hh𝒉t−1+𝒃h),
(2.20)

and 𝒙t and 𝒉t are respectively the input vector and hidden state vector at time t. Note that 𝑾hh is the recurrent weights matrix, i.e. the influence of the previous timestep's hidden state on the current timestep's hidden state.

This architecture can be expanded to multi-layer, or stacked RNNs, by introducing additional weight matrices and bias vectors for inter-layer and inter-time relationships, as well as skip-connections between layers or forward looking bi-directional connections, to capture richer time-dependent behaviours (Schmidhuber, 1992; Schuster & Paliwal, 1997).

Backpropagation Through Time

Training RNNs is still performed as we described in subsection 2.3.10: Gradient descent and backpropagation. However, since RNNs also have a time component, we also have to perform backpropagation through time (BPTT) (Werbos, 1990; Sutskever, 2013). As the name implies, the RNN is unrolled in time for every step of the sequence as shown in Fig. 2.10. It can then be trained with backpropagation like a regular deep network, with the constraint that weights are shared across timesteps. Thus RNNs can be thought of as deep in time as well as deep in layers.

However, for very long sequences this will result in very deep networks, which can be rather slow and inefficient to train. One way to optimise this is to segment the full sequence of length L timesteps into shorter segments of length l timesteps. We can then run BPTT on each segment, and train the network much quicker, but at the cost of losing long-term temporal relationships greater than l timesteps. For very long sequences where these long-term temporal relationships are required, an efficient approximation is Truncated Backpropagation Through Time (Sutskever, 2013). With this method we run BPTT on each segment sequentially, without shuffling the order of the segments and without resetting the RNN's internal state between segments. So even though the gradients are only propagated back l timesteps, the network has the potential to remember further back in time via its internal state.

Objective

Given a training set S of input-target pairs (𝒙∈X,𝒚^∈Y^), and 𝜣 the parameters of our network, our training objective is to find the set of parameters 𝜣ML with the maximum likelihood (ML), i.e. that maximises the probability of training set S with (Graves, 2008)

𝜣ML
=argmaxθP(S|𝜣)
(2.21)
=argmaxθ∏(𝒙,𝒚^)SP(𝒚^|𝒙,𝜣).
(2.22)

Since the logarithm is a monotonic function, a common method for maximizing its likelihood is minimizing its negative logarithm, also known as the Negative Log Likelihood (NLL), Hamiltonian or surprisal (H. W. Lin & Tegmark, 2016). We can then define our objective function ℒ as

ℒ
=−ln∏(𝒙,𝒚^)SP(𝒚^|𝒙,𝜣)
(2.23)
=−∑(𝒙,𝒚^)SlnP(𝒚^|𝒙,𝜣).
(2.24)

Long Short-Term Memory (LSTM)

While BPTT and variants can solve the performance issue of training RNNs deep in time (i.e. on long sequences), backpropagating error gradients is still likely to fail due to the vanishing and exploding gradients problem, whereby the backpropagated error can result in gradients exponentially diminishing to zero or exploding towards infinity (Hochreiter, 1991; Bengio et al., 1994). This has made it very difficult to use RNNs on real-world problems with long sequences. In order to address this problem, Hochreiter and Schmidhuber (1997) have proposed an architecture for recurrent units known as Long Short-Term Memory (LSTM). An LSTM cell is a recurrent unit which — in addition to the normal hidden state of a recurrent unit — contains a memory cell. Access to the memory cells are controlled via gates which open and close as desired, allowing the information in the cell to be preserved for extended periods of time. Gates are implemented as logistic sigmoid functions, thus their state (open vs closed) is continuous and differentiable. This allows their behaviour to be learnt during training along with the network weights and biases, with gradient descent and backpropagation.

Initially, Hochreiter and Schmidhuber (1997) introduced input and output gates to control writing to and reading from the memory cells. Subsequently, Gers et al. (2000) proposed forget gates, allowing LSTM cells to learn when to reset themselves. With this architecture, LSTM networks can preserve and process information from many timesteps in the past.

Similar to the simple RNN demonstrated above, at timestep t, an LSTM cell outputs a hidden state vector 𝒉t to the rest of the network. But in addition to this, it also contains a memory cell 𝒄t of the same dimensions. Collectively these two vectors constitute the internal state of the cell and replace eqn. (2.19) with

𝒉t
=𝒐t⊙tanh(𝒄t)
(2.25)
𝒄t
=𝒇t⊙𝒄t−1+𝒊t⊙tanh(𝑾xc𝒙t+𝑾hc𝒉t−1+𝒃c),
(2.26)

where ⊙ is an element-wise multiplication and 𝒊t, 𝒐t, 𝒇t are respectively input, output and forget gates at time t. The gates have the same dimensions as 𝒉t and are defined as

𝒊t
=φ(𝑾xi𝒙t+𝑾hi𝒉t−1+𝒃i)
(2.27)
𝒐t
=φ(𝑾xo𝒙t+𝑾ho𝒉t−1+𝒃o)
(2.28)
𝒇t
=φ(𝑾xf𝒙t+𝑾hf𝒉t−1+𝒃f),
(2.29)

where φ denotes the logistic sigmoid function. Both φ and tanh are applied element-wise. While the LSTM architecture is generally successful in overcoming the vanishing gradients problem, gradients can still tend to become quite large. This can be prevented by clipping the gradients. A simple method is to either clip them element-wise (potentially changing the direction of the gradient) or clip the L2 norm by re-scaling the elements (Pascanu et al., 2012). A computationally more expensive, but more stable solution was proposed by Pascanu et al. (2013), in which gradients are rescaled according to the global norm.

LSTM Variants

In recent years, many variations on the LSTM architecture has been introduced. These include Peephole connections (Gers & Schmidhuber, 2000), in which the gates also learn to respond to the cells' current value (from previous timestep for input and forget gates, adding a 𝑾c𝒄t−1 term; and current timestep for output gate, adding a 𝑾c𝒄t term). This has been shown to enable the LSTM to learn more precise timing and rhythmic information. In addition, simplifications have been proposed by pairing and omitting (effectively merging) gates, such as No Input Gate and No Output Gate LSTM cells (Z. Wu & King, 2016). An even simpler architecture was proposed in Cho et al. (2014) which introduces Gated Recurrent Units (GRU). These also have only two gates — reset and update, but further simplify the LSTM architecture by omitting the separate memory cell and storing the long term memory in the hidden state vector.

Due to fewer gates — and thus fewer weights and biases — these variants are computationally less expensive. However, ignoring computional requirements, they have been shown to perform roughly the same as standard three-gate LSTMs, occasionally performing marginally better on some tasks, and occasionally worse on others depending on the domain (Greff et al., 2015; Jozefowicz et al., 2015; Nayebi & Vitelli, 2015).

Sequence generation with Recurrent Neural Networks

Combining these techniques, and with increased compute power, large training sets and many new insights into training deep RNNs (Graves, 2012; Sutskever, 2013; Zaremba et al., 2014; Pham et al., 2014; Karpathy et al., 2015), LSTMs and its variants are having lots of success not only in sequence classification (Graves et al., 2009; Hinton et al., 2012; Pham et al., 2014), but also in sequence generation in domains such as music (Eck & Schmidhuber, 2002; Boulanger-Lewandowski et al., 2012; Nayebi & Vitelli, 2015; Sturm, 2015), text (Sutskever et al., 2011; Sutskever, 2013), handwriting (Graves, 2013), images (Gregor et al., 2015), machine translation (Sutskever et al., 2014), Chinese characters (Nayebi & Vitelli, 2015; Ha, 2015), speech synthesis (Z. Wu & King, 2016) and even choreography (Crnkovic-friis & Crnkovic-friis, 2016).

In another study that we present in section 3.2: Collaborative generative sketching with MCTS and CNNs, we use an agent-based approach to collaborative, generative sketching. The agent-based method that we use is Monte Carlo Tree Search (MCTS). This is not a DNN architecture per se. However, it is an agent-based approach to ML, and is used for example by DeepMind in their AlphaGo (Silver et al., 2016) software, that beat world Go champions Lee Sedol and Fan Hui; and AlphaZero (Silver et al., 2018) software, that beat human champions and other programs at the games of Go, Chess and Shogi.

MCTS is a very efficient, probabilistic approach to exploring a vast decision space. A detailed explanation and survey of MCTS can be found in (Browne et al., 2012), but for completeness we will include a summary below.

We represent our problem as a discrete-time Markov Decision Process (MDP) (Bellman, 1957). At a particular timestep, the system is in a state s. The agent can take an action a (out of a number of available actions na) to go to a new state s′, and will be given a reward Ra(s,s′) for doing so.

Instead of trying to simulate every possible action at every timestep, MCTS uses a heuristic to explore only what might be the most promising branches of the decision tree. At every timestep, many simulations are run, but only from carefully chosen nodes of the decision tree. The algorithm decides which node to expand and run a simulation from based on a balance between exploiting known high rewards for nodes already expanded, and exploring new nodes, not yet expanded, with unknown rewards. Many rollouts (i.e. simulations) are performed at each timestep, and the simulated rewards are backpropagated along the partially expanded decision tree, and accumulated in each node, assigning an estimated value to each potential action.

The tree policy decides which action (i.e. child node) to select and unroll (i.e. run a simulation from), and is given by the UCT formula

vnc+k2ln(nt)nc
(2.30)

where v is the value of the child node, nc is the number of times the child node has been visited, k is the exploration parameter (theoretically equal to 2 but usually chosen empirically) and nt is the total number of simulations for the node considered. The default policy decides how to choose actions during the rollout (i.e. simulation). We use a random rollout, i.e. actions are selected randomly from the na actions.

In a typical two-player zero-sum game such as tic-tac-toe, MCTS simulations will run until they reach an end game state, where a simple reward of 1 is backpropagated if the agent wins, −1 is backpropagated if the agent loses, and 0 is backpropagated if the agent draws. In situations where rollouts could potentially last for many timesteps, combinatorially increasing the size of the decision tree and making it very inefficient to run the simulation upto an end state such as in the game of Go (Silver et al., 2016), it is common to end the simulation after a predefined maximum rollout depth. In this case another heuristic is used to evaluate the end-state of the rollout, and that is backpropagated as the reward. This process is repeated, nodes are expanded and simulations run usually until a predefined time budget (i.e. maximum milliseconds per timestep) is reached, after which a final decision is made by choosing the action which was visited the most (some implementations use different policies to choose the final action, examples can be found in (Browne et al., 2012)).

The steps of a Monte Carlo tree search, illustrated with branching trees.
Figure 2.11 Overview of the steps of MCTS

2.4 Conclusion

In this section, we presented key concepts and the technical foundations that are required for the remainder of this thesis. We discussed discriminative and generative models, within generative models we discussed conditional and unconditional generative models, and we presented the deep architectures that we work with in this thesis. These include Recurrent Neural Networks, Convolutional Neural Networks, Variational Auto Encoders and Generative Adversarial Networks. In the following chapters, we will present a number of different approaches that we followed using these different architectures, to build Deep Visual Instruments, and we will discuss the affordances and limitations of each approach.

Footnotes

  1. For example, an accompanying latent space interpolation video for StyleGAN2 (Karras et al., 2020) https://www.youtube.com/watch?v=c-NJtV9Jvp0 ↩

  2. https://ml4a.github.io ↩

  3. https://aiartists.org ↩

  4. We discuss this in more technical detail in subsection 2.3.10: Gradient descent and backpropagation. ↩

  5. https://twitter.com/search?q=deepdream. ↩

  6. https://twitter.com/search?q=from%3Amemotv deepdream ↩

  7. https://dreamscopeapp.com/deep-dream-generator ↩

  8. https://deepdreamgenerator.com ↩

  9. https://apkpure.com/deep-dream/com.deepdreamnow.app.deepdream ↩

  10. https://www.ostagram.me ↩

  11. https://grayarea.org/event/deepdream-the-art-of-neural-networks ↩

  12. http://www.memo.tv/works/all-watched-over-by-machines-of-loving-grace-deepdream-edition ↩

  13. https://gizmodo.com/this-google-dream-bot-inspired-artwork-is-mind-blowing-1761049728 ↩

  14. https://www.vox.com/2016/2/27/11588302/googles-tripply-ai-neural-nets-put-on-an-art-show ↩

  15. https://www.wired.com/2016/02/googles-artificial-intelligence-gets-first-art-show ↩

  16. http://blogs.wsj.com/digits/2016/02/29/googles-computers-paint-like-van-gogh-and-the-art-sells-for-thousands ↩

  17. https://www.washingtonpost.com/news/innovations/wp/2016/03/10/googles-psychedelic-paint-brush-raises-the-oldest-question-in-art/?postshare=921457638736588 ↩

  18. https://www.theverge.com/google/2016/3/1/11140374/google-neural-networks-deepdream-art-exhibition-san-francisco ↩

  19. https://www.theguardian.com/artanddesign/2016/mar/28/google-deep-dream-art ↩

  20. http://www.memo.tv/works/deepdream-is-blowing-my-mind ↩

  21. https://rossgoodwin.com/ ↩

  22. https://www.decontextualize.com/ ↩

  23. https://twitter.com/search?q=stylenet ↩

  24. https://neuralzoo.com/ ↩

  25. https://chrisrodley.com/2017/06/19/dinosaur-flowers ↩

  26. We discuss these in subsection 2.3.15: Convolutional Neural Networks (CNN). ↩

  27. https://magenta.tensorflow.org/sketch-rnn-demo ↩

  28. https://twitter.com/search?q=%23biggan ↩

  29. https://twitter.com/search?q=from%3Amemotv biggan ↩

  30. These include applications to different domains. ↩

Full-size image