Skip to Content
You are currently on the new version of our website. Access the old version .
Applied SciencesApplied Sciences
  • Article
  • Open Access

22 January 2025

21 Pages

A Trustworthy Framework for Skin Cancer Detection Using a CNN with a Modified Attention Mechanism

,
and
1
Department of Computer Science and Engineering, Ewha Woman’s University, Seoul 03760, Republic of Korea
2
Department of Laboratory Medicine, Seoul National University Bundang Hospital, Seongnam 13620, Republic of Korea
3
Department of Laboratory Medicine, Seoul National University College of Medicine, Seoul 03080, Republic of Korea
*
Authors to whom correspondence should be addressed.

Abstract

The early and accurate detection of skin cancer can reduce mortality rates and improve patient outcomes, but requires advanced diagnostics. The integration of artificial intelligence (AI) into healthcare enables the precise and timely detection of skin cancer. However, significant challenges remain including the difficulty in differentiating visually similar skin conditions and the limitations of diverse, representative datasets. In this study, we proposed DCAN-Net, a novel deep-learning framework designed for the early detection of skin cancer. The model leverages an efficient backbone architecture optimized for capturing diverse skin patterns, utilizing carefully tuned parameters to enhance the discrimination capabilities and refine the extracted features using modified attention modules, thereby prioritizing relevant foreground information while minimizing background noise. Furthermore, the Grad-CAM explainable AI method was employed, highlighting the most salient features within dermatoscopic images. The fused optimal feature representations significantly enhanced the dermatoscopic image analysis. When evaluated on the HAM10000 dataset, DCAN-Net achieved a precision, recall, F1-score, and accuracy of 97.00%, 97.57%, 97.10%, and 97.57%, respectively. Moreover, the application of advanced data augmentation techniques mitigated data imbalance issues and reduced false-positive and false-negative rates across the original and augmented datasets. These findings demonstrate the potential of DCAN-Net for improving clinical outcomes and advancing AI-driven skin cancer diagnostics.

1. Introduction

Artificial intelligence (AI) has emerged as a transformative tool in healthcare, offering significant potential for improving outcomes in managing cancer including skin cancer by addressing unregulated cell growth [1]. Skin cancer, the most common cancer worldwide, accounts for over half of all cancer cases, with melanoma being the most dangerous form. In the United States, one in five individuals faces a skin cancer diagnosis by the age of 70, and the risk doubles for those with a history of frequent sunburns. Despite these alarming statistics, early detection significantly improves the survival rates, emphasizing the critical need for effective diagnostic systems [2]. Skin cancer primarily affects the skin, eyes, and nerve centers, leading to tumor formation, with its identification often requiring extensive clinical expertise [3,4]. However, acquiring such expertise is costly and time-consuming, making the development of AI-driven approaches essential for more accessible diagnosis [5,6].
Traditional diagnostic methods, such as clinical examination and advanced imaging techniques including CT, MRI, and ultrasound, are vital in identifying skin cancer, but require skilled professionals for accurate interpretation [7,8]. Self-examinations, while useful, often result in overreactions due to a lack of knowledge. Similarly, the accuracy of clinical diagnoses without technological assistance ranges between 65% and 80%, while dermoscopic images can increase precision but still fall short of delivering the optimal results [9,10,11]. These limitations highlight the need for AI-driven solutions to support clinicians and enhance diagnostic accuracy, especially for diseases such as melanoma, where early detection directly impacts the treatment outcomes and survival rates.
Recent advancements in deep learning and convolutional neural networks (CNNs) have revolutionized the medical field by providing automated, accurate, and cost-effective diagnostic solutions for skin cancer [12,13]. Deep learning models, unlike traditional machine learning, do not require manual feature engineering, making them particularly suited for analyzing complex dermatoscopic images. However, several challenges remain such as the need for large, diverse datasets and the development of robust model architectures capable of addressing domain-specific requirements [14]. Hybrid approaches that combine deep learning with traditional methodologies have shown promise in improving diagnostic precision, particularly in differentiating between benign and malignant lesions [15,16]. These innovations underscore the role of AI in addressing critical gaps in skin cancer detection and treatment.
In this study, we propose the DCAN-Net framework, which integrates a ConvNeXt-based CNN architecture with a customized attention mechanism to enhance diagnostic accuracy. ConvNeXt, a scalable CNN architecture, excels in capturing long-range spatial representations, making it ideal for analyzing dermatoscopic images [17]. The framework leverages explainable AI techniques like Grad-CAM to provide visual justifications for model predictions, fostering transparency and clinician trust. By employing the HAM10000 dataset—a comprehensive collection of dermatoscopic images—we validated the proposed approach, demonstrating its ability to reduce false positives and negatives. This work contributes to the domain of medical image processing by addressing key challenges in early melanoma detection and advancing methodologies for skin cancer diagnosis.
In the proposed DCAN-Net framework, there are several significant steps to enhance skin cancer detection using the HAM10000 dataset.
  • Incorporation of the ConvNeXt-based model: This provides high performance, confirming an effective cancer pattern followed by contextual understanding.
  • Modified attention mechanism: Fitted to the focal point on related image regions, improving diagnostic precision and reducing errors.
  • Explainable AI with Grad-CAM: Provides visual justification of the model’s outcomes, enhancing transparency and clinician trust.
  • Comprehensive training over the HAM10000 dataset: Utilizes a distinct dataset to improve the generalization of the model to new images.
  • Optimal feature collection and fusion: Combines the most informative features for specialized dermatoscopic analysis.
  • Rigorous evaluation: Validates the model’s effectiveness through extensive testing and performance metrics.
The contributions of this study are as follows:
  • Proposed DCAN-Net framework: This study introduces DCAN-Net, an advanced deep learning framework for skin cancer detection. It incorporates a tailored attention mechanism to focus on critical regions of dermatoscopic images, improving diagnostic accuracy and providing visual attention maps for enhanced explainability.
  • Integration of ConvNeXt and modified Grad-CAM: ConvNeXt serves as the core feature extraction architecture, offering state-of-the-art efficiency, while a modified Grad-CAM explainable AI enhances interpretability. This combination improves the diagnostic precision and empowers clinicians with insights into the model’s decision-making process.
  • Parallel feature fusion strategy: An advanced parallel feature fusion strategy amplifies essential feature extraction, enabling accurate skin cancer classification by distilling critical details from dermatoscopic images.
  • Comprehensive ablation study: Rigorous ablation studies evaluate the impact of hyperparameters and model components, resulting in reduced false positives and negatives and overall improved accuracy.
  • Evaluation on the HAM10000 dataset: Extensive testing on the HAM10000 dataset including its augmented version was conducted to validate the model’s robust generalization, precision, and potential to transform healthcare diagnostics.
  • Addressing limitations of traditional CNNs: The study tackles challenges in traditional CNNs including the lack of explainability, overfitting, and sensitivity to data quality. It ensures improved reliability for diverse real-world clinical scenarios.
  • Enhanced trustworthiness: By incorporating Grad-CAM for visual explanations, robust preprocessing, balanced training, and continuous evaluation, DCAN-Net can establish a transparent, reliable, and clinically applicable system for skin cancer detection.
The remainder of the article is organized as follows. The mainstream approaches are briefly explained in Section 2, and the technical information of the proposed model is provided in Section 3. The empirical results are presented in Section 4, and Section 5 concludes the paper.

3. Proposed DCAN-Net

This section consists of two fundamental steps that are pivotal to our research methodology: preprocessing, and proposed model selection and testing. Preprocessing was used to prepare and enhance the dataset to ensure the quality and suitability for subsequent analyses. Following the preprocessing phase, we delve into the core of our research, where we carefully chose and evaluated the efficacy of the proposed model. This step involves rigorous testing, validation, and assessment, as described in the following section.

3.1. Preprocessing

Data preprocessing is an important step in training machine learning approaches to enhance the quality of the input data. The classification accuracy can decrease when training a CNN model using raw input data such as images. To mitigate this problem, data augmentation was performed during the preprocessing phase. This involves the generation of new images derived from the original images, introducing variations in aspects such as brightness adjustments, contrast, orientation position, and scale, as shown in Figure 1. For skin cancer, we employed a dataset augmentation approach similar to that previously used by Aladhadh et al. [39], as shown in Figure 1. For contrast enhancement, we employed adaptive histogram equalization (CLAHE) with a clip limit of 2.0 and a tile grid size of 8 x 8 to evenly distribute intensity values across the image, enhancing visibility while avoiding noise amplification. Brightness adjustment involved linearly scaling the pixel intensity values within a range of −20% to +20% of the original brightness, enabling better model robustness under varying lighting conditions. For geometric transformations, we applied rotations of up to ±10 degrees, along with horizontal and vertical flipping. These transformations were chosen to simulate natural variations in dermatoscopic images and improve the generalization of the proposed model. We will ensure that these details are clearly outlined in the revised manuscript to enhance clarity and precision. A two-step approach was used, preprocessing and training a CNN model, and the results were compared with other benchmarks with and without data augmentation. Our strategy is similar to that of Aladhadh et al. [39], in that it provides augmentation using brightness adjustment, contrast enhancement, and geometric transformations.
Figure 1. Data preprocessing step to increase the number of samples in the skin cancer benchmark for adequate classification.
Brightness adjustment: Various lighting conditions can lead to fluctuations in the image brightness, and the application of gamma correction transformations with different values, as given in Equation (1), can result in images that are either too bright or too dark. Therefore, the chosen images may exhibit variations caused by differences in illumination. Brightness adjustment transformations allowed us to address this illumination-induced variation.
g ( x ,   y ) = a × f ( x ,   y )
Contrast enhancement: This process mitigates the effect of contrast variations in images resulting from changing lighting conditions. The contrast stretching procedure described in Equation (2) was applied to modify the contrast variations using various factors, as illustrated in Figure 1.
g x ,   y = a 1 f x ,   y f x ,   y < r 1 a 1 f x ,   y f x ,   y < r 1 a 2 f x ,   y − r 1 + s 1 ,   r 1 ≥ f x ,   y < r 2 a 2 f x ,   y − r 1 + s 1 ,   r 1 ≥ f ( x ,   y ) < r 2 a 3 f x ,   y − r 2 + s 2 ,   f x ,   y ≥ r 2 a 3 f x ,   y − r 2 + s 2 ,   f ( x ,   y ) ≥ r 2
where g(x, y) is the output pixels derived from the g(x, y) input pixel; s 1 , s 2 , r 1 , and r 2 , are the parameters used for contrast adjustment; a 1 , a 2 , and a 3 are the scale factors for the rotations in grayscale image and formulated as s 1 / r 1 , ( s 2 − s 1 )/( r 2 − r 1 ), and (L − s 2 )/(L − r 2 ), respectively; L is the maximum range of the gray level value.
Geometric transformations: This process encompasses scaling, translation, and rotation operations, which are used for each image within the dataset, resulting in the creation of new images. In the context of the CNN architecture, this process holds significant value because it enables the model to perceive the same object from various angles, bolstering its generalization capability. Therefore, all preprocessing steps are fundamental for performance enhancement.

3.2. Proposed Model Selection

The proposed model incorporates key modifications to the ConvNeXt architecture [40], enhancing its capability to detect skin cancer in dermatoscopic images. A significant improvement involves integrating a modified channel attention mechanism inspired by the dual-fire attention network (DFAN) [41]. Unlike the original ConvNeXt architecture, which primarily focuses on extracting features using standard convolutional layers, the proposed model replaces the conventional 7 × 7 convolution layer with a 5 × 5 separable convolution. This substitution reduces the computational overhead while maintaining the feature extraction efficiency. Additionally, the spatial attention module was fused with the intermediate outputs of the channel attention module via element-wise product operations. This dual-attention mechanism, illustrated in Figure 2, improved the model’s ability to localize and emphasize critical regions within the input images, enabling more precise detection of cancerous lesions.
Figure 2. Generic overflow of the proposed DCAN-Net for effective skin cancer classification.
The modified architecture diverges from the original ConvNeXt by employing stacked dual-attention modules after every two successive convolutional layers, a novel design that optimizes feature representation. While the base ConvNeXt architecture relies on depthwise and 1 × 1 convolutions with GELU activation and layer normalization [42], the proposed model integrates channel attention to weigh the importance of RGB channels in the feature maps (denoted as A t t C ) as well as spatial attention to focus on the most salient image regions. This synergistic attention fusion offers a unique advantage over the standard ConvNeXt by refining the model’s sensitivity to the subtle visual cues in dermatoscopic images. Moreover, the patchy stem cell design of ConvNeXt is preserved, ensuring efficient multi-scale feature extraction while the attention mechanisms enhance the representation capabilities, particularly for medical image analysis.
The two-phase (offline and online) framework introduced further differentiation from the original ConvNeXt. In the offline phase, preprocessing steps, such as augmentation with variations in brightness, contrast, and orientation, are applied to improve the model’s generalizability on the HAM10000 dataset. Grad-CAM is utilized to identify critical regions in the training images, with these features fused into the attention mechanism for improved specialization in dermatoscopic analysis. In the online phase, DCAN-Net leverages the pre-trained dual-attention-enhanced model for real-time predictions, combining accuracy with explainability by using Grad-CAM visualizations. This ensures that clinicians can trust the system’s diagnostic outputs, a feature absent in the original ConvNeXt. Overall, the proposed design achieves a balance between high diagnostic precision and computational efficiency, making it highly suitable for resource-constrained medical environments.
To capture the improved feature maps F_(M^’), we combined the spatial attention feature maps A t t S with the input feature maps F_M using a residual skip connection, accomplished through elementwise addition. This approach notably increased the feature representation capability, allowing for a more accurate recognition of essential regions. Mathematically, we can respectively express the feature maps for channel attention, spatial attention, and refined attention as follows:
A t t C W x H x C = A C F M W x H x C ⊗ F M W x H x C ,
A t t S W x H x C = A S A t t C W x H x C ⊗ A t t C W x H x C ,
F C W x H x C = A t t S W x H x C ⊗ F M W x H x C ,
In the equations above (Equations (3)–(5)), H, W, and C denote the dimensions of the feature maps, representing the height, width, and number of channels, respectively. A_C and A_CS refer to the intermediate channel and spatial attention module, respectively. We acquired the refined feature maps, labeled F_(M^’), by integrating the spatial attention feature maps (A_S) with the input feature maps (F_M), as shown in Figure 3. This strategy enabled us to increase the feature representation capability and improve the overall performance of the skin cancer model.
Figure 3. Generic overflow of the proposed attention mechanism for effective skin cancer classification.
ConvNeXt was selected for skin cancer detection due to its outstanding performance, efficiency, scalability, and proven reliability, making it an ideal choice for this medical application. It consistently achieved state-of-the-art results in complex image classification tasks, demonstrating its ability to extract intricate features and discern patterns in dermatoscopic images, which is crucial for identifying subtle visual cues indicative of skin cancer. ConvNeXt’s efficiency ensures a low computational overhead while maintaining high accuracy, essential for real-time diagnosis and processing large datasets in healthcare environments. Its extensive validation within the research community underscores its robustness and reliability, while its generalizability across diverse datasets and tasks is advantageous for handling the inherent variability in dermatoscopic images. Despite the suitability of ConvNeXt, a novel model was developed to address the unique demands of skin cancer detection by incorporating a dual-attention mechanism to improve the feature localization and precision. This modification enhances the model’s focus on relevant regions within images, further optimizing its performance for skin cancer diagnosis and ensuring that it meets both the accuracy and interpretability requirements for clinical applications.

4. Results and Discussion

This section briefly presents a comprehensive evaluation of the proposed model for skin cancer detection using the HAM10000 dataset. The effectiveness of the model and its potential to revolutionize early skin cancer diagnosis were assessed using various performance metrics and comparative analyses. In this context, we first explain the experimental settings, evaluation metrics, datasets, and producible results and compare them with state-of-the-art approaches.

4.1. Experimental Setting

This section describes the experimental setup and hyperparameter selection. In this context, the training procedure was carefully fine-tuned using the Adam optimizer, incorporating a progressive learning rate schedule of 0.001, suitable batch sizes of 32, and the careful selection of 50 epochs to guarantee convergence while avoiding overfitting. To implement the proposed model, we used a high-performance NVIDIA GeForce RTX 3090 GPU, enabling the execution of efficient training processes. In the implementation and experimentation, we used a prominent deep-learning framework, TensorFlow-banked kernels. The experimental settings employed in this study were carefully planned to support a rigorous evaluation of the ConvNeXt-based model coupled with its potential transformative influence on early skin cancer diagnosis. The main objective of the proposed model is to detect the affected skin area at an early stage. To this end, an automatic intelligent model is highly desirable to assist the dermatology department and patients before the cancer reaches its final level. Therefore, a deep learning technique was developed that learns significant features from diverse skin cancer diseases and identifies the types of illnesses. To tune the pretrained model, we removed the upper layer and updated the remaining layer parameters by adjusting our skin dataset. In the initial epoch, the model attempted to learn new patterns and update randomly assigned weights to minimize errors. Next, through backpropagation, the model randomly updated the weight values and quickly obtained the local minima using various filtering strategies and fusion over variant positions.

4.2. Dataset Description

The HAM10000 dataset comprises 10,015 dermatoscopic images collected over 20 years from two distinct locations: the Department of Dermatology at the Medical University of Vienna, Austria, and the skin cancer clinic of Cliff Rosendahl in Queensland, Australia. The HAM10000 dataset is widely regarded as a benchmark dataset in the field of skin cancer detection and analysis. It consists of 10,015 dermatoscopic images representing seven different types of skin lesions including melanoma, basal cell carcinoma, and benign lesions, making it a comprehensive and diverse resource for training and evaluating machine learning models. Its broad acceptance within the research community stems from the high-quality annotations provided by experienced dermatologists and its representation of a wide spectrum of real-world skin conditions. Furthermore, the dataset’s size, variety, and availability have enabled researchers to develop and compare innovative methods for skin lesion classification and segmentation effectively. While there are other datasets in the domain, such as the ISIC Challenge datasets, the HAM10000 dataset is considered a reliable standard for benchmarking and is particularly well-suited for studies like ours that focus on improving the early detection and classification of skin cancer. The dataset consists of seven different classes: actinic keratoses (Akiec), basal cell carcinoma (Bcc), benign keratosis-like lesions (Bkl), dermatofibroma (Df), melanoma (Mel), melanocytic nevi (Nevi), and vascular lesions (Vasc). It is a highly imbalanced and challenging dataset. Various preprocessing steps were used to improve visibility and increase the number of samples in the dataset to enhance the generalization capability of the model. Furthermore, these preprocessing steps reduced the data imbalance.
For preprocessing, only the Akiec, Bcc, Df, and Vasc classes were considered because the training samples were very limited, as shown in Table 1. Consequently, 70% of the data were used to train the model, 20% for validation, and 10% for testing. Figure 4 shows sample images taken from the HAM10000 dataset.
Table 1. Data with and without preprocessing.
Figure 4. Sample images of each class from the HAM10000 dataset.

4.3. Model Performance Metrics

This subsection focuses on the performance evaluation metrics to evaluate the effectiveness and robustness of the proposed model. To evaluate this capability, we used an extensive range of performance indicators such as accuracy, precision, recall, and F1-measure.
Accuracy assessment is a critical parameter for evaluating the overall efficacy of the skin cancer detection models. This metric quantifies the ratio of accurately classified skin cancer instances to the total number of instances included in the dataset. Mathematically, the accuracy is determined by the following calculation:
A c c u r a c y = C o r r e c t   p r e d i c t i o n s T o t a l   n u m b e r   o f   p r e d i c t i o n s
A high accuracy score indicates that the model detected skin cancer and noncancer instances well, but other measures were required for imbalanced datasets.
Precision is a metric that quantifies the proportion of correctly identified positive cases relative to the overall number of positive predictions generated by the skin cancer detection model. In the context of our study, precision plays a crucial role in evaluating the capacity of the model to accurately detect instances of skin cancer while minimizing the occurrence of false-positive classifications for noncancer cases. Precision was computed using the following formula:
P r e c i s i o n = T r u e   P o s i t i v e s T r u e   P o s i t i v e s + F a l s e   P o s i t i v e s
Recall, sometimes referred to as the sensitivity or the true positive rate, measures the capacity of the model to accurately identify and include all skin cancer occurrences in a dataset. This measures the ability of a model to correctly identify all positive instances out of the total number of positive instances. The concept of recall is commonly referred to as:
R e c a l l   S e n s i t i v i t y = T r u e   P o s i t i v e s T r u e   P o s i t i v e s + F a l s e   N e g a t i v e s
A higher recall indicates that the model has a lower rate of missing positive instances, meaning that it is better at capturing all instances of the positive class, which is crucial in medical diagnosis to avoid missing potential cases of disease.
The F1-score combines precision and recall, offering a consolidated measure for evaluating the overall performance of a model. The harmonic means of the precision and recall were computed using the following formula:
F 1 − S c o r e = 2 × P r e c i s i o n   ×   R e c a l l P r e c i s i o n + R e c a l l
When the positive and negative classes are imbalanced, the F1-score helps balance the false positives and negatives in the datasets.

4.4. 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%.
Table 2. Confusion matrix of the proposed model without the preprocessing steps.
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 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.
Figure 5. Accuracy and loss graphs of the proposed model without the preprocessing step.
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.
Table 3. Proposed skin cancer classification results without preprocessing.
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.
Figure 6. Accuracy and loss graphs of the proposed model with preprocessing.
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 proposed model, incorporating the effects of preprocessing through a detailed confusion matrix that indicates the correct and incorrect predicted values for each class. Upon examining Table 4, it becomes apparent that the BCC class exhibited the lowest performance, whereas the Vasc and Df classes demonstrated the highest performance. This pattern underscores the varying degrees of success in classifying distinct categories within the target dataset. When considering the overall test performance of the proposed model, it registered an accuracy of 97.57%. This metric reflects the effectiveness of the model in making correct predictions across all classes, further emphasizing its effectiveness in classification tasks after applying the preprocessing steps.
Table 4. Confusion matrix of the proposed model with preprocessing.
Table 5 presents the results of validating the model performance using the preprocessed dataset. Compared to the results shown in Table 3 without preprocessing, only the recall score of the Akiec class was reduced by 0.01 recall, while all other classes exhibited improved performances.
Table 5. Classification results of the proposed skin cancer classification model with preprocessing.
To compute the strength of the proposed model and obtain the optimal optimizer, we conducted numerous experiments using different backbone models and optimizers. After a comprehensive experiment on various collections, we concluded that Adam performed better than the others on ResNet. Based on these results, we also used Adam for our proposed model and demonstrated its remarkable performance in skin cancer detection.

4.5. Results Comparison with State-of-the-Art Methods

A comparison between the proposed skin cancer classification model and other existing models is presented in Table 6. Compared to the current models, the proposed model obtained a promising performance in all of the evaluation metrics.
Table 6. Performance of different models when evaluating various optimizers.
Table 7 describes comparisons results with state-of-the-art models. The proposed model achieved a precision of 96.42%, F1-score of 96.71%, and similar average recall and accuracy scores of 97.57%. The proposed model outperformed the benchmark method by obtaining higher precision, recall, F1-score, and accuracy values by 1%, 1.07%, 0.10%, and 1.43%, respectively.
Table 7. Comparison of the proposed model comparisons with state-of-the-art models.

4.6. Ablation Study

As shown in Table 8, various ablation studies were conducted to determine the optimal skin cancer detection model. The proposed model was evaluated using four different settings in an ablation study. In setting (1), Solo ConvNeXtBase was employed, and the worst results were obtained, with an average accuracy of 96.40%. Setting (2) used ConvNeXtBase with a channel attention mechanism; this strategy achieved a higher performance than setting (1). The performances of settings (3) and (4) were better than those of setting (2). In setting (3), the spatial attention mechanism was employed with ConvNeXtBase, which achieved an improved performance compared with settings (1) and (2) and a lower performance compared to setting (4). Setting (4) involved the proposed model coupled with channel and spatial attention mechanisms, and it achieved improved performances throughout the experiment compared to the other settings. Table 8 shows the model effectiveness analysis obtained by integrating different modules with ConvNeXtBase.
Table 8. Ablation study of the proposed model by integrating various attention modules. All the results are given as percentages (%).

4.7. Visualization and Comparison of the Results of the Proposed Model

In this study, a Grad-CAM (gradient-weighted class activation mapping) visualization approach was utilized to assess the interpretability and localization performance of the proposed skin cancer classification model. Grad-CAM generates heat maps that highlight the regions in the input image that contribute most significantly to the model’s prediction, thus providing valuable insights into the decision-making process. The HAM10000 dataset, which consists of a large collection of annotated skin lesion images, was used to evaluate the model. A key advantage of using Grad-CAM is its ability to pinpoint the specific areas of the images that correspond to the skin cancer lesions, offering a transparent way to visualize the model’s focus during classification. Figure 7 displays the original images from the HAM10000 dataset, alongside their corresponding heat maps and the final model predictions. The heat maps were overlaid on the original images to show which parts of the images the model emphasized in making its decisions. These visualizations are critical in confirming the model’s ability to accurately localize lesions. Each class including melanoma, basal cell carcinoma (BCC), and squamous cell carcinoma (SCC) was represented with its corresponding heat map. The heat maps clearly demonstrated that the proposed model effectively focused on the relevant areas of the lesions, making it a reliable tool for skin cancer classification.
Figure 7. Visualized results of the proposed model for effective skin cancer localization and classification.
The visual results from the Grad-CAM heat maps highlight the robustness of the proposed model as it consistently identifies and classifies skin lesions with high accuracy. The model’s ability to both classify and localize lesions reinforces its practical potential for use in clinical applications, where interpretability and accurate lesion localization are crucial. Overall, the results confirm that the proposed model is both effective and reliable for skin cancer classification, showing strong performance in lesion detection and classification across different skin cancer types.

4.8. Pros and Cons of the Proposed Model

The proposed model modification, integrating a ConvNeXt-based CNN architecture with modified channel and spatial attention mechanisms, offers distinct advantages tailored to the specific challenges of skin cancer detection. The inclusion of attention mechanisms enhances the model’s ability to focus on relevant regions of dermatoscopic images, leading to improved diagnostic precision and reduced false positives. By emphasizing critical areas in the data, the model achieved a fine balance between accuracy and interpretability, enabling clinicians to better understand the reasoning behind predictions. The ConvNeXt backbone further contributed to the model’s efficiency, leveraging its advanced feature extraction capabilities to handle high-dimensional image data while maintaining a relatively low computational overhead compared to more resource-intensive transformer architectures. This makes the model particularly suitable for specialized medical imaging tasks where both precision and resource optimization are critical.
However, the model’s design also introduces tradeoffs that must be considered. While it excels in focusing on image-based tasks, its unimodal nature limits its ability to incorporate complementary data sources, such as patient history or genetic information, which multimodal models like CLIP and LLAVA can efficiently handle. Multimodal approaches offer greater flexibility and generalization across various tasks, enabling broader applications but often at the cost of higher computational demands and the need for extensive training datasets. Additionally, the added complexity of attention mechanisms, while beneficial for feature prioritization, can increase the model’s training and inference time, potentially posing challenges for real-time deployment in resource-limited settings. Thus, while the proposed model strikes a balance between accuracy, efficiency, and interpretability in a specific domain, its scope may need to be expanded or adjusted to compete with the versatility and broader applicability of multimodal frameworks.

5. Conclusions

This study introduced a novel approach for detecting skin cancer by combining a ConvNeXt-based CNN model with a modified attention mechanism. This method is crucial for early detection and distinguishing between visually identical skin conditions. The ConvNeXt architecture is effective for feature extraction, and a custom attention mechanism was integrated to distinguish between malignant and benign lesions in dermatoscopic images. The experimental findings on the HAM10000 dataset demonstrated a dramatic improvement in accuracy and a decrease in false positives and false negatives. This study also highlighted the potential of deep learning models for medical image processing, particularly when paired with attention mechanisms. This method may aid in early diagnosis, reduce the impact of skin cancers on patients, and increase the chances of positive results. This study established a framework for more accurate and efficient skin cancer diagnoses by demonstrating the potential of ConvNeXt-based CNN models with attention processes. The investigation of ConvNeXt-based CNN models featuring attention mechanisms has revealed encouraging results for skin cancer recognition. However, further improvements are required including expanding the dataset to include a wider range of skin conditions, incorporating transfer learning from other medical imaging domains, adapting the model for real-time applications, developing interpretable AI methods, conducting clinical trials, and integrating multimodal data fusion to improve the diagnostic accuracy. These advancements will benefit patients and healthcare professionals in the early diagnosis of skin cancer.

Author Contributions

Conceptualization, S.M.T., H.-S.P. and S.H.S.; Methodology, S.M.T. and H.-S.P.; Software, S.M.T., H.-S.P. and S.H.S.; Validation, S.M.T., H.-S.P. and S.H.S.; Formal analysis, S.M.T., H.-S.P. and S.H.S.; Investigation, S.M.T. and H.-S.P.; Resources, H.-S.P. and S.M.T.; Data curation, H.-S.P. and S.H.S.; Writing—original draft preparation, S.M.T.; Writing—review and editing, S.M.T., H.-S.P. and S.H.S.; Visualization, S.M.T. and H.-S.P.; Supervision, H.-S.P. and S.H.S.; Funding acquisition, H.-S.P. and S.H.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The original contributions presented in the study are included in the article, further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Alam, T.M.; Milhan, M.; Atif, M.; Wahab, A.; Mushtaq, M. Cervical cancer prediction through different screening methods using data mining. IJACSA Int. J. Adv. Comput. Sci. Appl. 2019. [Google Scholar] [CrossRef] [Scilit]
  2. Shalhout, S.Z.; Kaufman, H.L.; Emerick, K.S.; Miller, D.M. Immunotherapy for Nonmelanoma skin cancer: Facts and Hopes. Clin. Cancer Res. 2022, 28, 2211–2220. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  3. Mignion, L.; Desmet, C.M.; Harkemanne, E.; Tromme, I.; Joudiou, N.; Wehbi, M.; Baurain, J.-F.; Gallez, B. Noninvasive detection of the endogenous free radical melanin in human skin melanomas using electron paramagnetic resonance (EPR). Free Radic. Biol. Med. 2022, 190, 226–233. [Google Scholar] [CrossRef] [Scilit]
  4. Gururaj, H.L.; Manju, N.; Nagarjun, A.; Aradhya, V.N.M.; Flammini, F. DeepSkin: A deep learning approach for skin cancer classification. IEEE Access 2023, 1, 50205–50214. [Google Scholar] [CrossRef] [Scilit]
  5. Tschandl, P.; Codella, N.; Akay, B.N.; Argenziano, G.; Braun, R.P.; Cabo, H.; Gutman, D.; Halpern, A.; Helba, B.; Hofmann-Wellenhof, R.; et al. Comparison of the accuracy of human readers versus machine-learning algorithms for pigmented skin lesion classification: An open, web-based, international, diagnostic study. Lancet Oncol. 2019, 20, 938–947. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  6. American Cancer Society. Key Statistics for Melanoma Skin Cancer; American Cancer Society Center: Atlanta, GA, USA, 2022. [Google Scholar]
  7. Riaz, L.; Qadir, H.M.; Ali, G.; Ali, M.; Raza, M.A.; Jurcut, A.D.; Ali, J. A Comprehensive Joint Learning System to Detect Skin Cancer. IEEE Access 2023, 11, 79434–79444. [Google Scholar] [CrossRef] [Scilit]
  8. Krishnan, M.M.R.; Venkatraghavan, V.; Acharya, U.R.; Pal, M.; Paul, R.R.; Min, L.C.; Ray, A.K.; Chatterjee, J.; Chakraborty, C. Automated oral cancer identification using histopathological images: A hybrid feature extraction paradigm. Micron 2012, 43, 352–364. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  9. Akilandasowmya, G.; Nirmaladevi, G.; Suganthi, S.; Aishwariya, A. Skin cancer diagnosis: Leveraging deep hidden features and ensemble classifiers for early detection and classification. Biomed. Signal Process. Control 2024, 88, 105306. [Google Scholar] [CrossRef] [Scilit]
  10. Argenziano, G.; Soyer, H.P. Dermoscopy of pigmented skin lesions—A valuable tool for early. Lancet Oncol. 2001, 2, 443–449. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  11. Kittler, H.; Pehamberger, H.; Wolff, K.; Binder, M. Diagnostic accuracy of dermoscopy. Lancet Oncol. 2002, 3, 159–165. [Google Scholar] [CrossRef] [Scilit]
  12. Javaid, A.; Sadiq, M.; Akram, F. Skin cancer classification using image processing and machine learning. In Proceedings of the 2021 International Bhurban Conference on Applied Sciences and Technologies (IBCAST), Islamabad, Pakistan, 12–16 January 2021; IEEE: New York, NY, USA, 2021. [Google Scholar]
  13. Yar, H.; Abbas, N.; Sadad, T.; Iqbal, S. Lung nodule detection and classification using 2D and 3D convolution neural networks (CNNs). In Artificial Intelligence and Internet of Things; CRC Press: Boca Raton, FL, USA, 2021; pp. 365–386. [Google Scholar]
  14. George, M.; Zwiggelaar, R. Breast tissue classification using Local Binary Pattern variants: A comparative study. In Medical Image Understanding and Analysis, Proceedings of the 22nd Conference, MIUA 2018, Southampton, UK, 9–11 July 2018; Proceedings 22; Springer: Berlin/Heidelberg, Germany, 2018. [Google Scholar]
  15. Milton, M.A.A. Automated skin lesion classification using ensemble of deep neural networks in isic 2018: Skin lesion analysis towards melanoma detection challenge. arXiv 2019, arXiv:1901.10802. [Google Scholar]
  16. Wolner, Z.J.; Yélamos, O.; Liopyris, K.; Rogers, T.; Marchetti, M.A.; Marghoob, A.A. Enhancing skin cancer diagnosis with dermoscopy. Dermatol. Clin. 2017, 35, 417–437. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  17. Woo, S.; Debnath, S.; Hu, R.; Chen, X.; Liu, Z.; Kweon, I.S. Convnext v2: Co-designing and scaling convnets with masked autoencoders. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023. [Google Scholar]
  18. Taufiq, M.A.; Hameed, N.; Anjum, A.; Hameed, F. m-Skin Doctor: A mobile enabled system for early melanoma skin cancer detection using support vector machine. In eHealth 360°, Proceedings of the International Summit on eHealth, Budapest, Hungary, 14–16 June 2016; Revised Selected Papers; Springer: Berlin/Heidelberg, Germany, 2017. [Google Scholar]
  19. Vidhyalakshmi, A.; Kanchana, M. AMLGB-: Efficient Model for Skin Disease Detection and Classification using Adaptive Machine for Light Gradient Boosting. In Proceedings of the 2023 5th International Conference on Smart Systems and Inventive Technology (ICSSIT), Tirunelveli, India, 23–25 January 2023; IEEE: New York, NY, USA, 2023. [Google Scholar]
  20. Jaisakthi, S.M.; Mirunalini, P.; Aravindan, C. Automated skin lesion segmentation of dermoscopic images using GrabCut and k-means algorithms. IET Comput. Vis. 2018, 12, 1088–1095. [Google Scholar] [CrossRef] [Scilit]
  21. Masood, A.; Al-Jumaily, A.; Anam, K. Self-supervised learning model for skin cancer diagnosis. In Proceedings of the 2015 7th International IEEE/EMBS Conference on Neural Engineering (NER), Montpellier, France, 22–24 April 2015; IEEE: New York, NY, USA, 2015. [Google Scholar]
  22. Esteva, A.; Kuprel, B.; Novoa, R.A.; Ko, J.; Swetter, S.M.; Blau, H.M.; Thrun, S. Dermatologist-level classification of skin cancer with deep neural networks. Nature 2017, 542, 115–118. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  23. Nasr-Esfahani, E.; Samavi, S.; Karimi, N.; Soroushmehr, S.M.R.; Jafari, M.H.; Ward, K. Melanoma detection by analysis of clinical images using convolutional neural network. In Proceedings of the 2016 38th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Orlando, FL, USA, 16–20 August 2016; IEEE: New York, NY, USA, 2016. [Google Scholar]
  24. Ghanshala, T.; Tripathi, V.; Pant, B. An efficient image-based skin cancer classification framework using neural network. In Research in Intelligent and Computing in Engineering; Springer: Singapore, 2021; pp. 851–858. [Google Scholar] [CrossRef] [Scilit]
  25. Hameed, N.; Shabut, A.; Hameed, F.; Cirstea, S.; Harriet, S.; Hossain, A. Mobile based skin lesions classification using convolution neural network. Ann. Emerg. Technol. Comput. (AETiC) 2020, 4, 26–37. [Google Scholar] [CrossRef] [Scilit]
  26. Subramanian, R.R.; Achuth, D.; Kumar, P.S.; Reddy, K.N.K.; Amara, S.; Chowdary, A.S. Skin cancer classification using Convolutional neural networks. In Proceedings of the 2021 11th International Conference on Cloud Computing, Data Science & Engineering (Confluence), Noida, India, 28–29 January 2021; IEEE: New York, NY, USA, 2021. [Google Scholar]
  27. Malo, D.C.; Rahman, M.M.; Mahbub, J.; Khan, M.M. Skin Cancer Detection using Convolutional Neural Network. In Proceedings of the 2022 IEEE 12th Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, NV, USA, 26–29 January 2022; IEEE: New York, NY, USA, 2022. [Google Scholar]
  28. Nampalle, K.B.; Raman, B. An efficient multi-functional deep learning model for effective medical image classification using skin lesion database. In Proceedings of the 2022 IEEE 5th International Conference on Multimedia Information Processing and Retrieval (MIPR), Online, 2–4 August 2022; IEEE: New York, NY, USA, 2022. [Google Scholar]
  29. Li, L.; Seo, W. Deep learning and transfer learning for skin cancer segmentation and classification. In Proceedings of the 2021 IEEE 21st International Conference on Bioinformatics and Bioengineering (BIBE), Kragujevac, Serbia, 25–27 October 2021; IEEE: New York, NY, USA, 2021. [Google Scholar]
  30. Agrahari, P.; Agrawal, A.; Subhashini, N. Skin cancer detection using deep learning. In Futuristic Communication and Network Technologies: Select Proceedings of VICFCNT 2020; Springer: Berlin/Heidelberg, Germany, 2022. [Google Scholar]
  31. Mnih, V.; Heess, N.; Graves, A. Recurrent models of visual attention. In Advances in Neural Information Processing Systems 27, Proceedings of the Annual Conference on Neural Information Processing Systems 2014, NIPS, Montreal, QC, Canada, 8–13 December 2014; NIPS: Montreal, QC, Canada, 2014; Volume 27, p. 27. [Google Scholar]
  32. Bahdanau, D.; Cho, K.; Bengio, Y. Neural machine translation by jointly learning to align and translate. arXiv 2014, arXiv:1409.0473. [Google Scholar]
  33. Zhu, B.; Hofstee, P.; Lee, J.; Al-Ars, Z. An attention module for convolutional neural networks. In Artificial Neural Networks and Machine Learning, Proceedings of the ICANN 2021: 30th International Conference on Artificial Neural Networks, Bratislava, Slovakia, 14–17 September 2021; Proceedings, Part I 30; Springer: Berlin/Heidelberg, Germany, 2021. [Google Scholar]
  34. Rensink, R.A. The dynamic representation of scenes. Vis. Cogn. 2000, 7, 17–42. [Google Scholar] [CrossRef] [Scilit]
  35. Corbetta, M.; Shulman, G.L. Control of goal-directed and stimulus-driven attention in the brain. Nat. Rev. Neurosci. 2002, 3, 201–215. [Google Scholar] [CrossRef] [Scilit]
  36. Qian, S.; Ren, K.; Zhang, W.; Ning, H. Skin lesion classification using CNNs with grouping of multi-scale attention and class-specific loss weighting. Comput. Methods Programs Biomed. 2022, 226, 107166. [Google Scholar] [CrossRef] [Scilit]
  37. Singh, H.; Devi, K.S.; Gaur, S.S.; Bhattacharjee, R. Automated Skin Cancer Detection using Deep Learning with Self-Attention Mechanism. In Proceedings of the 2023 International Conference on Computational Intelligence and Sustainable Engineering Solutions (CISES), Greater Noida, India, 28–30 April 2023; IEEE: New York, NY, USA, 2023. [Google Scholar]
  38. Castro-Fernández, M.; Hernández, A.; Fabelo, H.; Balea-Fernández, F.J.; Ortega, S.; Callicó, G.M. Towards Skin Cancer Self-Monitoring through an Optimized MobileNet with Coordinate Attention. In Proceedings of the 2022 25th Euromicro Conference on Digital System Design (DSD), Maspalomas, Spain, 31 August–2 September 2022; IEEE: New York, NY, USA, 2022. [Google Scholar]
  39. Aladhadh, S.; Alsanea, M.; Aloraini, M.; Khan, T.; Habib, S.; Islam, M. An effective skin cancer classification mechanism via medical vision transformer. Sensors 2022, 22, 4008. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  40. Liu, Z.; Mao, H.; Wu, C.-Y.; Feichtenhofer, C.; Darrell, T.; Xie, S. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022. [Google Scholar]
  41. Yar, H.; Hussain, T.; Agarwal, M.; Khan, Z.A.; Gupta, S.K.; Baik, S.W. Optimized Dual Fire Attention Network and Medium-Scale Fire Classification Benchmark. IEEE Trans. Image Process. 2022, 31, 6331–6343. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  42. Yang, J.; Li, C.; Dai, X.; Yuan, L.; Gao, J. Focal modulation networks. Adv. Neural Inf. Process. Syst. 2022, 35, 4203–4217. [Google Scholar]
  43. Chaturvedi, S.S.; Gupta, K.; Prasad, P.S. Skin lesion analyser: An efficient seven-way multi-class skin cancer classification using mobilenet. In Proceedings of the International Conference on Advanced Machine Learning Technologies and Applications, Jaipur, India, 13–15 February 2020; Springer: Berlin/Heidelberg, Germany, 2020. [Google Scholar]
  44. Huang, H.W.; Hsu, B.W.; Lee, C.; Tseng, V.S. Development of a light-weight deep learning model for cloud applications and remote diagnosis of skin cancers. J. Dermatol. 2021, 48, 310–316. [Google Scholar] [CrossRef] [Scilit]
  45. Shahin, A.H.; Kamal, A.; Elattar, M.A. Deep ensemble learning for skin lesion classification from dermoscopic images. In Proceedings of the 2018 9th Cairo International Biomedical Engineering Conference (CIBEC), Cairo, Egypt, 20–22 December 2018; IEEE: New York, NY, USA, 2018. [Google Scholar]
  46. Carcagnì, P.; Leo, M.; Cuna, A.; Mazzeo, P.L.; Spagnolo, P.; Celeste, G.; Distante, C. Classification of skin lesions by combining multilevel learnings in a DenseNet architecture. In Proceedings of the 20th International Conference Image Analysis and Processing (ICIAP 2019), Trento, Italy, 9–13 September 2019; Springer: Berlin/Heidelberg, Germany, 2019. [Google Scholar]
  47. Chaturvedi, S.S.; Tembhurne, J.V.; Diwan, T. A multi-class skin Cancer classification using deep convolutional neural networks. Multimedia Tools Appl. 2020, 79, 28477–28498. [Google Scholar] [CrossRef] [Scilit]
  48. Alsunaidi, S.J.; Almuhaideb, A.M.; Ibrahim, N.M.; Shaikh, F.S.; Alqudaihi, K.S.; Alhaidari, F.A.; Khan, I.U.; Aslam, N.; Alshahrani, M.S. Applications of big data analytics to control COVID-19 pandemic. Sensors 2021, 21, 2282. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.