# Generating Structurally Complete Stylish Chinese Font Based on Semi-Supervised Model
## 3 Stylish Chinese Font Generation
### Improved Attention Module  
To enhance the realization of stylish Chinese font style conversion and emphasize the network's attention to the relationship between the position of Chinese strokes and the overall structure of Chinese characters, we incorporate an attention module in this paper. We improve the attention module by incorporating average pooling and maximum pooling operations to extract partial information from the feature mapping. To enhance the connection with the original features, we perform operations between the obtained non-local feature mappings and the original features, resulting in the final perceptually enhanced feature mappings. The module learns by capturing the dependency between Chinese character features and stroke features, as well as the interconnections among  
Figure 2: Overall framework diagram of the proposed model. stroke features, thereby better preserving the crucial stroke information of characters. The improved attention module possesses fewer parameters compared to the self-attention mechanism and exhibits enhanced focus on stroke information, as illustrated in Figure 4. Additional details regarding the attention module and its refinements are presented in the following sections. 1. Three embedded feature spaces are used in this module. \(\zeta(x)\in R^{n\times c}\), \(\psi(x)\in R^{n\times c}\), and \(\xi(x)\in R^{n\times c}\) are all constructed by \(1\times 1\) convolution. \(n\) is the size of the feature map, and \(c\) is the number of channels. 2. To simplify the parameters of the attention module, accelerate the speed of the model, and obtain some feature information of Chinese characters and strokes, the average pool and maximum pool are used to obtain some feature information in the feature map. Average pooling and maximum pooling are used to obtain feature information in the two feature spaces \(\zeta(x)\in R^{n\times c}\) and \(\psi(x)\in R^{n\times c}\), respectively. \[P_{a}=\left(avePooling(\zeta(x))\right)_{n},\;P_{a}\in R^{1\times c}\] (1) \[P_{m}=\left(maxPooling(\psi(x))\right)_{n},\;P_{m}\in R^{1\times c}\] (2)
3. The feature correlation matrix \(F\) is obtained by simple matrix multiplication of the two feature information \(P_{a}\) and \(P_{m}\) obtained earlier. Each element \(F_{ij}\) in the feature  
Figure 4: Framework diagram of the improved attention module. Figure 3: These strokes above are the basic strokes that form Chinese characters. Here are some examples of Chinese characters that have distinct composition structures but share common basic strokes. correlation matrix signifies the association between the \(i^{th}\) average feature in \(P_{a}\) and the \(j^{th}\) significant feature in \(P_{m}\). \[F_{P}=P_{a}{}^{T}P_{m}\,\ F\in R^{c\times c} \tag{3}\]  
In this context, each channel map can be considered as a response specific to Chinese character features, and these feature responses exhibit correlations among themselves. Consequently, the resulting feature correlation matrix \(F_{P}\) carries significant physical meaning, where the \(i^{th}\) row represents the statistical correlation between channel \(i\) and all other channels. By capitalizing on these inter-dependencies, we can effectively highlight the interdependent feature maps. 4. The feature map \(m\) is derived by performing matrix multiplication between the feature correlation matrix \(F_{P}\) and the feature space \(\xi(x)\in R^{n\times c}\). This matrix effectively measures the response of each location to the overall characteristics present in the Chinese character image. This design establishes a linkage between the strokes and the overall structure of the Chinese image. \[m=\xi(x)F_{P} \tag{4}\]  
The aforementioned mechanism strives to augment the channel features at every position by leveraging the amalgamation of all channels and integrating the inter-dependencies among them.