## 3 Materials and Methods
### Model for Segmentation of Amastigotes  
The proposed segmentation model performs the segmentation of amastigotes in blade field images. The U-Net [33] architecture was applied for the segmentation of parasites, as it is widely used in medical image segmentation [17; 42; 43]. This architecture seeks to automatically identify the pixels of interest in the image based on the binary masks containing the specialist's notes. In this case, the pixels of interest contain _Leishmani_ parasites.  
This architecture was used to perform training with images and their corresponding binary masks. The balanced dataset was used to train the segmentation model, as described in Table 3. Table 4 presents the hyper-parameters used by the model.  
Within the scope of this study, the U-Net network is used to predict the presence of parasites, particularly in identifying the area of amastigotes in an image. This network can locate and distinguish edges and classify each pixel of the image, allowing precise segmentation of amastigotes. The U-Net is composed of two main parts: the contraction path, also known as the encoder, which captures the general characteristics of the original image, and the symmetrical expansion path, also called the decoder, which allows the precise location of the amastigotes by through the use of transposed convolutions [33].  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Hyper-Parameter** & **Best Value** & **Values of** \\  & **of Hyper-Parameter** & **Tested Hyper-Parameters** \\ \hline Input dimensions & 96 \(\times\) 96 & [96 \(\times\) 96, 128 \(\times\) 128, \\  & 256 \(\times\) 256, 512 \(\times\) 512] \\ Dropout & 0.1 & [0.1, 0.2] \\ Activation function in the output layer & Sigmoid & - \\ Optimizer & Adam & - \\ Total training epochs & 100 & - \\ Initial learning rate & 0.001 & [0.001, 0.0001, 0.00001] \\ Minimum learning rate & 0.000001 & [0.00001, 0.000001] \\ Learning rate reduction factor & 0.1 & - \\ Patience to reduce learning rate & 5 epochs & [3; 5] \\ Patience to stop learning & 10 epochs & [10; 12] \\ Initial filters of the model & 64 & [32; 64] \\ Loss function & Dice loss & [Dice loss, \\  & & Binary Crossentropy] \\ Batch Size & 6 & [6; 16; 32] \\ \hline \hline \end{tabular}
\end{table}
Table 4: Hyper-parameters used by the segmentation model of U-Net.  
\begin{table}
\begin{tabular}{l l l l l} \hline \hline  & **Total** & **Positive** & **Negative** & **Technique Used** \\ \hline Training (70\%) & 76,190 & 38,095 & 38,095 & Oversample in the positive class \\ Validation (10\%) & 670 & 335 & 335 & Undersample in the negative class \\ Test (20\%) & 6884 & 711 & 6173 & Not applied \\ \hline Total & 83,744 & 39,141 & 44,603 & - \\ \hline \hline \end{tabular}
\end{table}
Table 3: Balancing clippings in training, validation, and testing databases.  
Based on the U-Net architecture, our segmentation model uses four blocks of convolutional layers and maximum pooling in the paths of contraction and expansion of the image. Each block applies two consecutive 3 \(\times\) 3 convolutions and the ReLU activation function between each convolution, followed by a 2 \(\times\) 2 maximum pooling operation. At the end of each block of reduction or increase in the dimensionality of the images, a 10% dropout is applied to avoid overfitting the model. In total, the network has 23 convolutional layers.  
Our segmentation methodology, model training, uses an initial learning rate 0.0001. This rate can be reduced based on the loss assessment in the validation dataset. During training, if the model does not show a decrease in the loss of validation for five consecutive epochs, the learning rate is reduced based on a decay factor. Additionally, even after this interference, if there is no reduction in the loss of validation for ten consecutive epochs, the model stops learning. It is worth noting that the model with the lowest loss on the validation set is saved to disk for further evaluation on the test set.