In traditional computer vision, tasks like segmenting a blood vessel or detecting a road are often framed as binary classification: every pixel is either part of the structure or it isn't. However, this "hard" labeling creates a difficult optimization landscape. A model that misses a thin line by a single pixel receives the same penalty as one that misses it by fifty.
To solve this, researchers have increasingly turned to distance transform regression. Instead of predicting a binary mask, the model learns to predict a continuous map where each value represents the distance to the nearest boundary or centerline. This shift from discrete labels to continuous proximity provides a richer supervision signal that guides the model toward the correct geometry.
The Problem with Binary Plateaus
When a neural network is trained to output a binary mask, the resulting score maps often suffer from a "plateau effect." As Sironi et al. observe, classification-based methods often produce thick, ambiguous detections where many adjacent pixels are labeled as the center. This makes precise localization difficult, requiring post-processing steps like non-maximum suppression that may still fail to find the true peak.
By reframing the task as a regression problem—predicting the distance to the closest centerline—the model generates a smooth landscape with a distinct, sharp peak. Sironi et al. argue that this continuous representation facilitates the identification of elongated geometries, such as winding roads or delicate blood vessels, far more effectively than standard pixel-wise labels.
Smoother Gradients for Thin Structures
The advantage of distance transforms is most apparent when dealing with thin, curvilinear structures like power lines or lanes. In these cases, the target may only be a few pixels wide. A binary loss function provides no useful gradient for pixels that are near the target but not exactly on it.
Oner et al. demonstrate that representing these structures as a distance transform map provides smoother gradients during training. This allows the network to "feel" the proximity of the target even from a distance, improving robustness when detecting objects that occupy very little area in high-resolution imagery. Similarly, Máttyus et al. show that predicting the distance to lane boundaries helps the network better capture spatial relationships, leading to easier convergence and more robust detection in autonomous driving scenarios.
This spatial awareness is also critical for maintaining connectivity. Oner et al. found that regressing distance maps results in cleaner skeletons and fewer disconnected segments in network-like structures like canals or roads. Because the distance map encodes the global geometry of the shape, the model is less likely to produce anatomically impossible gaps or outliers, a benefit also noted by Li et al. in the context of cardiac scar quantification.
Softening the Decision Boundary
The logic of continuous supervision extends beyond spatial pixels to the concept of similarity. In tasks like visual localization or image retrieval, traditional methods use a "hard" threshold to decide if two images match. This creates noise: two nearly identical images might be labeled as "different" simply because they fall on opposite sides of an arbitrary distance cutoff.
To address this, Thoma introduced Soft Contrastive Learning, which replaces binary labels with continuous scores based on geometric distance. This allows the model to learn a gradual transition between matching and non-matching images, reflecting the continuous nature of physical space. Leyva-Vallina et al. further showed that this "graded similarity" significantly improves model convergence and accuracy, mitigating the noise inherent in hard thresholds and allowing for much faster training.
Encoding Geometry and Scale
Distance transforms do more than just smooth the loss function; they encode the internal geometry of an object. Liang et al. utilize an inverse distance transform to provide a richer supervision signal for drawing crosswalks, as the transform encodes the relationship between a region's interior and its boundaries.
In medical imaging, Navarro et al. use the Euclidean distance transform as an auxiliary task to help networks learn the geometric center and scale of organs. This provides a "soft-localization" signal that is particularly helpful for small or irregularly shaped structures that binary masks might overlook. Whether it is tracking the motion of vocal folds (Hamad et al.) or registering a sports field (Nie et al.), the shift from "what is this pixel" to "how far is this pixel from the goal" has proven to be a fundamental improvement in how machines perceive spatial structure.
Key Foundational Work
Multiscale Centerline Detection by Learning a Scale-Space Distance Transform (2014) — contributed 2 concept elements to this direction.
Projection onto the Manifold of Elongated Structures for Accurate Extraction (2015) — contributed 1 concept elements to this direction.