Views
No views yet
| Dataset | Baseline (zero-shot) | Fine-tuned | Δ |
|---|---|---|---|
| NCT-CRC-HE-100K (9-class) | 53.4% | 89.6% | +36.2 pp |
| PatchCamelyon (2-class) | ~60% | 85.2% | +25.2 pp |
| BACH ICIAR 2018 (4-class) | ~40% | 68.3% | +28.3 pp |
| Overall | 53.4% | 81.0% | +27.6 pp |
google/medgemma-4b-it (4B parameter multimodal LLM)| Dataset | Task | Classes | Samples used |
|---|---|---|---|
| NCT-CRC-HE-100K | 9-class tissue classification | Adipose, Background, Debris, Lymphocyte, Mucus, Muscle, Normal, Stroma, Tumor | 5 000 |
| PatchCamelyon | Binary metastasis detection | Normal, Tumor | 5 000 |
| BACH ICIAR 2018 | 4-class breast cancer grading | Normal, Benign, InSitu, Invasive | ~400 (full dataset) |
google/medgemma-4b-it) is downloaded separately and requires a HuggingFace
token with access to the gated MedGemma model.1git clone https://github.com/karaditya/medgemma-histolab
2cd medgemma-histolab
3pip install -e .
4export HF_TOKEN=hf_...
5export ADAPTER_REPO_ID=karadi97/medgemma-histolab-5k
6python app.py1from transformers import AutoProcessor, AutoModelForImageTextToText
2from peft import PeftModel
3import torch
4
5BASE = "google/medgemma-4b-it"
6ADAPTER = "karadi97/medgemma-histolab-5k"
7TOKEN = "hf_..." # needs MedGemma access
8
9processor = AutoProcessor.from_pretrained(BASE, token=TOKEN)
10base = AutoModelForImageTextToText.from_pretrained(
11 BASE, torch_dtype=torch.bfloat16, device_map="auto", token=TOKEN
12)
13model = PeftModel.from_pretrained(base, ADAPTER, token=TOKEN)
14model = model.merge_and_unload() # optional: bake adapter in for faster inferencegoogle/medgemma-4b-it) is subject to
Google's MedGemma Terms of Use.