Dermato

A reproducible seven-class skin-lesion image-classification study built around HAM10000, TensorFlow, and model-behavior analysis.

November 3, 2025 Python / TensorFlow / Keras / Machine Learning / Computer Vision Repository ↗

What this project is

Dermato is an educational computer-vision project for examining how a skin-lesion classifier behaves when its data, labels, confidence, and input conditions are made explicit. The work uses the seven diagnostic categories represented by HAM10000 and treats the model as a research subject, not as a diagnostic authority.

The important result is not a single confident label. It is a reproducible path from dataset inspection to model output, with enough structure to expose class imbalance, grouped images, uncertainty, and failure modes.

The question

How stable and honest is an image classifier when an input moves away from the conditions represented by its training data?

That question changes the interface and the evaluation plan. A useful result includes the full probability vector, the top-ranked classes, uncertainty signals, and the conditions under which the prediction changes. Softmax confidence is not presented as a medical risk score.

Data boundary

The project uses the HAM10000 dermatoscopic image dataset and preserves its native seven-class target:

akiec, bcc, bkl, df, mel, nv, vasc

The dataset audit verified 10,015 primary JPEG images. Every image decodes as an RGB image at 600 × 450, and every metadata image identifier resolves to one image. The records contain 7,470 lesion groups, including lesions represented by multiple images.

The split is diagnosis-stratified and grouped by lesion_id so images of one lesion cannot cross the train, validation, and held-out test boundaries:

  • train: 7,007 images across 5,216 lesion groups;
  • validation: 1,503 images across 1,127 lesion groups;
  • test: 1,505 images across 1,127 lesion groups.

The held-out test partition remains separate from model selection and threshold decisions. Two exact duplicate image pairs were found during the audit. Both pairs belong to the same lesion group and are labeled nv, so they do not create cross-partition leakage.

Reproducible preparation

The reusable preparation code is written in Python and keeps the dataset decisions visible:

  • metadata is normalized and checked for duplicate image IDs, missing values, unknown labels, and conflicting lesion labels;
  • filenames are derived from validated image IDs;
  • train, validation, and test manifests are deterministic and seeded;
  • class weights are translated through explicit label-to-index mappings;
  • a full image preflight decodes every referenced JPEG before training.

The source repository keeps raw archives, extracted images, generated manifests, credentials, and model artifacts outside Git. This separates reproducible code and documentation from data that has its own distribution terms.

Model baseline

The continuity baseline uses TensorFlow and Keras with an ImageNet-pretrained MobileNetV2 backbone:

JPEG image → resize to 224 × 224 → MobileNetV2 features → pooling → seven-class output

The backbone is frozen for the initial feature-extraction phase. Training uses explicit class weighting and modest geometric augmentation so rare categories are not hidden by the dominant nv class. A conservative fine-tuning phase can be compared later under the same split and evaluation protocol.

The recovered notebook recorded 69.55% validation accuracy after five epochs. That number is retained as a historical reference point, not presented as held-out performance or clinical evidence. The corrected preparation path exists to make later measurements more trustworthy than the original image-level split.

Inspecting model behavior

Dermato is designed as an observatory rather than a single prediction endpoint. Its evaluation surface focuses on questions that raw accuracy cannot answer:

  • how performance changes by lesion category;
  • whether confidence is calibrated against correctness;
  • whether the model should abstain on uncertain inputs;
  • how blur, brightness, contrast, compression, crop, and rotation affect a prediction;
  • whether the top three classes tell a different story from the top class;
  • how much performance is hidden by the dominant class.

The primary report is therefore built around macro-F1, balanced accuracy, per-class sensitivity and precision, confusion matrices, top-three accuracy, calibration, and risk-coverage behavior. A grouped internal test split is still an internal benchmark. It is not external validation.

Why seven classes instead of a binary label

The native task has seven categories, so the project keeps that target for the primary benchmark. A malignant versus benign display would require a separate, explicitly documented mapping and would introduce a new label definition rather than reveal a fact already present in the dataset.

Keeping the original categories makes class-specific failures visible and prevents a simple binary result from hiding clinically meaningful distinctions or minority-class errors.

Safety and limitations

Dermato is not a cancer detector, diagnostic service, triage tool, or substitute for a qualified medical professional. A model output does not determine what a lesion is, what treatment is appropriate, or whether someone should delay care.

HAM10000 is a dermatoscopic research dataset. Its images do not establish reliable performance on ordinary phone photographs, different lighting conditions, unseen devices, or every skin tone. Dataset labels also represent different forms of clinical confirmation and should not be treated as uniformly equivalent to a biopsy result.

The project does not claim clinical validation, demographic fairness, regulatory authorization, or production readiness. Personal images should not be retained by default, and the dataset license must be reviewed before redistributing images, fixtures, model weights, or a hosted demo.

Reproduction

  • Repository: View the project on GitHub
  • Preparation: python3 scripts/prepare_baseline.py
  • Image preflight: python3 scripts/preflight_data.py
  • Tests: python3 -m unittest discover -s tests -p 'test_*.py' -v
  • Primary labels: akiec, bcc, bkl, df, mel, nv, vasc
  • Input size: 224 × 224 × 3

The repository documents the archive checksum, image inventory, split manifest, evidence boundary, and known limitations alongside the implementation. The raw HAM10000 archive and generated training outputs are intentionally excluded from the public source tree.

What I learned

A classifier can run successfully and still be difficult to trust. The engineering work is in making the split, labels, data provenance, uncertainty, and failure cases inspectable before polishing the prediction screen.

For Dermato, the most defensible product is an instrument for studying imperfect medical-image models. It is more useful to show when the system should hesitate than to manufacture certainty from a benchmark result.