DIR CRC Malignant-Region Identification Model (CONCH + Logistic Regression)
Classifies tissue patches from H&E-stained colorectal cancer (CRC) whole-slide images as
malignant (cancer) or non-malignant (normal), given CONCH
patch-level embeddings as input. Part of the Digital Immune Reporter (DIR) pipeline.
- Architecture: scikit-learn
LogisticRegressionhead on top of frozen CONCH patch embeddings (CONCH itself is a separate, third-party pretrained encoder and is not included in this repo) - Task: binary malignant/non-malignant patch classification
- Classes:
cancer,normal
Files
logreg_conch_model_20260204.jsonβ serializedLogisticRegressionparameters (coef,intercept,classes,paramsβ the constructor kwargs used at training time)
Usage
import json
import numpy as np
from sklearn.linear_model import LogisticRegression
with open("logreg_conch_model_20260204.json") as f:
d = json.load(f)
model = LogisticRegression(**d["params"])
model.classes_ = np.array(d["classes"])
model.coef_ = np.array(d["coef"])
model.intercept_ = np.array(d["intercept"])
# features: CONCH patch embeddings, shape (n_patches, embedding_dim)
predictions = model.predict(features)
Training data
Trained on the public HunCRC dataset, which provides patch-level annotations across nine histological categories (adenocarcinoma, low-grade dysplasia, high-grade dysplasia, suspicious for invasion, tumor necrosis, inflammation, resection edge, artifact, normal tissue). These were remapped into two categories for this binary model: malignant (adenocarcinoma, low-/high-grade dysplasia, suspicious for invasion, tumor necrosis) and non-malignant (inflammation, resection edge, artifact, normal tissue).
Split at the slide level (to prevent train/test leakage) into a training set of 160 slides (198,614 malignant / 121,771 non-malignant pre-generated patches) and a held-out test set of 40 slides (49,637 malignant / 32,872 non-malignant patches), with stratified sampling to keep a comparable malignant:non-malignant ratio across both splits.
Patch embeddings were extracted with Trident (v3.3.0)
using three pathology foundation models compared side by side β UNI, UNIv2, and
CONCH (v0.1.0) β this checkpoint is the CONCH variant.
For each, a scikit-learn (v1.7.2) LogisticRegression head was trained via linear probing (only
the logistic-regression parameters were optimized; the foundation model's weights were frozen).
At inference time, patch-level predictions are post-processed with iterative 3x3-neighborhood majority-vote spatial smoothing (each patch reassigned to the class held by >=50% of its existing neighbors, repeated to convergence or a max of 1,000 iterations) to suppress isolated patch-level misclassifications and produce spatially coherent malignant-region masks.
Because the intended use is restricting downstream spatial analysis to tumor-containing regions, the model was additionally validated for agreement with pathologist-defined tumor-containing ROIs on an independent TCGA WSI cohort, using recall as the primary metric (fewer false exclusions of tumor tissue is the more costly error for downstream spatial biomarker quantification).
License
CC-BY-NC-4.0 β research/non-commercial use only.