## 2 Materials and Methods
### Conditional GAN (cGAN)  
The GAN architecture used as our baseline consists of two different neural networks trained simultaneously for 40,000 iterations. The generator that has been trained is one that operates by synthesizing an image from an input sketch.  
The main task of a model generator in this research is to build a realistic image based on the input sketch and the given noise. To achieve an acceptable result, the generator must be able to find out what features are in the input, convert it into a feature map, and reconstruct the feature map into an image according to the desired target. Feature maps can be easily generated by CNN. However, the generator's task does not stop until it gets a feature map. The generator must make a new image reconstruction from the feature map. To carry out this task, a decoder layer is needed to change the encoder results' features. This architecture is commonly referred to as an autoencoder.  
Since the features learned in the downsample can be lost in the encoding process, the autoencoder is not suitable for use as a generator of a GAN. Therefore, [PERSON] et al. introduced a new architecture called U-Net [14]. U-Net implements what are known as skip-connections. As the name suggests, skip-connections pass through multiple layers and take the output of one convolution layer as the input of another layer of the same dimension.  
Using this architecture, the features found from each downsample can be decoded by the upsample. This provides much better image segmentation than a traditional autoencoder which only upsamples the smallest feature vector in the code layer.  
The generator architecture that will be used in this research is composed of upsample blocks composed of Conv2 DTranspose, Dropout, with LeakyReLU activation and a downsample composed of Conv2D, BatchNormalization, with LeakyReLU activation. The first downsample layer will not use BatchNormalization, and the first three upsample layers will drop out by 50%, this is done to prevent overfitting.  
As seen from Figure 1, every downsample, other than the first downsample, has a skip connection to its upsample pair. Note that the upsample will accept two inputs. Input from the previous upsample output and from the downsample output. These two inputs have the exact dimensions and will be concatenated. For example, the first upsample will accept two inputs with dimensions of \(1\times 1\times 512\), and after concatenation, the dimensions become \(1\times 1\times 1025\).  
The discriminator has a vital role in the GAN model. Its functions are to evaluate the results produced by the generator and provide loss to change the weights in the generator and discriminator models. The discriminator is a component that distinguishes GAN from an ordinary autoencoder.  
This research used the PatchGAN architecture, as shown in Figure 2, for the discriminator, due to its ability to enforce local-region consistency in the output image by using its patch. Suppose the ordinary discriminator uses the entire image to determine whether the image generated by the generator is genuine or fake. In that case, PatchGAN will try  
Figure 1: U-NET architecture used as the generator.  
to classify if every N \(\times\) N patch in the image is real or fake. The discriminator will run convoluntarily on the entire image and find the average of all the responses given from that classification. The value of N can still give good results even though the value is smaller than the original image. It is advantageous because the smaller PatchGAN has fewer parameters, runs faster, and can be applied to large images. The implementation of PatchGAN has been widely used, especially for systems related to image or video [15; 16].