# Conditional Generative Adversarial Networks for Domain Transfer: A Survey
## 2 The Development Methods of CGAN
### The Improvement of CGAN
#### 2.2.1 The Loss Function of CGAN
Since hidden variables do not have a dataset as the \"standard answer\", it is necessary to design the network architecture in a reasonable way to construct two hidden variables with the same semantics. For example, in the task of improving image resolution, if the generative network is designed to resemble an auto-encoder network, two hidden variables on the symmetry of the bottleneck can be considered to represent the same semantic information, and the difference between them can be designed as the loss of hidden variables. The expression of the loss is  
\[L_{\text{latent}}(\mathbf{x};\mathbf{\theta})=D_{f}(l_{1}||l_{2}), \tag{6}\]  
where \(l_{1}\) and \(l_{2}\) are the distributions of two hidden variables, and \(D_{f}\) is f-divergence. The specific type of f-divergence can be selected according to different tasks. 4. Category loss: In some scenarios, the user does not require the generated image to be similar to an expected image, as long as it has the correct category. For example, after training with MNIST, the user requires the network to generate the specified number but does not require the handwriting characteristics of the number. For these requirements, many CGAN models put the generated images into a pre-trained classifier. Therefore, the expression of this kind of loss is similar to the common classification problem, and cross-entropy loss is commonly used. The expression of the loss is  
\[L_{\text{class}}(\mathbf{x};\mathbf{\theta})=\mathbb{E}_{\mathbf{z},c}[-\log D_{\text{cls} }(c|G(\mathbf{z},\mathbf{y}))], \tag{7}\]  
where \(D_{cls}\) represents the classifier and \(c\) represents the category to which the image belongs. The above four kinds of losses are only representing typical usage in CGAN, and there is no clear boundary between them. Their differences are mainly reflected in independent variables, calculation methods, etc. Table 1 summarizes them as a whole. In most of the existing results, all the above losses are not applied simultaneously. The usual practice is to select 2-3 losses to build the loss function according to the specific requirements of the task. Table 2 summarizes the usage of these losses in some typical works. As can be seen from Table 2, most CGAN models use content loss. That said, in most application scenarios, supervision of the low-level semantics is necessary. \begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline
**Loss Function** & **Content Loss [25]** & **Perception Loss [14]** & **Hidden Loss [26]** & **Variable Loss [27]** \\ \hline Source of independent variables & The output of generative network and training data & Two latent variables in the network & The output of generation network and condition \\ \hline Data type of independent variables & Image tensors & & Distribution \\ \hline Whether to use additional networks & No & Yes & No & Yes \\ \hline Metric & Error (usually MSE) & Divergence & Divergence (usually cross-entropy loss) \\ \hline Contents of supervision & Low-level semantics of generated images & High-level semantics of generated images & States of generative network & Class of generated images \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The comparison of different loss functions.