Notre Dame's TopoCL Teaches Medical AI to Read Shape, Not Just Pixels
A new framework teaches contrastive models to see shapes, not just pixels, boosting medical image classification by 3.26% across five methods.
ProTakeaways
- TopoCL adds persistent homology to contrastive learning, boosting medical classification accuracy by +3.26% on average.
- Topology-aware augmentations use relative bottleneck distance on SAM-extracted ROIs to control structural perturbations.
- A Hierarchical Topology Encoder uses self-attention and cross-attention over H0 (components) and H1 (holes).
- A five-expert mixture-of-experts adaptively fuses visual and topological features per sample.
- Works as a plug-in with SimCLR, MoCo-v3, BYOL, DINO, and Barlow Twins across five medical datasets.
- Code available at github.com/gm3g11/TopoCL; adds only 13% average training overhead.
Self-supervised contrastive learning has become the default way to squeeze representations out of unlabeled medical images, but it has a blind spot. The dominant methods learn what things look like at the pixel level, and mostly ignore what things are shaped like. A group at Notre Dame and UT Rio Grande Valley just released TopoCL, a plug-in framework that bakes topology, meaning connectivity, holes, and boundary structure, directly into contrastive pretraining. It works on top of SimCLR, MoCo-v3, BYOL, DINO, and Barlow Twins, and code is publicly available.
Why pixel similarity is not enough for tissue
The core principle of contrastive learning is to apply data augmentations to create multiple views of each image, encode these views through deep neural networks, and learn representations that maximize agreement between different views of the same image. That works well for natural images where texture and color carry most of the signal. In medical imaging, though, diagnosis often hinges on shape: lesion types can differ primarily in boundary patterns, connectivity structures, or cavity formations but look similar in visual appearance, and standard augmentations (random cropping, color jitter, Gaussian blur) can quietly destroy exactly those structural cues.
The authors illustrate this with dermatofibroma cases where MoCo-v3 confuses them with actinic keratosis or melanocytic nevi. MoCo-v3 with TopoCL correctly classifies both by capturing characteristic topological features: circular-to-oval boundary patterns with uniform internal connectivity, and radial pigmentation structures with a consistent boundary configuration despite hair overlay.

Turning shape into a training signal
TopoCL uses persistent homology, a technique from computational topology that tracks features as you sweep a threshold across pixel intensity. It records when connected components (H0) and loops or cavities (H1) are born and when they merge or fill in, storing each event as a birth-death pair in a persistence diagram (PD). The bottleneck distance between two PDs measures how different two shapes are, with mathematical stability guarantees.
The framework has three moving parts:
- Topology-aware augmentations. Instead of blindly cropping and blurring, the authors define a relative bottleneck distance between the PD of the original image and the augmented one, normalized by the PD's span. Topology-weak augmentations use operation intensities producing relative bottleneck distance of 5 to 15 percent, and topology-strong augmentations use intensities giving 15 to 25 percent. PDs are computed inside regions of interest extracted by Segment Anything, not the full image, so background artifacts don't drown out the signal.
- Hierarchical Topology Encoder. Because PDs are unordered point sets, the encoder starts with a PointNet-style MLP over the top-48
H0and top-96H1points, then applies self-attention within each homology dimension and bidirectional cross-attention between them. The cross-attention captures the fact that holes are always bounded by connected components, soH0andH1features are geometrically linked. - Mixture-of-Experts fusion. Five experts (visual-only, topology-only, concatenation, gated blending, and cross-attention) each propose a fused representation, and a per-sample gating network softmax-weights them. This handles the reality that texture-dominated samples may benefit more from visual features, while structure-dominated samples require stronger topological signals.
Results across five methods and five datasets
The evaluation uses PathMNIST, OCTMNIST, OrganSMNIST, ISIC2019, and Kvasir, spanning colon pathology, retinal OCT, abdominal CT, dermoscopy, and GI endoscopy. All models use a ResNet-50 backbone, and quality is measured with linear probing on frozen features.
Averaged across all datasets, TopoCL consistently improves the baseline performance, with accuracy gains ranging from 2.46 to 4.60 percent and AUC gains from 0.45 to 1.80 percent, giving overall average improvements of 3.26 percent accuracy and 0.90 percent AUC. Paired t-tests show 86 percent of individual dataset-metric comparisons and 90 percent of dataset-averaged metrics achieve statistical significance, with 80 percent of the averaged metrics reaching p below 0.001. DINO gets the biggest lift (+4.60 percent accuracy), while histopathology and endoscopy datasets show the strongest gains.
The ablations are informative. The hierarchical attention design matters: its complete removal drops the performance by 6.70 percent on PathMNIST, and cross-attention is more important than self-attention. Among fusion experts, the cross-attention expert contributes a 1.73 percent average drop when removed, followed by the gated expert at 1.45 percent, showing that adaptive fusion, not just adding topology as a side channel, is where the gains come from.
What it costs and where it stumbles
The overhead is modest for a research method. Training time increases by 6 to 18 percent, with a 13 percent average, parameter count increases by 6.5M on average, and throughput drops by 12 percent. Persistence diagrams can be precomputed offline for deployment, which pushes most of the topology cost outside inference.
The method is not free of failure modes. On OrganSMNIST with MoCo-v3, AUC decreased from 99.57 to 98.75 percent despite a considerable accuracy improvement, suggesting a trade-off in near-saturated situations where topological features help classification performance at the expense of ranking confidence. It also depends on SAM producing reasonable ROIs, and on datasets where topology actually differentiates classes: ISIC showed higher variance because skin lesions are visually heterogeneous.
Where this fits
Persistent homology has been used as an auxiliary loss for segmentation and for supervised tumor grading, but wiring it into self-supervised pretraining as a first-class citizen is new. The practical appeal is that TopoCL is a wrapper, not a replacement: if you already have a contrastive medical imaging pipeline, you can add a topology encoder branch and an MoE head without touching the base method. That makes it a reasonable thing to try on any medical classification task where boundaries, connectivity, or holes carry diagnostic weight, from pathology tiles to endoscopy frames.