# Unsupervised Image Segmentation on 2D Echocardiogram
## 3 Methods
### Training Process
Sharpness was assessed using Laplacian variance, which quantifies the amount of high-frequency content in the image, effectively capturing the sharpness of the frames--higher variance indicates sharper frames. Contrast was measured using the standard deviation of pixel intensities, where a higher standard deviation suggests greater contrast between pixel values, representing clearer differentiation of anatomical structures. Before applying these metrics, each frame was pre-processed using CLAHE to enhance local contrast. The final quality score for each frame was computed as a weighted sum of normalized sharpness (with a weight of 0.3) and normalized contrast (with a weight of 0.7), reflecting the greater importance of contrast in this dataset. The overall score for each video was calculated as the average score across all frames, and only videos with an average score of 0.8 or higher were selected for use in training, validation, and testing. Through visual inspection, it was clear that videos with higher scores consistently had better chamber delineation, further confirming the effectiveness of the scoring method. This process allowed us to prioritize high-quality echocardiogram frames, improving model performance by focusing on clearer images [18]. The distribution of scores is presented in Figure 2, and examples of selected and non-selected videos are provided in the appendix for comparison. The network was trained using the Adam optimizer [24], with an initial learning rate of 0.001. A learning rate scheduler was applied to reduce the learning rate by a factor of 0.1 every 16 epochs. The training was conducted for a total of 32 epochs. To validate the selection of these hyperparameters, a grid search was employed to systematically explore a broad range of values for learning rate, epochs, and weight decay. The grid search began by testing epoch values of 16, 32, 64, and 128, while the learning rate was tested across five increments, starting from \(10^{-1}\), \(10^{-2}\), and continuing in decreasing powers of ten. The search was refined iteratively, narrowing down to smaller intervals based on the observed loss values during training. The choice of 32 epochs was made to balance relatively short training time, considering the complexity of the model, with model performance. Observations from the grid search showed that after 32 epochs, there were no significant improvements in validation loss for most configurations, allowing us to fix the epoch number and focus on optimizing the other parameters. Thus, 32 epochs offered an efficient training duration without compromising accuracy. The final configuration was chosen by selecting the combination that minimized the validation loss consistently across the 32 epochs. During training, a batch size of 4 videos, with 16 frames per video, was used. The model was trained on a system equipped with the following configuration: Intel Core i7-12700 KF processor, 32 GB of RAM, and an NVIDIA GeForce RTX 3080 GPU. The model with the lowest validation loss was saved at epoch 32. The weights corresponding to this model were selected based on the validation loss observed during training, ensuring that the model was saved at the point of its best performance. As shown in Figure 3, the behavior of the loss function throughout training indicates that the model effectively learned the objectives of the loss functions without overfitting, demonstrating stable and consistent learning. Figure 2: Score distribution for training, validation, and test datasets.