# Deep Learning-Based Methods for Prostate Segmentation in Magnetic Resonance Imaging
## 2 Materials and Methods
### Training Methodology  
Due to a limited amount of data, the k-fold cross-validation strategy was applied by randomly dividing the dataset into k sub-datasets of equal size (17 patients, k = 5). For each network, we trained k models by combining k-1 folds into the training set and keeping the remaining fold as a holdout test set. Despite the fact that 2D models were considered, slices from the same study were never used for both training and testing purposes. So, there was no cross-contamination between training and test sets. Moreover, the data augmentation technique was applied in six different modalities to increase the statistic. Additionally, data standardization and normalization were adopted to prevent the weights from becoming too large, to make the model converge faster, and to avoid numerical instability. Regarding loss function, prostate segmentation suffers from the imbalanced data problem because there are very few examples of the positive class compared to the background or negative class. In terms of image segmentation, the target (i.e., the prostatic region) is small compared to the background, which may be composed of many different organs or types of tissue exhibiting a wide range of intensity values. Some slices may have a very small target area compared to the background. This makes it hard for the DL to learn a reliable feature representation of the foreground class. In such cases, the networks tend to simply predict most voxels as belonging to the background class. To deal with this problem, various loss functions have been proposed over the years. These loss functions typically aim to solve the class imbalance problem by providing a larger weight to foreground voxels. This translates to a higher penalty in the loss function for foreground voxels that are misclassified by the network leading to the network being able to learn the foreground object representation more effectively. One such loss function which the authors of this paper have experimentally determined to be better suited for the biomedical image delineation process is the Tversky loss function [50]. Specifically, the Dice similarity coefficient (DSC) between \(P\) and \(G\) is defined as:  
\[\text{DSC}=\frac{2|P\cap G|}{|P|+|G|} \tag{1}\]  
where \(P\) and \(G\) are the predicted and ground truth labels. DSC measures the overlap between \(P\) and \(G\) and is used as a loss function in many DL approaches. Nevertheless, DSC is the harmonic mean of false positives and false negatives and weighs both equally. To modify their weights, the Tversky index [51] was proposed as:  
\[S(P,G;\alpha\ \beta)=\frac{|P\cap G|}{|P\cap G|+\alpha|P\backslash G|+\beta|G \backslash P|} \tag{2}\] \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer (Type)** & **Output Shape** & **Parameters Number** \\ \hline input\_1 (InputLayer) & (None, 512, 512, 1) & 0 \\ \hline conv2d\_1 (Conv2D) & (None, 256, 256, 15) & 150 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The model parameters and shape output after the first hidden layer in the ENet model for a given provided input image (Patient #7 slice #20). \(\alpha\) and \(\beta\) control the penalty magnitude of false positives and false negatives. Using this index, the Tversky loss [50] is defined as:  
\[T(\alpha\ \beta)=\frac{\sum_{i=1}^{N}p_{0i}\ g_{0i}}{\sum_{i=1}^{N}p_{0i}\ g_{0i}+ \alpha\sum_{i=1}^{N}p_{0i}\ g_{1i}+\beta\sum_{i=1}^{N}p_{1i}\ g_{0i}} \tag{3}\]  
Additional information about the study design is shown in Figure 1.  
Starting from 16 patients, the best learning rates for each network were determined experimentally. We used a learning rate of 0.0001 for ENet, 0.00001 for ERFNet, and UNet with Adam optimizer [52]. A batch size of eight slices, \(\alpha\) and \(\beta\) of 0.3 and 0.7, respectively for the Tversky loss function, were identified. All the models were allowed to train for a maximum of 100 epochs with an automatic stopping criteria of ending training when the loss did not decrease for 10 epochs continuously.