{'fraction_non_alphanumeric': 0.024822921319634993, 'fraction_numerical': 0.008231765681832684, 'mean_word_length': 4.845580007459903, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Deep Snow: Synthesizing Remote Sensing Imagery with Generative Adversarial Nets

In this work we demonstrate that generative adversarial networks (GANs) can be used to generate realistic pervasive changes in remote sensing imagery, even in an unpaired training setting. We investigate some transformation quality metrics based on deep embedding of the generated and real images which enable visualization and understanding of the training dynamics of the GAN, and may provide a useful measure in terms of quantifying how distinguishable the generated images are from real images. We also identify some artifacts introduced by the GAN in the generated images, which are likely to contribute to the differences seen between the real and generated samples in the deep embedding feature space even in cases where the real and generated samples appear perceptually similar.


INTRODUCTION
"Ceci n'est pas une pipe." René Magritte, The Treachery of Images The problem of mapping an image from one domain to a corresponding image in another domain is known as image-to-image translation. This type of task is analogous to language translation in the field of natural language processing (NLP): just as the same sentence may have representations in two different languages, a given image may have representations across two different domains. In this work, we attempt to generate synthetic color (three channel RGB) remote sensing imagery across seasonality domains. In particular, we focus on synthesizing snow cover. To this end, we utilize generative adversarial networks (GANs), a recent development in the field of deep generative modelling. 1 The principal aim of this work is to investigate the viability of GANs as a method for the generation of synthetic remote sensing data which may be used to test a variety of change detection algorithms.
Interest within the field of remote sensing in utilizing GANs is growing, particularly in the realm of imageto-image translation, mostly stemming from the multi-modal nature of remote sensing imagery. Most of the efforts thus far in the field are directed at transforming data from different sensors into the same modality domain (usually multispectral, which is most easily interpreted); 2-7 these transformations are based on machine learning, not physical models, and so the transformed images comprise synthetic signals. One of the principal aims of these approaches is to take a modality unaffected by cloud cover, such as synthetic aperture radar (SAR), and learn a mapping to the multispectral domain which can be hindered by cloud cover. Interestingly, Mohajerani et al. demonstrated the first use of an unpaired image-to-image translation framework in generating land cover changes (also snow to non-snow), but with the ultimate aim of preserving cloudy pixels for cloud segmentation purposes 8 and limited to resolutions of 30 metres. In this work we demonstrate how an unmodified GAN-based framework can be utilized to generate high quality samples from Sentinel-2 imagery collected at a 10 metre resolution. Although previous work 9 has investigated the practical applicability of this framework for anomalous change detection, 10 in this work we demonstrate metrics that enable the quantification of sample quality as well as evaluation of the viability of the transformed data in terms of generating synthetic imagery for potential applications.

Generative Adversarial Networks
The framework of GANs consists of a so-called "game" between two adversaries. One is the generator, whose objective is to generate samples which originate from the same distribution as some training data. The other is the discriminator, whose objective is to determine whether samples are "fake" (generated by the generator) or "real" (originating from the training set). 11 Goodfellow et al. liken the generator to a counterfeiter attempting to produce fake currency and distribute it undetected, and liken the discriminator to the police attempting to detect that fake currency. 1 Competition in this process drives both the counterfeiter and the police to improve their methods of counterfeiting and detection, respectively, until the counterfeit currency is indistinguishable from the genuine article.
More formally: a prior over noise variables (the inputs) is defined as p z (z) in order to learn the distribution p g over data x (the training data) such that the mapping from the noise to the data space is G(z; θ g ) where G is a neural network with parameters θ g . A second neural network parametrized by θ d is defined as D(x, θ d ) and outputs a single scalar, the probability that a sample came from the training data rather than p g . D and G are trained simultaneously in a two-player minimax game, such that D attempts to maximize the probability of assigning correct labels to samples from the training data and those from G, whilst G attempts to minimize log(1 − D(G(z)). The value function V of said minimax game is thus: (1)

Image-to-Image Translation
The use of GANs as a potential general purpose solution to image-to-image translation problems was first highlighted by Isola et al. 12 In their framework, named pix2pix, GANs were conditioned on input images in order to produce desired output images in a paired image setting. As such, the output produced by the GAN is evaluated both by the discriminator and by using an L 1 loss relative to the target.
In remote sensing imagery, it can often be difficult to consistently find corresponding pairs of imagery in the required domains at the same location due to cloud cover. 8 To address this, we utilize an unpaired image-to-image translation framework known as cycleGAN. 13 This leverages a pair of GANs to learn two transformations: one from domain X to Y, and one back from domain Y to X. These two GANs are bounded by the cycle-consistency loss: returning to our analogy of language translation, cycle-consistency ensures that a sentence translated from English to French, and then back to English is the same as the original sentence. In the case of cycleGAN, the two translators G : X → Y and F : Y → X should be inverses of one another and the translations are bijections, ensuring individual inputs and outputs can be connected in pairs in a valid manner. 13 Thus, given a pair of translators G and F , the full objective is given by: where L GAN ) is the adversarial loss function described by Eq. 1; X and Y are the two domains between which we wish to learn a mapping; D X , D Y are the discriminators paired with the generators G, F , respectively; and L cycle is the cycle-consistency loss given by:

Deep Embedding Quality Assessment
The task of evaluating GANs is an area of active research, and a result of the fact that the optimization (driven by Eq. 1) contains no explicit measure of sample quality other than the discriminator loss. Heusel et al. introduced a measure known as the Fréchet Inception Distance, whereby samples are embedded in a specific layer of an Inception-v3 network 14 pretrained on ImageNet in order to produce embedded features. Two multivariate Gaussians are then fit to these features and the Fréchet Distance, 15 or Wassterstein-2 distance 16 between these two Gaussians ( fit to the real and fake embedded features) is calculated 17 as: where µ and Σ denote the mean and covariance of the real (x) and generated (g) samples. In this work, we introduce a measure to evaluate the quality of samples from unpaired image-to-image translators such as cycleGANs. We utilize a similar methodology to Heusel et al. in that we utilize a pretrained deep neural network to embed the samples. We choose the Resnet-50 architecture 18 pretrained on ImageNet, as it has been shown to enable similarity searching in the embedding space for remote sensing imagery even without finetuning. 19 Since the quality of the samples in this problem setting is determined not only by their realism but also by their "closeness" to the target domain, we evaluate the average cosine distances between each generated sample and each real sample in the Resnet-50 embedding space. The cosine Resnet distance (CRD) is then defined: where G[i] represents the ith generated sample embedded by the Resnet-50 network, and X[j] represents the jth real sample also embedded by the Resnet-50 network. We also calculate the Fréchet Distance for the samples in the Resnet embedding space to provide a comparison between the Inception-v3 and Resnet features in terms of their applicability to remote sensing imagery. Figure 1 shows some of the samples generated by the cycleGAN, where the input images are three channel RGB images from Sentinel-2, and the transformed images are those same scenes with realistic snow deposit. Qualitatively, we can see the high degree of realism in the generated snow. The cycleGAN is clearly able to learn the texture and colors of snow, and to apply them in a realistic manner while conserving the structure of the images. We note that the cycleGAN learns a perceptually realistic snow transformation for both rural and urban areas, colorizing roads, buildings and streets effectively.

Generated Samples
Although the samples shown in Figure 1 appear realistic, a closer look at some of the textures generated by the cycleGAN does reveal some issues. We show here a close up of the red bounding box in Figure 1. A common issue we observe in our dataset is the generation of unrealistic looking grid-like patterns, as shown in Figure 2; in particular this is present over bodies of water. In order to further investigate the transformation learnt by the cycleGAN, we decompose the transformation into the red, green, and blue bands by simply taking the L1 norm of the bands between the original image and the transformed image. These band norms are shown in Figures 2(c,d,e). We see here that not only does the cycleGAN introduce this grid-like artifact, but there also seems to be 'noise" that is imperceptible in the transformed image, but is evident in the speckle present in the L1 norm of the band intensities between the images, especially for the red band on the surface of the water. We hypothesize this effect occurs mostly over bodies of water as these are decidedly different from land in terms of texture in the images, and are much darker which can highlight low-amplitude effects; additionally, the cycleGAN sees few examples of bodies of water in both domains during the training process.

Image Quality Assessment
Thus far we have discussed the qualitative output of the cycleGAN. Currently there are no widely agreed upon and clearly-defined procedures for the evaluation of unpaired image-to-image translation frameworks. As mentioned in Section 2.3, the evaluation of GAN output quality is an active area of research. The fact that our samples are unpaired further complicates the matter. For paired frameworks such as pix2pix, the image quality can be evaluated by comparing the generated image directly with the target; the inherently unpaired cycleGAN does not afford such a luxury. This introduces a further complexity: the unpaired nature of cycleGAN does not allow for the direct evaluation of a loss function, making it difficult to know when to terminate training (typically this would be determined by some stopping criterion based on the evaluation of a loss function). Although the unpaired nature of cycleGAN increases its generally applicability remote sensing problems, it does make it more difficult to assess image quality using traditional techniques.
In order to quantitatively evaluate the progression of the cycleGAN, we apply the metrics described in Section 2.3 (FID, CRD and FRD) to data generated at each epoch of the training. This enables us to investigate the training dynamics of the cycleGAN, as shown in Figure 3. In Figure 3(a), we can see that only the cycleconsistency loss provides any indication that the cycleGAN output may be improving beyond the early stages of training (ẽpochs [10][11][12][13][14][15][16][17][18][19][20], as both the generator and discriminator losses plateau early on. Similarly, the FID, shown in Figure 3(b), stops decreasing beyond epoch 50 and is additionally quite noisy throughout. Finally, Figures 3(c) and 3(d) demonstrate that the embedding of remote sensing images using Resnet as opposed to Inception-v3 may capture more relevant features in the data, as we see our measures of transformation quality continuously decreasing throughout the training process in a much smoother manner compared to the FID.   Figure 2 for training epochs 1, 10 and 50. As the training progresses we see the image is gradually sharpened, an effect of the adversarial loss. 12 We note that even in epoch 1, the "colors" of snow appear to have been learnt by the cycleGAN already, as the image is already vastly different to the original non-snowy image (shown in Figure 2(a)). We show in the right-most column the L1 norm between all three bands of the cycleGAN transformed image in order to highlight artifacts generated by the GAN and show how these disappear as the training progresses.

Embedded Features
We have shown in the previous section that quality metrics derived by embedding both real and cycleGAN generated images using a pre-trained Resnet-50 qualitatively correlate with perceptual image quality as evidenced by the decrease in the level of artifacts and blurriness of the cycleGAN generated images. As such, we now ask the question: based on this embedding, how convincing are the cycleGAN generated images relative to the real ones?
In a final test of the quality of the images generated by the cycleGAN, we train a random forest (RF) classifier to differentiate between real and cycleGAN generated images generated from each training epoch by embedding both sets of images using a pre-trained Resnet-50 and then performing 2-fold cross validation using an RF classifier averaged over 100 repeats. The averaged log loss of the RF classifier for generated data from each epoch is shown in Figure 5. Although the generated image quality can be seen to improve in terms of the ''confusion," or increased log loss of the classifier in the task of classifying real and generated images, we note that even at epoch 200 the log loss remains low, indicating a good ability of the RF classifier to differentiate between real and synthetic images based on the Resnet-50 features. This may be due to artifacts such as those shown in Figure 2.

CONCLUSIONS
We have shown in this work that the cycleGAN framework can be utilized to learn realistic transformations of remote sensing imagery, with particular emphasis on transforming a non-snowy scene to a snow-covered one. We show that despite the apparent perceptual realism of the generated samples, a detailed look at some areas can reveal artifacts implanted by the transformation, which indicates that care must be taken when performing any sort of down-stream analysis on transformed samples. We introduce some methods to evaluate the quality of samples generated using unpaired image-to-image translation framework such as cycleGAN, which may help in guiding when training should be stopped. Although in this case we have only investigated modality-consistent image translations (i.e., Sentinel-2 RGB to Sentinel-2 RGB), we envision that image-to-image translation frameworks such as cycleGAN and pix2pix may be used in the future to generate synthetic datasets for the testing of algorithms designed to operate across multiple modalities. [20][21][22] However, as demonstrated in this paper, careful analysis of potential artifacts introduced by these frameworks must be taken into account.