# Hlss Histopathology Eval

> Evaluates the quality of self-supervised visual representations learned from histopathology images by measuring downstream classification performance at patch, slide, and patient levels. It probes the model's ability to capture hierarchical pathological structures and align them with clinical diagnostic categories. Use when the user wants to benchmark on OpenSRH, TCGA, or asks about evaluating this task. Reports kNN classification accuracy (ACC).

- Skill: `qhjqhj00/hlss-histopathology-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/hlss-histopathology-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/hlss-histopathology-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/hlss-histopathology-eval

---


# hlss-histopathology-eval

> Hierarchical Text-to-Vision Self Supervised Alignment for Improved Histopathology Representation Learning — Hasindri Watawana et al. (2024) (arXiv:2403.14616, 2024)

## What this evaluates

Evaluates the quality of self-supervised visual representations learned from histopathology images by measuring downstream classification performance at patch, slide, and patient levels. It probes the model's ability to capture hierarchical pathological structures and align them with clinical diagnostic categories.

## Datasets

- **OpenSRH** — total ?; splits: train (225000), val (58000)
- **TCGA** — total ?; splits: train (491000), val (130000)

## Metrics

- `kNN classification accuracy (ACC)` **(primary)** — range: percent
  - k-Nearest Neighbors classification accuracy. For each test instance, the class is predicted by majority voting among the k nearest neighbors in the training feature space. Slide and patient-level scores are computed by average pooling the patch-level prediction scores of all component patches.

## Input / output format

**Input**: Frozen pretrained visual backbone receives histopathology image patches. For slide/patient evaluation, multiple patches per slide/patient are processed.

**Output**: Class prediction scores or labels at patch, slide, and patient levels.

## Scoring recipe

```python
def compute_knn_acc(test_feats, test_labels, train_feats, train_labels, k=5):
    # Patch-level: predict class via kNN majority vote
    patch_preds = [train_labels[get_k_nearest_indices(f, train_feats, k).mode()] for f in test_feats]
    patch_acc = accuracy_score(patch_preds, test_labels)
    # Slide/Patient-level: average pool patch prediction scores
    slide_preds = average_pool(patch_preds, grouping=slide_indices)
    slide_acc = accuracy_score(slide_preds, slide_labels)
    return patch_acc, slide_acc
```

## Common pitfalls

- TCGA evaluation uses only 400 randomly sampled patches per slide due to memory constraints, introducing sampling variance if the random seed is not fixed.
- Slide and patient-level metrics are derived by average pooling patch-level prediction scores rather than direct classification on aggregated slide/patient embeddings, which differs from standard hierarchical evaluation protocols.
- The dataset splits are labeled as 'train' and 'validation', but the 'validation' split is used for final evaluation/testing, which may cause confusion when comparing with other benchmarks.

## Evidence (verbatim from paper)

> We report kNN classification accuracy (ACC) metric per each task. Slide and patient level metrics are reported by average pooling the patch level prediction scores of component patches of the given slide or patient.

## Citation

```bibtex
@misc{watawana2024hlss,
  title={Hierarchical Text-to-Vision Self Supervised Alignment for Improved Histopathology Representation Learning},
  author={Hasindri Watawana et al. (2024)},
  year={2024},
  note={arXiv:2403.14616}
}
```

- arXiv: 2403.14616

