# A Deep-Learning Approach for Diagnosis of Metastatic Breast Cancer in Bones from Whole-Body Scans
## 4 Results
### Presentation of Results  
OpenCV was used for loading and manipulating images, Glob for reading filenames from a folder, Matplotlib for plot visualizations and finally Numpy for all mathematical and array operations. Python was used for coding, with the CNN being programmed with Keras (with Tensorflow [92]), the data normalization, data splitting, confusion matrices and classification reports with Sci-Kit Learn. The computations ranged between 2\({}^{\prime}\) to 4\({}^{\prime}\) per training for grayscale images and 2\({}^{\prime}\) to 5\({}^{\prime}\) per training (epoch) for RGB images (256 \(\times\) 256 pixels), depending on the different input, with the grayscale images being the fastest and RGB images being the slowest to train. To accomplish the aim of this study, we initially employed different CNN-based architectures and hyperparameter selection as defined in Section 3. After a thorough CNN exploration analysis, we concluded that the best CNN configuration was the following: a CNN with 3 convolutional layers, starting from 8 filters for the first layer, and for each convolutional layer that comes next, the number of filters is doubled (8->16->32), just like the following max-pooling layers. All of those filters have dimensions of \(3\times 3\). This set-up is shown in Table 1.  
Following the steps described in Section 2.2, first we load the images and select the image type, RGB or grayscale. The images are in RGB mode by default and only after requesting are they transformed to grayscale mode. The second and important step is to normalize them, because we want to exclude any outliers and fuzzy data from our dataset. Furthermore, we should shuffle to randomize the order and then perform data augmentation to create variance to our data. Following that, we split our dataset into training, validation and testing and then we pass our images through the CNN. The proposed CNN network has been pre-trained on the ImageNet data set [93]. This data set has proven to be of high utility as it can provide another, more efficient method of weights initialization, in any image-related task. We followed a two-class classification problem, for bone metastasis presence and absence in patients suffering from breast cancer, considering in total 408 samples of women patients. Through our experimental analysis, working initially in RGB mode, we conducted experiments with various drop rates, epochs, number of dense nodes, pixel sizes and batch sizes. Different values for pixels were examined, such as 100 \(\times\) 100, 200 \(\times\) 200, 256 \(\times\) 256, 300 \(\times\) 300 and various values for batch sizes such as 8, 16 and 32 were investigated. In addition, variant drop rate values were studied, for example 0.2, 0.4, 0.7 and 0.9 and a divergent number of dense nodes like 16, 32 and 64 were explored. Epochs were explored from 100, 200, 300 and 500. Table 7 depicts the performance metrics for both malignant (metastasis) and benign (no metastasis) patients for this network configuration. The best confusion matrix is illustrated in Table 8.  
To further investigate the performance of the proposed CNN architecture, the grayscale mode was applied, for various CNN parameters with respect to drop-rate, batch size, dense nodes, pixel sizes and number of epochs. The same CNN exploration as in RGB mode was followed. After a thorough CNN exploration for grayscale mode, the best network parameters were selected: 3 convolutional layers (2, 4, 8), dense = 16, pixel size 150 \(\times\) 150 and drop-rate = 0.2, epochs = 200, batch size = 8. The results for the best network performance for the bone metastasis classification problem, concerning the grayscale mode images, are gathered in Table 9. Table 10 depicts the average values of the five performance metrics and the best produced confusion matrix for grayscale mode. Figure 6 illustrates the plots of precision curves concerning accuracy and loss for the best CNN in grayscale mode. The best time was Best: 196 s, Average: 205 s, Steps: 28-30 step.