Skip to content

feat: LesNet 4.5.0 — data-sourcing module + S/M/L/XL model family (distillation, int8 quantisation)#69

Merged
Thomasbehan merged 5 commits into
mainfrom
4.5.0-data-module
Jun 15, 2026
Merged

feat: LesNet 4.5.0 — data-sourcing module + S/M/L/XL model family (distillation, int8 quantisation)#69
Thomasbehan merged 5 commits into
mainfrom
4.5.0-data-module

Conversation

@Thomasbehan

Copy link
Copy Markdown
Owner

LesNet 4.5.0 — clinically-usable, sub-500 MB triage system

Builds the 4.5.0 architecture as a flow of separate, tested modules. Two parts land here:

Stage 1 — data sourcing (lesnet/data/, no TensorFlow)

  • Per-source loaders: ISIC (malignant-maximal API download, resumable), PAD-UFES-20, Fitzpatrick17k, DDI (+ registry).
  • Curated diagnosis-name canonicalisation (merges variant spellings into one folder).
  • Quality gate + perceptual-hash near-duplicate removal (anti-leakage, anti-score-inflation).
  • Sort into benign/not_sure/malignant/<diagnosis>/, then fair, group-safe, fairness-aware ~1:1 benign:malignant balancing with per-diagnosis caps.
  • Leakage-safe grouped manifest + report.json. Driven by commands/build_dataset.py.
  • 100% unit-test coverage on lesnet/data (network mocked); validated end-to-end on the live ISIC API (1199 labelled → balanced 163:163).

Stage 2+ — model family (lesnet/ml/)

  • Variants M4.5s / M4.5m / M4.5L / M4.5XL (EfficientNetV2-S/M/L, increasing resolution).
  • Knowledge distillation: students learn from the XL teacher (cross-resolution weight transfer) — keeps the small live-demo model near teacher accuracy.
  • int8 TFLite quantisation for M4.5s under the strict ≤500 MB peak-inference budget (float students/teacher stay available).
  • Training tricks: weight EMA, label smoothing (aux head), focal loss + class weights, metric-gated training, temperature calibration, split-conformal, Mahalanobis OOD gate, sensitivity-first operating point, fairness gate.
  • Orchestrator commands/build_models.py trains teacher → distils students → quantises M4.5s → packages for release.
  • Release workflow (v* tag → GitHub Release); commands/package_model.py + gh release upload attach the model assets.

Restructure / cleanup

  • Moved data concerns out of lesnet/ml into lesnet/data (taxonomy, splits, records/manifest IO); lesnet/ml keeps the TF-coupled model/training/inference.
  • Removed superseded data commands; rewired imports; updated CLAUDE.md, scripts/train_full_m4.sh.

Verification: ruff clean, 69 tests pass (CPU-deterministic via conftest.py), existing training (CPU smoke) + inference (web /labels+/predict, real M-4s CLI) intact. Trained models + the v4.5.0 release with downloadable artifacts follow once the full dataset build + training cycle complete; the live demo will pull M4.5s.

…ce, sort

New lesnet/data/ subsystem (no TensorFlow): per-source loaders (ISIC API malignant-maximal
download, PAD-UFES-20, Fitzpatrick17k, DDI) -> curated diagnosis-name canonicalisation ->
quality gate + perceptual-hash near-duplicate removal -> sort into benign/not_sure/malignant
/<diagnosis>/ folders -> fair, group-safe, fairness-aware 1:1 benign:malignant balancing with
per-diagnosis caps -> leakage-safe grouped manifest + report. Driven by commands/build_dataset.py.

Restructure: moved the data concerns out of lesnet/ml (taxonomy, splits, records/manifest IO)
into lesnet/data; lesnet/ml keeps the TF-coupled model/training/inference. Removed the three
old data commands (download_isic_full, fetch_isic_sample, run_build_dataset) and the stale
datasets test, rewired all importers, updated CLAUDE.md + train_full_m4.sh.

100% unit-test coverage on lesnet/data (63 tests, network mocked), ruff clean. Existing
training (CPU smoke) + inference (web /labels+/predict, real M-4s CLI) still pass. Validated
end-to-end on the live ISIC API: 1199 labelled -> balanced 163:163, leakage-safe splits.
@render render Bot temporarily deployed to 4.5.0-data-module - LesNet PR #69 June 15, 2026 23:55 Destroyed
@Thomasbehan Thomasbehan merged commit 2dd0e53 into main Jun 15, 2026
6 checks passed
@Thomasbehan Thomasbehan deleted the 4.5.0-data-module branch June 15, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant