# A Trustworthy Framework for Skin Cancer Detection Using a CNN with a Modified Attention Mechanism
## 4 Results and Discussion
### Results Evaluation with and Without Preprocessing  
This subsection describes the utilization of a pretrained ConvNeXt model coupled with spatial and channel attention mechanisms to classify skin cancer. The proposed model was trained using 30 epochs on the target dataset, before and after preprocessing. The results presented in Table 2 demonstrate the effectiveness of the proposed model using the original dataset without preprocessing. Based on the data given in Table 2, the proposed model obtained a lower performance for the Mel class, whereas the Vasc and Df classes had a higher performance and achieved an average accuracy of 91.85%. Figure 5 presents the accuracy of the proposed model without preprocessing, showing the progression of the training and validation accuracy over time. The x-axis represents \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Class** & **Akiec** & **Bcc** & **Bkl** & **Df** & **Mel** & **Nv** & **Vasc** &
\begin{tabular}{c} **Class-Wise** \\ **Accuracy** \\ \end{tabular} \\ \hline Akicec & **0.98** & 0.01 & 0.00 & 0.00 & 0.00 & 0.01 & 0.00 & 98.00\% \\ Bcc & 0.07 & **0.84** & 0.06 & 0.00 & 0.01 & 0.00 & 0.02 & 84.00\% \\ Bkl & 0.02 & 0.03 & **0.86** & 0.01 & 0.03 & 0.05 & 0.00 & 86.00\% \\ Df & 0.00 & 0.00 & 0.00 & **1.00** & 0.00 & 0.00 & 0.00 & 100\% \\ Mel & 0.03 & 0.01 & 0.07 & 0.00 & **0.80** & 0.09 & 0.00 & 80.00\% \\ Nv & 0.00 & 0.00 & 0.01 & 0.00 & 0.03 & **0.95** & 0.01 & 95.00\% \\ Vasc & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & **1.00** & 100\% \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Confusion matrix of the proposed model without the preprocessing steps. the number of epochs, and the y-axis represents the accuracy and loss values. In this visualization, the blue lines represent the training accuracy and loss, whereas the orange lines represent the validation accuracy and loss. Initially, the validation accuracy was higher than the training accuracy; however, this trend reversed after a few epochs. Specifically, after eight epochs, the training accuracy exceeded the validation accuracy. Our proposed model achieved a training accuracy of 96% and a validation accuracy of 92%. Throughout the experiment, the validation loss remained consistently higher than the training loss, reflecting the combined losses in both the training and validation phases. The classification results reported in Table 3 indicate the performance of the proposed model in terms of precision, recall, and F1-score to further validate the model performance over the original dataset without any preprocessing steps. Figure 6 illustrates the training and validation accuracies obtained after applying the preprocessing techniques. The initial training and validation accuracies were 55% and 75%, respectively. As training progressed through each epoch, both the training and validation accuracies steadily improved. By the final epoch, the training accuracy reached 98.50% and the validation accuracy reached 98%. Additionally, Figure 6 showed a significant reduction in both the training and validation losses over the course of the epochs, indicating improved model performance. According to the evaluation results, the system with preprocessing steps could significantly reduce the training and validation losses compared to the system without preprocessing steps. Table 4 represents the performance of the proposed model, which demonstrates the advantages of the data preprocessing steps. It is worth noting that the performance of our skin cancer classification model showed substantial improvement following preprocessing. Table 4 provides a comprehensive overview of the performance of the  
Figure 5: Accuracy and loss graphs of the proposed model without the preprocessing step.