Gigabytes of Nightmares: Turning the Maze of Ultra-Large Medical Images into a Path to Success in Eosinophilic Esophagitis

Andrey Astafev24 May 2025

Problem

A pathologist diagnoses eosinophilic esophagitis (EoE) by counting eosinophils under a microscope. The criterion is more than 15 cells in one high-power field, and the count is written down by hand. The team at HSE University wants an ML model to do it. Three things get in the way: a single scanned slide is 0.5–1 GB packed, the scans have defects, and annotation is slow and inconsistent between experts. By company estimates only 5% of histology slides in Russia are digitized, partly because labs lack scanners and storage.

Example from the article: one patient with primary EoE has 16 slides (6 biopsies). Outlining every eosinophil on one slide takes up to 9 hours, with about 3000 cells per image.

Solution in brief

Scan the slides into whole slide images (WSI), annotate target cells with polygons in QuPath, cut the image into high-power-field patches and train YOLO11 for segmentation and detection. The model is then run over the whole slide with a sliding window. The same cell counts are compared with the physician's counts.

Questions this case answers
  • How to build a detection pipeline on gigapixel images by cutting them into fixed-size windows and merging predictions with a sliding window
  • How to organize consistent expert annotation of very large images before training a detector
  • How to build an ML pipeline for quantitative assessment of ultra-large histology images when annotation quality is poor
  • How to estimate storage and scanner requirements before starting a digital pathology project

Tools and methods

  • QuPath — polygon annotation of eosinophils and their granules, GeoJSON export
  • YOLO11 — segmentation and detection of eosinophils on patches
  • Sliding window over 2144×2144 px patches — matches the high-power field used for counting
  • Augmentation — expands the 54 annotated slides
  • Peak eosinophil count (PEC) — the clinical measure to compare with the physician
Continue reading — it's free

Google or a one-time email code. No password.