# Multi-Path Recurrent U-Net Segmentation of Retinal Fundus Image
## 3 Methodology
### Recurrent Unit  
The recurrent unit design in this method is inspired by the gate recurrent unit (GRU) [37]. The encoder represents the input image as a fixed-length vector. Since the proposed method is a multi-path encoder, the vectors output by each path can be serialized. The sequence is then filtered through a recurrent unit to output a new sequence vector, and the encoder uses these sequence vectors to reconstruct the target image. Therefore, this article modifies the GRU equation accordingly, but retains the original purpose of the GRU, as shown in Figure 3c.  
In the \(t\)-\(th\) iteration, this article first obtains the two gating states by the previous hidden state \(h_{t-1}\) and the current node input \(x_{t}\), resets the gate and updates the gate; see Equations (1) and (2).  
\[r_{t}=\sigma(conv(x_{t},h_{t-1}]) \tag{1}\]  
\[z_{t}=\sigma(conv(x_{t},h_{t-1}]) \tag{2}\]  
where \(r_{t}\) indicates reset gating and \(z_{t}\) indicates update gating. \(\sigma()\) represents the sigmoid activation function. Through this function, the data can be transformed into a value in the range of 0-1, thereby serving as a gating signal. \([]\) represents the concatenation of two vectors. \(conv()\) represents a \(1\times 1\)convolution operation. The initial weights of \(conv()\) in these two gates are different. After obtaining the reset gating information, we aim to generate a candidate update \(f_{t}\) through the tensor combination of \(r_{t}\) and hidden state \(h_{t-1}\) with the current input \(x_{t}\). At this time, \(f_{t}\) contains the current input \(x_{t}\), and \(f_{t}\) is added to the current hidden state in a targeted manner, and the information at the current time is retained; see Equation (3).  
\[f_{t}=tanh(conv(\{x_{t},(r_{t}\odot h_{t-1})\})) \tag{3}\]  
where \(tanh()\) represents the Tanh activation function, which shrinks the data to the range of \(-1\sim 1\). \(\odot\) indicates that the corresponding elements in the operation matrix are multiplied, so the two multiplication matrices are required to be of the same type. The hidden state \(h_{t}\) at the current moment is obtained according to the information of the update gate and the candidate update \(f_{t}\). The operation of this step is performed to forget some of the dimensional information passed by \(h_{t-1}\) and add some dimensional information input by the current node. This is shown in Equation (4).  
\[h_{t}=f_{t}\odot z_{t}\oplus h_{t-1}\odot(1-z_{t}) \tag{4}\]  
where \(\oplus\) represents the matrix addition operation.  
Finally, according to the hidden state \(h_{t}\) at the current moment, we input \(h_{t}\) to the basic convolution block to obtain the output feature map of the \(t-th\) recurrent unit as the input of the corresponding position decoder, as shown in Equation (5).  
\[o_{t}=CB(h_{t}) \tag{5}\]  
\(CB()\) represents the basic convolution block used in this paper. In contrast to GRU, the RU in the proposed method uses \(1\times 1\) convolution in each gate to further abstract the feature, and uses the current concealed state as the output of the recurrent unit through the basic convolution block. Compared with the original U-Net, this allows us to extract a large number of features without having to increase the number of channels in the encoding and decoding layers.  
Figure 3: Multi-path recurrent U-Net structure and detailed internal structure of the model. (**a**) is the Multi-path recurrent U-Net structure; (**b**) is the basic convolution block; (**c**) is recurrent unit; (**d**) is a recurrent unit with an attention gate; (**e**) is the structure of the attention gate in the recurrent unit.