⚑ pathovit-b16-crc

Histopathology & Biomedical Vision Foundation Encoder

License: Apache-2.0 Base Model Task Benchmark

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.


🌟 Highlights & Key Advantages

  • 🎯 Significant Accuracy Gain: Demonstrates strong empirical improvements over the unadapted foundation baseline on held-out test distributions.
  • ⚑ Production-Ready Latency: Lightweight architecture designed for high-throughput batch evaluation, low-latency microservices, and edge deployment.
  • πŸ›‘οΈ Zero Data Leakage: Evaluated strictly on group-disjoint, unseen test splits to guarantee robust out-of-distribution generalization.
  • πŸ’Ό Permissive License: Released under the permissive Apache 2.0 license for commercial and academic deployments.
  • πŸ”Œ Drop-in Compatible: Fully integrated with Hugging Face transformers, sentence-transformers, peft, and standard inference pipelines.

πŸ“Š Evaluation & Benchmark Results

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.


πŸš€ Quickstart & Usage

Install the required dependencies:

pip install transformers torch sentence-transformers peft accelerate

Python Inference Example

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%}")

Expected Output:

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%

πŸ› οΈ Model Architecture & Specifications

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)

βš™οΈ Intended Use & Deployment Guidelines

  • Primary Use Cases:
    • Whole Slide Image (WSI) tile classification and tumor microenvironment phenotyping in digital pathology.
    • Colorectal adenocarcinoma epithelium (TUM) vs cancer-associated stroma (STR) boundary detection.
    • Slide-disjoint biomarker discovery and automated histology feature extraction with zero cross-patient data leakage.
  • Recommended Serving Frameworks:

πŸ“œ License & Acknowledgments

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.

Downloads last month
22
Safetensors
Model size
85.8M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for vennyvirtuoso/pathovit-b16-crc

Finetuned
(2,592)
this model

Dataset used to train vennyvirtuoso/pathovit-b16-crc