## 2 Materials and Methods
### Methodology
#### 2.2.3 Modeling  
Segmentation of UT Projections  
The results of the convolutional neural network for image segmentation were compared to the performance of more conventional segmentation algorithms.  
* Global thresholds: different values for global segmentation of the projections were applied. The pixel values of the ultrasonic projections were normalized between [0, 1], and the thresholds were in the range [0.25, 0.4] with a 0.05 step. We also explored local segmentation algorithms such as Sauvola, but their results were found to be too noisy.
* Network architecture: the network is a slightly modified version of the one shown in [37]. The hyperparameters are shown in Table 1. The proposed network has four convolutional layers with two max-pooling layers and three FC layers. The network architecture is illustrated in Figure 3. It was trained from scratch using extracted patches. Convolutional layers have a 3 \(\times\) 3 kernel, stride 1, and no padding. Max pooling is performed with a 2 \(\times\) 2 window and stride 2. All the hidden layers, except the output units, are equipped with rectified linear units (ReLU).  
We also explored local segmentation algorithms such as Sauvola, but their results were found to be too noisy.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Labels** & **Ratio** & **Epoch** & **h** & **s** \\ \hline Manual & 11 & 20 & 5 & 1 \\ \hline XCT & 6 & 25 & 5 & 1 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Table of hyperparameters for each type of label.  
Figure 3: Diagram of the CNN structure. The leftmost image is the input patch with one channel. Other cubes indicate the feature maps obtained from convolution (Conv) or max pooling. All convolutional layers have a kernel of \(3\times 3\), stride 1 and zeros padding. Max pooling is performed with stride 2 over a \(2\times 2\) window.  
Training and Testing  
In a situation where there are multiple labels, the output units are not necessarily exclusive. This means that there can be more than one positive output at the same time. To handle this scenario, the binary cross-entropy is utilized in the loss function. The binary cross-entropy is defined as:  
\[L=-\frac{1}{N}\sum_{i=1}^{N}y_{i}\log(\hat{y}_{i})+(1-y_{i})\log(1-\hat{y}_{i}) \tag{2}\]  
where \(N\) is the number of samples in the dataset, \(y_{i}\) is the true label of the \(i\)th sample (either 0 or 1), \(\hat{y}_{i}\) is the predicted probability of the \(i\)th sample belonging to the positive class (being a void), and log is the natural logarithm. No regularization was used in the network.  
Data augmentation consisting uniquely in rotation of the training dataset was used. The dropout technique is an easy and efficient way to prevent overfitting. While training a neural network, some hidden neurons are randomly assigned a value of zero. This technique is applied to the first two fully connected (FC) layers, and the dropout ratio is set to 0.5. Weights in convolutional layers and FC layers are initialized using the Xavier method. [PERSON] is adopted as the optimizer with a learning rate set to 0.01 and decaying to 0.002 from the ninth epoch onwards. The batch size for each iteration is set to 1256.  
Evaluation  
As mentioned under the methodology, the evaluation was performed on a set of 2D projections (see Figure 1). Using this approach, it is possible to calculate precision \((Pr)\), recall \((Re)\), F1 score \((F1)\), and intersection over union (IoU), which are defined as follows.  
\[Pr=\frac{TP}{TP+FP}\] \[Re=\frac{TP}{TP+FN}\] \[F1=\frac{TP}{2 TP+FN+FP}\] \[IoU=\frac{TP}{TP+FN+FP}\]  
Being  
* False positive (FP): negative class predicted as positive.
* True positive (TP): positive class predicted as positive.
* True negative (TN): negative class predicted as negative.
* False negative (FN): negative class predicted as positive.