# An Enhanced Feature Extraction Network for Medical Image Segmentation
## 3 Proposed Method
### Improved Skip-Connection
The improved skip-connection \(R\left(F^{E^{\prime}},F^{D^{\prime}}\right)\) can be formulated as follows:  
\[R\left(F^{E^{\prime}},F^{D^{\prime}}\right)=concat\left(F^{E^{\prime}}\odot \ op2(AV),op3\left(F^{D^{\prime}}\right)\right), \tag{5}\]The skip-connection \(R\left(F^{E^{\prime}},F^{D^{\prime}}\right)\) is related to the encoder and decoder. The final output of improved skip-connection is the result of \(concat(\bullet)\), which includes the output of cross attention and the result of \(op3\left(F^{D^{\prime}}\right)\). \(F^{E^{\prime}}\) is the input of the skip-connection and it comes from the encoder feature \(F^{E}\). \(F^{D^{\prime}}\) is another input of the skip-connection which comes from the decoder feature \(F^{D}\). \(\odot\) represents the pixel-wise multiplication operation. \(op2(\bullet)\) includes operations such as \(conv1\times 1\), batch normalization, Relu and up-sampling. \(op3(\bullet)\) involves up-sampling, one layer of \(conv3\times 3\), one layer of \(conv1\times 1\), batch normalization and Relu. \(AV\) establishes a correlation between each pixel of the input image. \(A\) is \(softmax(\bullet)\), which comes from the output features of each stage of the decoder part. The output features from the decoder are more purified, and it is more instructive to use the signal generated by those features to supervise the signal of skip-connection. In fact, \(A\) is the weights of cross-attention. \(F^{E^{\prime}}\), \(F^{D^{\prime}}\), \(A\) and \(V\) are obtained according to the following formulas:  
\[F^{E^{\prime}}=F^{E}+P\left(F^{E}\right), \tag{6}\]  
\[F^{D^{\prime}}=F^{D}+P\left(F^{D}\right), \tag{7}\]  
\[A=softmax\left( \begin{array}{c}QK^{T}\\ \hline d_{k}\end{array} \right), \tag{8}\]  
\[V=op1\left(F^{E^{\prime}}\right)W_{V}, \tag{9}\]  
where \(P(\bullet)\) in Equations (6) and (7) is the operation of positional encoding. \(Q\) and \(K\) in Equation (8) are calculated from \(F^{D}\), and they are obtained by multiplying \(F^{D}\) with the learnable parameters \(W_{Q}\) and \(W_{K}\) in the matrix, respectively. Of course, we also need some necessary dimensional transformation. \(d_{k}\) is the channel number of \(V\). \(W_{V}\) in Equation (9) is also a set of learnable parameters, \(op1(\bullet)\) includes max-pooling, \(conv1\times 1\), batch normalization and Relu, so the output feature map size of the \(op1\) will be halved. Each variable is shown in Figure 2.  
Figure 2: The improved skip-connection (ISC). The feature maps of different colors represent the results obtained by different ways of processing. In order to provide a detailed explanation of the contents, Box 1 presents the pseudocode for position encoding, while Box 2 presents the pseudocode for cross-attention. In Box 1, sequence_length represents the length of the input sequence, and d_model represents the hidden dimension of the model. This function returns a position coding matrix with the shape of (sequence_length, d_model). The position coding uses sine and cosine functions to generate coded values for each position in the sequence. The coded value for each dimension is generated using both a sine function and a cosine function, and the frequency and offset are calculated by div_term. Then, according to the parity of position and dimension, the sine coding value and cosine coding value are assigned to the corresponding positions of the position coding matrix, respectively. The position coding matrix can be added to the embedding vector of the input sequence to combine positional and semantic information. In this way, the model can better understand the relevance and importance of different positions in the sequence through the self-attention mechanism. The query and key in Box 2 are derived from the same tensor and are multiplied to calculate the similarity. The model can assign a weight corresponding to the key to each query and use these weights to sum the value to obtain the final representation.