# COMA: Propagating Complementary Multi-Level Aggregation Network for Polyp Segmentation
## 2 Materials and Methods
### Hybrid Loss Function  
We employ hybrid loss to constrain the area, boundary, and noisy annotations in the loss function as follows: \(\mathcal{L}=\alpha*E_{BCE}^{w}+\beta*\mathcal{L}_{IoU}^{w}+\gamma*\mathcal{L} _{L1}\). In medical image segmentation tasks, binary cross entropy (BCE) and IoU losses are adopted extensively to impose local and global constraints. The BCE and IoU losses consider all pixels to make equal contributions [29]. That is, because colonoscopy images contain more background than polyp regions, a class imbalance problem can occur. To prevent this imbalance, we utilize the weighted BCE (wbce) and IoU (wIoU) losses, which focus on hard pixels, as demonstrated in previous study [29]. The weighted loss uses \(\lambda\) to calculate the importance of each pixel, and \(\lambda_{ij}\) is calculated as follows:  
\[\lambda_{ij}=\left|\frac{\sum\limits_{h,w\in A_{ij}}y_{h,w}}{\sum\limits_{h,w \in A_{ij}}1}-y_{ij}\right| \tag{5}\]  
Here, \(A_{ij}\) refers to the area surrounding the target pixel \((i,j)\). The value of \(\lambda_{ij}\) is larger when it is placed at the boundaries of the polyp compared to the center of the polyp. Thus, the weighted loss allows the network to focus on the boundary regions. For example, wbce loss is given by Equation (6). Here, \(y\) and \(\hat{y}\) indicate the ground truth and prediction of each pixel, respectively. The notation \(c\in\{0,1\}\) refers to binary classes. \(\gamma\) is a hyper-parameter and is set to 5 as in previous study [29]. In wbce, the importance of each pixel is assigned using weight \(\lambda_{ij}\). As a result, the network can focus more on the local structures at the boundaries than using the BCE.  
\[\mathcal{L}_{BCE}^{\varpi}=-\frac{\sum\limits_{i}^{H}\sum\limits_{j}(1+\gamma \cdot\lambda_{ij})\sum\limits_{c=0}^{1}(y_{c}log(\hat{y}_{c})+(1-y_{c})log(1- \hat{y}_{c}))}{\sum\limits_{i}^{H}\sum\limits_{j}(1+\gamma\cdot\lambda_{ij})} \tag{6}\]  
In contrast, the wIoU loss detects the global structure of the polyp rather than individual pixels based on the pixel importance \(\lambda_{ij}\).  
\[\mathcal{L}_{IoU}^{w}=1-\frac{\sum\limits_{i}^{H}\sum\limits_{j}^{W}(y_{ij} \hat{y}_{ij})(1+\gamma\cdot\lambda_{ij})}{\sum\limits_{i}^{H}\sum\limits_{j}(y _{ij}+\hat{y}_{ij}-y_{ij}\hat{y}_{ij})(1+\gamma\cdot\lambda_{ij})} \tag{7}\]  
Moreover, we consider the L1 distance loss to be robust to noisy labels [30; 31], which often occurs when annotating in segmentation tasks, so that the model converges robustly and reliably on noisy annotations.  
\[\mathcal{L}_{\text{L1}}=\frac{1}{H\times W}\sum\limits_{i}^{H}\sum\limits_{j }^{W}|y_{ij}-\hat{y}_{ij}| \tag{8}\]  
We provide the ablation studies exploring different combinations by calibrating the loss weights (i.e., \(\alpha\), \(\beta\), and \(\gamma\)) in Section 4.4.2. Moreover, existing study [27] revealed that explicitly using the dependency of both region and boundary causes an overfitting problem; however, we avoid this issue by applying independent boundary loss and data augmentations. Based on the hybrid loss, the final loss is calculated using the deep supervision maps as follows:  
\[\mathcal{L}_{final}=\sum\limits_{i=1}^{5}\mathcal{L}(GT,DS_{i})+\mathcal{L}( GT_{B},B) \tag{9}\]  
As we combine three different loss functions, we investigate the effectiveness of each and their contributions to the performance improvement in Section 4.4.