## 3 Materials and Methods
### Proposed Method
#### 3.2.3 Ensemble  
The dual-attention mechanism provides a robust focus on the feature maps. At the same time, the multi-scale approach generates detailed versions of the encoded feature maps at varying sizes, ensuring precise feature extraction. The Ensemble technique significantly improves the system's resilience to fluctuations in size and intensity. Tiles and patches are handled at varying scales, as shown in Figure 7. The feature maps obtained by the encoder are segmented into tiles and patches of differing dimensions across different scales. Larger tiles and patches provide a broader view of the image, while smaller ones focus on finer details, enabling feature extraction at multiple resolutions. Each collection of tiles and patches thereafter passes a dual-attention mechanism that analyzes features within these segmentations to determine areas pertinent to tumor segmentation and allocates suitable weights to various features.  
The outputs from the attention mechanisms for each scale represent regions of interest within the feature maps. The outputs of these attention functions are then combined (or ensembled), taking the weight from each scale and merging all of them into a single representation. The integration of local and global information reduces the reliance on local information and improves the model's ability to segment tumors in liver CT images.  
For these patch and tile sizes, we use 32 \(\times\) 32 and 64 \(\times\) 64 for the patch and 32 \(\times\) 48 and 64 \(\times\) 96 for the tile. These dimensions ensure comprehensive feature extraction across multiple scales through excellent feature extraction in terms of different levels of detail and context at the input image level.  
Adaptive ensembling can enhance the integration of attention outputs obtained from processing tiles and patches at different scales. This method enables the model to selectively integrate information from scales that most significantly enhance correct segmentation. An adaptive weighting approach exerts an increased effect on attention outputs from higher-performing or more pertinent scales in the final ensemble. Conversely, less informative scales are diminished in importance or omitted. This technique allows the model to utilize the advantages of varied perspectives obtained at different scales, especially at the intricate interfaces of the liver and liver cancers.  
Figure 7: Ensemble mechanism of tiles and patches.  
The formula for adaptive ensembling is expressed as follows:  
\[\text{E}=\sum_{i=1}^{n}wi\times Ai \tag{4}\]  
where E represents the ensembled attention output, \(n\) is the number of scales, _Ai_ is the attention output at scale \(i\), and _wi_ is the adaptive weight assigned to each attention output.  
Dynamically, the amount of contribution of each scale to the final ensembled output is changed based on a threshold calculated from the average weights, based on which the adaptive weights _wi_ are determined. This equation captures the heart of the adaptive ensembling process, which is to combine the attention outputs from each of the scales in a weighted fashion to end up with a unified representation of the regions of interest across all scales.