Why?
Counting and classifying nuclei is one of the slow, manual parts of reading a tissue slide. Detection models for this task are easy to train and easy to overrate. If images from the same patient or hospital end up in both training and test data, the scores look better than the model really is. I wanted to build a detector whose numbers I could actually defend.
What I Built
TVision runs from the public NuCLS dataset to a working tool:
- Data pipeline. It converts NuCLS annotations into YOLO labels and splits train, validation and test by hospital, using NuCLS’s official test fold, so no slide, patient or hospital crosses splits. Separate code then recomputes every label from the raw annotations, and training refuses to start until the two agree. The processed data is fingerprinted.
- Model selection. It fine-tunes Ultralytics’ pretrained
yolo26ncheckpoint and compares single-factor experiments against a hash-protected baseline. The selection rule was fixed before any run, and each candidate was repeated across three seeds. Only validation data is used to choose. - One-shot test. Operating thresholds are fixed on validation first. The test evaluation then runs once, and an append-only ledger records every pass.
- Serving. A standalone inference layer is shared by a CLI, a FastAPI service and a Nuxt web UI. All three use one typed detection contract, and the UI’s TypeScript types are generated from the API schema. The detector refuses any checkpoint whose SHA-256 doesn’t match the pinned one.
Results
Evaluated once on four held-out hospitals (263 fields of view). The headline metric is the unweighted mean of tumor and non-tumor classes.
| Metric | Baseline | Final |
|---|---|---|
| Headline mAP50-95 | 0.199 | 0.232 |
| Headline mAP50 | 0.476 | 0.489 |
| Non-tumor mAP50-95 | 0.194 | 0.273 |
| Tumor mAP50-95 | 0.203 | 0.192 |
- The headline mAP50-95 gain is +0.034 (95% CI +0.020 to +0.054, from a paired slide-level bootstrap), about 17% relative.
- Most of the gain comes from non-tumor nuclei and tighter boxes. Tumor AP did not improve.
- One test hospital scores only 0.12. The most common error is calling a non-tumor nucleus tumor.
Limitations
TVision was trained only on NuCLS breast-cancer fields of view at about 0.2 µm/px. Accuracy drops sharply on unfamiliar hospitals and stains, and confidence scores are not calibrated probabilities. It is a research tool, not a medical device.
