Generating Art from Neural Networks
Total Page:16
File Type:pdf, Size:1020Kb
DECEMBER 16, 2019 Generating Art from Neural Networks Generative adversarial networks have received much media attention due to the rise of deepfakes. These algorithms are finding unique applications in the arts and helping us make giant strides in understanding artificial intelligence. By Tejesh Kinariwala WorldQuant, LLC 1700 East Putnam Ave. Third Floor Old Greenwich, CT 06870 www.weareworldquant.com 12.16.19 GENERATING ART FROM NEURAL NETWORKS PERSPECTIVES developing a machine that can.2 In the past few decades, AI research “All art is has increasingly adopted statistical modeling techniques like machine learning, in which systems learn by looking for patterns but imitation of nature.” in data and making inferences with minimal human intervention. ― Seneca One such modeling technique, called a neural network, has driven much progress in recent years, leveraging growing computational IN OCTOBER 2018, A PAINTING TITLED PORTRAIT OF EDMOND power and access to massive datasets. GANs are the latest in Belamy was expected to sell at auction for $7,000 to $10,000, the line of such models and take a uniquely creative approach but to the surprise of auction house Christie’s it ended up using neural networks to train machines. So groundbreaking is fetching the whopping price of $432,500.1 The gilt-framed this idea that Yann LeCun, one of the modern pioneers in artificial painting is a portrait of a black-clad man with indistinct facial intelligence, has described GANs as the “coolest idea in machine features. The corners of the portrait are unfinished, but the learning in the last 20 years.”3 most unique part of the painting, and perhaps the reason for its high price, is the mathematical formula that can be FROM DISCRIMINATION TO GENERATION seen in the bottom right corner, where the artist’s signature To understand the game-changing potential of GANs, we need to normally would be found. The painting was created not by a first look at the concepts of discriminative modeling and generative human but by an algorithm. Specifically, it was generated by modeling. In machine learning, researchers have been trying to a class of machine learning algorithms known as generative develop algorithms that can ingest large volumes of training data adversarial networks (GANs), developed by Ian Goodfellow, to learn and understand the world. But until recently, most of the a renowned artificial intelligence (AI) researcher currently noteworthy progress in the field revolved around the idea of dis- working at Apple. criminative modeling. This refers to tasks like identifying whether a photo contains a dog or whether a given painting was created GANs have received a lot of media attention recently due to the by van Gogh. Here the algorithms learn from training data, with rise of deepfakes — videos created by superimposing celebri- each observation labeled. Mathematically speaking, discriminative ties’ and politicians’ faces on other people’s modeling tries to estimate the probability bodies, often those of impersonators. These that an observation x belongs to a category deepfakes, which are powered by GANs, are y. Since the launch of the ImageNet data- eerily realistic and capable of convincing base in the early 2010s, the ImageNet Visual viewers that they feature real celebrities. Recognition Challenge and the development Unsurprisingly, GANs have found applica- of the deep convolutional neural network tions in all kinds of visual content editing, (CNN), such image classification tasks have from auto-generating anime characters to become easier, with many considering the changing photos of fashion models to show challenge a solved problem. different poses to increasing the resolution of blurry photographs. The video game Generative modeling, on the other hand, design industry is on the verge of a revo- is not merely about identifying whether a lution thanks to this technology, which is photo shows a dog. It learns from a training being used to create more-realistic com- dataset of images of dogs to figure out the puter graphics and virtual environments. rules about their appearance and generate or Some consumer-facing applications, like synthesize new canine images. Importantly, FaceApp, also employ GANs, showing users this model should be probabilistic and not how they would look if they aged a certain deterministic. A deterministic model always number of years. Even astronomers are Portrait of Edmond Belamy produces the same result, given a set of using GANs to fill in parts of the sky with Source: @obvious_art starting conditions or initial parameters. missing data and generate realistic realizations of deep-space The generative model should therefore include a random element for further research. so that the new, synthesized image is different every time. Assume there is some unknown probabilistic distribution that describes why But GANs’ true potential lies in how the algorithms could advance certain images are likely to be found in the training dataset and other the field of AI from narrow applications to more general ones. Ever images are not. The generative model should closely resemble this since Alan Turing published his famous paper asking whether distribution and sample from it to output a group of pixels that look machines can think, there has been steady progress toward like they could have been part of the original training dataset. Copyright © 2019 WorldQuant, LLC December 2019 2 12.16.19 GENERATING ART FROM NEURAL NETWORKS PERSPECTIVES Yann LeCun, one of the modern The first term on the right-hand side of the formula represents the likelihood of the real sample passing through the discriminator; the pioneers in artificial intelligence, has second term is the likelihood of the synthetic sample not passing described GANs as the “coolest idea in through. The aim of the discriminator is to maximize this function so that in the most ideal case all real samples will pass through machine learning in the last 20 years.” and synthetic samples won’t. The generator’s job is exactly the opposite — to minimize the function. The two networks engage A GAN comprises neural networks that are based on the preceding in this zero-sum game until the model reaches an equilibrium. In two models but engaged in opposing objective functions: a gen- fact, the signature in the Edmond Belamy painting is a version of erative network and a discriminator, or adversarial, network. The this formula. generative network is trained to take random noise as input and output a synthetic candidate. To create a painting, a GAN would WALKING A TIGHTROPE take in numerous samples of paintings as input and generate an For generative adversarial networks, the most crucial challenge artificial one. To generate artificial faces, it would study a huge data lies in the training process. This is typically done in a cyclical set of real photos of people. manner so both networks have an opportunity to learn from each other’s progress. In one step, the generator learns from how the The adversarial network, on the other hand, is trained to discrim- discriminator classified the previously generated samples. If some inate between a synthetic candidate and a real one. That is, this were more likely to get classified as real than others, the generator discriminator is expected to “catch” or classify a generated painting learns to produce more samples similar to them. The discrimina- or an artificial face as being fake. When trained in a cyclical fashion, tor is frozen until the generator has learned as much as possible the generative network becomes progressively better at what it from the current state of its adversary. Once that has happened, does — generating synthetic candidates very close to the real ones. the generator is frozen and the discriminator is allowed to learn And the discriminator network gets better at its job of catching what made some of the samples almost get classified as real fakes and picking out the synthetic candidates. in the previous iteration; this helps the discriminator spot these near-misses going forward. This cycle is repeated again and again, Think of the generative network as a forger producing imitations improving both networks. of great artworks and the adversarial network as an appraiser evaluating the authenticity of those works. The two are engaged in It’s not ideal for one of the networks to advance too quickly. If a constant tug of war. The forger wants the fake to be misclassified either network gets too good before the other can catch up, the as real; the appraiser stands in the forger’s way because he can spot training will plateau and the overall result will be suboptimal.4 A the fakes. The forger makes a large number of attempts and learns useful analogy is that of two chess students playing each other from what the appraiser allows to go through. The appraiser, for to improve their respective games. They both have to learn and his part, learns from all the tricks the forger plays and in doing so improve at roughly the same pace. If one student improves her becomes better and better at distinguishing a fake from a real work game significantly more than the other, they will both end up of art. This process helps both networks understand the nuances with a suboptimal level of expertise: The better player will not be of what makes a painting real. How do we know when the training challenged enough, and the lesser player will keep losing without is complete? When a human eye cannot tell whether the painting learning anything significant. was created by an algorithm or by an actual artist. When trained well, GANs can be tools to generate information in Mathematically, the GAN system can be represented by the fol- any scenario where we have a certain understanding of what to lowing function: expect and where we have a system to tell if the generated infor- mation meets our expectations.