# PAM-UNet: Enhanced Retinal Vessel Segmentation Using a Novel Plenary Attention Mechanism
## 2 Methods
### DropBlock_Diagonal  
The regularization method Dropout randomly discards some activation units during network training and is not applicable to convolutional layers containing spatial correlations. In 2018, [PERSON] et al. proposed DropBlock [39], which was designed and tested with a shared DropBlock mask across different channels. DropBlock discards some contiguous regions of the feature map to lose some semantic information (non-vascular or vascular regions) and uses the remaining activation units to learn the features of the input image, as shown in Figure 3. DropBlock controls the number of activation units to be dropped through \(\gamma\), which is calculated as shown in Equation (3). \[\gamma=\frac{(1-keep\_prob)\times(w\times h)}{block\_size^{2}\times(w-block\_ size+1)\times(h-block\_size+1)} \tag{3}\]  
where \(block\_size\) denotes the size of the discarded block, \(keep\_prob\) denotes the probability of retaining the activation unit, \(w\) denotes the width of the feature map, and \(h\) denotes the height of the feature map. Figure 3b shows the effect of Dropout, where the activation units are randomly discarded. This method does not effectively remove semantic information (vessel or non-vessel regions) because nearby activation units contain redundant information. In contrast, Figure 3c illustrates the effect of DropBlock, where consecutive regions are discarded. This approach effectively removes specific semantic information, thereby forcing the remaining activation units to learn and represent the features of the fundus image more accurately. Figure 2: Plenary attention mechanism. By observing the characteristics of retinal vessel data, it is evident that vascular direction is often intricate and tends to be angled. Therefore, by discarding the diagonal of the relevant region, the network is enabled to better learn vascular information. So, we propose DropBlock_Diagonal based on DropBlock. DropBlock_Diagonal controls the diagonal length using _diag_1_, _diag_type_ to control whether it is the primary diagonal or the secondary diagonal, and _num_diag_ to control the diagonal width. The specific implementation steps are shown in Algorithm 1. Similar to DropBlock, DropBlock_Diagonal also controls the number of dropped activation units using \(\gamma\), calculated according to the formula shown in Equation (4). In DropBlock, the area of the discarded region is represented by \(block\_size^{2}\). Following a similar approach, in DropBlock_Diagonal, we denote the area of the discarded region by \(\sqrt{2}diag\_1+2\sqrt{2}(\sum_{i=1}^{num\_diag}(diag\_1-i))\). Similar to \(block\_size^{2}\), \(\sqrt{2}diag\_1+2\sqrt{2}(\sum_{i=1}^{num\_diag}(diag\_1-i))\) denotes the number of pixel points in the discarded region. A DropBlock_Diagonal illustration is shown in Figure 4.  
\[\gamma=\frac{(1-keep\_prob)\times(w\times h)}{\sqrt{2}diag\_1+2\sqrt{2}(\sum_{ i=1}^{num\_diag}(diag\_1-i))\times(w-diag\_1+1)\times(h-diag\_1+1)} \tag{4}\]  
where \(keep\_prob\) denotes the probability of keeping the activation unit, \(w\) denotes the width of the feature map, and \(h\) denotes the height of the feature map. ```
1:Input: a layer output (\(A\)), \(diag\_1\), \(\gamma\), \(mode\), \(diag\_type\), \(num\_diag\)
2:if\(mode==Inference\)then
3: return \(A\)
4:end if
5:Random sampling of \(M\), \(M\): \(M_{i,j}\sim\) Bernoulli(\(\gamma\))
6:For each zero \(M_{i,j}\), generate diag_mask centered on \(M_{i,j}\). Generate diag_mask based on \(diag\_1\), \(diag\_type\), \(num\_diag\), and make \(C\) copies of it so that it is the same as the number of \(A\) channels. 7:Apply mask: \(A=A\times M\)
8:Regularize the feature map: \(A=A\times count(M)/count\_ones(M)\)
```  
**Algorithm 1**DropBlock_Diagonal  
In order to prevent the network from overfitting, DropBlock_Diagonal is added to the convolutional block. The convolutional block is illustrated in Figure 4(a).