# DeepSarc-US: A Deep Learning Framework for Assessing Sarcopenia Using Ultrasound Images
## 2 Methods
### Experimental Setup
#### 2.2.1 Regression and Classification for QMT Measurements  
Both regression and classification approaches were employed to achieve this goal, and within each approach, a total of six DL models were compared using either their ImageNet weights [45] or our experimentally derived weights. The first approach consisted of training a regression model to predict the QMT value (in cm) as a continuous output. The second approach consisted of training a classification model to predict the QMT class (10 classes binned in 0.5 cm increments starting at 1.0 cm) as an ordinal output and also to generate activation maps for visualization. Using this experimental setup, the following hypotheses were tested:  
1. Models with transformer and CNN architecture would achieve good results in predicting QMT. 2. Regression models with pre-trained weights experimentally derived from classification training runs would outperform the same models with pre-trained weights from ImageNet. 3. Classification models with pre-trained weights experimentally derived from regression training runs would outperform the same models with pre-trained weights from ImageNet. 4. Activation maps that correctly highlighted the anatomical structures of interest would be more likely to correspond to accurate predictions of QMT. The six DL models investigated for regression and classification tasks were ResNet101 [46], DensNet121 [47], ConvNext [25], ViT [29], MAE [30], and SwinT [32]. For the transformer-based models (i.e., ViT, MAE, and SwinT), the base (i.e., ViT-B, MAE-B, and SwinT-B) and large (i.e., ViT-L, MAE-L, and SwinT-L) architecture designs of the models were used in our experiments. For ConvNext, the base architecture design was utilized. The initialization weights investigated for the regression models were experimentally derived from classification training runs (CW-Regression) vs. a priori derived from ImageNet weights (IW regression). The rationale is that pre-training a model on an easier task (i.e., classification) can help it learn basic features, and then training it on a more sophisticated task (i.e., regression) can fine-tune it to learn complex features [48; 49; 50]. The initialization weights investigated for classification models were experimentally derived from regression training runs (RW classification) vs. a priori derived from ImageNet weights (IW classification). Since the ImageNet weights were designed for 1000 classes, the last layer was modified accordingly for 10 classes (1-1.5 cm, 1.5-2 cm, 2-2.5 cm, 2.5-3 cm, 3-3.5 cm, 3.5-4 cm, 4-4.5 cm, 4.5-5 cm, 5-5.5 cm, above 5.5 cm. For all training, the Adam [51] optimizer with a learning rate of 0.0001 was used. Five-fold cross-validation was used, and the results were presented as the average of each fold for the patients comprising the test set. Furthermore, multiple augmentations, including horizontal flipping, cropping, Gaussian noise addition, and blurring, were randomly applied to the training set. **Training Regression Models for QMT Estimation:**  
The regression models in the proposed strategies were trained for hundreds of epochs until the loss did not change for 50 consecutive epochs, using the mean squared error (MSE) loss function defined as:  
\[MSE_{loss}=\frac{1}{N}\sum_{i=1}^{N}(y_{i}-\hat{y}_{i})^{2}, \tag{1}\]  
where \(y\) and \(\hat{y}\) represent the ground truth and predicted QMT, respectively, in a batch of \(N\) (32) US images. As previously noted in Section 2.1, the ground truth values of QMT were derived from manual annotations of skeletal muscle. **Training Classification Models for QMT Estimation and Activation Map Visualization:**  
The classification models were trained using the focal loss function [52]. Focal loss, as defined in Equation (2), tackles the class imbalance problem by reducing the loss contribution from common samples (which are usually correctly classified) and increasing the importance of rare cases (which are often misclassified).