# Attention-Based Two-Branch Hybrid Fusion Network for Medical Image Segmentation
## 3 Method
### Attentional Feature Fusion Module
The specific computational expressions are detailed in Equations (12) and (13):  
\[m=\sigma(MLP(AvgPool(\tau_{4}))+MaxPool(\tau_{4})) \tag{12}\]  
\[\hat{t}_{i}=Channel\,Attention(t_{i}),i=1,2,3,4 \tag{5}\]0  
where \(\sigma\) represents the sigmoid activation function and \(f^{7\times 7}\) signifies a convolutional layer with a 7 \(\times\) 7 convolutional kernel. The global attention upsampling module (GAU) subsequently extracts the high-level features' global contextual information by employing these features to guide the weighted computation of the low-level features through a global pooling operation. The number of channels in the CNN feature map is reduced when a 3 \(\times\) 3 convolution is applied to the low-level features. The high-level features generate a global context, which is then multiplied by the low-level features after being processed by a 1 \(\times\) 1 convolution with batch normalization and ReLU nonlinearity. Ultimately, the high-level features are added to the weighted low-level features and undergo a progressive upsampling process. \[\hat{t}_{i}=Channel\,Attention(t_{i}),i=1,2,3,4 \tag{5}\]1  
\[\hat{t}_{i}=Channel\,Attention(t_{i}),i=1,2,3,4 \tag{5}\]2  
where Conv is a 3 \(\times\) 3 convolutional layer, \(\delta\) denotes the relu activation function, and GAP denotes global average pooling. Ultimately, l scm will achieve a twofold increase in resolution and a 50% reduction in channel size, or maintain quadruple resolution and channel size, during the upsampling process by employing a cross-scale extension layer instead of the downsampling and patch merging layer. The cross-scale extension layer within \(AtFF_{1}\) amplifies the resolution of the input features to quadruple \((h_{i}\times w_{i}\times dim_{i}\longrightarrow 4h_{i}\times 4w_{i}\times dim _{i})\). In contrast, within \(AtFF_{2,3,4}\) the input features' resolution is transformed from \(h_{i}\times w_{i}\times dim_{i}\) to \(2h_{i}\times 2w_{i}\times dim_{i}/2\). Consequently, the proposed cross-scale expansion layer (csel) can be expressed as follows:  
\[\hat{t}_{i}=Channel\,Attention(t_{i}),i=1,2,3,4 \tag{5}\]3where T represents all transposed convolutions in total. We set T to 4 in \(AttrF_{1}\), and T to 2 in \(AttrF_{2,3,4}\). Given that \(AttrF_{4}\) serves as the initial upsampling block, it lacks input from any preceding module. Therefore, the computation of the \(AttrF_{4}\) module proceeds as follows:  
\[\hat{t}_{i}=Channel\,Attention(t_{i}),i=1,2,3,4 \tag{5}\]4  
The calculation of \(AttrF_{2,3}\) module is shown in Equation (17):  
\[ \begin{split} l_{i}=concat\Big{[}transpose_{t}\big{(}SCM\big{(}\hat{t}_{i}+\hat{r}_{i},l_{i+1}\big{)} \big{)}_{t=1}^{T}\Big{]}\\ l_{i}\in\mathbb{R}^{\frac{k}{2}\times\frac{k}{2}\times 2^{i-2} \epsilon},\;\;i=2,3\end{split}  \tag{17}\]  
And the calculation of \(Attr_{1}\) module is shown in Equation (18):  
\[l_{1}=concat\Big{[}transpose_{t}\big{(}SCM\big{(}\hat{t}_{i}+\hat{r}_{i},l_{2} \big{)}\big{)}_{t=1}^{T}\Big{]},l_{1}\in\mathbb{R}^{h\times w\times c} \tag{18}\]  
where SCM is the skip connection and \(t_{i}\) and \(r_{i}\) are the features in the CNN and Transformer branches in stage i, respectively. The result of \(AttrF_{i}\) is \(l_{i}\). Following the output from the \(Attr_{1}\) module, a linear projection (LP) layer is implemented to accomplish pixel-level segmentation of the image x.  
\[l_{0}=Segmentation(x)=LP(l_{1}) \tag{19}\]  
The complete process of GLFUnet is shown in Algorithm 1:  
```
Input: The image to be segmented x, the training batch size, learning rate, momentum, max epoch. Output: Trained network model.