Web-based melanoma detection system using convolutional neural networks and advanced image processing⋆ Sebastian Górecki1*,†, Wiktoria Duszczyk1,† Zuzanna Huda1,†, Andrzej Faryna2,† and Aleksandra Tatka2,† 1 Maria Sklodowska-Curie Warsaw Higher School, Al. Solidarności 12, 03-411 Warszawa 2 Centrum Diagnostyczne im. Marii Skłodowskiej-Curie sp. z o.o., Jasionka 954, 36-002 Jasionka, Polska Abstract Melanoma, an aggressive malignancy of melanocytes, is one of the deadliest skin cancers, marked by high mortality rates, particularly when diagnosed late. This study presents the development of an autonomous diagnostic system designed to detect melanoma using embedded AI technologies, specifically convolutional neural networks and advanced image processing methods. The system aims to enhance diagnostic accuracy, shorten waiting times for diagnosis, and provide a non-invasive, accessible solution for early melanoma detection. We leverage deep learning models trained on a diverse dataset of dermoscopic images, combined with innovative pre-processing and segmentation techniques, to achieve high-performance melanoma classification. The results demonstrate the potential of this web-based system to serve as an effective decision support tool for clinicians, ultimately improving patient outcomes through early intervention. Keywords Melanoma, Autonomous Diagnostic Systems, Convolutional Neural Networks, AI in Dermatology 1. Introduction Skin melanoma is one of the most common malignancies, with its incidence increasing significantly over the past few decades, making it a serious public health concern. In Western populations, one in 50 individuals is expected to develop melanoma. While most cases occur in the elderly, melanoma is also the third most common cancer in adolescents and young adults aged 15 to 39 years [1]. The development of melanoma is multifactorial, involving an interplay between genetic susceptibility and environmental factors. Primary melanomas can present with a wide range of pigmentation, from heavily pigmented to amelanotic. Early diagnosis of melanoma is a crucial factor in improving patient survival rates. The traditional approach to melanoma diagnosis begins with a visual examination, followed by biopsy and histopathological evaluation. The major challenge in melanoma detection lies in accurately identifying early-stage melanomas while minimizing the need for biopsies of benign lesions. Recent advancements in noninvasive diagnostic techniques have enhanced the accuracy of melanoma detection, particularly in managing melanocytic lesions with uncertain diagnoses. Additionally, the promising potential of artificial intelligence offers a transformative opportunity in the field of melanoma detection. IDDM’24: 7th International Conference on Informatics & Data-Driven Medicine, November 14 - 16, 2024, Birmingham, UK ∗ Corresponding author. † These authors contributed equally. sebastian.gorecki@dokt.p.lodz.pl (S. Górecki); wiktoria.duszczyk@adres.pl (W. Duszczyk); zuziahuda@gmail.com (Z. Huda); andrzejfaryna@gmail.com (A. Faryna); olatatka@gmail.com (A. Tatka) 0000-0001-5700-4000 (S. Górecki); 0009-0005-3322-1904 (W. Duszczyk); 0009-0009-2481-8281 (Z. Huda), 0009-0004- 7388-2603 (A. Faryna); 0000-0002-8268-894X (A. Tatka) © 2023 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR ceur-ws.org Workshop ISSN 1613-0073 Proceedings Skin cancer is the most common malignancy affecting humans [2]. Early recognition is the most effective intervention to improve melanoma prognosis [3]. Both melanoma and non-melanoma skin cancers are showing a gradually increasing incidence worldwide, especially in the Caucasian population, posing a growing health problem due to the associated morbidity, mortality, and economic burden of monitoring and treatment. Melanoma, a malignant skin cancer originating from melanocytes, poses a significant public health threat due to its rapid progression and high metastatic potential. In Poland, melanoma accounts for approximately 2% of all cancer deaths, and its incidence has been increasing by 5-6% annually. The implementation of AI-powered autonomous diagnostic systems can play a crucial role in addressing the challenges of early melanoma detection and improving patient outcomes. 2. Related works This section describes current diagnostic methods for detecting skin cancer. While some of these techniques were developed decades ago, they have undergone continuous transformation and improvement. We will focus on methods such as dermoscopy, digital photography, and multispectral imaging, which provide better visualization of skin lesions. However, these approaches often require expert interpretation by experienced dermatologists and can be time- consuming. Advances in artificial intelligence, particularly the rapid development and deployment of convolutional neural networks, have enabled the automatic classification of skin images, greatly improving the accuracy and efficiency of cancer detection. Figure 1: Melanoma detection technology development timeline [4] The figure 1. illustrates the evolution of melanoma detection technologies over the years, reflecting key advancements that have shaped the field of skin cancer diagnostics. Early methods, such as dermoscopy, provided the foundational tools for visual inspection, whereas digital and multispectral imaging later emerged, enhancing lesion visualization and pattern recognition. More recent advancements in artificial intelligence (AI), specifically convolutional neural networks (CNNs), have accelerated the capacity for automatic lesion classification, improving diagnostic accuracy and efficiency. These innovations highlight the ongoing transition toward AI-driven methods that offer substantial improvements over traditional diagnostic approaches. 2.1. ABCDE Principle Measuring characteristics from an image, such as color, texture, or shape helps distinguish benign from malignant melanoma. In this work, the ABCD rule is used which is divided into four phases: Asymmetry, Border, Color, and Diameter. In 2004, it was expanded to E –Evolving to reflect the possibility of melanoma in rapidly progressing moles. This is commonly applied by physicians, healthcare workers, or even patients to determine skin lesions for melanoma or features concerning. The tool was developed to provide a simple and straightforward template that laypersons and physicians could follow in case of features that may represent melanoma. (a) (b) (c) (d) (e) Figure 2: ABCDE characteristics of melanoma [5]  Asymmetry (Figure 2.a) – is a significant indicator evaluated by splitting the image into two parts and comparing them. It is benign if both pieces are identical; if they are asymmetrical on both axes (x,y), it is melanoma.  Border (Figure 2.b) - to determine this score, the lesion is divided into eight octants. Every slice has a score of one for an irregular perimeter and zero for a regular one. As a result, zero is the lowest border score and eight is the highest.  Color (Figure 2.c) – this feature is considered up to the presence of six following colours: white, red, light or dark brown, blue-grey, and black. The score is increased by the presence of each color that is present therefore, the range is from 0 - 6.  Diameter (Figure 2.d) – characteristic presents an alteration in the size of lesions which is usually increased. Melanomas are frequently larger than 6 milliammeters.  Evolving (Figure 2.e) – indicator shows if there are lesions that look different from previous ones or if there are present changes in shape, color, or texture. The ABCD criteria [5] have great profits for physicians and healthcare workers who don’t have enough experience in screening and diagnostic methods to examine skin lesions. Moreover, the introduction of the ABCDE rule improved patient education about melanoma and self-skin examination. However, the ABCDE rule doesn’t include all melanoma features, and sometimes melanoma moles don’t present characteristics aided by ABCDE criteria. In studies, Abbasi NR et al. and Thomas L et al. showed a sensitivity and a specificity of the differentiating of benign from malignant based on ABCDE principles have the following results: 57 – 100 % and 37 – 100%. One of the other limitations is insufficient knowledge of laypeople who don’t understand how to refer a lesion to the ABCDE rule therefore, there is necessary cognitive training to educate patients and improve their accuracy of detection of skin cancer. 2.2. Dermoscopy The advancement in skin cancer diagnosis has been facilitated using a dermoscope – a simple, handheld optical device. The dermoscope provides 10x magnification and uses illumination that minimizes surface light reflection. This technique allows for a more precise visualization of the structures and pigmentation beneath the stratum corneum, which are typically not visible to the naked eye. [6] Dermoscopy is a noninvasive technique that enables the clinician to perform direct microscopic examination of diagnostic features, not seen by the naked eye, in pigmented skin lesions. The device operates by positioning it directly on or near the skin while the built-in light source is activated, allowing the user to examine the targeted lesion through the magnifying lens [7]. In the meta-analysis conducted for the National Institute for Health Research (NIHR) Cochrane Systematic Reviews Program the findings indicate that dermoscopy is more effective than visual inspection alone in both accurately diagnosing melanoma and ruling out conditions that are not melanoma [8]. Melanoma can be difficult to distinguish not only clinically but also dermoscopically from melanocytic nevi, especially in early-stage lesions where specific malignant features may be absent [9]. In addition, dermatoscopic structures and patterns used in the detection of melanoma. There are many helpful algorithms, including the ABCD rule, the Menzies method, the 7-point checklist, the 3-point checklist, chaos and clues, and CASH (color, architecture, symmetry, and homogeneity) [10]. The results of this systematic review and meta-analysis highlight the diagnostic relevance of dermoscopic features linked to melanoma detection, such as shiny white structures and the blue- white veil. They further emphasize the importance of recognizing the overall pattern and may indicate a hierarchy regarding the significance of these features and patterns [11]. Based on the principle that benign lesions tend to remain stable, while melanoma typically changes over time, digital follow-up of melanocytic lesions has been proposed as a strategy to identify melanomas that may lack clear dermoscopic features at the initial assessment. Whole-body photography (TBP) has been widely used for patients with extensive or atypical nevi, identifying malignant lesions can be challenging TBP involves capturing high-resolution, full-body clinical images as an adjunct to total body skin examinations (TBSE) during follow-up visits. This approach helps in identifying new or changing lesions and provides reassurance to both the patient and physician by showing the stability of lesions over time. TBP is particularly beneficial for patients with extensive or atypical nevi [12]. Dermatoscopic examination, although a very useful tool in diagnosing skin lesions, has certain limitations such as the necessity of having a dermatoscope, the subjectivity of assessment depending on knowledge and experience, and limited capability in detecting deeper lesions. 2.3. Ultrasonography (USG) Diagnosis of skin melanoma using ultrasound is based on several main aspects. This method is used to assess the advancement and progression of the disease. It is mainly important in cases of suspected metastases to lymph nodes or other organs. Ultrasonography is a diagnostic technique using high-frequency sound waves. The ultrasound machine records reflected sound waves from given structures, depending on the density of the examined area and the structures located there. The reflected waves are converted into a computer image in real time, which allows for the study of the dynamics of processes in the body [13]. This is a common diagnostic test, but in the case of skin melanoma it will be limiting. It complements the medical diagnosis of skin melanoma and will be important for specific purposes:  To examin regional lymph nodes, in case of diagnosing possible metastases. It is an important aspect in advanced stages of melanoma. The ultrasound of lymph nodes allows to asses their size, shape and echogenicity (in the case of metastases they will be enlarged and have a pathological shape).  An estimation of Breslow depth, the depth of infiltration of the lesion in the skin. This parameter is difficult to determine clinically, and the ultrasound examination helps in its assessment. The analysis of tumor thickness, is essential in predicting outcomes and guiding treatment for invasive melanomas. This metric has been integrated into the staging frameworks developed by the American Joint Committee on Cancer, helping to define pathological stages, set appropriate excision margins, and indicate when a sentinel lymph node biopsy should be performed [15].  An assessment of metastases to internal organs, is important examination in case of later stages of the disease and its diagnosis. Analysis of possible metastases in organs such as liver etc.  Monitoring the body's response to tailored treatment. Re-diagnosis of lymph nodes or tumors in the case of implementation of appropriate treatment. The use of ultrasound in the diagnosis of skin melanoma is important in case of its advanced stage. Studies suggest that it is necessary to observe, control and monitoring changes in the lymph nodes and metastases to other organs. The ability to capture real-time images, measure the morphological and physiological characteristics of the skin, along with the safety of using non- ionizing media and the absence of contraindications, are additional benefits of skin sonography. However, ultrasound has many disadvantages and significant limitations. It is not a test that allows for quick diagnosis and spontaneous diagnosis of early stages of skin melanoma. It is not able to identify characteristic features of superficial skin lesions. It is limiting in the case of early diagnosis of neoplasms and is a complementary examination, especially in the case of later stages of skin cancer. In addition, the described diagnostics are subject to limitations due to the possible lack of experience of the operator performing the test [14] [15] 2.4. AI-Driven Innovations in Early Melanoma Detection The application of artificial intelligence (AI), particularly convolutional neural networks (CNNs), in medical image analysis has revolutionized the field of dermatology. CNNs have demonstrated extraordinary performance in the classification of skin lesions, consistently surpassing traditional image analysis techniques in terms of accuracy and reliability. These deep learning models have an unparalleled capacity for extracting critical features from dermoscopic images, enabling the differentiation between benign and malignant lesions with exceptional precision. One study has reported an area under the receiver operating characteristic curve (AUC) of 0.94 for a CNN model in detecting melanoma, highlighting its potential as a decision support tool in clinical settings [16]. AI models, particularly CNNs, excel in feature extraction due to their multi-layered architecture, which enables automatic identification of hierarchical patterns within images. These models are capable of discerning minute variations in skin lesion characteristics, such as texture, shape, and color, which are often difficult for the human eye to detect. Such capabilities significantly enhance diagnostic accuracy, especially in the early stages of melanoma, where early intervention can drastically improve patient outcomes. In addition to standard CNN architectures, transfer learning has emerged as a powerful technique to mitigate the challenges associated with limited medical datasets. Transfer learning allows for the utilization of pre-trained models often trained on large general datasets, such as ImageNet—and fine-tuning them on domain-specific data, such as dermoscopic images of skin lesions. Leveraging transfer learning have reported significant improvements in classification accuracy, even when training data is limited. This approach not only reduces the computational burden but also accelerates the development of highly accurate diagnostic models, making them accessible for clinical use in under-resourced settings. Despite the considerable advancements in AI-driven skin lesion detection, several limitations persist that impede the widespread clinical adoption of these models. One of the foremost challenges is the reliance on large, annotated datasets for training. Although datasets such as ISIC and HAM10000 have been instrumental in advancing research, the scarcity of diverse and representative datasets remains a significant hurdle. For instance, most publicly available datasets are skewed towards specific skin types, ethnicities, and geographic regions, which can lead to biased model predictions when applied to underrepresented populations [17]. Addressing this issue requires not only the expansion of existing datasets but also the inclusion of more diverse skin phototypes, lesion types, and patient demographics. Moreover, the inherent variability in lesion presentation, including differences in lesion size, shape, and color across different stages of melanoma, poses additional challenges. CNN models, while highly effective at identifying well-represented lesion types, may struggle to generalize across varied presentations of atypical or rare skin lesions. This variability can result in misclassifications, particularly in cases where early-stage melanomas exhibit subtle features that are difficult to distinguish from benign lesions. Furthermore, certain dermoscopic features that are vital for melanoma diagnosis, such as the presence of regression structures or blue-white veils, may not be adequately captured in the training data, further complicating the classification process. Another significant concern is the black-box nature of CNNs. While these models provide high accuracy, their decision-making process is often opaque, making it difficult for clinicians to interpret the rationale behind a given prediction. This lack of transparency has led to calls for more interpretable AI models that can offer insights into how specific features influence diagnostic outcomes. Techniques such as Grad-CAM (Gradient-weighted Class Activation Mapping) and SHAP (SHapley Additive exPlanations) have been proposed to enhance model interpretability by visualizing the regions of the image that most contributed to the model’s decision. However, further research is needed to make these techniques more clinically useful. 2.5. Histopathological Diagnosis of Melanoma Histopathological examination remains the gold standard in melanoma diagnosis, confirming malignancy through microscopic evaluation of biopsied tissue. Pathologists employ specialized staining techniques such as HMB-45, S-100, and MART-1 to distinguish malignant melanocytes from benign lesions. The tissue, once biopsied, is fixed, embedded in paraffin, sectioned, and stained for microscopic evaluation. Key histopathological features like irregular lesion borders, nuclear atypia, and mitotic activity are assessed to determine malignancy and stage. Upon histopathological confirmation, treatment is guided by crucial factors like Breslow thickness - depth of tumor invasion and Clark level -extent of penetration into skin layers. For instance, a Breslow thickness exceeding 1 mm typically necessitates wide excision of the lesion. When the thickness exceeds 4 mm, more aggressive treatment may be warranted, including adjuvant therapies like PD-1 or BRAF inhibitors. Additional features such as ulceration or lymphatic invasion signal a poorer prognosis and can prompt more intensive treatment plans. Histopathology plays a pivotal role in determining eligibility for immunotherapies. Molecular and histological characteristics identified during evaluation assist clinicians in tailoring personalized treatment plans, optimizing patient outcomes [18]. Despite its diagnostic accuracy, histopathological diagnosis has certain limitations. The process can be time-consuming, with more complex cases requiring several days to weeks for conclusive results, potentially delaying treatment initiation. Costs can also be a significant barrier, especially when advanced analyses like BRAF mutation testing are involved. These expenses cover not only the biopsy and immunohistochemical staining but also specialist consultations, which may be limited in certain medical centers. The availability of such diagnostics varies globally, with some regions facing delays and higher costs due to limited access to specialized laboratories. Furthermore, histopathological analysis, while reliable, is not infallible, with potential for misinterpretation in ambiguous cases, leading to false-negative or false-positive results [19]. 3. Project Objective The goal of this project is to develop an advanced, autonomous diagnostic system for the early detection of melanoma using convolutional neural networks (CNNs) and sophisticated image processing techniques. This system is designed to reduce diagnostic waiting times by approximately 35 minutes and improve detection accuracy by 20% compared to traditional diagnostic methods. The key objectives are:  Development of an autonomous diagnostic system: A system capable of analyzing dermoscopic images to diagnose melanoma autonomously.  Efficiency and accuracy: The system will enhance diagnostic precision while reducing the time needed for professional evaluation.  Accessibility: It will be accessible to a wide range of users, enabling early detection through intuitive, easy-to-use mobile platforms. The scope of work for this project includes: 1. Development of the Diagnostic Algorithm: o The core of the system will be based on convolutional neural networks specifically trained to detect melanoma in dermoscopic images. o The CNN models will be developed and optimized to achieve high accuracy in recognizing and classifying skin lesions as benign or malignant. 2. Mobile and Web Platform Integration: o The diagnostic system will be integrated into an accessible mobile and web-based platform. o This platform will allow users to easily upload dermoscopic images for analysis. o The system's user interface will be designed for simplicity and ease of use, ensuring that individuals without medical expertise can effectively navigate the application. 3. System Validation and Testing: o These tests will focus on measuring the accuracy, specificity, and sensitivity of the system in correctly identifying melanoma. 3.1. Expected Outcomes The proposed project aims to develop an autonomous diagnostic system for the early detection of melanoma using convolutional neural networks and advanced image processing techniques. This system is designed to analyse dermoscopic images and automatically classify skin lesions as malignant or benign, with a target accuracy over 60%, significantly improving upon conventional diagnostic methods. Furthermore, the project seeks to raise public awareness about the importance of early detection and diagnosis of skin cancer. The system will incorporate educational features to inform users about the risks associated with neglecting suspicious skin lesions, as early recognition of melanoma is crucial for improving treatment outcomes and patient prognosis. The application will be designed to be user-friendly and accessible, allowing individuals with varying levels of technical expertise to utilize the system. By integrating the diagnostic system into a mobile and web-based platform, the project aims to make it widely accessible, as users with a smartphone equipped with a camera and internet access can easily upload and analyse their skin lesion images. To address potential variability in image quality, the system will employ advanced image processing algorithms to effectively analyze even suboptimal images. In cases where the image quality does not meet the required standards for accurate diagnosis, the system will provide feedback to the user, prompting them to retake the image to ensure the highest possible diagnostic accuracy. 3.2. Key points of projects  The accuracy and broad diagnostic base of the proposed method will significantly speed up the process of mole recognition. Accelerating diagnosis is crucial in implementing possible treatment, which, due to the low stage of the cancer, will be less burdensome to the body.  Nowadays, more and more people have access to smartphones, so with the knowledge of the existence of the proposed application, many owners of the necessary equipment will check their signs. It will also be a form of promoting the examination of skin lesions.  A mobile application installed on a smartphone will reduce the burden on potential users. To use it, you do not have to leave your home, and you can check moles without time limits. Thanks to this, when the patient speculates about the diagnosis, the proposed method can have a positive impact on the patient-user's psyche.  The project does not exclude any user. Regardless of the quality of the supported camera, the application can analyse the photo.  Reduction in the number of biopsies. Even low-risk routine surgical procedures are associated with morbidity, mounting health care costs, and patient anxiety. 3.3. Add values  Reducing the time of doctor’s working by mobile application, may decrease the time of doctors working on identifying and diagnosing skin lesions in melanoma by examining skin lesions and providing preliminary diagnosis. Moreover, it may help identify whether the mole is benign, malignant, or requires further investigation. This optimizes the doctor's workflow and supports their decisions.  Remote diagnosis by smartphone application provides health care services for people who live in less urbanized places or underserved areas. It reduces costs related to travelling to clinic appointments, and day off work but also costs with diagnostic tools. The next advantage is decreased exposure to infectious diseases on which patients might be exposed in the clinic.  Introducing a novel non-invasive diagnosis method leads to several benefits in melanoma diagnosis which can improve the patient’s life standard and the effectiveness of diagnosis. It opens perspective in skin cancer diagnosis to revolutionize current technologies and optimize the recognition process of skin moles. 3.4. Limitation  The dataset applied for the recognition of skin lesions is limited in the diversity of lesions and doesn’t include all significant data to accurately diagnose each case. An expanding dataset is required to provide errorless patient outcomes.  The application analyses visual features of skin lesions such as color, border, shape, and other characteristics seen by the eye. It doesn’t consider molecular aspects such as cell morphology, tumor invasion in a tissue, and structural disorganization in skin tissue. Therefore, it doesn't replace histology techniques, which are more specific in examining melanoma stages.  Misdiagnosis of a skin lesion due to incorrect date recording or technical issues may affect decision-making for laypersons and health care workers and lead to plenty of consequences in the recognition process of a skin mole.  The lack of universal standards for mobile applications and concerns about the security of patient's medical records have been challenging and require licensing laws.  Insufficient education of laypeople and lack of understanding limitations of the tool are potential risks to misinterpretation of results and non-comprehensive investigation due to replacement of dermatologist appointments. 4. Methodology The development of the autonomous melanoma diagnostic system will follow a structured approach, broken down into several key stages. Each stage focuses on different aspects of the system's design, development, and deployment to ensure the final solution is robust, accurate, and efficient. Figure 3: Project Methodology The main stages are as follows: 4.1. Hardware Preparation The first step involves selecting and preparing the hardware infrastructure necessary for training and deploying convolutional neural networks (CNNs). High-performance computing resources, including powerful GPUs or TPUs, will be utilized to handle the computationally intensive processes of deep learning. The hardware will also need to support cloud-based services for scalability and real-time diagnostic capabilities. Additionally, mobile devices such as smartphones will be tested to ensure compatibility and smooth operation of the application. 4.2. Data Preparation For this project, we utilized the publicly available HAM10000 dataset [20] published by Philipp Tschandl in 2018 on the Harvard Dataverse platform. The dataset consists of 10,015 high-quality dermatoscopic images covering a range of diagnostic categories, including actinic keratoses, basal cell carcinoma, melanocytic nevi, melanoma, and vascular lesions. More than 50% of the lesions were confirmed through histopathological examination, which is considered the gold standard for skin cancer diagnosis, while the remaining cases were validated via follow-up examinations, expert consensus, or in-vivo confocal microscopy. Figure 4: Skin nevi from the base [20]. The preprocessing of the dataset involved several key steps to ensure the quality and consistency of the images. First, color normalization was applied to account for variations in lighting conditions and imaging devices, ensuring a uniform appearance across the dataset. Next, noise reduction techniques were employed to remove any artifacts or unwanted disturbances, thereby enhancing the overall image quality and enabling more accurate feature extraction. Additionally, advanced fuzzy logic-based methods were used to further refine the segmentation of the skin lesions, improving the accuracy of the subsequent feature extraction process. To address the common issue of class imbalance in the dataset, we applied data augmentation techniques. This included transformations such as rotations, translations, and flips, which were used to artificially expand the size of the underrepresented classes. This approach helps to prevent overfitting and enhances the generalizability of the model, enabling it to perform well when encountering new, unseen data during the deployment phase. Table 1 Division of the dataset according to classification Lesion Type Train set Validation Set Melanocytic Nevi (nv) 5954 751 Melanoma (mel) 1074 39 Benign Keratosis-like Lesions (bkl) 1024 75 Basal Cell Carcinoma (bcc) 484 30 Actinic Keratoses and Intraepithelial Carcinoma / 301 26 Bowen's Disease (akiec) Vascular Lesions (vasc) 131 11 Dermatofibroma (df) 109 6 A comprehensive machine learning solution was developed to classify skin lesions, starting with model creation and culminating in the deployment of a live web application. The primary objective was to enable users to upload an image of a skin lesion and receive an instant diagnosis. The system classifies skin lesions into seven categories, including melanocytic nevi, melanoma, basal cell carcinoma, and more. 4.3. Model Building The model employed for this task is a fine-tuned MobileNet Convolutional Neural Network (CNN), chosen for its compact size and efficient performance, making it ideal for web and mobile deployment. MobileNet's lightweight architecture enables real-time inference with lower computational requirements while still maintaining strong performance in image classification tasks. Input Layer  The model accepts input images with a shape of (224, 224, 3), corresponding to RGB images that have been resized to 224x224 pixels. This ensures that all input data is uniformly processed by the network. Convolutional Layers and Depthwise Separable Convolutions  Depthwise Separable Convolutions: The MobileNet architecture relies heavily on depthwise separable convolutions, which separate spatial filtering from channel-wise operations. This approach dramatically reduces the number of parameters and computation required compared to traditional convolutions, while still capturing relevant image features effectively.  Pointwise Convolution: Following each depthwise convolution, a pointwise convolution (1x1) is applied, enabling the model to learn interactions between features across different channels.  Batch Normalization and ReLU Activation: Each convolutional layer is followed by batch normalization and ReLU activation to stabilize the training process and introduce non-linearity, allowing the model to learn more complex patterns. 4.4. Model Training & Tuning The model was trained using the Keras framework, employing a fine-tuned MobileNet architecture for the classification of skin lesions. The training process was designed to maximize the model's ability to generalize to new, unseen data while avoiding overfitting. Several techniques were utilized to optimize the training process, including early stopping, learning rate reduction, and model checkpointing. To address the challenge of class imbalance in the HAM10000 dataset, where certain skin lesion types were overrepresented, a combination of data augmentation techniques such as rotations, flips, and zooms was applied to artificially expand the dataset. Additionally, class weights were introduced to make the model more sensitive to melanoma (class weight = 3.0), helping to mitigate bias toward more common lesions like benign nevi (class weight = 1.0). Leveraging the pre-trained MobileNet model, we froze the weights of all layers except the last 23 layers, allowing only these layers to be trainable. This approach enabled the model to retain the general image features learned from the ImageNet dataset while fine-tuning the later layers to specialize in melanoma detection based on the dermoscopic images from the HAM10000 dataset. Hyperparameters such as the learning rate (initially set at 0.01), batch size, and the number of epochs were optimized through trial and error. Callbacks like ModelCheckpoint and ReduceLROnPlateau were employed to save the best model based on the top-3 accuracy metric, and to reduce the learning rate if validation performance plateaued. The model was compiled using the Adam optimizer with a learning rate of 0.01 and categorical cross-entropy as the loss function. In addition to the standard categorical accuracy, we introduced custom metrics like top-2 accuracy and top-3 accuracy to better capture the model's ability to rank the correct diagnosis within the top few predictions. During training, the model demonstrated consistent improvements, achieving strong results after 30 epochs. By the end of training, the final model reached a validation accuracy of 89.5%, with a top-2 accuracy of 91.3% and a top-3 accuracy of 96.3% on the validation set. This indicated that the model was able to rank the correct diagnosis within the top three predictions 96.3% of the time, making it highly effective in identifying the correct lesion type, even in challenging cases. After the best model was selected based on the top-3 accuracy metric, we evaluated its performance on the validation data:  Final Validation Loss: 0.59  Categorical Accuracy: 80.8%  Top-2 Accuracy: 91.2%  Top-3 Accuracy: 96.2% These metrics demonstrate that the model generalizes well and is highly capable of correctly classifying both common and rare types of skin lesions, providing a reliable tool for melanoma detection. 4.5. Model Deployment To make the melanoma detection system accessible to a broad audience, a web-based application was developed using a lightweight framework, leveraging modern web technologies to deliver a seamless and user-friendly experience. The primary goal was to allow users, regardless of their technical expertise, to upload an image of a skin lesion and receive an immediate, real-time diagnosis. The system provides the predicted class (such as melanoma or benign lesion) along with the associated probability, offering users an easy-to-understand result. One of the unique aspects of this project is the conversion of the trained model, initially developed in Keras, to TensorFlow.js, allowing the model to run directly within a web browser. This approach ensures that the entire process, from image submission to the generation of predictions, takes place locally on the user's device. As a result, no data is uploaded to external servers, which preserves the user's privacy and makes the solution particularly well-suited for medical applications, where data security and privacy are of paramount importance. The conversion of the model from Keras to TensorFlow.js involved the following steps: 1. Recreating the Model in Native Keras: The trained Keras model was finalized and saved in a format compatible with conversion. 2. Conversion to TensorFlow.js: The model was converted to TensorFlow.js using the command-line conversion tool. This allowed the model to be served directly in the browser without additional server infrastructure. The model was then embedded within a basic HTML interface, which provides an intuitive and simple user experience. The application allows users to: 1. Upload an Image: Users can select an image of a skin lesion from their device and upload it directly through the browser. 2. Real-Time Processing: The model processes the image in real-time, leveraging the TensorFlow.js framework to run the neural network in the browser. 3. Display of Results: The predicted lesion class, along with the top-3 probabilities, is displayed on the page, giving users insights into the potential diagnosis. The use of TensorFlow.js brings several key benefits:  Local Processing: Since the model runs entirely in the user's browser, the need for a backend server is eliminated. This not only preserves privacy but also reduces infrastructure costs and improves scalability.  Fast Inference: The conversion to TensorFlow.js ensures that model inference is fast, enabling real-time feedback to users without noticeable delays.  Offline Capability: As the model is stored in the browser, it can potentially function even in low-connectivity or offline environments, making it accessible to a wider audience. 4.6. Model Management The development of this AI-powered skin lesion diagnosis system represents a significant advancement in automated medical diagnostics. To maintain its effectiveness, continuous monitoring and regular updates are essential. The model will be periodically monitored to ensure it remains accurate as new data is collected. Retraining the model with fresh, labelled data will prevent model drift and ensure high performance in detecting diverse skin lesions. Feedback from dermatologists will be integrated to improve the system’s diagnostic accuracy, particularly in handling ambiguous cases. This collaboration will ensure the model complements medical expertise and maintains clinical relevance. Strict data management protocols will ensure compliance with privacy regulations like GDPR and HIPAA. All patient data used for retraining will be anonymized, ensuring secure, privacy-focused model updates. The web-based deployment using TensorFlow.js allows for easy scaling, making the system accessible in underserved areas. As the model evolves, it can be adapted for mobile use, further expanding its reach. By focusing on these aspects, the system can continue to improve early detection of melanoma and provide lasting benefits to global healthcare. 5. Results This section outlines the performance of the AI-powered skin lesion classification model, along with a real-world test case comparing the model’s prediction to the histopathological findings of an actual patient. The model's performance was evaluated using standard classification metrics: precision, recall, and F1-score. These metrics provide a comprehensive view of how well the model performs in classifying melanoma and other skin lesions. Here is a summary of the model's performance:  Precision: Measures the proportion of correctly predicted instances among all instances predicted as positive by the model. For example, for the "melanoma" class, the precision indicates how likely the model’s melanoma prediction is to be correct.  Recall: Measures the proportion of correctly predicted positive instances out of all actual positive instances. In other words, for the "melanoma" class, recall shows how well the model can detect melanoma cases when they actually exist.  F1-Score: The harmonic mean of precision and recall, providing a single score that balances both concerns, especially in cases where there is class imbalance. Table 1 Classification Report Precision (mel) Recall (mel) F1-score (mel) 0.27 0.48 0.34 This indicates that when the model predicts a lesion to be melanoma, it is correct only 27% of the time. The model detects melanoma in 48% of the cases where it is present. The overall performance for melanoma classification, balancing both precision and recall, is moderate with an F1 score of 0.34. These metrics highlight that while the model has room for improvement, it can detect melanoma in some cases. Given the nature of skin lesion classification and the importance of early detection, further tuning and adjustments may be required to improve the performance of the model, particularly in real-world clinical applications. Figure 5: Real skin nevus diagnosed for surgical excision In addition to the evaluation metrics, the model was tested on a real case of a suspicious skin lesion, where a physician recommended removal. The histopathological report confirmed as compound melanocytic nevus, a benign condition (ICD-10: D22). Model Prediction:  Melanocytic nevi: (97.8%)  Melanoma: (0.5%) The model strongly predicted the lesion to be a benign melanocytic nevus, with a very low probability of melanoma, which aligned with the final histopathological diagnosis. This real-world validation supports the potential utility of the model in clinical scenarios, although more extensive validation is needed to ensure broader applicability. 6. Discussion The proposed method of diagnosing skin melanoma may also have negative effects and certain limitations. There are risks where a mole scanning app will have downsides. Firstly, due to the wide availability of diagnosis via mobile applications, many potential patients may misinterpret the results and not further diagnostics of a specific nevus by a specialist. Moreover, due to the wide availability of the tool and the limited diagnostic knowledge of users, it is possible to practice self-treatment or create false security, which may ultimately prove disastrous and lead to the progression of the neoplasm. Therefore, it is extremely important to educate potential users before introducing this diagnostic tool, emphasizing the disadvantages of the method and considering that it is not a fully professional diagnosis, which is only possible in the case of contact with a specialist. The limitation of the method, which depends on the type of user, is the possible lack of effectiveness of the application due to the quality of the photo provided to the application by the patient. An image of insufficient quality sent for analysis may make the diagnosis unreliable, which may adversely affect further treatment. 6.1. Clinical Impact and Applications The developed autonomous diagnostic system offers a rapid, non-invasive, and highly accurate solution with broad potential applications across various healthcare environments. Its ability to function autonomously without the need for specialised personnel makes it particularly valuable in settings where access to expert dermatological care is limited, such as rural clinics or underserved regions. This can significantly improve the accessibility of early detection and diagnosis, especially for conditions like melanoma, which are critical for reducing morbidity and mortality. Moreover, the system's compatibility with teledermatology platforms further enhances its utility by enabling clinicians to provide timely assessments and treatment recommendations remotely, without the need for in-person visits. This can streamline the diagnostic process, improve patient convenience, and make quality dermatological care more accessible to a wider population, regardless of their geographic location. Previous studies have shown that similar AI-based systems can aid in the early detection of skin cancer, reducing the burden on healthcare systems and improving patient outcomes. The integration of this technology into clinical practice has the potential to revolutionise the field of dermatology, making high-quality care more readily available to underserved communities. 6.2. Limitations and Future Directions Despite its promising performance, the system faces several limitations that must be addressed in future iterations. One significant challenge is the need to further refine the algorithm to account for the heterogeneity in skin phototypes, ethnic backgrounds, and the wide range of morphological presentations of skin lesions encountered in real-world clinical practice. Additionally, while the model has demonstrated high diagnostic accuracy in controlled clinical settings, further large-scale trials across diverse patient populations are necessary to assess its generalizability and robustness Future research will focus on incorporating advanced imaging modalities, such as multispectral imaging, to improve diagnostic accuracy and expand the system's capabilities to detect a broader range of dermatological conditions These advancements, combined with continuous updates to the model's training data, will be key to ensuring the system remains a reliable, accurate, and effective tool in clinical dermatology. The development of an autonomous diagnostic system using convolutional neural networks represents a significant advancement in the field of automated melanoma detection by reducing diagnostic times and improving the accuracy of early melanoma detection, this system has the potential to revolutionize dermatological care, making high-quality skin cancer screening more accessible and reliable for patients. Ongoing research and technological advancements will be crucial in optimizing the system for broader clinical adoption and integration into routine clinical practice. 6.3. Comparison with Existing Systems While the proposed system demonstrates significant potential in improving the accuracy and accessibility of melanoma detection, it is essential to compare its performance and approach with existing AI-driven diagnostic systems. Recent studies [20, 21], have explored the capabilities of convolutional neural networks (CNNs) in skin cancer classification. These studies employed CNN-based architectures, similar to our system, for identifying melanoma and other skin lesions, demonstrating accuracy levels comparable to those of trained dermatologists. In Mahbod et al.'s work [21], a deep learning model was developed to classify skin lesions, focusing on optimizing sensitivity and specificity for melanoma detection. Similarly, implemented CNN architectures [22], examining their performance on large datasets to enhance classification accuracy. However, these models were primarily evaluated in controlled environments with limited real-world applicability due to factors such as image quality and lack of integration with web-based platforms. Our system advances these efforts by providing an accessible, web-based platform that allows real-time image analysis without the need for backend servers. This approach not only preserves user privacy but also facilitates a faster diagnostic process by performing all computations locally on the user’s device. While systems [23, 24] focus on mobile and desktop applications, our system is tailored for direct web browser use, making it highly accessible and requiring minimal technical expertise from the end user. Moreover, studies [24] highlight the ongoing challenge of dataset diversity. Existing models often lack generalizability across different skin phototypes and ethnic backgrounds, which can impact diagnostic accuracy in diverse populations. Our system addresses this limitation by employing data augmentation techniques and transfer learning, though further dataset expansion remains a priority for future improvement [24]. Despite its strengths, our system also shares limitations with these existing models, such as the need for standardized image quality and the risk of overreliance on an AI-based preliminary diagnosis. Thus, suggest, user education is crucial to avoid misinterpretation of results, a challenge that all AI-based diagnostic systems face [23]. Our system aligns with the capabilities and challenges observed in other CNN-based melanoma detection models, its web-based, real-time diagnostic feature distinguishes it from prior approaches. Ongoing research is essential to further refine this technology and fully assess its clinical utility and impact, especially through large-scale trials across diverse populations. 7. Conclusion The development of our web-based melanoma detection system using convolutional neural networks represents a promising advancement in dermatological diagnostics. By utilizing dermoscopic images and employing sophisticated image processing, this system has demonstrated a high potential to aid in the early detection of melanoma. With mobile accessibility and rapid diagnostic capability, the system can expand access to initial screenings, especially in regions lacking specialist dermatological resources. Dermoscopy, while effective in improving melanoma detection accuracy, has limitations in terms of equipment needs and subjectivity in assessment, particularly for non-expert users and deeper lesions. Our system addresses some of these limitations by integrating automated classification, which not only provides real-time results but also enables greater consistency in evaluation. However, it remains complementary to traditional histopathology, which continues to be crucial for confirming malignancy. Histopathological methods, while precise, are limited by cost, access, and time constraints, underlining the utility of an adjunctive AI tool that can assist in preliminary assessments. Although the ABCDE criteria offer a valuable foundation for skin lesion evaluation, they can be challenging for laypeople to apply accurately. Our system’s intuitive interface aims to bridge this gap, allowing users to engage with melanoma detection independently while also supporting clinicians in triaging cases that warrant further investigation. Future developments will focus on expanding our dataset to improve model accuracy across diverse populations, refining interpretability to enhance user trust, and integrating the system with telemedicine platforms to foster broader clinical adoption. Overall, our autonomous diagnostic system is a step toward democratizing skin cancer screening, with the potential to improve outcomes by facilitating early detection and reducing diagnostic wait times. Ongoing research, dataset expansion, and clinical trials will be essential for optimizing and validating the system's real-world effectiveness. Through continued innovation, this technology holds significant promise for enhancing the accessibility and accuracy of melanoma screening on a global scale, ultimately improving patient care and outcomes. 8. Declaration on Generative AI In the preparation of this work, the author employed tools such as ChatGPT to assist with grammar and spelling verification, as well as paraphrasing and rephrasing. The content was subsequently reviewed and refined by the author, who assumes full responsibility for the accuracy and integrity of the final publication. References [1] Weir HK, Marrett LD, Cokkinides V, Barnholtz-Sloan J, Patel P, Tai E, Jemal A, Li J, Kim J, Ekwueme DU. Melanoma in adolescents and young adults (ages 15-39 years): United States, 1999-2006. J Am Acad Dermatol. 2011 Nov;65 (5 Suppl 1):S38-49. PMID: 22018066; PMCID: PMC3254089. doi: 10.1016/j.jaad.2011.04.038. [2] Simões MCF, Sousa JJS, Pais AACC. Skin cancer and new treatment perspectives: a review. Cancer Lett. 2015 Feb 1;357(1):8-42. Epub 2014 Nov 11. PMID: 25444899. doi: 10.1016/j.canlet.2014.11.001. [3] Jones OT, Ranmuthu CKI, Hall PN, Funston G, Walter FM. Recognising Skin Cancer in Primary Care. Adv Ther. 2020 Jan;37(1):603-616. Epub 2019 Nov 16. PMID: 31734824; PMCID: PMC6969010., [4] Eleni Chatzilakou, Yubing Hu, Nan Jiang, Ali K. Yetisen, Biosensors for melanoma skin cancer diagnostics, Biosensors and Bioelectronics, Volume 250, 2024, 116045, ISSN 0956-5663, https://doi.org/10.1016/j.bios.2024.116045. [5] Reda Kasmi, Karim Mokrani Classification of malignant melanoma and benign skin lesions: implementation of automatic ABCD rule IET Image Processing Volume 10, Issue 6 June 2016 https://doi.org/10.1049/iet-ipr.2015.0385 [6] Steven Q. Wang, Ashfaq A. Marghoob, and Alon Scope Principles of dermoscopy and dermoscopic equipment An Atlas of Dermoscopy 2nd Edition, CRC Press, 2013 ISBN: 9780429110948 DOI: https://doi.org/10.3109/9781841847627 [7] Jones OT, Jurascheck LC, van Melle MA, Hickman S, Burrows NP, Hall PN, Emery J, Walter FM. Dermoscopy for melanoma detection and triage in primary care: a systematic review. BMJ Open. 2019 Aug 20;9(8):e027529, PMID: 31434767; PMCID: PMC6707687, doi: 10.1136/bmjopen- 2018-027529 [8] Dinnes J, Deeks JJ, Chuchu N, Ferrante di Ruffano L, Matin RN, Thomson DR, Wong KY, Aldridge RB, Abbott R, Fawzy M, Bayliss SE, Grainge MJ, Takwoingi Y, Davenport C, Godfrey K, Walter FM, Williams HC; Cochrane Skin Cancer Diagnostic Test Accuracy Group. Dermoscopy, with and without visual inspection, for diagnosing melanoma in adults. Cochrane Database Syst Rev. 2018 Dec 4;12(12):CD011902, PMCID: PMC6517096, PMID: 30521682; doi: 10.1002/14651858.CD011902.pub2. [9] Puig S, Argenziano G, Zalaudek I, Ferrara G, Palou J, Massi D, Hofmann-Wellenhof R, Soyer HP, Malvehy J. Melanomas that failed dermoscopic detection: a combined clinicodermoscopic approach for not missing melanoma. Dermatol Surg. 2007 Oct;33(10):1262-73. PMID: 17903162. doi: 10.1111/j.1524-4725.2007.33264.x. [10] Carrera C, Marchetti MA, Dusza SW, Argenziano G, Braun RP, Halpern AC, Jaimes N, Kittler HJ, Malvehy J, Menzies SW, Pellacani G, Puig S, Rabinovitz HS, Scope A, Soyer HP, Stolz W, Hofmann-Wellenhof R, Zalaudek I, Marghoob AA. Validity and Reliability of Dermoscopic Criteria Used to Differentiate Nevi From Melanoma: A Web-Based International Dermoscopy Society Study. JAMA Dermatol. 2016 Jul 1;152(7):798-806. PMID: 27074267; PMCID: PMC5451089. doi: 10.1001/jamadermatol.2016.0624. [11] Williams NM, Rojas KD, Reynolds JM, Kwon D, Shum-Tien J, Jaimes N. Assessment of Diagnostic Accuracy of Dermoscopic Structures and Patterns Used in Melanoma Detection: A Systematic Review and Meta-analysis. JAMA Dermatol. 2021 Sep 1;157(9):1078-1088. PMID: 34347005; PMCID: PMC8339993. doi: 10.1001/jamadermatol.2021.2845. [12] Salerni G, Terán T, Puig S, Malvehy J, Zalaudek I, Argenziano G, Kittler H. Meta-analysis of digital dermoscopy follow-up of melanocytic skin lesions: a study on behalf of the International Dermoscopy Society. J Eur Acad Dermatol Venereol. 2013 Jul;27(7):805-14. Epub 2012 Nov 26. PMID: 23181611. doi: 10.1111/jdv.12032 [13] Yashdeep Singh Pathania, Zoe Apalla, Gabriel Salerni, Anant Patil, Stephan Grabbe, Mohamad Goldust, Non-invasive diagnostic techniques in pigmentary skin disorders and skin cancer JCD Volume 21, Issue 2 February 2022 Pages 444-450 https://doi.org/10.1111/jocd.14547 [14] Wortsman, Ximena. 2024. "Ultrasound in Skin Cancer: Why, How, and When to Use It?" Cancers 16, no. 19: 3301. https://doi.org/10.3390/cancers16193301 [15] Marcel Arakaki Asato, Francisco Alves Moares-Neto, Marcelo Padovani de Toledo Moraes, Juliana Polizel Ocanha-Xavier, Luiz Carlos Takita, Mariangela Esther Alencar Marques, José Cândido Caldeira Xavier-Júnior, Depth of invasion analysis to predict acral melanoma outcomes, Annals of Diagnostic Pathology, Volume 71, 2024, 52305, ISSN 1092-9134, https://doi.org/10.1016/j.anndiagpath.2024.152305. [16] Bissoto, Alceu, et al. "Skin lesion synthesis with generative adversarial networks." OR 2.0 Context-Aware Operating Theaters, Computer Assisted Robotic Endoscopy, Clinical Image- Based Procedures, and Skin Image Analysis: First International Workshop, OR 2.0 2018, 5th International Workshop, CARE 2018, 7th International Workshop, CLIP 2018, Third International Workshop, ISIC 2018, Held in Conjunction with MICCAI 2018, Granada, Spain, September 16 and 20, 2018, Proceedings 5. Springer International Publishing, 2018. https://doi.org/10.48550/arXiv.1902.03253 [17] Luiz Carlos De Araújo Souz, Sandra Lúcia Branco Mendes Coutinho, Diogo Batista Dos Santos Medeiros, Hugo Oliveira De Figueiredo Cavalcanti, Rebeca Lima De Miranda, Júlia De Souza Araújo, Ana Gabriela Leite De Moura, Vinícius Carvalhêdo Cunha, Raíssa Habka Cariello and Paulo Victor Rabelo Barbosa Conjunctival Melanoma and Role of Immunohistochemical Markers protein S100, HMB-45 and Melan A in Tumor Staging: Case Report and Literature Review Surgery Current Trends & Innovations Feb 2019 DOI: 10.24966/SCTI-7284/100011 [18] Hollis Viray, William R. Bradley, Kurt A. Schalper, David L. Rimm, Bonnie E. Gould Rothberg, MPH Marginal and Joint Distributions of S100, HMB-45, and Melan-A Across a Large Series of Cutaneous Melanomas Arch Pathol Lab Med (2013) 137 (8): 1063–1073. https://doi.org/10.5858/arpa.2012-0284-OA [19] Tschandl, Philipp, 2018, "The HAM10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions", Harvard Dataverse, V4, https://doi.org/10.7910/DVN/DBW86T [20] Waheed, Safa & Saadi, Saadi & Shafry, Mohd & Rahim, Mohd & Suaib, Norhaida & Najjar, Fallah & Mundher, Myasar & Salim, Ali & Bahru, Johor. (2023). Melanoma Skin Cancer Classification based on CNN Deep Learning Algorithms. 19. 299-305. 10.11113/mjfas.v19n3.2900. [21] Ni Zhang, Yi-Xin Cai, Yong-Yong Wang, Yi-Tao Tian, Xiao-Li Wang, Benjamin Badami, Skin cancer diagnosis based on optimized convolutional neural network, Artificial Intelligence in Medicine, Volume 102, 2020, 101756, ISSN 0933-3657, https://doi.org/10.1016/j.artmed.2019.101756. [22] Moturi, D., Surapaneni, R.K. & Avanigadda, V.S.G. Developing an efficient method for melanoma detection using CNN techniques. J Egypt Natl Canc Inst 36, 6 (2024). https://doi.org/10.1186/s43046-024-00210-w [23] Musthafa, M.M., T R, M., V, V.K. et al. Enhanced skin cancer diagnosis using optimized CNN architecture and checkpoints for automated dermatological lesion classification. BMC Med Imaging 24, 201 (2024). https://doi.org/10.1186/s12880-024-01356-8 [24] Waheed, Safa & Saadi, Saadi & Shafry, Mohd & Rahim, Mohd & Suaib, Norhaida & Najjar, Fallah & Mundher, Myasar & Salim, Ali & Bahru, Johor. (2023). Melanoma Skin Cancer Classification based on CNN Deep Learning Algorithms. 19. 299-305. doi: 10.11113/mjfas.v19n3.2900.