## 3 Materials and Methods
### Proposed Method
#### 3.2.2 Proposed Residual Dual-Attention Mechanism  
The core idea of the proposed dual-attention mechanism is to apply two types of attention to the same feature map, achieving a more comprehensive representation. Instead of relying on one kind of attention, the feature map is processed in parallel: one path employs layered attention, processing the feature map through multiple layers, while the  
Figure 4: The structure of the UNet model. Figure 5: Residual UNet Model with attention. other path applies direct attention without additional layers. The dual-attention mechanism aims to extract the most relevant features by leveraging layered and direct attention. This mechanism balances potential under- or over-attention by combining these two sets of attention weights, creating a more stable and robust feature representation. This fusion process enhances the model's ability to accurately segment tumors in liver CT images by ensuring that attention is neither too sparse nor too concentrated. The dual-attention mechanism is applied to tiles and patches of the feature maps at different scales. Each tile and patch undergo layered and direct attention, fusing the resulting weights. This ensures that attention is effectively distributed across various regions and scales, improving overall segmentation accuracy. The model benefits from this balance of layered and direct attention, leading to robust and accurate feature representations for tumors in liver CT images. To identify small segmentation areas accurately, the model divides images into patches and tiles. In the patch-based mode, the mechanism performs local-level feature extraction on finer-grained details in different image regions. On the other hand, the tile-based mode operates in the middle level, extracting higher-level information covering many patches. Figure 6 illustrates the integration of local details and global context-based implications of the hierarchical feature extraction approach. It takes the outputs from the patch-based and tile-based mechanisms and combines and feeds them to the decoder for further processing. For instance, the decoder uses the tile-derived features and the broader context and leverages the detailed local analysis from patch-derived features. In addition, the original features are incorporated to provide a global perspective. To reduce the impact of vanishing gradients, a skip connection between the encoder and decoder is used within the RDAM block. Stabilizing the attention components with this connection also increases the feature extraction process, which ultimately improves the segmentation accuracy. The model comprehensively understands the input image by combining local and global information for precise pixel-level classification. The model then uses a SoftMax classifier to perform a proper classification. The refined features from  
Figure 6: The structure of the residual dual-attention mechanism. attention mechanisms are used to assign probabilities to each pixel by this classifier to differentiate tumor and non-tumor pixels with high fidelity. The working method of the residual dual-attention mechanism is as follows:
* Separation into Different Scales The residual dual-attention mechanism starts by segmenting the input feature map into distinct and non-overlapping scales. This allows the model to capture information at different levels of granularity, enhancing its ability to identify patterns and features within the data. * ReLU Activation and Batch Normalization After the separation, Rectified Linear Unit (ReLU) activation and Batch Normalization are applied. ReLU introduces non-linearity to the model, enabling it to learn complex data relationships. Batch Normalization helps stabilize and speed up the training by normalizing the input for each layer. * Softmax for Attention Weights The processed features are passed through a softmax function to derive attention weights.