## 4 Architecture
### Network Architectures
#### 4.1.2 Font Generation Module  
As illustrated in Section 1 of our paper, the Zi2 zi model faces some problems as a Chinese character generation model. On the one hand, the model is difficult to train, easy to collapse, and often unstable. On the other hand, generating images leads to relative low resolution. Considering those problems mentioned above, we adopt some strategies to solve these issues. We use EM Distance [6]:  
\[W\big{(}P_{r},P_{g}\big{)}=\inf_{\omega\sim\prod\left(P_{r},P_{g}\right)}E_{(p_ {1},p_{2})\sim\omega}[\|p_{1}-p_{2}\|], \tag{1}\]  
which is continuous and differentiable, and which could solve the phenomenon of gradient disappearance. Where \(\Pi(P_{r},P_{g})\) is the set of all possible joint distributions combined by \(P_{r}\) and \(P_{g}\), the \(P_{r}\) is the distribution of real paired images (consisting of source font images and real target domain images), and the \(P_{g}\) is the distribution of fake paired images (consisting of source font images and generated images). The marginal distributions of \(\omega(p_{1},p_{2})\) are, respectively, \(P_{r}\) and \(P_{g}\). Equation (1) can be interpreted as the minimum cost of transforming the distribution \(P_{r}\) into the distribution \(P_{g}\). Meanwhile, as the EM Distance continues to shrink the closer the two distributions are, this can provide indicators to guide the process of model training and visible supervision over the process of training and judging the metrics model of effectiveness, and this can further the enhancement towards the revolution of generating images. Furthermore, Gradient Penalty [7] is employed to enhance the quality of generation images. \[L_{gradient\_penalty}=E_{\hat{x}\sim P_{r,g}}\big{[}(\|\
abla_{\hat{x}}D(\hat{ x})\|_{2}-1)^{2}\big{]}, \tag{2}\]  
where \(\hat{x}\) is uniformly sampled from the straight line between pairs of points sampled from \(P_{r}\) and \(P_{g}\)[7]. We use L1 distance rather than L2, as L1 encourages less blurring:  
\[L_{L_{1}}(G)=E_{x,y,z}[\|y-G(x,s,z)\|_{1}]. \tag{3}\]  
We define the generator loss:  
\[L_{gen\_loss}=-E_{(x,z)\sim P_{g}}[D(G(x,z))], \tag{4}\]  
to encourage \(G\) to fool the \(D\) by the way of generating high-quality images as much as possible. The discriminator loss is  
\[L_{disc\_loss}=E_{(x,z)\sim P_{g}}[D(G(x,z))]-E_{(x,z)\sim P_{r}}[D(x,y)]. \tag{5}\]  
We use constant loss [30] to assume that the generated image and real image should reside in the same space and close to each other. \[L_{const\_loss}=E_{(x,s,z)\sim P_{g}}[G_{encoder}(x,z)]-E_{(x,y)\sim P_{r}}[G _{encoder}(x,y)]. \tag{6}\]  
Figure 6: Facial image is transformed into 48x48 gray images to feed the pre-trained recognition module. Then the probabilities of seven kinds of expressions including ‘anger,’ ‘disgust,’ ‘fear,’ ‘happiness,’ ‘neutral,’ ‘sadness,’ and ‘surprise’ are calculated. The first two probabilities \((c_{1},c_{2})\) are selected and finally adjusted into standard data \(c\big{(}c^{\prime}_{1},c^{\prime}_{2}\big{)}\) as combined style labels to guide the process of font generation. We use category loss [31] to solve the one-to-many function [32] by concatenating a non-trainable Gaussian noise as style information, and embedding s to the character embedding to generate a target character. We incorporate the style information s in the constant loss function and the category loss function. \[L_{category\_loss}=L_{real\_category\_loss}+L_{fake\_category\_loss}, \tag{7}\]  
\[L_{real\_category\_loss}=-E_{(x,y)\sim P_{t}}(t*\log D(x,s,y)+(1-t)*\log(1-D(x,s,y))), \tag{8}\]  
\[L_{fake\_category\_loss}=-E_{(x,s,z)\sim P_{g}}(t*\log D(G(x,s,z))+(1-t)*\log(1-D( G(x,s,z)))), \tag{9}\]  
where \(t\) denotes target domain labels. Although those loss functions can be used in our model to generate high-quality images, some fonts generation will still be blurred. Therefore, we incorporate a classification strategy [22] to make the discriminator easier to distinguish the style of the generated characters.