## 2 Proposed Method
### Spatial-Channel Mutual Attention-Guided Transformer Module (SCATM)
#### 2.3.3 Channel-Wise Multi-Head Transformer Block (CMTB)  
After preprocessing the inner feature maps with the guiding blocks, there is still a high demand to effectively aggregate the previous feature information from various channels for high-quality face image restoration. Moreover, the usual spatial-wise transformers  
Figure 3: Architectures of the Spatial-Channel Mutual Attention Guiding Block (SCAGB): (**a**) the Spatial-Channel Mutual Attention Guiding Block-Top (SCAGB-T) and (**b**) the Spatial-Channel Mutual Attention Guiding Block-Bottom (SCAGB-B). Here, (c) denotes the sigmoid function. are limited to position-specific windows, where the partition strategy may potentially alter the structure of the facial image [15]. Therefore, we introduce the Channel-wise Multi-head Transformer Block (CMTB). It can achieve image-size receptive fields based on channels instead of position-specific windows and is more computation-friendly, making it a good match for the previous guiding blocks. As depicted in Figure 4, CMTB consists of a Channel-wise Multi-head Self-attention Network (CMSN) and a Gated-Dconv Feed-Forward Network (GDFN). The CMSN is the primary component of the CMTB, while the GDFN aims to encode information from spatially neighboring pixel positions to effectively learn local image structures. The CMTB can achieve image-size receptive fields based on feature map channels instead of position-specific windows. Given feature maps \(\mathbf{X}_{in}\in\mathbb{R}^{H\times W\times C}\) as the input of the CMSN, which are reshaped into tokens \(\mathbf{X}\in\mathbb{R}^{HW\times C}\) based on channels (where \(H\), \(W\), and \(C\), respectively denote the height, width, and channel numbers of the feature maps), then \(\mathbf{X}\) is linearly projected to achieve three different matrices: _query_\(\mathbf{Q}\in\mathbb{R}^{HW\times C}\), _key_\(\mathbf{K}\in\mathbb{R}^{HW\times C}\), and _value_\(\mathbf{V}\in\mathbb{R}^{HW\times C}\):  
\[\mathbf{Q}=\mathbf{X}\mathbf{W}^{\mathbf{Q}},\quad\mathbf{K}=\mathbf{X} \mathbf{W}^{\mathbf{K}},\quad\mathbf{V}=\mathbf{X}\mathbf{W}^{\mathbf{V}}, \tag{4}\]  
where \(\mathbf{W}^{\mathbf{Q}}\), \(\mathbf{W}^{\mathbf{K}}\), and \(\mathbf{W}^{\mathbf{V}}\in\mathbb{R}^{C\times C}\) are learnable parameters (_biases_ are omitted here for simplification). Afterwards, \(\mathbf{Q}\), \(\mathbf{K}\) and \(\mathbf{V}\) are split into _N heads_ along the channel dimension: \(\mathbf{Q}=[ \begin{array}{cccc}\mathbf{Q}_{1},&\ldots,&\mathbf{Q}_{N}\end{array} ]\), \(\mathbf{K}=[ \begin{array}{cccc}\mathbf{K}_{1},&\ldots,&\mathbf{K}_{N}\end{array} ]\), \(\mathbf{V}=[ \begin{array}{cccc}\mathbf{V}_{1},&\ldots,&\mathbf{V}_{N}\end{array} ]\), where the dimension of each head is \(d=C/N\). Therefore, the self-attention matrix for _head_\({}_{i}\) is  
\[\mathbf{A}_{i}=softmax(\sigma_{i}\mathbf{K}_{i}^{T}\mathbf{Q}_{i}),\quad head_ {i}=\mathbf{V}_{i}\mathbf{A}_{i}, \tag{5}\]  
where \(\mathbf{K}_{i}^{T}\) denotes the transposed matrix of \(\mathbf{K}_{i}\). By implementing this reshape strategy, the size of the generated attention map will be \(d\times d\) instead of \(HW\times HW\), which greatly cuts down the computational complexity. Moreover, a learnable parameter \(\sigma_{i}\in\mathbb{R}^{1}\) is introduced to further extend the flexibility of the network. Subsequently, the outputs of _N heads_ are fed to the concatenate layer followed by a full connection layer, and the resulting attention matrix is then added with the values from the position embedding generator:  
\[CMSN(\mathbf{X})=(C_{i=1}^{N}(head_{i}))\mathbf{W}+f_{p}(\mathbf{V}) \tag{6}\]  
Figure 4: Architecture of the Channel-wise Multi-head Transformer Block (CMTB). Here, \(\bigotimes\), \(\bigotimes\), and \(\bigcirc\) denotes the sigmoid function, reshape, and split, respectively, while PE denotes the position embedding generator.