# High-Quality Text-to-Image Generation Using High-Detail Feature-Preserving Network
## 3 Method
### iT2 IG Module  
The transformation of text descriptions to image feature maps is a vital topic in text-to-image generation because the generation of an adequate feature map is important for subsequent image enhancement. The first component of the proposed framework is the iT2 IG module (Figure 2a), which performs initial feature generation. The module incorporates a text encoder, an initial image generator \(G_{0}\), and a dynamic memory generative network (DM-GN) [14]. 1. Text Encoder: Following the methods adopted in [10,14], textual data are processed by using a pre-trained bidirectional long short-term memory (LSTM) text encoder [10] to transform descriptive sentences into sentence features (s) and word features (W). 2. Initial Image Generator \(G_{0}\): The conditioning augmentation \(F^{ca}\) proposed in [4] is used to optimize sentence features. Next, \(G_{0}\) is used to generate the initial image \(I_{0}\) and image features \(H_{0}\), \[z:\ I_{0},H_{0}=G_{0}(z,\ F^{ca}(s)),\] (1) where \(z\ \sim\ N(0,1)\), and \(G_{0}\) denotes the initial image generator. This generator is composed of four upsampling blocks. \(F^{ca}\) denotes the conditioning augmentation block [11]. 3. DM-GN: The DM-GN [14] is used to generate feature maps because its effective image enhancement method dynamically adjusts word weights to achieve images with more word-level detail. As presented in Figure 2a, the inputs of the DM-GN are the initial image features \(H_{i}\) and the word features W to the DM-GN: \[\text{W}=\{w_{1},w_{2},\ w_{3},\dots,w_{T}\},\ w_{i}\in\mathbb{R}^{N_{w}}\] (2) \[H_{i}=\{h_{1},h_{2},h_{3},\dots,h_{N}\},\ h_{i}\in\mathbb{R}^{N_{r}}\] (3) where \(T\) denotes the number of words, \(N_{w}\) denotes the dimensions of word features, \(N\) denotes the number of pixels, and \(N_{r}\) denotes the dimensions of the image features. In this study, \(N_{w}=256,\ N_{r}=64\). The image feature and word feature vectors are input into the  
Figure 2: Architecture of the proposed HDFpNet. It consists of the iT2 IG module, FESFE module (including CE block, FFE block, and CS block), and CA mechanism. DM-GN to perform feature recombination. To process text features, \(1\times 1\) kernels are used to select word features, which are then placed in a feature space,  
\[m_{i}=Conv(w_{i}),\ m_{i}\in\mathbb{R}^{N_{m}}, \tag{4}\]  
where \(Conv()\) denotes the selection of word features by the \(1\times 1\) kernels, \(N_{m}\) denotes the dimensions of the feature space (\(N_{m}=128\)), and m denotes the feature space. Equation (4) is not used to process the corresponding word features to select specific word vectors and extract image features. Instead, the word features \(W\) are integrated with the image features \(H_{i}\) generated in the previous stage to determine the weight of each word. The weight is calculated as  
\[d_{i}^{w}(H,w_{i})=\delta(A*w_{i}+B*\frac{1}{N}{\sum_{i=1}^{N}{h_{i}}}), \tag{5}\]  
where \(\delta()\) denotes the sigmoid activation function, \(A\) denotes a \(1\times N_{w}\) matrix, and \(B\) denotes a \(1\times N_{r}\) matrix. After the weight of each word is calculated, the word and image features are recalculated based on the corresponding weights and placed in the feature space \(m_{i}\in R^{N_{m}}\),  
\[m_{i}=C_{w}(w_{i})*d_{i}^{w}+C_{r}(\frac{1}{N}{\sum_{i=1}^{N}{h_{i}}})*(1-d_{i }^{w}),\ m_{i}\in R^{N_{m}}, \tag{6}\]  
where \(C_{w}\) and \(C_{r}\) denote the selection of word and image features, respectively, by the \(1\times 1\) kernels, and m denotes the feature space with dimension \(N_{m}\). After the image and word features are integrated, the weight of the \(j\)th image feature in the \(i\)th feature space is calculated:  
\[\alpha_{i,j}=\frac{\exp(\varnothing_{K}(m_{i})^{T}h_{j})}{\sum_{l=1}^{T}\exp( \varnothing_{K}(m_{l})^{T}h_{j})}, \tag{7}\]  
where \(\alpha_{i,j}\) denotes the similarity probability between the \(i\)th feature space and \(j\)th image feature, and \(\varnothing_{K}\) denotes the feature selection process by the \(1\times 1\) kernels.