# Optimizing Generative Adversarial Network (GAN) Models for Non-Pneumatic Tire Design
## 2 Test Methods
### StarGAN  
An image-to-image translation model must preserve two properties: image diversity and scalability across multiple domains. However, existing models either synthesize images using only two domains or require a corresponding number of generators if there are many domains. For example, if there are K domains, existing methods require K(K \(-\) 1) generators and a training effort that depends on their number. StarGAN v2 proposes four new frameworks to meet these two requirements. Generator: The generator (G) takes an image x as input and outputs G(x,s), reflecting a style code (s). The style code (s) is provided by a mapping network (F) or a style encoder (E). s is used in G by applying AdaIN [43] to it. This method eliminates the need to input numerous y directly into G and allows G to synthesize images from any domain. A description of these notation can be found in Table 1. \begin{table}
\begin{tabular}{c c} \hline \hline
**Notation** & **Denote** \\ \hline G & Generator \\ D & Discriminator \\ s & Style cder \\ E & Style Encoder \\ F & Mapping Network \\ z & Latent code \\ y & domain \\ x & Input Image \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Notation used in StarGAN v2. Figure 5: DCGAN architecture modified for 256 \(\times\) 256 image size. Figure 6: Comparison between real images and images generated by DCGAN. Mapping network: The mapping network (F) takes a latent code (z) and a domain (y) as input and generates a style code \(\mathrm{s}=\mathrm{F_{y}(z)}\). \(\mathrm{F_{y}}\) is characterized for domain y. F consists of an MLP with multiple output branches and provides style codes for all domains. F takes a random latent vector z and samples from domain y to generate a set of style codes. Style encoder: E takes an image x that matches y as input. E extracts the style code of \(\mathrm{x},\mathrm{s}=\mathrm{E_{y}(x)}\). It is similar to the mapping network F, but because E takes a random number of images rather than a latent vector as input, a style code that references an image can be obtained. Discriminator: The discriminator (D) in StarGAN v2 is a multi-task discriminator (D) consisting of several output branches. Each branch \(\mathrm{D_{y}}\) learns a binary classification that distinguishes between a real image x in domain y and a fake image G(x,s) provided by the generator (G). Images x and \(\widetilde{\mathrm{s}}\) are input into G using Equation (2) and trained to output \(\mathrm{G}\!\left(\mathrm{x},\widetilde{\mathrm{s}}\right)\) with adversarial loss. \[\mathrm{L_{adv}}=\mathbb{E_{x,y}\!\left[\log\mathrm{D_{y}(x)}\right]}+ \mathbb{E_{x,\widetilde{y},x}\left[\log\!\left(1-\mathrm{D_{\widetilde{y}}} \!\left(\mathrm{G}\!\left(\mathrm{x},\widetilde{\mathrm{s}}\right)\right) \right)\right]} \tag{2}\]  
where \(\mathrm{D_{y}(\cdot)}\) denotes the output for domain y in D. In other words, if image x is in domain y, the output is fake for all other domains except the corresponding domain and real for that domain. F is trained to provide a style code \(\widetilde{\mathrm{s}}\) that is likely to be domain \(\widetilde{\mathrm{y}}\), and G is trained to use \(\widetilde{\mathrm{s}}\) to produce a \(\mathrm{G}\!\left(\mathrm{x},\widetilde{\mathrm{s}}\right)\) that is indistinguishable from the real image of domain \(\widetilde{\mathrm{y}}\). Equation (3) is the style reconstruction loss. The loss reconstructs the original image x using the generated image \(\mathrm{G}\!\left(\mathrm{x},\widetilde{\mathrm{s}}\right)\) and the style code. It attempts to minimize the difference between the reconstructed image and the original image x. This allows [PERSON] to learn from the input images x and s to produce an image of the desired domain. \[\mathrm{L_{sty}}=\mathbb{E_{x,\widetilde{y},z}\!\left[\left\|\widetilde{ \mathrm{s}}-\mathrm{E_{\widetilde{y}}}\!\left(\mathrm{G}\!\left(\mathrm{x}, \widetilde{\mathrm{s}}\right)\right)\right\|_{1}\right]} \tag{3}\]  
Equation (4) is the diversity-sensitive loss that allows the generator to learn a variety of images.