# Uncertainty-Aware Adaptive Multiscale U-Net for Low-Contrast Cardiac Image Segmentation
## 2 Materials and Methods
### Dynamic Saliency U-Net
#### 2.2.1 Contextual Dynamic Encoder (CDE)
The \(r_{l-1}\) of layer \(l-1\) can be calculated using the following equation:  
\[r_{l-1}=\text{ReLU}(DF(x_{l-1})), \tag{4}\]  
where \(x_{l-1}\) is the input to layer \(l-1\), and DF represents the deformable convolution operation performed by the feedforward weights. A modulation network which comprises two sequential deformable convolutions computes a set of modulation weights \(mw_{l-1}\) based on the output \(r_{l-1}\):  
\[mw_{l-1}=\sigma(DF_{1\times 1}(DF_{1\times 1}(r_{l-1}))) \tag{5}\]  
Figure 2: Overall structure of CDE encoder block, along with Modulated Predictive Coding Module (MPCM), used in our model. The modulation weights \(mw_{l-1}\) are applied to \(r_{l-1}\) to compute the modulated input \(\bar{r}_{l-1}\) for layer \(l\):  
\[\bar{r}_{l-1}=r_{l-1}\odot mw_{l-1}. \tag{6}\]  
The modulated input \(\bar{r}_{l-1}\) is then processed by layer \(l\) to produce the representation \(r_{l}^{t}\), which also undergoes ReLU activation after the deformable convolution:  
\[r_{l}^{t}=\text{ReLU}(DF(r_{l-1})) \tag{7}\]  
where \(r_{l}^{t}\) denotes the representation at layer \(l\) before any feedback adjustments. The prediction \(p_{l-1}(t)\) of the previous layer at the \(r_{l}^{t}\) layer and subsequent prediction error \(e_{l-1}(t)\) is then calculated as follows:  
\[ \begin{split}& p_{l-1}(t)=(W_{l,l-1})^{T}r_{l}(t)\\ & e_{l-1}(t)=r_{l-1}-p_{l-1}(t)\end{split}  \tag{8}\]  
where \(W_{l,l-1}\) is the feedback layer weights, which are obtained by feedback convolution operation, and T is the iterative cycle. The \(r_{l}^{t}\) layer is then updated with the prediction error using the feedforward deformable convolution operation as follows:  
\[r_{l}^{t}=r_{l}^{t}+\alpha_{l}FF\,\text{conv}(e_{l-1}(t)) \tag{9}\]  
where \(\alpha_{l}\) is the hyperparameter to balance the update. Figure 3 shows the structure of the DMSA module, which is designed to enhance the CDE by providing a more robust and adaptive attention mechanism that can dynamically focus on the most relevant features across both channels and spatial dimensions. Our proposed method utilized dynamic convolutions which can adapt its filters to the specific content of an input image, potentially leading to more effective feature enhancement compared to static filters. Moreover, the integration of Spatial Pyramid Pooling (SPP) enables the module to capture information at various scales and resolutions, providing a rich representation of the spatial context. Therefore. DMSA offers a comprehensive recalibration of the feature space that can lead to improved performance on tasks requiring detailed feature discrimination. DMSA consists of two blocks, the channel and spatial blocks. The detailed description is discussed below. Figure 3: The overall structure of the proposed DMSA module used in the encoder block. Channel Attention Mechanism  
The module begins by extracting channel-wise statistics from the input feature map \(F\) using Global Average Pooling (GAP) and Global Max Pooling (GMP):  
\[F_{\text{avg}}=GAP(F),F_{\text{max}}=GMP(F) \tag{10}\]  
where \(F_{\text{avg}},F_{\text{max}}\in\mathbb{R}^{1\times 1\times C}\). These outputs from GAP and GMP are then dynamically processed using separate dynamic convolutional layers, allowing the module to generate adaptive filters for each instance:  
\[ \begin{split} D_{\text{avg}}&=\text{DynamicConv} \big{(}F_{\text{avg}}\big{)}\\ D_{\text{max}}&=\text{DynamicConv}(F_{\text{ max}}),\end{split}  \tag{11}\]  
where \(D_{\text{avg}}\), \(D_{\text{max}}\) are the dynamically convolved features.