# Intelligent Healthcare Platform for Diagnosis of Scalp and Hair Disorders
## 2 Materials and Methods
### Deep Learning Model Description  
To accurately predict the severity level of each disorder, we applied two CNN models (ResNet-152, EfficientNet-B6) and a transformer model (ViT-B/16) that have been popular for image classification. The pre-trained models of ResNet-152 with ImageNet, EfficientNet-B6 with ImageNet, and ViT-B/16 with ImageNet-21k were fine-tuned on the scalp image dataset and the performances of the fine-tuned models were compared. The type of deep learning models and hyperparameters were carefully selected considering our GPU computing power (Table 4). ResNet is one of the CNN models [24]. The deeper the network model, the more levels of features can be integrated so better performance can be expected. However, the vanishing gradient problem occurs. To resolve the problem, shortcut connections were inserted in ResNet. The input was added to the output of the convolutional block through the short connection, and it makes residual learning and more layer stacking possible. ResNet-152 was used in this study and it is composed of 152 residual network layers and operates on about 58 million parameters. EfficientNet is also one of the CNN models [25]. The classification accuracy is commonly improved by scaling up network depth, width, and input image resolution. However, the computational cost has dramatically increased. The compound scaling method was proposed to determine network depth, width, and input image resolution efficiently. The EfficientNet model showed better performance with less computation compared to previous CNN models. The baseline EfficientNet B0-B7 models mainly contain mobile inverted bottleneck MBConv blocks in addition to squeeze and excitation blocks. Among the baseline models, the EfficientNet-B6 model which operates on about 41 million parameters was selected in this study. ViT is one of the transformer models with self-attention to sequences of image patches [26]. To convert 2D image data into 1D sequential data for using transformer encoder input, an image is firstly divided into fixed size (e.g., 16 \(\times\) 16) patches. Each patch is flattened and linearly embedded. A class token, which is a learnable embedding and is \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Models** & **Input Dimension** & **Epochs** & **Batch Size** & **Learning Rate** & **Optimizer** & **Loss** \\ \hline ResNet-152 & 480 \(\times\) 480 \(\times\) 3 & 200 & 16 & \(1\times 10^{-3}\) & [PERSON] & Categorical cross-entropy \\ EfficientNet-B6 & 480 \(\times\) 480 \(\times\) 3 & 200 & 8 & \(1\times 10^{-3}\) & [PERSON] & Categorical cross-entropy \\ ViT-B/16 & 224 \(\times\) 224 \(\times\) 3 & 200 & 16 & \(1\times 10^{-4}\) & [PERSON] & Categorical cross-entropy \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Hyper parameters for training models. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & \multicolumn{4}{c}{**Original Data**} & \multicolumn{4}{c}{**After Data Balancing**} \\ \hline
**Label** & **0** & **1** & **2** & **3** & **0** & **1** & **2** & **3** \\ \hline Dryness & 686 & 5702 & 7054 & 2936 & 7339 & 10,047 & 7054 & 8054 \\ Oiliness & 686 & 36,079 & 31,481 & 4816 & 7339 & 9019 & 9444 & 8627 \\ Erythema & 686 & 38,520 & 16,659 & 5496 & 7339 & 9630 & 8329 & 9713 \\ Folliculitis & 686 & 2733 & 974 & 427 & 2676 & 2733 & 2818 & 2500 \\ Dandruff & 686 & 21,291 & 12,244 & 2900 & 7339 & 10,645 & 12,244 & 7912 \\ Hair loss & 686 & 17,159 & 4881 & 1075 & 7339 & 8579 & 8739 & 7536 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The number of scalp images of each label. used for classification tasks, is added at the beginning of the input sequence. Positional embeddings are added to retain positional information about individual input sequences. The sequence of the resultant vectors is fed into multiple transformer encoder blocks composed of layer normalization, multi-head self-attention, multi-layer perceptron (MLP) blocks, and residual connections. Finally, the class is predicted through MLP for the output of the last transformer encoder.