Çakı 2026 — Topology-Guided Hard Example Mining (TG-HEM)
A training strategy that reweights the cell-detection loss by how different the arrangement of predicted cells is from the truth, measured with persistent homology — so the network is pushed hardest on regions whose structure it got wrong, not just its pixels.
Read status. Abstract obtained from PubMed; the Elsevier full text is paywalled. The GitHub implementation (
tghem.py, 451 lines) was read in full, which covers the method in more detail than a Methods section usually would. What is not known: magnification, patch size, the λ actually used, and the numeric results. Marked[unverified]below where it matters.
The problem it addresses
Cell detection degrades in crowded regions. Standard hard example mining picks difficult pixels by their individual loss, which is a local, pixel-centric view. The paper’s argument is that what goes wrong in crowded tissue is the global organisation of cells — clustering, spacing, arrangement — and a pixel-wise criterion cannot see that.
Who wrote it
Koç University, Istanbul: Computer Engineering and the KUIS AI Center (Çakı, Gündüz-Demir), Mathematics (Ünver), and Pathology (Aydın Meriçöz, Bulutay, Kapucuoğlu, Kulaç), with pathologists from Başakşehir Çam and Sakura City Hospital and Şişli Hamidiye Etfal. Twelve authors, of whom roughly eight are pathologists or medical students — an annotation-heavy study. Gündüz-Demir’s group is a long-standing computational-pathology lab.
Method, as implemented
Three parts, wrapped as a single PyTorch loss module.
1. Segmentation loss with pixel-level OHEM. Cell detection is posed as dilated segmentation: dot annotations at cell centres are slightly dilated into a binary mask, and the network segments that. Loss is Dice + BCE, with online hard example mining selecting hard pixels by confidence threshold or top-k loss, with a floor on how many are kept.
2. Topological discrepancy per crop. For each sample in the batch: - ground-truth points come from the dot mask; - predicted points are the centroids of connected components in the thresholded prediction (OpenCV contours plus image moments); - both point sets go through a Vietoris–Rips filtration (Gudhi) with max_edge_length = 50 pixels and simplices up to dimension 2; - H0 and H1 persistence intervals are extracted, with infinite deaths clipped to ε; - the discrepancy is the Wasserstein distance (order 1, Euclidean ground metric) between the ground-truth and predicted diagrams, summed over H0 and H1.
3. Reweighting. w = 1 + λ · D_topo, and the final loss is the weighted mean of the per-sample segmentation losses.
The design choice worth noticing
The topology is computed inside torch.no_grad(). No gradient flows through the persistence computation — it produces a scalar that scales an ordinary segmentation loss.
That neatly sidesteps the usual difficulty with topological losses, which is that persistence is only piecewise-differentiable and awkward to backpropagate through. The cost is that topology supplies a magnitude but never a direction: the network is told a region is structurally wrong and to try harder there, not which way to move. Calling it hard example mining rather than a topological loss is therefore accurate, and is the paper’s actual contribution.
Consistent with that, the abstract reports no added model complexity and no inference-time overhead — the loss exists only during training.
Evaluation
Two datasets: the public BRCA-M2C, and KUCell, an in-house Koç University set released with the paper. Tested across multiple network architectures. Reported to improve both counting and localisation over existing HEM strategies. Effect sizes are not in the abstract. [unverified]
Methodological notes and reservations
- ε = 50 is in pixels, so it is magnification-dependent. The filtration’s
max_edge_lengthsets the spatial scale at which cell arrangement is measured. Ported to a different magnification or scanner resolution it must be retuned, and nothing in the repo records the magnification it was tuned at. This is exactly the buried scanner/magnification dependency worth extracting from any model paper. - The released λ is ambiguous. The
TGHEMclass defaults tolambda_pers=0.5; the usage example in the same file passes0.01. A 50× difference, and the value used for the published results is not stated in the repo. A reproducibility gap, and the first thing to resolve before reusing the code. - The weight is bounded below by 1.
w = 1 + λDcan only ever increase a sample’s loss, never decrease it — unlike focal loss, which down-weights easy examples. So the effective learning rate on the batch drifts upward with topological error. Whether that is compensated elsewhere is not visible in the loss code.[unverified] - Cost claim worth checking on your own data. Topology runs as a per-sample Python loop on CPU, moving tensors off the GPU each step. The abstract calls the training-time impact negligible, which is plausible for small crops with few cells; Vietoris–Rips scales badly in the number of points, so a dense crop with many hundreds of cells may behave differently. Worth timing before adopting.
[unverified] - H0 infinite death is clipped to ε. Standard practice, but it means the H0 Wasserstein term partly encodes a difference in component count rather than pure arrangement. Not a flaw, but it explains why the method improves counting as well as localisation.
- The repo is the loss function only. No model, no data loader, no training script; the
main()example references undefined variables and is illustrative rather than runnable. Using this means dropping the module into an existing pipeline, not cloning a project.
Why it is relevant here
Cell counting and IHC quantification are already core to the group’s QuPath work, and this addresses the failure mode that matters there — crowded fields. It is also a local group: Koç University, Istanbul, with a large pathologist author list and a newly released public Turkish dataset.