# TMAL: Topology-preserving Multi-offset Affinity Learning for Curvilinear Structure Segmentation

TMAL learns soft affinities that keep thin curvilinear structures connected

Suho Han, Soungsill Park, Kanghyun Ryu, Yoseob Han · arXiv · 2026-11-10

- **Problem** Binary connectivity labels give thin and thick links the same value, so thin branches that break most easily get no extra weight.
- **Method** TMAL swaps binary connectivity labels for soft affinities that are larger in thin regions near the boundary. It predicts these at several offsets and fuses them using decoder features.
- **Results** On DRIVE, TMAL reaches the highest Dice, IoU and clDice scores and cuts the connected-component error ∆β0 to 24.50, compared to 204.45 for the lowest baseline.

![Figure 7: Qualitative comparison on DRIVE \[18\] and DeepCrack \[11\]. On DRIVE, red and green boxes mark the two regions enlarged beneath each panel; on DeepCrack…](https://refivu.com/papers/02ba3d96-c6ad-42b0-9f2d-4dcac980b272/figures/figure-6f7716a25653fc663a07854aff67a576.png?thumb=512)

**Figure 7** . Qualitative comparison on DRIVE \[18\] and DeepCrack \[11\]. On DRIVE, red and green boxes mark the two regions enlarged beneath each panel; on DeepCrack, red arrows mark the corresponding regions. The highlighted regions illustrate differences in branch continuity and false-positive responses. Yellow values give Dice /∆β0 for each example.

[Original paper](https://arxiv.org/abs/2611.13511v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Suho Han, Soungsill Park, Kanghyun Ryu, Yoseob Han · TMAL: Topology-preserving Multi-offset Affinity Learning for Curvilinear Structure Segmentation · Original paper figure · Extracted the figure area from page 7 of the original PDF.

## Where binary connectivity labels fall short

Pixel-wise training with binary cross-entropy and Dice losses improves local accuracy and region overlap, but it never supervises how neighboring foreground pixels connect. So a prediction can score well on pixel accuracy and still contain broken branches. Topology-based losses such as clDice and CAPE add a term that rewards skeleton agreement or low-cost paths between components.

Their outputs remain ordinary masks, though, and they don't represent connections between pixel pairs.

Connectivity-based methods come closer to the problem, because they predict directional links between pixels. Their binary targets treat every positive link alike, whether the link sits in a thin branch or a thick one. Thin segments are the ones that break most easily, so a label that ignores thickness misses where errors begin.

## A soft, thickness-aware target for each link

TMAL keeps the pairwise formulation of binary connectivity models but changes the label from a yes or no to a continuous affinity. The affinity is larger for thin structures near the boundary, where breaks are most likely. The source of the affinity is a distance map computed from the binary ground-truth mask Y. That distance is then inverted and normalized, so boundary-adjacent and thin regions receive the largest values.

The inverted distance map is largest in thin regions and smallest inside thick centers, the opposite of D.

Affinity Target Conversion forms each link's target as the product of the inverted distance at its two endpoints. Because this product is symmetric, a link and its opposite direction share one target value. Prior models read each pair only at offset s = 1, where the neighbor is the immediate pixel. At offset 1, the continuous affinity takes the place of the binary connectivity label c\_k in Equation (1).

The sampling patterns differ by offset, so each branch reaches a different distance from the pixel. Branch s = 1 reads the eight neighbors of the 3 × 3 window. Branch s = 2 scales the same eight directions onto the 5 × 5 neighborhood. The rotated branch s = 2′ keeps the 5 × 5 window but reads the displacements (±1, ±2) and (±2, ±1). Figure 4(d) shows this rotated set as the counterpart of the axis-aligned branch s = 2.

## Predicting and fusing affinities across offsets

Each offset branch starts from one shared feature map, produced by an ImageNet-pretrained ResNet-34 encoder and an upsampling decoder with 32 channels. Each branch has its own lightweight head that applies a 1×1 convolution and bilinear upsampling to that feature map. The head predicts an eight-channel logit map, and an element-wise sigmoid turns those logits into per-direction affinities.

Each branch output is compared with its own offset target through a Smooth L1 loss, so the branches stay separate.

Affinity Fusion decides how much each offset should count at every pixel and in each direction. It concatenates the branch logits with the decoder feature and passes them through a fusion layer of 3 × 3 convolution, batch normalization, ReLU and bilinear upsampling. A branch-specific projection then produces one gating logit map for each offset.

A softmax across the branches turns these gating logits into spatial weights that sum to one for each direction. The fused logit is the sum of the weight maps multiplied by the branch logits, and a sigmoid gives the fused affinity.

The fused map is supervised against the offset-1 target, even though it draws on the wider offsets. The authors expect the wider offsets to act as context that makes the offset-1 affinity more accurate. The offset-1 target is used because the offset-1 bilateral step decodes the fused map. Each branch keeps its own offset target, so the separate offsets stay supervised.

## Turning affinities back into a mask

Distance Map Decoding (DMD) turns a predicted affinity map back into one inverted distance map per pixel, in two steps. The first step, Bilateral Affinity Calculation (BAC), multiplies the response of each direction at a pixel by the response of the opposite direction at the paired pixel. This product gives an eight-channel bilateral map, so each direction is checked against its reverse neighbor before any aggregation happens.

The authors note that a target-consistent affinity map returns the inverted distance scaled by the largest value among the sampled neighbors.

That scaling factor approaches one in thin regions near the boundary, which is where the target puts its emphasis. The model supervises the predicted inverted distance map directly against the inverted distance target, so it never has to invert the output. TMAL thresholds the fused map at τ = 0.5 to produce the binary mask, so the mask is a simple cut on a continuous map.

During training, DMD also runs on each branch map for deep supervision, but only the fused path ˆ¯D(f) produces the final mask. The auxiliary segmentation head is discarded at inference, so the affinity path alone produces the reported mask.

The training losses that act on these decoded maps are described in the next section, along with the auxiliary supervision. Dice, IoU, clDice, and the Betti-number errors are then computed on that mask, so topology is judged on the same output.

## Auxiliary mask supervision and the loss terms

The auxiliary segmentation branch adds pixel-level mask supervision that the affinity path doesn't provide on its own. AuxSeg takes the FE representation Fd and predicts a binary mask Ŷaux during training. Its binary cross-entropy loss, Laux, compares that prediction with the ground-truth mask Y. The authors use this direct supervision to keep region-level accuracy while the regression target shapes connectivity.

The auxiliary term carries weight 0.5 in the total loss, and the AuxSeg module is discarded at inference.

Each branch trains with five loss terms, while the fused output uses only three of them. Laff applies the Smooth L1 loss to all continuous targets, and Ldist shapes the profile toward the inverted distance map. The soft Dice loss Ldice compares the decoded map with Y and counters the imbalance between foreground and background. The edge term Ledge follows the edge-decoupled supervision, and its edge set comes from the binary connectivity.

Training uses these weights on DRIVE and DeepCrack, which the next section describes.

## Datasets, resizing and baseline protocol

Each image and its labels are resized to 512×512, and the network runs on the same 512×512 input at inference.

The authors retrained U-Net, FR-UNet and CS-Net from scratch with BCE and no architectural changes. Every other baseline is retrained with its official implementation and published configuration. That group includes the generative V-GAN, SegDiff and MedSegDiff, the topology-based clDice and CAPE, and the connectivity-based DconnNet. Because every method shares this 512×512 protocol, the absolute values differ from those in the original papers.

TMAL's gains therefore rest on a common training and evaluation setup rather than on numbers copied from prior work.

Dice and IoU measure region overlap, but they cannot capture the connectivity of thin structures on their own. clDice measures agreement with the morphological skeleton, so it adds a skeleton-level check on top of overlap. The two Betti-count errors, ∆β0 for connected components and ∆β1 for loops, measure topology preservation.

The optimizer, learning-rate schedule, training length and augmentation settings for each dataset are given in the supplementary material. With these settings fixed, Table 1 reports the mask-based, topology-based and connectivity-based results side by side.

## Does TMAL improve connectivity without losing overlap on DRIVE and DeepCrack

On DRIVE, TMAL reaches 0.8295 Dice and 0.8773 clDice, the highest values in the table. Its IoU on DRIVE is 0.7090, so the overlap gain holds in the IoU column too. On DeepCrack, TMAL reaches 0.8439 Dice and 0.9074 clDice, which are also the highest values. Its DeepCrack IoU is 0.7427, the best of the compared methods.

The connectivity result is the part that matters most for this question. On DeepCrack, TMAL reaches 1.98, compared to 4.22 for the lowest baseline clDice. They read this as gains that reach beyond pixel accuracy to component-level continuity.

The authors tie TMAL's much lower ∆β0 to the distance-aware targets and the wider offsets. DconnNet is the closest prior method in design, with a ∆β0 of 452.80 on DRIVE. The qualitative examples support the connectivity numbers in Table 1, but they don't measure overlap on their own.

![Table 1: Quantitative comparison on DRIVE \[18\] and DeepCrack \[11\]. Higher is better for Dice, IoU and clDice; lower is better for∆β 0, ∆β1 and HD95. Methods ar…](https://refivu.com/papers/02ba3d96-c6ad-42b0-9f2d-4dcac980b272/figures/figure-116058a5a4d4990e61289f0cf50688c9.png?thumb=512)

**Table 1** . Quantitative comparison on DRIVE \[18\] and DeepCrack \[11\]. Higher is better for Dice, IoU and clDice; lower is better for∆β 0, ∆β1 and HD95. Methods are grouped as mask-, topology-, and connectivity-based approaches. Bold and underlining denote thebestand second-best results, respectively; the shaded row denotes TMAL.

[Original paper](https://arxiv.org/abs/2611.13511v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

## Which design choices carry the gains

The segmentation-label ablation on DRIVE starts from the binary mask Y, which Table 2(a)(i) shows reduces Dice, IoU and clDice. The authors explain this by leaving thin branches broken, while a soft target reconnects them and can close a loop the ground truth lacks. The standard distance map D is worse than the inverted map on every metric, with ∆β0 of 27.95 compared to 24.50.

![Table 2: Ablation study on DRIVE \[18\]. Each group replaces one setting, shown in parentheses. RemovingL (f) also removes AF. In group (c), primed offsets denot…](https://refivu.com/papers/02ba3d96-c6ad-42b0-9f2d-4dcac980b272/figures/figure-6b66f89c808549015820869f1b695933.png?thumb=512)

**Table 2** . Ablation study on DRIVE \[18\]. Each group replaces one setting, shown in parentheses. RemovingL (f) also removes AF. In group (c), primed offsets denote the rotated direction set. Higher is better for Dice, IoU and clDice; lower is better for∆β 0,∆β 1 and HD95. Bold and underlining denote thebestand second-best results, respectively; the shaded row denotes TMAL.

[Original paper](https://arxiv.org/abs/2611.13511v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

The objective ablation removes the fused loss L(f) and the auxiliary loss L aux in different combinations. Removing both terms raises ∆β0 to 67.65, and removing L(f) alone gives a comparable 68.50. Removing the fused loss also leaves the fused path unsupervised, so that row can't separate the loss from an untrained fusion branch. The authors read this as evidence that the auxiliary supervision regularizes affinity learning.

The branch-set ablation varies the number of offsets and whether the offset-2 directions are rotated. Using only offset 1 gives ∆β0 of 30.10, and only offset 2 gives 44.50, both above the 24.50 of the proposed pair. Adding offset 3 gives the best Dice and IoU among the ablated variants, but its ∆β0 of 29.05 is still above 24.50. Adding offset 4 pushes ∆β0 to 33.50, so more offsets trade topology for overlap.

The rotated branch gave ∆β0 of 35.95 when it replaced offset 2 and 34.10 when it was added. Neither rotated variant improved the overlap scores or ∆β0, though the added variant reached the best HD95. The authors therefore keep S={1,2} for TMAL.

## Limitations of the affinity target

The affinity target only constrains pairwise links between pixels, so it doesn't directly optimize loop structure. It also leaves the worst-case boundary distance outside what the target controls. On DRIVE, ∆β1 rises to 20.95, compared to 4.95 for the lowest baseline, MedSegDiff. The authors list this loop error as a cost of the component-level gains in Table 1.

HD95 doesn't reach the best value, so TMAL doesn't win on boundary distance. Two datasets, DRIVE and DeepCrack, are the only test beds in this study. Fixed in advance, the sampling offsets are shared across the whole image. The model can't adapt the offsets to the local structure of each image.

They argue such a target would turn these properties into a controllable trade-off. They also propose learning the sampling offsets instead of fixing them in advance.

## Paper info

- **Authors**: Suho Han, Soungsill Park, Kanghyun Ryu, Yoseob Han
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-10
- **Added**: 2026-11-11
- **Updated**: 2026-11-10
- **Version**: v1
- **arXiv**: 2611.13511
- **Category**: cs.CV · physics.med-ph
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.13511v1) · [PDF ↗](https://arxiv.org/pdf/2611.13511v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Curvilinear structures such as retinal vessels and surface cracks need both pixel-level accuracy and structural continuity. Pixel-wise supervision does not model the connections between pixels, and topology-based losses still produce ordinary masks. Connectivity-based methods predict these connections directly, but they use binary connectivity targets over a fixed local range. Such labels give the same value to thin segments and to thick regions, and they cannot describe connections at larger offsets. To address these limitations, we propose Topology-preserving Multi-offset Affinity Learning (TMAL). TMAL uses soft affinities that emphasize thin regions near the boundary, and it predicts directional affinities at several offsets to reach further. It then combines these affinities with weights that come from the decoder features, so local continuity and wider context are used together. An auxiliary segmentation branch adds region-level supervision and keeps the overlap accuracy high. On the retinal vessel dataset DRIVE and the crack inspection dataset DeepCrack, TMAL reaches the highest Dice, IoU, and clDice scores, and it greatly reduces the connected-component error $Δβ\_0$. Code is available at https://github.com/suho-han/TMAL.

## Quote from the paper

Suho Han, Soungsill Park, Kanghyun Ryu, Yoseob Han (2026). TMAL: Topology-preserving Multi-offset Affinity Learning for Curvilinear Structure Segmentation. arXiv:2611.13511v1. https://arxiv.org/abs/2611.13511v1

**BibTeX**

```
@misc{han2026tmal,
  title = {{TMAL: Topology-preserving Multi-offset Affinity Learning for Curvilinear Structure Segmentation}},
  author = {Suho Han and Soungsill Park and Kanghyun Ryu and Yoseob Han},
  year = {2026},
  eprint = {2611.13511},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.13511v1}
}
```

## Other paper commentary

- [Vendi Anomaly Scores for Efficient and Accurate Anomaly Detection](https://refivu.com/en/papers/806f5b70-4ff5-4846-a82b-db852262f953-vendi-anomaly-scores-for-efficient-and-accurate-anomaly.md)
- [SWAM: Scaling World Action Models with Cross-Modal Alignment](https://refivu.com/en/papers/e8b2ba32-9c65-4ad1-b595-af05643ccc37-swam-scaling-world-action-models-with-cross-modal.md)
- [WanderBench: Can World Models Explore Dynamic Worlds from Video?](https://refivu.com/en/papers/7abb23d2-6e66-4d6d-975e-edf2604d3c4d-wanderbench-can-world-models-explore-dynamic-worlds-from.md)
- [The Deception Archive as a repository of standardized datasets for large-scale verbal deception detection research](https://refivu.com/en/papers/f95b76de-44ef-4fb8-8569-db8fbbd13737-the-deception-archive-as-a-repository-of-standardized.md)
- [MOOD: Benchmarking Post-Hoc OOD Detection for Materials Property Prediction](https://refivu.com/en/papers/43f71184-5ad3-4e22-907b-780780aa57a8-mood-benchmarking-post-hoc-ood-detection-for-materials.md)
- [Benchmarking CNNs, Vision Transformers, and Foundation Models for Explainable Brain Tumor MRI Classification: Calibration, Decision Analysis, and External Validation](https://refivu.com/en/papers/7a2d0525-ea26-4e79-9cd4-6a0e30e443ef-benchmarking-cnns-vision-transformers-and-foundation-models.md)
- [Discrete Model-Based Diffusion for Combinatorial Optimization in Multi-Robot Task Allocation](https://refivu.com/en/papers/a1ec382a-8589-45d0-91fb-e5e73a2fbe22-discrete-model-based-diffusion-for-combinatorial.md)
- [The AI Era's Lines of Code? A Case Study on What an Engineer's Token Spend Measures](https://refivu.com/en/papers/39d25821-8637-434b-a777-c0a0904348ea-the-ai-era-s-lines-of-code-a.md)
- [AdjointFlow: Accelerating Scientific Inverse Problems with Physics-Based Transport](https://refivu.com/en/papers/6b166ed0-3149-42f2-a941-1390dbf83385-adjointflow-accelerating-scientific-inverse-problems-with.md)
- [Robust Flow Matching under Target Corruption and Label Noise](https://refivu.com/en/papers/eb3184e2-769b-4ebb-9354-c5ce375a84f1-robust-flow-matching-under-target-corruption-and-label.md)
- [Wrong the Same Way: Cross-Prompt Sharing Both Suppresses and Amplifies Reward Hacking in RLVR](https://refivu.com/en/papers/5606ee9f-72c8-4ff9-a0b8-f8b75cb81222-wrong-the-same-way-cross-prompt-sharing-both.md)
- [Which Successes Make Good References? Action-Sequence Alignment for Multi-Turn On-Policy Distillation](https://refivu.com/en/papers/6490fb8a-d9fa-46f8-ba9c-bafe7b1c04c5-which-successes-make-good-references-action-sequence.md)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/02ba3d96-c6ad-42b0-9f2d-4dcac980b272-tmal-topology-preserving-multi-offset-affinity-learning-for)
