# DeepSarc-US: A Deep Learning Framework for Assessing Sarcopenia Using Ultrasound Images
## 2 Methods
### Experimental Setup
#### 2.2.2 Segmentation for QMT Measurement  
An alternative method to attain the objective of automating the assessment of QMT measurements in US images involved generating segmentation masks using annotations of quadriceps muscle and femur surfaces. Subsequently, the length between these surfaces was measured. Figure 3 illustrates examples of US images, where the first column on the left displays annotation points on the US images, and the second column on the left showcases generated segmentation masks derived from these annotation points for three patients (Figure 3a-c). The generated segmentations can be employed to calculate muscle thickness in US images. The muscle thickness can be calculated by identifying the lowest pixel of the muscle surface and the uppermost pixel of the femur surface, as indicated by the dashed lines in Figure 3. It is noteworthy that while segmentations can be used to measure muscle thickness, their application may not extend to the assessment of other biomarkers of muscle quality that are commonly utilized in sarcopenia detection.  
Figure 3: Examples of segmentation masks generated from manual annotations (ground truth) for three patients (**a**–**c**) (better seen in colored prints). The predicted masks showcase the segmentation outcomes achieved by the _Seg-Regression_ model (predicted mask). The Dice scores of predicted masks for patients (**a**), (**b**), and (**c**) were 0.63, 0.89, and 0.76, respectively. In this process, the QMT was derived through a post-processing step that involved determining the distance between the horizontal edges of the muscle surface and the femur surface, utilizing Canny edge detection (horizontal edges).  
For the training phase, binary masks were initially generated based on annotations of the surface areas of the muscle and femur. Following a standard approach for training the proposed regression and classification models, a 5-fold cross-validation technique was employed. The model architecture utilized for segmentation was a modified U-Net [55] with ResNet50 as its backbone. The chosen configuration included Dice loss as the loss function and a learning rate of 0.001. Dice loss can be defined as follows:  
\[\text{Dice Loss}=1-\frac{2\times\text{Intersection}}{\text{Union}+\epsilon}, \tag{3}\]  
where \(\epsilon\) was set to 0.00001.  
Subsequently, majority voting was applied to consolidate the binary masks for the 73 subjects in the test set. To be more specific, each test image had five masks generated by the five models trained on the five train-validation sets (i.e., 5-fold cross-validation). The final mask for each test image was determined via majority voting among these five generated masks. After this, muscle thickness was computed in a post-processing step involving the measurement of the distance between the surfaces of the muscle and the femur. In the post-processing phase, the horizontal edges of the binary mask were identified using the Canny edge detection method. This facilitated the determination of surface curves for both the muscle and femur. The QMT was subsequently determined by identifying the bottom-most pixel on the muscle surface and the highest pixel on the femur surface. An example of a QMT measurement from predicted segmentation masks is shown in Figure 3. For simplicity, the QMT measured based on predicted segmentation masks has been denoted as _Seg-Regression_ throughout the remainder of this manuscript.  
The overall overview of the proposed framework is summarized in Figure 2. The _IW-Regression_ model is initialized with ImageNet weights, the _CW-Regression_ model is initialized with _IW-Classification_ weights, and the _Seg-Regression_ model is initialized with ImageNet weights.