## 2 Method
### Segmentation Network  
**Feature Extraction--**First, feature maps are generated for the input images using the encoder structure of UNet 3+ as a feature extractor. We are given an image \(x\in\mathbb{R}^{H\times W\times C}\) with the spatial resolutions \(H\), \(W\) and \(C\). The preprocessed image \(x\) is fed into the network and the encoder applies a series of convolutional blocks to model the pixel-level contextual representations, with features progressively downsampled to \(\frac{H}{16}\times\frac{W}{16}\).  
**Transformer--**To extract the global features, the Transformer module is applied in the encoder design. Because Transformer is not as efficient as UNet 3+ when it comes to capturing regional features, patch embedding is directly used for patches generated from the UNet 3+ feature maps rather than from raw images. Then patches \(x_{p}\) are mapped into a K-dimensional embedding space by a trainable linear projection. To preserve location information, specific position embeddings \(E_{pos}\) are added to the patch embeddings when encoding the patch spatial information. Details are as follows:  
\[z_{0}=\left[x_{p}^{1}E;x_{p}^{2}E;\cdots;x_{p}^{N}E\right]+E_{pos}, \tag{1}\]  
where \(E\in\mathbb{R}^{\left(P^{2}\cdot C\right)\times K}\) is the patch embedding projection, \(E_{pos}\in\mathbb{R}^{N\times K}\) denotes the position embedding, and \(x_{p}^{1},\cdots,x_{p}^{N}\) are image patches.  
Then, a stack of Transformer blocks consisting of alternating layers of multi-head self-attention (MSA) and multi-layer perceptron (MLP) blocks are used to learn the long-range context representation. Layer normalization (LN) is used before each block, and residual connections are used after each block. The following can be expressed as the output of the \(i\)-th layer:  
\[z_{i}^{\prime}=MSA(LN(z_{i-1}))+z_{i-1}, \tag{2}\]  
\[z_{i}=MLP\Big{(}LN\Big{(}z_{i}^{\prime}\Big{)}\Big{)}+z_{i}^{\prime}, \tag{3}\]  
where \(LN(\cdot)\) represents the layer normalization operator, \(i\in\{1,2,\cdots,L\}\) where \(L\) is the number of Transformer layers and \(z_{i}\) denotes the image representation of the encoded output of the \(i\)-layer Transformer.  
**Decoder--**To generate segmentation masks and SDM in the raw image space, a decoder for UNet 3+ is introduced to perform feature upsampling. Since the output of the Transformer is sequential data, its output should first be recovered to spatial order. The encoded feature representation \(z_{i}\in\mathbb{R}^{N\times K}\) is reshaped into \(z_{i}\in\mathbb{R}^{\frac{H}{P}\times\frac{W}{P}\times K}\) where \(p\) is the size of each patch, and then the channel dimension is reduced by a \(3\times 3\) convolution block. In addition, each decoder layer in the decoder combines the feature maps of all encoders. Additionally, the full-scale deep supervision proposed by UNet 3+ is used to learn hierarchical representations from the full-scale aggregated feature maps, and the output from each decoder stage is supervised by the ground truth (GT). To achieve deep supervision, a \(3\times 3\) convolution block, a bilinear upsampling, and a sigmoid function are added to the last layer of each decoder stage in the network. To generate the SDM, the network adds an SDM head at the last decoder stage, which consists of a convolution block and tanh activation.