Training Contour Models to Converge from Anywhere

Deformable contour models segment an organ by starting from a rough outline and repeatedly nudging it toward the organ's edge. They can carry shape information across stretches where the edge is faint, which is exactly where ordinary per-pixel classifiers produce blurry or fragmented masks. They have a well-known weakness, though: they only work if the starting outline is close enough. The outline usually comes from a separate object detector. When that detector is fooled, for example by a text overlay, a scanner bed, a specular highlight, or a layer of subcutaneous fat, the contour slides into the wrong minimum. We propose to remove this dependency by training the field that moves the contour so that the true boundary is the only stable endpoint reachable from almost any starting outline in the image. Starting points placed on top of imaging artifacts are explicitly included.

The core idea fits in two sentences. Instead of training a contour model on starting outlines near the target, we train it against the worst starting outlines we can find, including ones placed on artifacts, and we measure success by the size of the region of starting points from which it reaches the right answer. If this works, contour evolution becomes detector-free and robust to artifacts while keeping its advantage on low-contrast edges. If it does not beat a well-tuned per-pixel network trained with the same artifact augmentation, that result is also informative: it would tell us that the iterative machinery is not earning its cost.

Core Claim

Recent learned contour models enlarge the region of starting points that converge to the right boundary (the "convergence basin") using hand-designed fields. Mamba Snake adds a distance-transform "energy shape prior map" that pulls points toward borders from farther away. MARL-MambaContour treats each contour vertex as a reinforcement-learning agent and reports recovery from initialization perturbations of ±10% and ±20%. Both still start from detector boxes. Neither measures what happens when the start is far away or sits on an artifact, and both are documented to fail when the detector misses the target.

Our claim is that basin size should be a training objective rather than a byproduct. We also claim that two ingredients determine it. The first is global context: a field computed from local features alone cannot know which of several edge-like structures is the target, so it creates spurious stable endpoints far from the organ. The second is artifact invariance: a pasted artifact should leave the field elsewhere unchanged and should not itself become an endpoint.

The hard-masking approaches of Zhang et al. multiply features by a lung mask, and Gare et al. excise superficial tissue in lung ultrasound. Both show that removing non-target tissue fixes shortcut behaviour in classifiers. For contour models, however, we predict that hard masking is counterproductive. A binary mask writes an artificial step edge into the image, and a contour will treat that edge as a boundary to stop at.

Research Program

We represent the contour implicitly as the zero level of a function $\phi$, so that holes and multiple components are allowed. This choice follows the recurrent level-set reformulation of RLS, which turns level-set updates into a learned recurrent step but remains sensitive to its starting function. It also sidesteps the fixed-topology failure shared by polygon snakes. An image encoder predicts a speed field once per image, in the spirit of the static displacement field of ACDRNet. A light recurrent update then evolves $\phi$ for $T$ steps. We write $E_\theta^T(\phi_0; I)$ for the result of evolving the starting function $\phi_0$ on image $I$ with parameters $\theta$.

Training minimizes the expected loss under the hardest admissible starting point:

$$\min_\theta \; \mathbb{E}_{(I,y)} \Big[ \max_{\phi_0 \in \mathcal{S}(I)} \mathcal{L}\big(E_\theta^T(\phi_0; I),\, y\big) \Big] + \lambda\, \mathbb{E}_{a}\, \big\| M_{\bar a} \odot \big(F_\theta(I) - F_\theta(I \oplus a)\big) \big\|_1$$

The symbols are as follows. $y$ is the ground-truth mask. $\mathcal{L}$ is a Dice-plus-boundary loss. $\mathcal{S}(I)$ is the set of ellipse starting outlines whose centres lie anywhere in the image. $F_\theta$ is the predicted speed field. $I \oplus a$ is the image with a synthetic artifact $a$ pasted in, such as a text label, ruler, caliper mark, scanner-bed band, or specular blob. $M_{\bar a}$ masks out the artifact's own footprint. $\lambda$ weights the invariance term.

The inner maximum is approximated in two stages. We first sample $K$ starting outlines, deliberately biased toward artifact locations and toward bright edges of neighbouring organs. We then take a few gradient-ascent steps on the ellipse parameters, which is possible because the evolution is differentiable.

A curriculum widens $\mathcal{S}$ from detector-like boxes to the full image. This mirrors the coarse-first logic of Khan et al., whose continuum scale space avoids fine-scale noise minima by solving for coarse structure first. We borrow the principle rather than the PDE solver.

The encoder is the axis we deliberately vary. We compare a purely local CNN, a hybrid with linear-time global mixing at low resolution and local attention at high resolution (the stratification of vMixer), and a CNN-plus-Mamba encoder like BELGNet's. Here, local-global context is not treated as an architecture contest. It is a hypothesis about basin geometry: global context should be necessary to suppress far-away stable endpoints.

The central measurement is basin coverage. For each test image, we lay a fixed grid of 64 ellipse starting outlines across the whole frame, evolve each, and record the fraction whose final boundary F-score exceeds a threshold. We also record the worst-case Dice over that grid. We additionally map which starting regions fail, so we can see whether failures cluster on artifacts, at mask edges, or on adjacent organs.

Baselines

The naive reference point is the same level-set evolver trained only from detector-style starting outlines with standard random jitter, as deep snakes and MARL-MambaContour do. It is run with the identical encoder, data, and epochs. Beating it means substantially higher basin coverage and worst-case Dice from full-image starts, with no loss of Dice from good starts.

The strongest per-pixel competitor on low-contrast pancreas CT is DB-MSMUNet. It reports a Dice similarity coefficient of 89.47% on NIH Pancreas and 87.59% on MSD Pancreas. On speckled breast ultrasound, the strongest is BELGNet, with a Dice of 89.80% on BUS-B. We will retrain both under our splits with the same artifact augmentation and the same tuning budget, measured in GPU-hours and hyperparameter trials. Matching their Dice on clean images while exceeding their boundary F-score in low-contrast boundary bands, and degrading less under held-out artifacts, would count as beating them.

For boundary regularization on cardiac MRI, the reference is the active-contour loss of Chen et al.. It reports a left-ventricle Hausdorff distance of 4.73 mm on ACDC, against 5.43 mm with cross-entropy.

The strongest existing contour method is Mamba Snake. The file gives only relative gains for it, roughly +3% average Dice across five datasets and +4.09% boundary F on MR_AVBCE, so we have no absolute numbers. No reported result was found on Lacuna for its absolute Dice on our target datasets. We will therefore run it, or a faithful reimplementation of its prior-map field if code is unavailable, with its detector, and again with our full-image starting grid.

Two ablations isolate the key ingredient. The first removes the adversarial inner maximum but keeps uniform full-image starts. The second removes the artifact-invariance term. A third baseline is hard lung or region masking as preprocessing, following Zhang et al., to test the predicted mask-edge attractors.

Why not just…?

Why not just jitter the detector box more during training? This is the cheapest version of our idea, and it is the naive baseline above. Jitter samples starting points near the target, and the failures we target come from distant or artifact-located starts that jitter never visits. The ablation with uniform full-image sampling but no adversarial mining separates "seeing far starts" from "being trained on the worst ones." If uniform sampling alone closes the gap, we will report that and drop the adversarial component.

Why not just use a per-pixel network, which has no initialization at all? This is the real threat. Mamba Snake reports that nnU-Net and MedSAM produce cavities and merged boundaries. Chen et al. show that cross-entropy networks leave speckle and larger Hausdorff error. Neither comparison, however, gave the pixel model the same artifact augmentation. Our comparison against DB-MSMUNet and BELGNet with matched augmentation decides the question. If they match us on low-contrast boundary bands, then detector-free contour evolution is not worth building.

Why not just mask out artifacts and non-target tissue first? Masking works for classifiers Gare et al., but it depends on an upstream segmenter that can itself fail. It also injects step edges exactly where boundaries are already ambiguous. The hard-mask baseline and the failure-region maps will show whether stable endpoints form at mask perimeters.

Why not just prompt a foundation model? SAM-style models still need a prompt. CaPro notes that SAM struggles on low-contrast structures, and Mamba Snake reports that MedSAM trails it. We include MedSAM with box prompts derived from the same perturbed starting grid as a secondary reference.

Proposed Experiments

We train and test on NIH Pancreas and MSD Pancreas for low soft-tissue contrast. We use BUS-B for speckle and faint margins, CVC-ClinicDB because specular reflections are a natural artifact, and ACDC for comparison with published cardiac boundary numbers.

Synthetic artifacts are drawn from two disjoint families. Text overlays, rulers, and calipers are used in training. Scanner-bed bands and specular blobs are held out for testing, so that invariance to unseen artifact types is measured rather than memorized. CVC-ClinicDB's real reflections provide an unsynthesized check.

Metrics are Dice, HD95, and boundary F-score restricted to a narrow band around ground-truth edges with low intensity gradient. We also report basin coverage and worst-case Dice over the starting grid, both clean and with held-out artifacts.

The first decisive check is the local-versus-global encoder comparison at fixed parameter count. We predict that the local CNN loses basin coverage mainly from distant starting points, and that global mixing recovers it. If coverage is flat across encoders, then global context is not what makes the basin large, and that part of the hypothesis is wrong.

The second check is the held-out-artifact test. The artifact-invariance term should keep basin coverage on CVC-ClinicDB and held-out synthetic artifacts close to clean-image coverage, while the no-invariance ablation shows failure starts clustered on artifacts.

The third check is the matched per-pixel comparison described above. It is the result that determines whether this line of work continues.