# Detecting the Absence of Lung Sliding in Lung Ultrasound Using Deep Learning
## 2 Materials and Methods
### Evaluation and Aggregation  
We trained separate models for binary segmentation of the individual tissues (lung, pleura, and rib). Therefore, the accuracy represents the ratio of the correctly classified pixels to all pixels in the mask. Precision measures the proportion of the correctly classified tissue pixels to all pixels classified as the tissue. Recall measures the proportion of the correctly classified background pixels to all pixels classified as the background. IoU measures the overlap between the correctly identified tissue pixels and the area of the union of all pixels identified as tissue pixels and misclassified background pixels.  
In the classification task, lung sliding absence is our target class. Accuracy represents the ratio of correctly classified samples with lung sliding presence and lung sliding absence to all samples. Balanced accuracy is the average accuracy per class to counteract the class imbalance. Sensitivity measures the proportion of correctly classified samples with the absence of lung sliding to all samples thus classified; specificity measuring the proportion of correctly classified samples with the presence of lung sliding to all samples thus classified.  
Lung sliding is a time-structured process. In our classification system, to obtain the final prediction of whether lung sliding is present for either a sequence of frames (volume) or the whole video file, we take into account several predictions. We use two types of prediction aggregation in our classification system: Volume and video aggregation. In both cases, we apply averaging. Volume aggregation represents the aggregation of samples from a single sequence of frames with dimensions \(H\times W\times N\); video aggregation is an aggregation of the volume predictions for the whole video. Let \(\hat{y}_{t}\) be the binary prediction of the classifier for a sequence of frames (a sample) starting at time \(t\). We aggregate this prediction by averaging as follows:  
\[y_{agg}(\hat{y}_{t})=\frac{1}{N_{samples}}\sum_{t=0}^{N_{samples}-1}\hat{y}_ {t} \tag{1}\]  
where \(N_{samples}\) is the number of samples from the specific video file. The volume aggregation is performed correspondingly. Let \(y_{t}\) be the ground truth for the binary classification for the sample starting at time \(t\); then the aggregated video accuracy is:  
Figure 5: Dataset augmentation for M-mode classification. In the top row, we can observe original samples from the dataset, and in the bottom row, we can see augmented samples. Blue outlines the original image. Red represents randomly erased areas. (**a**) Examples of lung sliding presence; (**b**) examples of lung sliding absence.  
\[acc_{video}(\hat{y}_{t},y_{t})=\frac{1}{N_{samples}}\sum_{t=0}^{N_{samples}-1}\hat{y}_ {t}=y_{t} \tag{2}\]  
where \(N_{samples}\) is the number of samples from the specific video file. This measure is the ratio of correctly classified samples from the video file to all samples from the given video. To measure the performance of a classifier on a set of testing videos, we introduce thresholded aggregated accuracy \(tata_{threshold}\), which represents the ratio of the number of video files with the aggregated video accuracy over the given threshold to the number of all files. For example, \(ta_{75}\) is defined as follows:  
\[taa_{75}=\frac{1}{N_{videos}}\sum_{t=0}^{N_{videos}-1}acc_{video}(\hat{y}_{t}, y_{t})>0.75 \tag{3}\]  
where \(N_{videos}\) is the total number of video files. \(taa_{75}\) represents the ratio of video files that have, in aggregate, more than 75% of samples correctly classified.