Advanced Skin Disease Diagnosis and Treatment: Leveraging Convolutional Neural Networks for Image-Based Prediction and Comprehensive Health Assistance ()
1. Introduction
1.1. Research Background
Skin diseases are a major global health concern, encompassing a wide range of conditions with varying severity. Prompt and precise diagnosis is critical for effective treatment. However, traditional methods often rely on dermatologists, creating disparities in access to care. Furthermore, the subjective nature of visual assessments can lead to inconsistent diagnoses.
A potential remedy for these issues is artificial intelligence, namely convolutional neural networks (CNNs). CNNs are especially useful for examining skin lesions because of their outstanding ability in image recognition and classification. By training these networks on extensive datasets of skin images, we can develop highly accurate models capable of identifying various skin diseases. These models can serve as invaluable tools for dermatologists, assisting in differential diagnosis and reducing the likelihood of misdiagnosis. Moreover, they have the potential to enhance accessibility to dermatological care by enabling remote diagnosis and triage.
Beyond diagnosis, this research explores the integration of CNN-based models into a comprehensive health assistance system. By combining image analysis with patient-reported symptoms, medical history, and other relevant information, we can adopt a more holistic approach to managing skin diseases. This system could provide personalized treatment recommendations, monitor disease progression, and improve patient education and self-management.
The ultimate goal of this research is to advance the field of dermatology by developing and validating a robust CNN-based model for diagnosing skin diseases and demonstrating its potential to improve patient outcomes through a comprehensive health assistance system. By addressing the limitations of traditional methods and leveraging the power of AI, this research aims to transform skin disease management, making it more accessible and effective.
1.2. Objectives
To create and assess a highly accurate Convolutional Neural Network (CNN) model that can use digital photos of skin lesions to diagnose a variety of skin conditions.
To look into how well various CNN architectures and pre-trained models may increase the precision and effectiveness of diagnosing skin conditions.
1.3. Justification of Study
Dermatological image analysis has greatly improved the detection and diagnosis of skin conditions thanks to the application of machine learning (ML) in dermatology. Particularly, convolutional neural networks (CNNs) have shown excellent diagnostic accuracy for common skin disorders like eczema, psoriasis, and acne [1]. These networks can identify critical features in medical images that may not be immediately apparent to human observers, enhancing traditional diagnostic methods. Our research is driven by the conviction that machine-learning models can greatly increase the precision and speed of skin disease diagnosis. Our research’s main goal is to employ medical imagery to improve the efficiency and diagnostic accuracy of skin disease detection. CNNs are especially well-suited for this task since they have proven to be very adept at processing intricate visual data, which makes them a prime contender for addressing dermatological diagnostic difficulties. Our research has the potential to improve healthcare outcomes and lessen the workload for medical personnel by developing diagnostic tools.
Beyond CNNs, other machine learning algorithms like Support Vector Machines (SVM) and K-Nearest Neighbors (KNN) have shown promise in medical image classification. Combining these techniques with CNNs can further enhance diagnostic accuracy, providing robust solutions for skin disease classification [2]. The primary goal of this research is to leverage medical imagery to improve the efficiency and diagnostic accuracy of skin disease detection. Advanced CNN architectures are particularly suitable for this task due to their ability to process complex visual data and extract intricate patterns from dermatological images, which are crucial for diagnosing diseases like melanoma, eczema, psoriasis, etc. [3]. Despite the progress in ML applications for dermatological diagnostics, challenges remain. Many existing studies rely on limited datasets, leading to models that struggle with generalization [4]. This study uses a bigger, well-annotated dataset of dermatological photos to overcome this constraint and enhance the model’s resilience to a range of skin diseases. Techniques for preprocessing and data augmentation improve representation and reduce class imbalances, which further improves the model’s training [5].
By developing a practical ML application that combines CNNs with user-friendly interfaces, this research seeks to bridge the gap between theoretical advancements and real-world applications. The resulting tool aims to democratize access to ML-driven diagnostics, providing an intuitive interface for both healthcare professionals and patients. With these advancements, this research contributes to improving the accessibility, accuracy, and efficiency of skin disease management. Our research closes the gap between theoretical developments in machine learning and real-world medical applications by creating a real-world ML application that uses CNNs. To democratize the use of ML in dermatological diagnostics, we want to develop an intuitive user interface that makes these potent ML technologies available to both patients and healthcare professionals.
1.4. Scope of Study
This study investigates the categorization and diagnosis of skin illnesses utilizing dermatological photos using Convolutional Neural Networks (CNNs). In particular, we assess how well several machine learning algorithms, including CNN, Decision Trees, Random Forest, XGBoost, SVM, and K-Nearest Neighbors (KNN), identify regions of interest in photos of skin diseases. The objective is to create an ML-based application that can quickly and reliably diagnose photos of skin diseases in real time. These architectures are particularly effective for processing complex visual data, allowing for accurate detection of skin conditions such as melanoma, eczema, and psoriasis [6]. We want to create a highly efficient model that is excellent at managing the massive amounts of picture data that are common in medical diagnostics by using CNNs model architecture. CNNs model have demonstrated great potential in picture classification workloads due to their deep design and capacity to sustain performance without experiencing vanishing gradient issues [7]. In order to improve model performance while reducing data loss during training, our research will examine several CNN setups.
This study will focus on performance assessment criteria such as accuracy, precision, recall, F1 Score, and false negative rate, in addition to refining the CNN model. Our goal is to evaluate our model’s performance in practical diagnostic applications by examining these metrics. Additionally, the study will concentrate on enhancing the effectiveness of data processing methods to guarantee that the tool can swiftly and precisely scan and categorize dermatological photos [8]. The ultimate goal of our study is to create an ML-driven tool that can diagnose skin conditions in real time, which will be a great help to patients and medical professionals alike. The tool’s potential influence on medical diagnostics will be increased by its design, which will make it accessible, scalable, and reasonably priced. Our work will advance the area of skin disease diagnosis by thoroughly evaluating and testing CNN models, providing a dependable and effective option for medical practitioners.
2. Literature Review
This study uses the HAM10000 dataset, a sizable collection of dermatological photos, to investigate the possibilities of deep learning in the classification of skin conditions. The authors categorize seven distinct skin disorders using a variety of Convolutional Neural Network (CNN) architectures, including Sequential CNN, DenseNet-121, and ResNet-50. By using data augmentation approaches, the study tackles the problem of imbalanced datasets, improving the models’ capacity to generalize and prevent overfitting. On the validation dataset, the Sequential CNN model with seven convolutional layers and batch normalization had the best accuracy (94%). The suggested Sequential CNN model performs better than DenseNet121 and ResNet-50 in terms of accuracy, precision, and recall, according to comparative research [9].
This Research presents a new approach for diagnosing skin diseases using a Deep Convolutional Neural Network. The authors address the complexity of dermatological diagnosis, especially for conditions like melanoma and carcinoma, which are difficult to identify in the early stages [10]. The proposed model processes skin images, removing noise and enhancing image quality. It uses feature extraction techniques and the softmax classifier to produce diagnostic reports. The proposed DCNN model is trained and tested using the HAM10000 dataset, which consists of 10,015 images of various skin conditions. Demonstrates superior accuracy of 93.4%, precision of 91.3%, and recall of 92.2% [11].
This study offers a fresh strategy to improve the precision and effectiveness of skin cancer diagnosis. The authors leverage the strengths of Discrete Wavelet Transformation (DWT) for feature extraction and combine it with the classification power of Convolutional Neural Networks (CNNs). Using DWT allows the model to analyze images in both spatial and frequency domains, capturing comprehensive information. The HAM10000 dataset is utilized in the research. It includes 10,000 photos of skin lesions that are divided into seven cancer kinds, such as benign keratosis, basal cell carcinoma, and melanoma. The suggested model achieved a 91% specificity and 92% sensitivity classification result [12].
This study suggests a new dermoscopy detection and classification technique based on convolutional neural networks (CNNs) for the diagnosis of skin conditions. After analyzing and processing picture data with a Convolutional Neural Network (CNN), the system employs a softmax classifier to extract features and classify the results. According to preliminary findings, the accuracy of identifying skin conditions from photos is 70%; with a larger dataset, this might rise to over 90%. The dataset’s size limits this system, while a larger dataset may result in higher accuracy [13].
This study offered a computer vision-based method for diagnosing five prevalent skin conditions: melanoma, nevus, herpes, eczema, and atopic dermatitis. MobileNet and Xception are two deep learning architectures that the authors implemented and contrasted. They used transfer learning, utilizing pre-trained weights from the ImageNet dataset, to get around the problem of limited data. To develop a more reliable and broadly applicable model, they also used real-time picture augmentation. Authors were carried out using a dataset of 18,692 photos that were divided into testing, validation, and training sets. Metrics like precision, recall, F1-score, confusion matrix, ROC curves, and classification accuracy were used to assess performance. The outcomes showed how well both the MobileNet and Xception models worked, especially when paired with augmentation and transfer learning. Xception obtained a test accuracy and F1-score of 93.00%, whereas MobileNet obtained a classification accuracy of 92.00% and an F1-score of 92.38%. The authors contrasted their suggested methods with those of existing deep learning models, such as DenseNet, ResNet50, InceptionV3, and Inception-ResNet. The findings demonstrated that in terms of accuracy and F1-score, MobileNet and Xception performed better than the other models [14].
This study examines the multi-classification of skin lesions from dermoscopic and clinical 4000 pictures using convolutional neural networks (CNNs). Three distinct CNN architectures (ResNet, Inception, and InceptionResNet) that were trained on the ImageNet dataset and refined on the skin lesion dataset are used in the authors’ innovative ensemble technique, which is based on progressive transfer learning. The suggested ensemble approach distinguished between four types of skin lesions: seborrheic keratosis (SK), melanoma (MM), common nevus (NV), and basal and squamous cell carcinomas (CAR) with an average sensitivity of 79.9% and specificity of 93.3%. Three ensemble configurations are compared: Method A (feature extraction with dense layers), Method B (concatenating softmax outputs with dense layers), and Method C (averaging softmax outputs). Method B was found to provide the best tradeoff between model complexity and generalization capability. The authors highlight the challenges of using clinical images, which can contain higher levels of noise, illumination variations, and occlusions compared to dermoscopic images. They demonstrate that the proposed ensemble scheme can effectively address these challenges and outperform traditional approaches for classifying skin lesions in a multi-class setting [15].
This study suggested a method for identifying skin conditions that makes use of a convolutional neural network (CNN). The authors validated the architecture using a DermNet database. The accuracy of the suggested CNN classifier ranged from 92.6% to 93.04%. The Convolution Layer, Activation Layer, Pooling Layer, Fully Connected Layer, and Soft-Max Classifier are among the 11 layers of the CNN that the authors suggested. The authors’ main focus was on automatic diagnosis of skin diseases. The authors of the research talked about the difficulties in automating the procedure, such as differences in skin tones, the disease’s location, and the requirements of the image acquisition equipment. Additionally, the authors gave the confusion matrix for test images and talked about how well the suggested strategy worked [16].
This research introduces a novel approach for classifying skin diseases using a deep convolutional neural network (CNN). The authors address the need for efficient and accurate skin disease diagnosis by utilizing a dataset of over 25,000 images covering eight common skin conditions. The authors evaluate the performance of various transfer learning techniques, including VGG16, VGG19, ResNet models, InceptionV3, DenseNet models, and MobileNet, to identify the most effective approach. The authors highlight the challenges associated with skin disease diagnosis, such as visual similarity between conditions, varying image quality, and the need for expert knowledge. To overcome these challenges, the researchers implement a robust preprocessing pipeline and incorporate data augmentation techniques. Their findings demonstrate that ResNet152 outperforms other models in terms of accuracy, precision, and recall, achieving a classification accuracy of over 75% [17].
Convolutional Neural Networks (CNN) are being used in this research to construct a deep learning-based skin disease detection system that can diagnose psoriasis and eczema. The authors used Adam and Rmsprop optimizers to implement and compare five distinct state-of-the-art CNN architectures: VGG-16, Inception v3, ResNet-50, MobileNet v2, and Inception ResNet v2. The scientists used a collection of 1000 photos of skin conditions, including 510 photos of psoriasis and 490 photos of eczema. Outperforming other architectures, the authors discovered that Inception ResNet v2 with Adam optimizer had the highest accuracy (91.1% validation and 90.8% testing). They proposed two practical approaches for implementing the model: 1) smartphone-oriented and 2) web server-oriented approaches. The authors demonstrate the effectiveness of CNN in accurately diagnosing skin diseases and emphasize the potential for practical applications, such as real-time diagnosis, using mobile applications or web-based platforms [18].
This study suggested utilizing convolutional neural networks (CNNs) to categorize digital photos of skin conditions. Ten convolutional layers—eight hidden layers and two thick layers—make up the CNN-based model that the authors suggest. To train, validate, and test the model, the authors used 2045 photos of various skin illnesses, including Melanoma-776, Melanocytic Nevus-654, and Basal Cell Carcinoma-615. The authors use the Adam optimizer to modify the model’s parameters and data augmentation approaches to improve the training process. With a 90% validation and 95% classification accuracy, the suggested CNN model showed promise in transforming dermatology by offering a precise and automated method of diagnosing skin conditions. The paper also covers the difficulties in image analysis, such as picture segmentation, image quality, feature extraction, and computational complexity. They explore techniques like image resizing and data augmentation to address some of these challenges [19].
This study investigates the classification of skin diseases in a mobile application using federated learning and convolutional neural networks (CNNs). The intrinsic variations in skin texture, different complexions, and the presence of hair and other surface features are some of the difficulties in classifying skin diseases that are highlighted in the research. The necessity of an automated and precise system for detecting skin diseases while protecting data privacy is emphasized in the research. The paper suggests using CNNs and the federated learning approach to create a mobile application for classifying skin diseases. The goal of this mobile application is to offer a cutting-edge approach to skin analysis while upholding the strictest privacy and data security guidelines. The study demonstrates how CNNs and federated learning may be used to classify skin diseases, creating an efficient mobile application for diagnosis without compromising data security or privacy. The paper provides a comprehensive overview of existing research on deep learning in medical image processing, particularly focusing on skin disease classification. It analyzes the performance of various pre-trained CNN models, including AlexNet, DenseNet, Xception, VGG16, and ResNet, and demonstrates the efficacy of the proposed CNN architecture for classifying skin diseases. The authors present the architecture and implementation details of their proposed CNN model and elaborate on the data preprocessing, training, and evaluation processes. A total of 24,138 images were used. 19,310 of them were used for training and 4828 for testing. The proposed CNN model achieved an accuracy of 90% in skin disease classification. The model was trained using the Adam optimizer with a learning rate of 0.0001 and a batch size of 16 [20].
The goal of this study is to understand the effectiveness of convolutional neural network (CNN)-based methods for diagnosing skin diseases. Two types of clinical skin disease datasets were constructed by the authors: 1) Skin-10, which comprises 10,218 photos from 10 common classes of skin diseases; 2) Skin-100, a larger dataset with 19,807 images from 100 skin disease classes. By comparing a number of SOTA CNN models, they demonstrated that skin-100’s accuracy is significantly worse than skin-10’s. Using an ensemble approach based on multiple CNN models, the authors were able to attain the highest accuracy of 53.54% for Skin-100 and 79.01% for Skin-10. By adding bounding boxes to the Skin-10 dataset, they also demonstrated an object detection-based method. According to their findings, object detection can increase the precision of some skin disease classifications [21].
A Convolutional Neural Network (CNN) model is proposed in this study to categorize and forecast skin conditions. 5633 photos of five different conditions—acne, eczema, melanoma, psoriasis, and urticaria hives—are used in the suggested model. The model obtained an accuracy of 83% on the test set of the dataset, which is separated into training and testing sets. Multiple layers, including convolution, pooling, ReLU, and fully linked layers, make up the CNN model. Forward and backward propagation are used to train the model, and this process is continued until the model has mastered the picture features. According to the authors, the CNN model can accurately determine the kind of skin condition depicted in the pictures [22].
This study suggests a deep learning-based model for dividing skin lesions into five groups: benign, malignant, eczema, acne, and healthy. The model uses an error-correcting output code (ECOC) support vector machine (SVM) for classification after a deep convolutional neural network (AlexNet) is used to extract features from the image. A total of 9144 photos from various sources were used in this study. Thirty percent of the dataset is for testing, and seventy percent is for training. According to the findings, the suggested model has an accuracy of 86.21% and a generalization error of 0.1593. The suggested model performs better than earlier research, increasing accuracy by 3.21% [23].
The existing literature has made notable strides in applying machine learning and deep learning techniques for dermatological diagnosis. Prominent studies employ CNN architectures such as ResNet50, DenseNet, and MobileNet while utilizing datasets like HAM10000, ISIC, and DermNet. These approaches typically achieve diagnostic accuracies ranging from 70% to 95%. We set a new benchmark by delivering a highly efficient and accurate diagnostic system specifically tailored for dermatological applications. This study achieves a remarkable diagnostic accuracy of 94.65%, outperforming traditional machine learning models such as SVM and KNN in both accuracy and robustness. Unlike prior studies, which often adopt a generalized approach, this research strategically utilizes the DermNet dataset of 19,500 images, ensuring a comprehensive yet focused analysis of 23 distinct skin disease categories. This work addresses critical gaps in the literature by emphasizing real-time applicability and scalability, offering a user-friendly diagnostic tool designed to be both accessible and affordable. The integration of advanced preprocessing techniques, including data augmentation, ensures that the model is not only accurate but also resilient to data imbalances.
By combining cutting-edge CNN architectures with practical usability, this research surpasses existing studies in its ability to provide a transformative solution for dermatological care. It bridges the gap between theoretical advancements and real-world implementation, making it a groundbreaking contribution to the field of medical diagnostics.
3. Methodology
3.1. Dataset Description
The DermNet Skin Disease Dataset comprises a diverse collection of 19,500 dermoscopic images categorized into 23 distinct skin diseases. This dataset is intended to aid in research, development, and education within the field of dermatology and medical image analysis. It provides a rich resource for building and evaluating machine learning models, particularly for tasks such as image classification, clustering, and exploratory data analysis (EDA).
Dataset Characteristics:
The images are sourced from the public portal DermNet (www.dermnet.com), the largest online dermatology resource. DermNet is dedicated to providing medical education and serves as a trusted repository for dermatological imagery, as shown in Table 1.
Table 1. Dataset characteristics.
Dataset Characteristics |
Number of Images |
19,500 |
Training Set |
15,500 images |
Test Set |
4000 images |
Categories |
23 types of skin diseases |
Image Format |
JPEG |
Color Format |
RGB |
Resolution |
Not extremely high-resolution |
Preprocessing Requirements:
Image Resizing: In order to satisfy the input specifications of deep learning models, we scaled images to a consistent dimension (224 × 224 pixels).
Normalization: To improve model performance and computational efficiency, pixel values were normalized to a range of 0 - 1.
Augmentation: In order to enhance model generalisation, data augmentation methods like flipping, rotation, and zooming were used.
Dataset Structure: The dataset structure is shown in Table 2
Table 2. Dataset structure.
Image File |
Category |
acne_001.jpg |
Acne |
melanoma_045.jpg |
Melanoma |
eczema_023.jpg |
Eczema |
seborrheic_keratoses_12.jpg |
Seborrheic Keratoses |
3.2. Data Preprocessing
3.2.1. Sample Selection
Figure 1 contains the dataset sample images. The dataset is divided into test and training data for every type of skin condition. Eighty percent of the dataset is made up of train data, and twenty percent is made up of test data. As indicated in Table 3, the validation data was collected using the same number of images as the test data, either in the train data or the test data.
To achieve exceptional results in the skin disease detection system, a few major challenges must be overcome. For example, creating a database and standardizing image dimensions. The next section explains the image scaling process.
Figure 1. Dataset sample image.
Table 3. Image sample collection.
Sl |
Class |
Training |
Testing |
Validation |
1 |
Bullous Disease Photos |
448 |
113 |
113 |
2 |
Light Diseases and Disorders of Pigmentation |
568 |
143 |
143 |
3 |
Warts Molluscum and Other Viral Infections |
1086 |
272 |
272 |
4 |
Exanthems and Drug Eruptions |
404 |
101 |
101 |
5 |
Actinic Keratosis Basal Cell Carcinoma and Other Malignant Tumors |
1149 |
288 |
288 |
6 |
Herpes HPV and Other STDs Photos |
405 |
102 |
102 |
7 |
Urticaria Hives |
212 |
53 |
53 |
8 |
Psoriasis Pictures Lichen Planus and Related
Diseases |
1405 |
352 |
352 |
9 |
Eczema Photos |
1235 |
309 |
309 |
10 |
Atopic Dermatitis Photos |
489 |
123 |
123 |
11 |
Acne and Rosacea Photos |
840 |
312 |
312 |
12 |
Poison Ivy Photos and Other Contact Dermatitis |
260 |
65 |
65 |
13 |
Hair Loss Photos Alopecia and Other Hair
Diseases |
239 |
60 |
60 |
14 |
Seborrheic Keratoses and Other Benign Tumors |
1371 |
343 |
343 |
15 |
Lupus and Other Connective Tissue Diseases |
420 |
105 |
105 |
16 |
Systemic Disease |
606 |
152 |
152 |
17 |
Nail Fungus and Other Nail Diseases |
1040 |
261 |
261 |
18 |
Cellulitis Impetigo and other Bacterial Infections |
288 |
73 |
73 |
19 |
Melanoma Skin Cancer Nevi and Moles |
463 |
116 |
116 |
20 |
Tinea Ringworm Candidiasis and Other Fungal Infections |
1300 |
325 |
325 |
21 |
Vascular Tumors |
482 |
121 |
121 |
22 |
Vasculitis Photos |
416 |
105 |
105 |
23 |
Scabies Lyme Disease and Other Infestations |
431 |
108 |
108 |
3.2.2. Image Resizing
An input image’s size can be increased or decreased to address the issue of disparate image sizes in the database. All photographs will have the same number of characteristics if the image sizes are unified. Additionally, shrinking the image improves system speed by cutting down on processing time. Figure 2 displays the original 250 × 500-pixel image. Figure 3 displays the resized image at 224 by 224 pixels.
Figure 2. Original image (250 × 500).
Figure 3. Resizing image (224 × 224).
3.2.3. Training Model
In pursuit of optimizing performance for our skin disease classification project, the dataset underwent a series of preprocessing steps to prepare it for training and evaluation. These steps ensure computational efficiency, compatibility with selected machine learning and deep learning models, and enhanced model performance. The original dermoscopic images, available in varying resolutions, were resized to a computationally efficient dimension of 224 × 224 pixels, as illustrated in Table 4. This resizing aligns with the input requirements of deep learning architectures such as MobileNet, VGG16, and ResNet50. Pre-trained models, such as VGG16 and ResNet50, retained the RGB format to preserve their three-dimensional color representation. Three model types are employed:
1) Custom CNN
2) Transfer Learning (VGG16, ResNet50, MobileNet)
3) Classical Machine Learning Algorithms
Deep learning models were trained using a batch size of 32, while classical models processed flattened image data without batching.
Table 4. Structure of training data.
SL |
Methods |
Image Size |
Color Channel |
Batch Size |
1 |
Custom CNN |
224, 224 |
3 |
32 |
2 |
Transfer Learning |
224, 224 |
3 |
32 |
3 |
Classical Algorithms |
224, 224 |
3 |
None |
3.2.4. Training Batch Size
Deep learning models, including Custom CNNs and pre-trained architectures, were trained with a batch size of 32, optimizing GPU utilization. Classical machine learning models, due to their structural simplicity, did not require batching and processed the flattened dataset directly.
When training deep learning models, significant computational resources are required due to the complexity of neural network architectures. A batch training strategy with a size of 32 was adopted for efficient GPU utilization. Conversely, classical machine learning models were trained on a flattened configuration of the data without batching, reflecting their distinct computational requirements.
These preprocessing steps ensure compatibility with various model architectures while optimizing both computational efficiency and model performance.
3.3. Model Architecture
Our customized Convolutional Neural Network (CNN) architecture, designed for skin disease classification, is outlined in Figure 4. It includes several key components: convolutional layers, MaxPooling layers, Dense layers, and Dropout layers. “valid” padding was employed for all convolutional layers to minimize information loss during training. A stride of (2, 2) was used in the convolutional layers to downsample the feature maps efficiently. For MaxPooling layers, a pool size of (2, 2) was chosen to selectively downsample feature maps and preserve salient features, also utilizing “valid” padding to avoid zero padding.
Figure 4. Custom CNN architecture.
A custom Convolutional Neural Network was developed for skin disease classification. The architecture consists of:
Convolutional Layers: Extract local features (edges, textures, lesion shapes).
Max Pooling Layers: Reduce spatial dimensions, preserving crucial features.
Flatten Layer: Converts feature maps into a one-dimensional vector.
Dense Layers: Learn complex patterns across entire images.
Dropout Layers: Reduce overfitting by randomly deactivating neurons during training.
Softmax Activation: Outputs probability distribution over 23 disease classes.
In this CNN designed for skin disease classification, the input layer receives the dermoscopic image data, which is typically represented as pixel values in RGB format. The preprocessing ensures these images are resized to a standard 224 × 224 pixels and normalized to a pixel value range of (0 to 1), optimizing the model’s performance. Conv2D layers are pivotal in the architecture, performing sliding window operations to detect local patterns and features within the images, such as texture variations, lesion shapes, and pigmentation differences. These patterns are crucial for distinguishing between diseases like melanoma, eczema, or psoriasis. MaxPooling2D layers follow each Conv2D layer, reducing the spatial dimensions of the feature maps. This pooling operation selects the maximum value from predefined regions, thereby retaining the most salient features while discarding redundant information. The reduction in spatial size also improves computational efficiency and prevents overfitting by focusing the model on the critical features of each skin condition. The sequence of Conv2D and MaxPooling2D layers is repeated, enabling the model to learn progressively complex and hierarchical representations of skin disease features. For instance, the earlier layers might detect simple patterns like edges, while deeper layers capture more abstract features, such as the irregular borders of a mole or specific pigmentation clusters associated with a condition. The Flatten layer then converts the multidimensional feature maps into a one-dimensional array. This transformation is essential for transitioning to the Dense layers, where the model learns global relationships and patterns that span the entire image. These layers integrate the localized features extracted by the convolutional layers to classify diseases effectively. Dropout layers are interspersed between Dense layers to randomly deactivate a fraction of neurons during training. This regularization technique prevents the model from overfitting, ensuring that it generalizes well to unseen dermoscopic images. The output Dense layer generates predictions, with the number of neurons corresponding to the number of skin disease classes. The activation function, such as softmax for multi-class classification or soft max for binary tasks, ensures the output represents probabilities for each class. This CNN architecture is particularly effective for skin disease classification because it automatically learns hierarchical representations of features, from basic textures to complex patterns, directly from the input data. By leveraging these capabilities, the model can accurately classify and differentiate between various dermatological conditions, making it a valuable tool for diagnostic support in clinical and research settings. In Table 5, we can find the layer Architecture Breakdown for Skin Disease Classification.
Table 5. Layer architecture breakdown for skin disease classification.
SL. No |
Layer (Type) |
Output Shape |
Parameters |
1 |
Input Layer |
(Batch, 224, 224, 3) |
|
2 |
Conv2d-1 |
(Batch, 112, 112, 64) |
832 |
3 |
MaxPool2d-3 |
(Batch, 56, 56, 64) |
0 |
4 |
Conv2d-4 |
(Batch, 28, 28, 64) |
16,448 |
5 |
MaxPool2d-6 |
(Batch, 14, 14, 64) |
0 |
6 |
Flatten-7 |
(Batch, 12544) |
0 |
7 |
Dropout-9 |
(Batch, 64) |
0 |
8 |
Linear-10 |
(Batch, 64) |
4160 |
9 |
Dropout-12 |
(Batch, 64) |
0 |
10 |
Linear-13 |
(Batch, 23) |
1495 |
11 |
Softmax-14 |
(Batch, 23) |
0 |
Total params: 22,935 Trainable params: 22,935 Non-trainable params: 0 |
3.4. Loss Function and Optimizer
In the field of deep learning focused on binary classification, the logarithmic loss function, commonly referred to as binary cross-entropy, stands out as a preferred option due to its success in reducing loss. This metric is designed to measure the difference between predicted results and real observations. The formula applied for this analysis is represented as:
We utilized the cross-entropy loss function to measure the effectiveness of our classification model. In this context, N represents the total number of images in our training dataset, which comprises 15,500 samples. Each image, indexed by “i”, is associated with a true classification label (
) and a predicted probability (
). The summation across all samples captures the total logarithmic loss, which assesses the difference between the predicted and actual classifications. By normalizing this total loss by dividing it by N, we obtain the average loss. This average loss is a crucial metric that guides our model’s training, embodying our objective of minimizing predictive errors across the entire dataset. It emphasizes the core of our model optimization strategy, providing a detailed view of how our model aims to improve its predictive performance throughout the training process. The formula governing the Adam optimizer is expressed as:
represents the updated parameter at the time step
.
denotes the learning rate-adjusted gradient or a component related to the gradient update.
signifies the first-moment estimate of the gradient in Adam.
A robust model architecture tailored for automated skin disease classification is developed. The CNN-based approach, combined with transfer learning and augmentation techniques, enhances accuracy and generalization, making it a valuable diagnostic tool in medical image analysis.
3.5. Justification of Methodology
This research is underpinned by a systematic selection and curation of a dataset comprising 19,500 dermoscopic images sourced from the publicly available Dermnet dataset. The dataset spans 23 categories of skin diseases, including common conditions like acne, melanoma, eczema, and psoriasis. The high-quality dataset ensures that the model can effectively learn the diverse patterns and features associated with various dermatological conditions. Images are stored in JPEG format with RGB channels, accommodating the computational requirements of machine learning models.
To enhance the model’s ability to generalize, the dataset is judiciously partitioned into 80% for training and validation (~15,500 images) and 20% for testing (~4000 images). This partitioning strategy ensures a robust evaluation of the model while dedicating sufficient data to training. Additionally, class imbalances are addressed through data augmentation techniques, such as rotations, flips, and color adjustments, specifically targeting underrepresented classes like rare bullous disorders. This approach improves class distribution and ensures that the model learns uniformly across all disease categories.
In the data preprocessing phase, images are resized to 224 × 224 pixels, optimizing computational efficiency without compromising critical diagnostic details. Since dermoscopic images often rely on color for diagnosis, the RGB format is preserved to retain important chromatic features. Pixel values are normalized to a range of 0 to 1, enhancing model convergence and stability by stabilizing the optimizer’s performance during training.
The chosen model architecture, depicted in Figure 1, is a custom Convolutional Neural Network (CNN) tailored for skin disease classification. The CNN consists of multiple convolutional and MaxPooling layers optimized through iterative testing. “Valid” padding is employed to prevent border information loss, while a stride of (2, 2) and a pool size of (2, 2) in the MaxPooling layers ensure efficient feature extraction and downsampling. Empirical experimentation has determined that 128 filters in the convolutional layers and 128 neurons in the dense layers yield the most favorable results. The Rectified Linear Unit (ReLU) activation function introduces non-linearity, enabling the model to capture intricate patterns and features of skin conditions.
For binary classification tasks, such as differentiating between healthy and diseased skin, binary cross-entropy is employed due to its effectiveness in reducing classification errors. For multi-class classification across 23 disease categories, categorical cross-entropy is used. The Adam optimizer is selected over traditional optimizers like Stochastic Gradient Descent (SGD) because of its adaptive learning rate and superior convergence properties. This decision is supported by prior research and empirical evaluations, where Adam demonstrated consistently optimal performance for image classification tasks. Data augmentation, normalization, and optimizer selection align with best practices in medical imaging and machine learning.
4. Requirement Analysis, Design & Developments
4.1. Computational Requirements
Developing deep learning models, especially Convolutional Neural Networks, requires (CNNs) substantial computational resources. Since skin disease prediction typically involves working with large image datasets, high-performance computing is necessary.
To meet this requirement, we turned to cloud-based platforms that provide cost-effective access to powerful computing resources. For example, Google Colab offers free access to Nvidia Tesla T4 GPUs, enabling efficient training and fine-tuning of complex deep-learning models.
In addition to Colab, we also utilized local computing resources when necessary, such as GPUs in personal machines or institutional resources, ensuring flexibility in training.
4.1.1. Development Environment
We chose to use Jupyter Notebooks as our primary development environment. Jupyter’s integration with IPython allows for step-by-step execution of code, making it easier to experiment and debug the model. Additionally, we leveraged Google Colab’s cloud-based environment, which supports easy integration with Keras and other deep learning frameworks for model training, allowing us to scale our experiments and perform resource-intensive operations in the cloud. The combination of Jupyter Notebooks for interactive coding and Google Colab for computational power allowed for a seamless development workflow that greatly accelerated our model-building process. Figure 5 shows the DFD diagram of the Proposed System.
4.1.2. Data Flow Diagram
Figure 5. DFD diagram of the proposed system.
4.2. Loss and Training Analysis
Upon detailed analysis of the data, a clear trend emerged, as shown in Figure 6, demonstrating a consistent reduction in loss and a corresponding increase in accuracy throughout the training period. At the beginning of the training, we observed some initial overfitting in the first few epochs. However, this issue was gradually resolved, indicating that the model training process was progressing effectively.
Figure 6. CNN loss vs training.
In the graphical analysis, the training loss and accuracy are represented using a blue line, while the validation accuracy and validation loss are shown in yellow. The close alignment between the blue and yellow lines suggests that the model has generalized the validation data well. Training accuracy exceeded 94%, which indicates that the model is learning to classify skin diseases with high precision.
The graphs reflect a smooth and harmonious convergence between the training and validation metrics, suggesting minimal overfitting and underfitting during the training phase. This indicates a robust model with effective learning, resulting in a high-performing system for skin disease classification.
5. Result Analysis
5.1. Confusion Matrix
The confusion matrix (Figure 7) is a performance evaluation tool that provides a detailed breakdown of the classification model’s predictions compared to actual outcomes. It summarizes the results of the model’s predictions for each class of skin disease, enabling a deeper understanding of the model’s strengths and areas for improvement.
In this research, the confusion matrix provides insights into the following metrics:
True Positives (TP): Accurate forecasts in which the disease class was correctly recognized by the model.
True Negatives (TN): Accurate forecasts in which an illness not seen in the picture was ruled out by the model.
False Positives (FP): Prediction errors in which the model incorrectly identified an absent disease.
False Negatives (FN): Predictions that are incorrect because the model was unable to detect the disease.
For example, in the case of “Psoriasis Pictures Lichen Planus and Related Diseases,” the matrix shows the number of correctly classified images (TP), along with misclassifications either as other diseases (FP) or failure to identify psoriasis when present (FN). Correctly classify skin disease cases (high recall). Avoid false alarms (high precision). Maintain overall predictive performance (high F1-score). The confusion matrix also enables targeted improvement, revealing specific disease classes where misclassification is more common. For instance, visually similar diseases, such as certain types of dermatitis, may have higher FP rates due to overlapping features, suggesting the need for enhanced feature extraction or class balancing during training.
Each of the 23 different skin disease classes included in the confusion matrices produced for this study provides a thorough analysis of the effectiveness of the CNN-based classification model. For the sake of clarity and conciseness, Figures 8-19 only display 12 exemplary confusion matrices. By displaying the number of true positives, true negatives, false positives, and false negatives for every class, each matrix demonstrates the model’s proficiency in picture classification. This thorough analysis makes it possible to comprehend the model’s advantages in great detail. The model’s durability and dependability in diagnosing a range of dermatological disorders are demonstrated by its remarkable overall accuracy of 94.65%. Important performance indicators, including F1-score, precision, and recall, further confirm the model’s capacity to distinguish across related disease classifications with minimal false negatives and false positive rates.
Figure 7. Confusion matrix.
Figure 8. Confusion matrix for bullous disease.
Figure 9. Confusion matrix for light diseases and disorders of pigmentation.
Figure 10. Confusion matrix for warts mollusca and other viral infections.
Figure 11. Confusion matrix for exanthems and drug eruptions.
Figure 12. Confusion matrix for actinic keratosis basal cell.
Figure 13. Confusion matrix for herpes HPV and other STDs.
Figure 14. Confusion matrix for urticaria hives.
Figure 15. Confusion matrix for psoriasis pictures lichen planus.
Figure 16. Confusion matrix for eczema photos.
Figure 17. Confusion matrix for atopic dermatitis photos.
Figure 18. Confusion matrix for acne and rosacea photos.
Figure 19. Confusion matrix for poison ivy photos.
5.2. Model Performance Metrics Table
The performance of the Custom CNN model was evaluated using widely recognized multi-class classification metrics, including Accuracy, Precision, Recall, and F1 Score, as summarized in Table 6. The analysis demonstrated that the CNN model achieved the highest overall accuracy and excelled particularly in Recall, whereas pre-trained models such as VGG16 and ResNet50 underperformed.
Table 6. Model performance metrics.
SL |
Class |
Accuracy |
Specificity |
Recall |
Precision |
F1-Score |
1 |
Bullous Disease Photos |
0.940002 |
0.9964 |
0.946903 |
0.884298 |
0.91453 |
2 |
Light Diseases and Disorders of Pigmentation |
0.941502 |
0.998445 |
0.944056 |
0.957447 |
0.950704 |
3 |
Warts Molluscum and Other Viral Infections |
0.939003 |
0.997587 |
0.944853 |
0.966165 |
0.95539 |
4 |
Exanthems and Drug Eruptions |
0.938753 |
0.995386 |
0.930693 |
0.839286 |
0.882629 |
5 |
Actinic Keratosis Basal Cell Carcinoma and Other Malignant Tumors |
0.940252 |
0.998384 |
0.954861 |
0.978648 |
0.966608 |
6 |
Herpes HPV and Other STDs Photos |
0.940752 |
0.997436 |
0.931373 |
0.904762 |
0.917874 |
7 |
Urticaria Hives |
0.941252 |
0.997214 |
0.924528 |
0.816667 |
0.867257 |
8 |
Psoriasis Pictures Lichen Planus and Related Diseases |
0.938253 |
0.996986 |
0.954545 |
0.9683 |
0.961373 |
9 |
Eczema Photos |
0.938003 |
0.997834 |
0.935275 |
0.973064 |
0.953795 |
10 |
Atopic Dermatitis Photos |
0.941002 |
0.998195 |
0.926829 |
0.942149 |
0.934426 |
11 |
Acne and Rosacea Photos |
0.937504 |
0.99729 |
0.935897 |
0.966887 |
0.95114 |
12 |
Poison Ivy Photos and Other Contact Dermatitis |
0.942001 |
0.997714 |
0.953846 |
0.873239 |
0.911765 |
13 |
Hair Loss Photos Alopecia and Other Hair Diseases |
0.941502 |
0.997463 |
0.933333 |
0.848485 |
0.888889 |
14 |
Seborrheic Keratoses and Other Benign Tumors |
0.938503 |
0.998087 |
0.944606 |
0.978852 |
0.961424 |
15 |
Lupus and Other Connective Tissue Diseases |
0.941752 |
0.998204 |
0.942857 |
0.933962 |
0.938389 |
16 |
Systemic Disease |
0.940752 |
0.998182 |
0.934211 |
0.95302 |
0.943522 |
17 |
Nail Fungus and Other Nail Diseases |
0.938503 |
0.996525 |
0.950192 |
0.950192 |
0.950192 |
18 |
Cellulitis Impetigo and Other Bacterial Infections |
0.940752 |
0.996691 |
0.945205 |
0.841463 |
0.890323 |
19 |
Melanoma Skin Cancer Nevi and Moles |
0.940002 |
0.996655 |
0.939655 |
0.893443 |
0.915966 |
20 |
Tinea Ringworm Candidiasis and Other Fungal Infections |
0.938503 |
0.99864 |
0.935385 |
0.983819 |
0.958991 |
21 |
Vascular Tumors |
0.940752 |
0.997166 |
0.950413 |
0.912698 |
0.931174 |
22 |
Vasculitis Photos |
0.940752 |
0.997177 |
0.942857 |
0.9 |
0.92093 |
23 |
Scabies Lyme Disease and Other Infestations |
0.940002 |
0.996405 |
0.944444 |
0.87931 |
0.910714 |
Overall: Accuracy: 94.65% Precision: 89.47% Recall: 94.44% F1-Score: 91.89% |
In dermatological diagnosis, recall is a critical metric as it measures the model’s ability to correctly identify skin disease cases (True Positives) while minimizing missed diagnoses (False Negatives). Missing a skin disease case (False Negative) could have severe consequences, including delayed treatment, which is unacceptable in clinical practice. The CNN model achieved a Recall of 94.44%, indicating a high reliability in correctly identifying actual cases of skin diseases.
The False Negative Rate (FNR) is another crucial metric in healthcare applications, such as skin disease diagnosis. A lower FNR signifies fewer missed cases, which is essential for early disease detection and timely treatment. The CNN model achieved a low FNR, confirming its robustness in minimizing overlooked dermatological conditions.
Furthermore, we can use the confusion matrix to compute a few more precise measures that may be decisive in indicating how well our models do in classification. Accuracy, precision, recall, and F1-score are these measurements. The following formulas are used to calculate these measures.
(1)
(2)
(3)
(4)
(5)
5.3. Model Comparisons
Table 7. Performance comparison table.
Model |
Accuracy |
Precision |
Recall |
F1 Score |
FNR (%) |
CNN |
0.94 |
0.89 |
0.94 |
0.91 |
0.06% |
VGG16 |
0.84 |
0.86 |
0.60 |
0.71 |
16.0% |
ResNet50 |
0.75 |
0.75 |
0.64 |
0.69 |
25.0% |
SVM |
0.87 |
0.92 |
0.81 |
0.86 |
17.8% |
KNN |
0.91 |
0.97 |
0.86 |
0.91 |
13.7% |
Decision Tree |
0.91 |
0.93 |
0.90 |
0.91 |
10.4% |
A comparative analysis of multiple models is presented in Table 7. While models such as Random Forest and XGBoost demonstrated strong performance in terms of precision and overall metrics, the CNN model outperformed them, particularly in Recall and FNR. These metrics are crucial in the context of skin disease classification, as a higher Recall and lower FNR ensure minimal missed cases, making the model highly suitable for clinical applications.
The results confirm that the Custom CNN model is the most effective in terms of overall performance, making it a viable option for automated skin disease diagnosis.
6. Conclusions
This study demonstrates the potential of convolutional neural networks (CNN) in revolutionizing dermatological diagnostics by offering accurate, efficient, and accessible solutions for skin disease detection and management. By leveraging a dataset of 19,500 labeled dermoscopic images and implementing advanced CNN architectures, the research achieved significant accuracy in diagnosing various skin conditions. Key innovations include data preprocessing techniques and model optimization strategies, which contributed to high diagnostic precision and reliability. The developed system addresses limitations in traditional dermatological methods, including inconsistent diagnoses and restricted accessibility. Its holistic approach, combining CNN-based predictions with patient-reported symptoms and medical history, provides a more comprehensive health assistance framework. The system not only facilitates early and accurate diagnosis but also enhances patient education and supports self-management, thereby contributing to improved healthcare outcomes.
While the results are promising, the study also highlights several challenges, including class imbalances, image variability, and the need for substantial computational resources. Future research could focus on expanding the dataset to incorporate rare conditions, enhancing real-time diagnostic capabilities, and exploring the integration of federated learning to ensure data privacy. This research underscores the transformative potential of AI in dermatology. By bridging the gap between theoretical advancements and practical applications, it paves the way for a new era in skin disease diagnosis, offering scalable and cost-effective solutions that can democratize access to quality healthcare worldwide.