Clear Sky Science · en

Accurate skin lesion classification on imbalanced dermoscopic images with high variance via the SCTFD framework

· Back to index

Why smarter skin checks matter

Skin cancer is one of the most common cancers, but it is also one of the most curable if caught early. Dermatologists increasingly rely on close-up photographs of moles and spots, taken with a handheld magnifier called a dermatoscope, to decide which ones are dangerous. Yet reading these images is hard, even for experts, and computers that might help them often stumble because some cancer types are rare and lesions can look very different from one patient to another. This study introduces a new artificial intelligence (AI) framework, called SCTFD, that is designed to make computer‑based skin lesion classification more accurate and reliable in exactly these difficult situations.

Figure 1
Figure 1.

The challenge of rare and tricky skin spots

Real-world skin image collections are far from balanced. Common, mostly harmless moles appear thousands of times in training data, while serious cancers such as melanoma or rare tumors appear only a few hundred times or less. At the same time, lesions from the same disease can look very different in size, color, and shape. Standard AI systems tend to overfit to the common patterns and overlook the rare ones, which is dangerous in medicine: it is better to miss a harmless mole than a melanoma. Classical strategies, like simply copying rare images or blending them together, or using complex generative models, have limitations in realism, stability, or computational cost. SCTFD was built specifically to handle this imbalance and variability while remaining efficient enough for practical use.

Making better training examples

The first building block of SCTFD is a data generator called CN-SMOTE. Instead of just interpolating pixel values or training a fragile generative adversarial network, CN-SMOTE uses an encoder–decoder pair: one network compresses a dermoscopic image into a compact internal code, and another reconstructs it back into an image. Once this compact space is learned, the method finds near neighbors among rare-class lesions and interpolates between their codes, then decodes these mixed codes back into new images. A special training penalty keeps the internal codes for lesions of the same type close together, so the synthetic images stay realistic and faithful to the underlying disease. The result is a larger, more balanced collection of dermoscopic images in which rare but important lesion types are better represented.

Seeing both details and the big picture

The second component, MARD-Net, focuses on turning each image into a rich set of telltale features. Convolutional layers act like adjustable magnifying glasses that pick up fine patterns such as borders and textures. On top of that, an attention module teaches the network to concentrate on the small region where the lesion actually is, downplaying surrounding healthy skin that might distract the model. Finally, a Transformer-based stage looks across the entire image to capture relationships between distant parts of the lesion, such as how different colors and structures are arranged. To avoid the heavy computation that usually comes with Transformers, the authors introduce a sliding-window strategy that lets the model gain a broad view of the lesion while only doing focused attention calculations in selected regions, making it faster and more memory-efficient.

Figure 2
Figure 2.

Guiding the model to treat every class fairly

The third pillar of SCTFD is a new training objective called FDLoss, which tells the AI how to adjust itself during learning. Instead of counting every image equally, FDLoss emphasizes hard and rare cases so the model cannot simply “coast” by doing well on the abundant, easy ones. It blends ideas from two popular scoring rules: one that rewards a good balance between sensitivity and precision, and another that down-weights trivial examples that the network already classifies correctly. On top of this, FDLoss adds a term that encourages images from the same disease to form tight groups in the model’s internal space, while pushing different diseases farther apart. This combination directly combats both class imbalance and the large variation within each class that typically confuse classifiers.

How well the new approach performs

The authors tested SCTFD on two widely used international skin imaging benchmarks, ISIC 2018 and ISIC 2019, which contain tens of thousands of real clinical dermoscopic images across seven and eight lesion types, respectively, and are strongly skewed toward common moles. Compared with several state-of-the-art methods, SCTFD achieved higher accuracy and a noticeably better balance between catching true positives and avoiding false alarms. It improved overall accuracy to about 93% on ISIC 2018 and 91% on ISIC 2019, and raised the F1 score—a measure that balances misses and mislabeling—beyond all competing systems. Visualizations showed that its attention modules focus squarely on lesion regions and that features from different diseases become more cleanly separated after training.

What this means for patients and doctors

For patients, the promise of SCTFD is a more dependable second opinion when a suspicious spot appears on their skin. By synthesizing realistic examples of rare cancers, concentrating on the most informative parts of each image, and training with a loss function that forces clear separation between disease types, the framework reduces the risk that automated systems will overlook dangerous lesions simply because they are uncommon or atypical. While it does not replace a dermatologist’s judgment, this approach could lower the barrier to early, accurate diagnosis in clinics and telemedicine platforms, potentially catching life‑threatening skin cancers sooner and more consistently.

Citation: Li, X., Ouyang, J., Chen, Y. et al. Accurate skin lesion classification on imbalanced dermoscopic images with high variance via the SCTFD framework. Sci Rep 16, 12302 (2026). https://doi.org/10.1038/s41598-026-37846-8

Keywords: skin cancer detection, dermoscopy AI, medical image classification, imbalanced datasets, deep learning in dermatology