# VDCrackGAN: A Generative Adversarial Network with Transformer for Pavement Crack Data Augmentation
## 3 Methods
### Experiment Results
#### 4.3.2 Ablation Study  
In order to obtain the optimal model, this paper mainly conducts ablation experiments on the position of the Swin Transformer module in the network layer of the generator network, the number of heads in the Swin Transformer's multi-head attention, and the weight of each loss function in the weighted loss function.  
The Influence of Different Swin Transformer Block Locations  
Table 6 shows the comparison of IS and FID scores of crack image samples generated by VDCrackGAN, with the Swin Transformer Block located in different network layers. It can be found that the location of the Swin Transformer Block has an important influence on the model performance. When the Swin Transformer Block is located behind the 128 \(\times\) 128 feature map (namely, feat128 in Table 6), it is obviously superior to other positions. The IS scores of feat128 are 2.3%, 0.7%, 8.0%, and 2.8% higher than that of feat64, feat32, feat16, and feat8, respectively, and it is very close to the IS score of the real crack dataset. Similarly, the FID score of feat128 is better than that of feat64, feat32, feat16, and feat8 by 42.2%, 28.2%, 56.0%, and 29.5%, respectively.  
The Influence of the Number of Heads in Swin Transformer's Multi-Head Attention  
Table 7 shows the influence of different head numbers of the Swin Transformer Block's multi-head attention mechanism on the model performance. It can be found that when the head number is 4, the IS scores are 6.3% and 7.6% higher than when the head number is 8 and 16, respectively, and the FID score promotion percentages reach 42.2% and 45.8%, respectively.  
The Influence of the Weight of Each Loss Function  
In this paper, the weighted loss function is used, and in order to study the influence of the weight of the loss function on the training results of the model, the related ablation experiments are also carried out. As shown in Equation (8), the weights of prior loss (KL loss) \(L_{prior}\), feature matching loss \(L_{like}^{Dis_{l}}\), and discriminator loss \(L_{GAN}\) are \(\lambda_{p}\), \(\lambda_{l}\), and \(\lambda_{G}\), respectively. Table 8 shows the influence of different weights on the training results. The optimal parameter group is 1.5 for \(\lambda_{p}\), 0.01 for \(\lambda_{l}\), and 1.0 for \(\lambda_{G}\).  
\begin{table}
\begin{tabular}{c c c c c} \hline \multirow{2}{*}{**Position of Swin Transformer Block**} & \multicolumn{2}{c}{**IS**} & \multicolumn{2}{c}{**FID**} \\ \cline{2-5}  & **Score** & **std** & **Score** & **std** \\ \hline real crack dataset & 3.259 & 0.216 & — & — \\ feat128 1 & 3.235 & 0.040 & 26.812 & 0.072 \\ feat64 & 3.162 & 0.038 & 46.410 & 0.097 \\ feat32 & 3.214 & 0.046 & 37.333 & 0.086 \\ feat16 & 2.995 & 0.033 & 60.955 & 0.091 \\ feat8 & 3.148 & 0.038 & 38.033 & 0.083 \\ \hline \end{tabular} \({}^{1}\) Feat128 represents the position of Swin Transformer Block located behind the feature map with the size of 128 \(\times\) 128, that is, after layer 6 (as shown in Table 2), and so on.  
\end{table}
Table 6: Comparison of different Swin Transformer Block locations.  
\begin{table}
\begin{tabular}{c c c c c} \hline \multirow{2}{*}{**Num\_Heads**} & \multicolumn{2}{c}{**IS**} & \multicolumn{2}{c}{**FID**} \\ \cline{2-5}  & **Score** & **std** & **Score** & **std** \\ \hline
4 & 3.235 & 0.040 & 26.812 & 0.072 \\
8 & 3.044 & 0.036 & 46.383 & 0.099 \\
16 & 3.006 & 0.033 & 49.501 & 0.101 \\ \hline \end{tabular}
\end{table}
Table 7: Comparison of different head numbers of Swin Transformer Block.