## 3 Materials and Methods
### RFAC Architecture  
#### 3.2.1 Full-Attention Mechanism  
In recent years, non-local self-attention methods have become widely applied in medical image segmentation models. These methods utilize self-attention mechanisms to explore channel dependencies and spatial relationships among features. However, this approach tends to overlook feature dependencies in other dimensions, leading to incomplete attention. Moreover, hybrid attention methods can only retain some advantages brought by a single attention type and fail to address the issue of incomplete attention. To avoid this problem, we have adopted a full-attention approach (Figure 3), utilizing a single attention map to capture both channel and spatial attention. This better reflects the relationships between different semantic features. This method effectively addresses the problem of attention deficiency and allows for more accurate kidney segmentation.  
Figure 2: The structure of multi-scale feature fusion module.  
The full-attention operation has three computational branches, each path is shown in Figure 4. Firstly, the feature \(F_{in}\) is input into the bottom Path 1, and \(\hat{Q}_{w}\) and \(\hat{Q}_{h}\) are obtained through two parallel paths. each path contains a global average pooling layer and a linear layer, and the pooling windows of the two paths are \(H\times 1\) and \(1\times W\), respectively, which helps to obtain richer information about the contextual prior and maintains the spatial consistency in the computation of the channel relations. Afterwards, \(\hat{Q}_{w}\) and \(\hat{Q}_{h}\) are repeated to form a global prior representing the horizontal direction \(Q_{w}\) and \(Q_{h}\) representing the vertical direction, which will be used to realize the spatial interactions in the corresponding dimensions. Furthermore, we cut \(Q_{w}\) along the \(H\) dimension and \(Q_{h}\) along the \(W\) dimension, followed by merging these two sets of slices in order to form the global context \(Q\ \in\ R^{(H+W)\times C\times S}\). In the same way, we can generate feature maps \(K,V\ \in\ R^{(H+W)\times C\times S}\).  
This enables each spatial location to receive a global a priori feature response from the same row and the same column through the operation \(P\), which named \(A\ \in\ R^{(H+W)\times C\times C}\). The \(P\) operation is defined as follows:  
\[P_{i,j}=\frac{\exp\big{(}Q_{i}\cdot K_{j}\big{)}}{\sum_{i=1}^{C}\exp\big{(}Q_ {i}\cdot K_{j}\big{)}}\, \tag{1}\]  
We then perform a matrix multiplication between \(A\) and \(V\) to update each channel map by the generated complete attention, multiply it by the scale parameter \(\alpha\), and perform an element-by-element summation operation with the input feature map \(F_{in}\) to obtain the final output \(F_{O}\ \in\ R^{C\times H\times W}\) as follows:  
\[F_{O_{j}}=\alpha\sum_{i=1}^{C}A_{i,j}\cdot V_{j}+F_{in_{j}}\, \tag{2}\]  
Figure 4: The process for constructing global context information. GAP stands for a global average pooling layer. Linear stands for a linear layer. Because H is equal to W, we use the letter ‘S’ to represent the merged dimension.  
Figure 3: The process of calculating full attention. Each of the three paths has the same construction step, forming global context Q by construction.  
Full attention helps to improve the discrimination of kidney features by constructing a global context in order to introduce spatial interactions into the channel attention maps, thus enabling the capture of full attention in a single attention map with more comprehensive contextual information.