# Computer-Aided Diagnosis of Skin Diseases using Deep Neural Networks
## 2 Materials and Methods
### Experimental Setup  
We used various state-of-the-art DNN architectures developed in the recent years like residual networks, inception networks, densely connected networks, and frameworks facilitating architecture search. To cope up with never-ending appetite of deep CNNs for data, we used these models pre-trained on ImageNet, which is a large dataset of around 1.5 million natural scene images divided into 1000 classes. We fine-tuned these models on dermatology datasets to leverage the benefits of transfer learning. From various CNN architectures tried for this task, we eventually selected ResNet-152 [29], DenseNet-161 [30], SE-ResNeXt-101 [31], and NASNet [32] for their better performance. To report the final results, we combined the potential of all of these biologically inspired neural networks by taking ensemble of their individual predictions. For ensemble we used average of individual predictions of four best performing CNNs to output final prediction.  
It is important to note here that comparing researches that use different datasets, different subsets or train/test splits of the same dataset is not scientifically correct. Since neither of the two datasets used in this work provided instructions on dividing the data into train and test sets, we used stratified k-fold cross validation (\(k=5\) in this work) so that any future research can be compared with our work at least. The k-fold cross validation is a statistical method to ensure that the classifier's performance is less biased towards a randomly taken train/test split. The k-fold cross validation is performed by dividing the whole dataset into \(k\), possibly equal, portions or folds. During a training iteration, one of these folds is kept aside for validation and rest of \(k-1\) folds are used for training the model. In next training iteration a different fold is kept aside for validation and remaining \(k-1\) are used for training. This way, the train and test sets in each iteration are completely mutually exclusive. This process is repeated \(k\) times such that each of the k-folds is used for validation exactly once. This cross-validation approach provides a more realistic generalization approximation. For training, we randomly cropped the images with scale probability ranging between 0.7 and 1.0 while maintaining the aspect ratio. These cropped images are then resized to \(224\times 224\) pixels (for NASNet the input is resized to \(331\times 331\)) before feeding them to the network. The images are also randomly flipped horizontally with flip probability 0.5. During testing, an image is cropped into four corners (top left, top right, bottom left, and bottom right) and one central crop of required size. These cropped images are given to the classifier for inference and ensemble of five predictions is taken to provide final output. Initial learning rate is set to \(10^{-4}\) and is halved every five epochs. The networks are trained for 20 epoch and 10 epochs for DermNet and ISIC Archive, respectively. The number of training epochs for each dataset and initial learning rate were determined empirically. To handle class imbalance, we used weighted loss where the weight for a certain class equals reciprocal of that class's ratio in the dataset.