# Deep Ensembles Based on Stochastic Activations for Semantic Segmentation
## 3 Results on Colorectal Cancer Segmentation  
### Datasets, Testing Protocol, and Metrics  
All the experiments on colorectal cancer segmentation have been carried out on the Kvasir-SEG dataset [16] which includes 1000 polyp images acquired by a high-resolution electromagnetic imaging system, with a ground-truth consisting of bounding boxes and  
Figure 1: Pseudocode of the procedures for stochastic activation selection.  
segmentation masks. For a fair comparison with other approaches as [17,23] we use the following testing protocol: 880 images are used for training and the remaining 120 for testing.  
The image sizes varied between 332 \(\times\) 487 and 1920 \(\times\) 1072 pixels. For training purposes, the images were resized to the input size of each model, but for performance evaluation, the predicted masks were resized back to the original dimensions (please note that other approaches evaluated performance on the resized version of the images).  
We trained our models with an SGD optimizer for 20 epochs, a learning rate of 0.01 with a drop period of 5 and drop factor 0.2, momentum 0.9, L2 regularization 0.005 (see the code for details) using the Dice loss function and data augmentation.  
Several metrics were proposed in the literature to evaluate the performance of image segmentation models. We report metrics for segmentation in two classes (foreground/background), which are suited to the polyp segmentation problem. Regardless, they can be easily extended to multiclass problems. The following metrics are the most popular to quantify model performance. All the following definitions hold for single images and are defined pixel-wise:  
* Accuracy/precision/recall/F1-score/F2-score can be defined for a bi-class problem (or for each class in the case of multiclass) starting from the confusion matrix (TP, TN, FP, and FN refer to the true positives, true negatives, false positives, and false negatives, respectively) as follows: \[Accuracy=\frac{\text{TP}+\text{TN}}{\text{TP}\;+\;\text{FP}\;+\;\text{FN}+ \text{TN}}\] (1) is the number of pixels correctly classified over the total number of pixels in the image. \[Precision=\frac{\text{TP}}{\text{TP}\;+\;\text{FP}}\] (2) is the fraction of the \"polyp\" that is correctly classified. \[Recall=\frac{\text{TP}}{\text{TP}\;+\;\text{FN}}\] (3) is the fraction of the \"polyp\" predictions that were actually \"polyp\" pixels. \[F1-score=\frac{\text{2}\cdot\text{TP}}{\text{2}\cdot\text{TP}\;+\;\text{FP} \;+\;\text{FN}}\] (4) \[F2-score=\frac{\text{5}\cdot Precision\cdot Recall}{\text{4}\cdot Precision+ Recall}\] (5) are two measures that try to average precision and recall.
* Intersection over union (IoU): IoU is defined as the area of intersection between the predicted segmentation map A and the ground-truth map B, divided by the area of the union between the two maps: \[IoU=\frac{|A\;\cap\;\;B|}{|A\;\cup\;\;B|}=\frac{\text{TP}}{\text{TP}\;+\; \text{FP}\;+\;\text{FN}}\] (6)
* Dice: The Dice coefficient is defined as twice the overlap area of the predicted and ground-truth maps divided by the total number of pixels. For binary maps, with foreground as the positive class, the Dice coefficient is identical to the F1-score: \[Dice=\frac{|A\;\cap\;\;B|}{|A|+|B|}=\frac{\text{2}\cdot\text{TP}}{\text{2} \cdot\text{TP}\;+\;\text{FP}\;+\;\text{FN}}\] (7)* All the above-reported metrics range in [0, 1] and must be maximized. The final performance is obtained averaging on the test set the performance obtained for each test image.