Back to projects

PathOS / Prostate Lesion Detection

Research pipeline for prostate whole-slide images using OpenSlide preprocessing, HistoEncoder/Virchow2 embeddings, artifact gating, ABMIL/TransMIL, QWK evaluation, and attention heatmaps.

ExperimentalNo public repoComputational pathology research lab / 2025-2026

Problem

Prostate biopsy research uses gigapixel slides where small tissue regions matter, artifacts can distort attention, and ISUP-grade experiments need careful evaluation.

Solution

Store patch coordinates, extract frozen pathology-model embeddings, suppress artifact-like tokens with spatial-variance and Median/MAD gating, train ABMIL/TransMIL classifiers, and project attention into heatmaps.

Key Features

OpenSlide preprocessing for SVS/TIFF/NDPI slides with HSV-Otsu tissue segmentation and 256x256 patch tessellation
Coordinate-only patch registry that avoids saving massive patch folders while preserving MPP, coordinates, and spatial variance
GPU feature extraction with Macenko color normalization and frozen HistoEncoder or Virchow2 pathology backbones
CustomGatingLayer v2 that combines low spatial variance with Median/MAD token-norm outlier detection
ABMIL and TransMIL slide-level classifiers with focal loss, patch dropout, cosine LR, gradient accumulation, and QWK-based model selection
Best documented run: HistoEncoder + 4-layer TransMIL + gating v2 reaching 0.9151 validation QWK at epoch 41
Cribriform morphology path that clusters high-attention embeddings when predicted ISUP grade suggests Gleason Pattern 4 risk
Explainability path for attention heatmaps, WSI overlays, class probabilities, cribriform fields, and research-report JSON
Experiment artifacts for training curves, QWK curves, gating analysis, confusion matrices, configs, and logs
Test suite covering preprocessing, patch extraction, feature extraction, training, cribriform detection, and explainability
Experimental decision-support research only; no clinical deployment or diagnostic claim

Whole-slide grading pipeline

one label per gigapixel slide
REDUCEWSISVS / TIFF / NDPI~10⁹ pixelsOpenSlidetiled patch readerHSV-Otsutissue vs backgroundvariance gateMedian / MADdrops blur + foldspatchesEMBED · FROZENMacenkoGPU stain normalisationHistoEncoder384-dVirchow21280-dABMIL / TransMILattention over bagbagISUP grade6 classes · QWKattention heatmapreprojected on the slidecribriform clusteringattentionCONTEXTMaster's end-of-study project · private repoGRADED17.75 / 20
A slide is billions of pixels and carries a single ISUP grade, so most of the work is deciding what to throw away. The violet gate is where the thesis sits — a variance and Median/MAD filter drops blurred, folded and background patches before they can dilute the bag. Attention weights come back out the other side, which is what turns a number into something a pathologist can point at.

PathOS Screenshots

5 views
Champion HistoEncoder + 4-layer TransMIL run: validation QWK reaches 0.9151 at epoch 41.
Focal-loss curves for the best gated TransMIL experiment, used to identify the model selection point and later overfitting.
Custom gating analysis: spatial variance vs token norm separates valid tissue tokens from rejected artifact-like patches.
Median/MAD gating evidence showing token norm thresholds used to suppress outlier patches before attention pooling.
TransMIL confusion matrix from the external evaluation framework, included as research evidence rather than a diagnostic claim.