1aurent/NCT-CRC-HE
Viewer β’ Updated β’ 207k β’ 24.7k β’ 6
Slide-disjoint Vision Transformer foundation encoder fine-tuned on NCT-CRC-HE-100K across 9 tissue phenotypes and evaluated strictly on external multi-patient cohort CRC-VAL-HE-7K with zero patient overlap.
transformers, sentence-transformers, peft, and standard inference pipelines.Evaluated on the official held-out test split under standard production evaluation protocols:
| Benchmark Metric | Score / Value |
|---|---|
| External Held-Out Accuracy | 96.00% |
| Unadapted Baseline Accuracy | 4.18% |
| Accuracy Gain | +91.82% |
| External Held-Out Macro-F1 | 0.9391 |
| Unadapted Baseline Macro-F1 | 0.0268 |
| Macro-F1 Gain | +0.9123 |
| Fine-Tuned Cross-Entropy Loss | 0.3381 |
| Baseline Cross-Entropy Loss | 2.2178 |
| External Validation Cohort (CRC-VAL-HE-7K) | 7,180 tiles (50 independent CRC patients, strictly slide-disjoint) |
| Training Cohort (NCT-CRC-HE-100K) | 6,300 balanced tiles (700 tiles / class across all 9 tissue phenotypes) |
| Tissue Classes (9 Phenotypes) | ADI (Adipose), BACK (Background), DEB (Debris), LYM (Lymphocytes), MUC (Mucus), MUS (Muscle), NORM (Normal Mucosa), STR (Stroma), TUM (Colorectal Adenocarcinoma Epithelium) |
| Model Architecture | Vision Transformer Base (ViT-B/16, 224x224 patch-16 resolution, 85.8M parameters) |
| F1 - ADI | 0.9921 |
| F1 - BACK | 0.9930 |
| F1 - DEB | 0.9687 |
| F1 - LYM | 0.9937 |
| F1 - MUC | 0.9908 |
| F1 - MUS | 0.8628 |
| F1 - NORM | 0.9641 |
| F1 - STR | 0.7123 |
| F1 - TUM | 0.9745 |
π‘ Benchmark Takeaway: Fine-tuning establishes substantial gains over the zero-shot base checkpoint, dramatically suppressing false predictions and improving domain confidence.
Install the required dependencies:
pip install transformers torch sentence-transformers peft accelerate
import torch
from PIL import Image
from transformers import AutoImageProcessor, ViTForImageClassification
# 1. Load fine-tuned PathoViT foundation encoder
model_name = "vennyvirtuoso/pathovit-b16-crc"
processor = AutoImageProcessor.from_pretrained(model_name)
model = ViTForImageClassification.from_pretrained(model_name, device_map="auto")
# 2. Load histopathology tissue tile (224x224 H&E stained biopsy crop)
image = Image.open("colorectal_tile.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt").to(model.device)
# 3. Classify histologic tissue phenotype across 9 categories
with torch.no_grad():
outputs = model(**inputs)
probs = outputs.logits.softmax(dim=-1)[0]
top_class_id = probs.argmax().item()
top_class_label = model.config.id2label[top_class_id]
top_prob = probs[top_class_id].item()
print(f"Predicted Tissue Phenotype: {top_class_label} (Confidence: {top_prob:.2%})")
print("\nAll Class Probabilities:")
for idx, p in enumerate(probs):
lbl = model.config.id2label[idx]
print(f" - {lbl:<6}: {p.item():.2%}")
Predicted Tissue Phenotype: TUM (Confidence: 99.12%)
All Class Probabilities:
- ADI : 0.01%
- BACK : 0.00%
- DEB : 0.12%
- LYM : 0.05%
- MUC : 0.08%
- MUS : 0.03%
- NORM : 0.10%
- STR : 0.49%
- TUM : 99.12%
| Parameter | Specification |
|---|---|
| Base Foundation Model | google/vit-base-patch16-224-in21k |
| Fine-Tuned Checkpoint | vennyvirtuoso/pathovit-b16-crc |
| Task Category | Histopathology & Biomedical Vision Foundation Encoder |
| Training Dataset | 1aurent/NCT-CRC-HE |
| Precision | Mixed Precision (bfloat16 / fp16) |
| License | Apache 2.0 (Permissive Commercial & Research) |
This model is open-sourced under the Apache 2.0 license. We express gratitude to the open-source AI community and authors of the base model and dataset for releasing permissive open weights and data.
Base model
google/vit-base-patch16-224-in21k