Star-Convex Segmentation in a Learned Metric

StarDist-style segmentation describes each object by a center point and the distance to the boundary along straight rays leaving that center. The rule behind it, called star-convexity, says that every point of the object can be reached from the center by a straight line that stays inside the object. The rule makes models compact and data-efficient. It fails on curved, folded or branching objects such as C-shaped worms, where straight rays cross the boundary several times and the center of mass can fall outside the object. Our proposal keeps the rule and changes what counts as a line. We replace straight lines with shortest paths in a distance function that the network predicts from the image. An object then only needs to be star-convex in that learned geometry. A worm curls in pixel space but can be a simple "star" around its middle once paths are measured along its body.

This also connects to the metric-space algorithms literature, where methods are designed to need only pairwise distances and the triangle inequality. Once star-convexity is phrased in terms of shortest paths, it is defined on any graph or metric: a pixel grid, an anisotropic 3D voxel lattice, or a point cloud with only neighbor distances. Two simple facts then shape the whole design, and both are developed below. The first shows that the star prior lives entirely in the choice of metric. The second gives an exact, linear-time way to cut out one object around a given center.

Core Claim

In a metric where distance is the length of the shortest path, say that a set $S$ is star-convex about a pole $c$ if every point $p$ lying on a shortest path from $c$ to some $x \in S$ also belongs to $S$. Here "lying on a shortest path" means $d(c,x) = d(c,p) + d(p,x)$. Two consequences follow.

The first concerns nearest-pole assignment. With consistent tie-breaking, assigning each point to its nearest pole always yields star-convex cells. If $x$ is closest to $c$ and $p$ lies on a shortest path from $c$ to $x$, then for any other pole $c'$ we get $d(p,c) = d(c,x) - d(p,x) \le d(c',x) - d(p,x) \le d(c',p)$. So the shape prior constrains nothing beyond the metric itself. Euclidean StarDist corresponds to the plain Euclidean metric, and its failures on curved shapes are failures of that metric.

The second concerns cutting out a single object. Fix a pole and build its shortest-path tree, meaning the tree of shortest routes from the pole to every point. A set is star-convex about the pole exactly when it is closed under taking parents in that tree. Choosing the best such set under any per-point score is therefore a maximum-weight rooted subtree problem. A single dynamic program over the tree solves it exactly in linear time.

Together these give the central claim. A network that predicts three things can represent curved and branching instances with StarDist's explicit per-instance masks. The three things are a positive cost field $w$, which defines path lengths $d_w$ on the pixel graph; a map of likely poles; and per-pixel foreground evidence. Because each instance is decoded from its own pole independently, instances may overlap, which a partition into regions cannot express. And because every step only touches graph distances, the same decoder runs unchanged on non-grid data.

Prior work comes close in three ways. K-convexity Shape Priors for Segmentation already defines a geodesic-star prior and optimizes unions of star-convex parts with graph cuts. However, it uses a fixed, hand-designed image metric, needs user scribbles to place each center, and runs only on pixel lattices. We learn the metric, place poles automatically, and decode by tree dynamic programming on arbitrary graphs. Embedding-based Instance Segmentation in Microscopy (EmbedSeg) motivates the use of medoids as centers, since a medoid is always inside the object. It still computes the medoid with Euclidean distances and drops any shape constraint. Convex Combination Star Shape Prior for Data-driven Image Semantic Segmentation makes multi-center star priors differentiable. It depends on image gradients in continuous 2D and on heuristic center choice, both of which we avoid.

Research Program

Network. A U-Net-style network outputs three maps: the cost field $w(x) > 0$, a pole probability, and a foreground logit $u(x)$. It also predicts a scale $R_c$ at each pole, giving the expected path length to the boundary.

Decoding. For each detected pole $c$, Dijkstra's algorithm over the 8-connected or 26-connected grid, weighted by $w$, produces the shortest-path tree. The decoder then picks the parent-closed subtree $S_c$ that maximizes

$$\sum_{x \in S_c} \Big(u(x) - \lambda\, \tfrac{d_w(c,x)}{R_c}\Big),$$

with $\lambda$ a tuned scalar. This is exact by the tree dynamic program. Non-maximum suppression over pole candidates follows StarDist, using mask overlap instead of polygon overlap.

Training. The training target is that each ground-truth instance be parent-closed in the shortest-path tree rooted at its own medoid, with distances measured in $d_w$. Medoids are computed in the geodesic metric of the ground-truth mask, which keeps the center inside even spiral shapes. This is a refinement of EmbedSeg's Euclidean medoid. Two losses enforce the target. The first is a hinge penalty on ground-truth pixels whose smoothed shortest path, computed with a soft-minimum relaxation of Bellman–Ford iterations, leaves the instance. The second is a direct penalty when $w$ is too low across ground-truth boundaries. The pole map is supervised at the geodesic medoids, and $u$ with ordinary cross-entropy.

Pole discovery without a pole network. On non-grid data we seed poles by sampling points with probability proportional to a power of their current $d_w$-distance to already-chosen poles. This is the $D^\ell$-sampling of FPT Approximation for Constrained Metric k-Median/Means, applied in the learned metric.

Theory. Because nearest-pole cells are automatically star-convex, that paper's list-then-partition approximations, $(3+\epsilon)$ for constrained metric $k$-median and $(2+\epsilon)$ when centers are data points, should carry over to star-constrained clustering, provided the partition step can be done exactly. We will check whether the tree dynamic program supplies that partition step for the version with background or outlier points. We will also identify where the star constraint stops being free, for example under capacity limits. This is a small, checkable lemma, not the headline result.

Non-grid extension. The decoder is reused on point clouds sampled from instance masks. Only k-nearest-neighbor graph distances are exposed, and the cost field is predicted per point by a simple point network.

Baselines

The naive reference is StarDist itself (Star-convex Polyhedra for 3D Object Detection and Segmentation in Microscopy), with straight rays from Euclidean centers. On PARHYALE it reports accuracy 0.593 at IoU 0.5. On CVPPP2017, Instance Segmentation of Biomedical Images with an Object-aware Embedding Learned with Local Constraints reports StarDist at a symmetric best Dice (SBD) of 0.8019. We retrain it with the same backbone, augmentation and tuning budget as our model. A second naive reference is our own model with the cost field frozen to a constant. In that case shortest paths are nearly straight, so the model collapses toward StarDist's prior. This reference isolates whether learning the metric is what helps.

The strongest competitor on curved objects is EmbedSeg (Embedding-based Instance Segmentation in Microscopy). It reports AP 0.965 at IoU 0.5 on BBBC010. Because that figure is near the ceiling, beating EmbedSeg means matching it at IoU 0.5 and exceeding it at IoU 0.75 and 0.9, where no reported number was found in the research file. It also means exceeding it on low-data subsets. On CVPPP the strongest reported number is the local-embedding method at SBD 0.8307 (same paper as above), and we must exceed that. EmbedSeg is rerun from its released configuration on our splits, with equal GPU-hours.

The key ablation is seeded watershed on our own learned cost field and poles. This assigns every foreground pixel to its nearest pole in $d_w$, and by the first fact above it is already star-convex. It shares every learned component with our method. The only differences are that it partitions the image instead of decoding each object independently, and that it ignores the subtree score. If it matches us, the star decoder adds nothing, and we will report that.

A further ablation swaps geodesic medoids for Euclidean medoids and for centroids as the pole targets.

Why not just…?

Why not just run seeded watershed on predicted boundaries? This is the real threat. Our first fact says watershed regions are already geodesically star-convex, so on images without overlap the two methods may perform the same. The claimed advantages are narrow and testable. Independent per-pole decoding can represent overlapping worms in BBBC010, which a partition cannot. The subtree score lets an instance stop before the background without a separate foreground threshold. The ablation above settles the question. If watershed ties us, we will conclude the contribution is the learned-metric training signal and not the decoder, and say so.

Why not just use EmbedSeg and drop shape priors? Unconstrained embeddings have no structural prior. Two results suggest that such a prior matters most with little data or noisy boundaries. StarDist-3D reached 0.7 accuracy on WORM with 4.15% of the training data, matching a U-Net trained on all of it (Star-convex Polyhedra for 3D Object Detection and Segmentation in Microscopy). Star priors also improved SAM's Dice on Refuge from 77.73% to 80.82% (Convex Combination Star Shape Prior for Data-driven Image Semantic Segmentation). The training-fraction sweep below tests whether our prior keeps this advantage on curved shapes, where Euclidean StarDist cannot.

Why not just use multiple Euclidean star centers per object? The k-convexity and convex-combination-star methods do this. Both need centers to be given or chosen by heuristic. A curled worm also needs many parts, and each part boundary is an error source. K-convexity Shape Priors for Segmentation shows that disjoint part decompositions do badly (F1 0.24–0.36 against 0.73–0.79). We will compare against a k-center Euclidean star decoder that uses our poles, with k chosen per instance by validation.

Why not just embed the metric into Euclidean space and run StarDist there? Flattening an abstract metric distorts it, as the file's Euclidean-collapse and multidimensional-scaling results warn. Our point-cloud experiment tests this directly. It compares Isomap-style embedding followed by Euclidean star decoding against decoding on the graph.

Proposed Experiments

2D curved and touching objects. These experiments use BBBC010, CVPPP2017 and DSB2018. Metrics are AP at IoU 0.5, 0.75 and 0.9, plus SBD on CVPPP. Separately, we score AP on BBBC010 instances that overlap another instance, the case where partition methods are structurally capped.

3D. These experiments use PARHYALE, WORM, Mouse-Skull and ISH-Nuclei. Anisotropic voxels are simply a stretched metric, so the cost field should absorb the anisotropy without hand-set ray spacing.

Data efficiency. We sweep training fractions from 5% to 100% on BBBC010 and WORM against StarDist and EmbedSeg.

Non-grid metric test. Instances from BBBC010 masks are converted to point clouds that expose only neighbor-graph distances. The test compares graph decoding, with $D^\ell$-sampled poles, against Euclidean embedding followed by star decoding. The metric is mask IoU after projecting points back to pixels.

Decisive check. The project succeeds if three things hold together. First, the learned-metric star decoder beats the constant-metric ablation on curved datasets. Second, it beats seeded watershed on the same cost field, at least on overlapping instances. Third, it beats EmbedSeg at strict IoU thresholds or in low-data regimes. Failing the watershed comparison would reduce the method to a training loss for geodesic seeded watershed. That would still be informative, but it is a smaller claim than the one made here.