Generate Satellite Images using DCGAN

Introduction

In this tutorial, we will teach Generative Adversarial Nets (GAN) to generate synthetic satellite imagery. Two of the most critical limits of AI today stem from the lack of training data and the difficulty of AI to simulate human creativity. Generative Adversarial Nets (GANs) provide a generative strategy that allows us to produce new outputs drawn from the same distribution as the training data. It is possible GANs hold the key to addressing issues related to both limited data and to simulating human creativity. Simulating synthetic satellite imagery has applications ranging from video game content generation to creating data to train self-driving cars. 

GANs have been shown to effectively create convincing handwritten digits and celebrity faces. As a starting point, we will use the fantastic tutorial by Nathan Inkawhich. However, instead of celebrity faces, we will use satellite imagery from the Planet: Understanding the Amazon from Space dataset as our source data. Our discriminator will be trained to predict the fakes, not from the original dataset. Our generator will be trained to generate convincing fake satellite images. 

In this blog post, we will cover the big ideas and high-level concepts. You can see all of the code required and run it yourself on Google Colab here.


GAN Explained

Generative adversarial Networks glean their name from the key relationship that makes them tick. The goal of the generator (G) is to produce fakes drawn from the same distribution as the training set. The math-speak "from the same distribution" simply means G produces images that look similar to the training set images. The goal of the discriminator (D) is to predict if an image is a real image from the training set or a fake from G. Our loss function rewards G for making good fakes and rewards D for finding the fakes. You can read more about GANs from the source, the 2014 paper Generative Adversarial Nets paper by Goodfellow. DCGAN is a very effective extension of the GAN we will be implementing, the paper on DCGAN is here

Figure 1: GAN Diagram


Model Inputs

Create a free Kaggle account to get access to the dataset. Install the Kaggle API, which allows us to quickly download our data. 

Install the Kaggle API

Once you have an account navigate to the account tab of your user profile and select Create API Token. You can now download the kaggle.json, which contains your API credentials. Now we can import our credentials into Google Colab. 

Import your Credentials


Create the Dataset and Dataloader


Figure 2: Preview of Training Images



Model Outputs

You can see our loss function graph is much different than what we would expect to see from a traditional supervised learning process. 
Figure 3: Generator and Discriminator Loss During Training


We see the generator going from producing white noise on the first epoch of training to images with a high level of detail after the 25th epoch of training.


Figure 4: GAN Learning Process the Output from Epoch 1 to 25


Let us compare the real images to the fake images after training. It appears we have a convincing set of fake images produced by our generator. 


Figure 5: Compare Training Samples with Our Fake Images