# Arthroscope Localization in 3D Ultrasound Volumes Using Weakly Supervised Deep Learning
## 2 Materials and Methods
This labeling was done by the first author, who received training by experienced sonographers on how to detect the arthroscope in the US images prior to performing this task. During the labeling process, it was possible to scroll through the images within a volume with the option of going back to correct the labelling of previous images. In this way, each 2D US image was assigned a label according to four categories: Label 0 for no arthroscope visible, Label 1 for arthroscope clearly visible, Label 2 for arthroscope vaguely visible and Label 3 for an incomplete image. Figure 2 shows examples of each label category extracted from one US volume acquired on a Phantom5 type. Only images with the arthroscope clearly visible (Label 1) or no arthroscope visible (Label 0) were used during the training of the deep learning algorithm. This decision was made to facilitate training convergence and generalization. \begin{table}
\begin{tabular}{l l c} \hline \hline
**Phantom Type** & **Phantom Composition** & **Number of US Volumes** & **Number of 2D Images** \\ \hline Phantom0 & Water & 10 & 2558 \\ Phantom1 & Water + mozzarella & 3 & 768 \\ Phantom2 & Water + mozzarella + flour & 10 & 2560 \\ Phantom3 & Water + mozzarella + flour + tomato & 9 & 2302 \\ Phantom4 & Water + mozzarella + flour + tomato + minced meat & 22 & 5137 \\ Phantom5 & Water + flour + minced meat & 27 & 6021 \\ Phantom6 & Water (with and without staple) & 1 & 256 \\ Phantom7 & Water + tomato (with and without staple) & 2 & 512 \\ Phantom8 & Water + tomato + flour (with and without staple) & 1 & 256 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Phantom type description. After labelling, the database (Phantom type 0 through 5) consisted of 8090 2D US images. In 2059 2D images the arthroscope was visible (Label 1), while in 6031 of these images no arthroscope was visible (Label 0). For 10 out of 81 volumes no 2D images were labeled with Label 1. These volumes have been excluded from further processing. The database was split into 10 cross-validation folds by putting 80% of the images with an arthroscope in the training set and 20% into the test set. All images belonging to one volume were put in either the training or test set to avoid correlation between the sets. In addition, it was ensured that, over all the folds, each US volume appeared at least once in a test set of a fold, which means that it was not part of the training set for that fold. The number of arthroscope and non-arthroscope images varied per volume, so this split could not be done randomly. Therefore, an algorithm based on simulated annealing [41], similarly to the one proposed by [PERSON] et al. [42], was used. In brief, the dataset splitting algorithm starts with putting 80% of the volumes in the training set and 20% of the volumes in the test set. Then, a volume from the training set is swapped with a volume from the test set. Based on the percentage of arthroscope images in each set, the new solution is either accepted or not. It was empirically determined that running 200 iterations for each fold was sufficient to achieve an 80-20% split of arthroscope and non-arthroscope images in the training and test set, respectively. Subsequently, the training set was split into a training and validation set following the same procedure. This resulted in 10 folds, each containing a training, validation and test set. Finally, to avoid the neural network being biased due to the imbalance in the number of arthroscope and non-arthroscope images, non-arthroscope images were discarded randomly such that the number of arthroscope and non-arthroscope images were equal in each training, validation and test set. In this work, a DenseNet neural network was used for its high performance with a low number of parameters and a tendency to not overfit [34]. The designed network had only 1 dense block with 12 convolutional layers and a growth rate of 18. The dense block was connected to a classification block, consisting of an average pooling layer and a Softmax activation layer with 2 classes.