Back to projects

PathOS / Prostate Lesion Detection

A research system that helps a pathologist grade prostate biopsies from whole-slide images: a slide-level ISUP grade, a pixel-level Gleason map and a cribriform detector, shown in a review interface where the human decision and the audit trail stay in charge. 0.9227 QWK in five-fold cross-validation on 10,616 PANDA slides.

ExperimentalNo public repoMaster's thesis, University of Algiers 1 / 2025-2026

Problem

A biopsy slide is a gigapixel image with one slide-level label, detailed annotations are expensive, and blurred, folded or empty regions can capture a model's attention. Grading is also ordinal: calling ISUP 5 a 4 is a smaller mistake than calling it a 1. The tool has to help a pathologist, not replace one.

Solution

Multiple-instance learning over frozen foundation-model features for the slide-level grade, trained with an ordinal loss and scored with quadratic weighted kappa. A U-Net localises Gleason patterns per pixel, a third model detects cribriform architecture, and the review interface presents all three as suggestions with attention maps. The pathologist accepts, edits or rejects each one, and every deviation is justified and logged.

Key Features

Slide-level ISUP grading: OpenSlide preprocessing, frozen Virchow2 patch embeddings, and a TransMIL aggregator trained with the CORAL ordinal loss
0.9227 ± 0.0046 QWK in five-fold cross-validation on 10,616 PANDA slides; 0.9134 on the fixed test split, with 92.6% sensitivity and 94.5% specificity at the clinically important ISUP 2 threshold
External generalisation with no retraining: 0.8772 QWK on SICAPv2 (155 slides) and 0.8109 on CrowdGleason (232 slides), both from Spanish centres, which limits what the agreement shows
Pixel-level Gleason segmentation with a pretrained ResNet-34 U-Net on 5,060 annotated slides: 0.753 mean Dice, with Gleason 5 the hard class at about 0.57 across every variant tried
CribriNet: cribriform detection inside Gleason 4 patches from masked PhiKoN features, 0.904 AUC and 0.661 F1 for the retained MLP head in five-fold cross-validation grouped by slide
An honest negative result: the artifact-aware gate gives no significant gain with Virchow2, whose register tokens already absorb the artifacts it targets. Bootstrap intervals on PANDA and CrowdGleason both include zero
Review interface with a slide viewer, Gleason and attention overlays, a decision panel that requires a justification for any deviation, a structured report and an audit trail
A platform behind it: web client, API, durable workflows for import, preprocessing, inference and aggregation, and object storage for slides and heatmaps
Research prototype only: no clinical validation, no diagnostic claim, and no local patient slides used for training or scoring

Role

Research and ML engineering as one of the two authors of the Master's thesis (with Chawki Ahmed Ramzi Belhaddad); the report presents the work as joint and does not divide it. Clinical guidance came from a doctor at CHU Parnet. The repository is private; this page shows the architecture, the evaluation and the interface. This is a research prototype, not a clinical product.

Stack

PythonPyTorchCUDAOpenSlideOpenCVVirchow2TransMILABMILU-NetPhiKoNMacenko Normalizationscikit-learnNext.jsNestJSTemporalPostgreSQLOpenSeadragon

Links

No public link available.

Whole-slide grading pipeline

one label per gigapixel slide
REDUCEWSISVS / TIFF / NDPI~10⁹ pixelsOpenSlidetiled patch readerHSV-Otsutissue vs backgroundartifact gatevariance + Median / MADdrops blur + foldspatchesEMBED · FROZENMacenkoGPU stain normalisationHistoEncoder384-d · controlVirchow21280-d · mainTransMIL · CORALattention over bagbagISUP grade6 classes · QWKattention heatmapreprojected on the slideshown to the reviewerattentionCONTEXTMaster's thesis, with Chawki Ahmed Ramzi Belhaddad · private repoPANDA, 5-FOLD CV0.9227 QWK
A slide is billions of pixels and carries a single ISUP grade, so most of the work is deciding what to throw away. An artifact gate (spatial variance and a Median/MAD norm test) drops blurred, folded and background patches before they can dilute the bag, and the thesis tests it with confidence intervals: with Virchow2 it adds no significant gain. Attention weights come back out the other side, which is what turns a number into something a pathologist can point at.

PathOS Screenshots

8 views
The PathOS review interface: the biopsy with the Gleason overlay from the segmentation model, and the suggestion panel. The panel states that the output is decision support, never the final diagnosis, and flags when the grade and the segmentation disagree.
The same slide with the attention view: each patch is coloured by the weight the grade model gave it, so a reviewer can see where the suggestion comes from.
The worklist, with test slides. A case stays awaiting review until a pathologist signs it out; the suggestion never closes a case on its own.
The platform around the models: web interface and API, durable workflows for import, preprocessing, inference and aggregation, a Python inference worker, and storage for slides and results. Labels are in French, as in the thesis.
PANDA fixed test split (1,061 slides), 0.9134 QWK. Most errors fall between adjacent grades, mainly ISUP 1 and 2. Axis labels are in French, as in the thesis.
Attention over three test biopsies: two correct grades (ISUP 3 and 4) and one adjacent-grade error (true ISUP 1, predicted 2), kept in because failures are part of the evidence.
Gleason segmentation against the pathologist masks: a correct Gleason 3 region, an adjacent-grade error, and a Gleason 5 focus predicted as 4, the class every variant struggled with.
The artifact gate on Virchow2 embeddings: patches flagged for low spatial variance and outlying norm. It flags roughly 0.5% of patches, and the thesis finds it adds no significant gain with Virchow2.