Referring image segmentation asks a model to outline the one object a sentence describes, for example "the zebra behind the fence," in an image that may contain several similar objects. When these models fail, they usually do not produce a ragged boundary. They produce the wrong shape. The mask spills onto a second zebra, breaks the true zebra into disconnected pieces, or adds a stray island on a red shirt worn by someone else. Current training objectives penalize these errors pixel by pixel. A ten-thousand-pixel mask placed on the wrong zebra is treated as ten thousand small, independent mistakes, not as one wrong decision about which object the sentence means.
We propose to use spatially anchored topological matching as a diagnostic that decides, at every training step, which connected regions of the prediction are wrong. Each wrong region is then used as a single, whole negative in the vision-language alignment loss. "Spatially anchored topological matching" means comparing the connected pieces of a predicted mask with those of the ground truth so that two pieces match only if they physically overlap. In plain terms: find the predicted blobs that land on distractor objects, and teach the model that the sentence does not describe those blobs, one blob at a time. The topology machinery is not used as another mask-shape penalty. It is used to choose the negatives for the cross-modal loss.
Core Claim
Our claim is that errors caused by local ambiguity in referring segmentation are, in large part, errors at the level of connected components. Prior work found evidence for both halves of this claim. CRIS: CLIP-Driven Referring Image Segmentation uses a contrastive loss that pulls each foreground pixel toward the text embedding and pushes each background pixel away. It weights every pixel independently, and its masks fragment in scenes with several similar instances. AMLRIS showed that dense pixel-to-text alignment sends misleading gradients through background pixels, which it calls a "supervision bottleneck." It responds by zeroing out weakly aligned grid patches, a step that ignores object structure. On the topology side, Betti matching and Topograph both compare predicted structures to ground-truth structures only where the two physically overlap. Betti matching showed that topology losses without this spatial constraint mismatch features more than 99% of the time on the CREMI electron-microscopy dataset. Topograph separates harmless boundary errors from "critical" errors that change connectivity. Both methods have been used only as mask losses against a single-modality ground truth.
We claim that a component-level contrastive loss will reduce how often the model picks the wrong instance more than two alternatives do. The first alternative is the same topological diagnosis used as a mask loss. The second is per-pixel hard-negative weighting over exactly the same pixels. In the component-level loss, the topological matcher supplies the negatives, and each negative is a whole spurious component pooled into one feature vector. This loss also addresses a known failure of topological losses. When the prediction does not overlap the target at all, Betti matching's gradient goes flat (Betti matching). In our loss, a prediction with zero overlap still has a positive: the pooled feature of the ground-truth region, which the text should prefer. It also still has negatives: the pooled features of the predicted components, which are all spurious. So a useful gradient exists exactly when the model has chosen the wrong object.
Mechanism
At each training step we threshold the predicted mask $P$ and overlay it on the ground truth $G$. We use Topograph's combined component graph for this, which runs in near-linear time and computes its loss in roughly 96 ms, against about 327 ms for Betti matching, as reported in Topograph. From this overlay we extract three kinds of region. The first kind is false-positive components that never touch $G$; these are distractor islands. The second kind is critical false-positive regions that join the referent to a neighboring object; Topograph already labels these as critical nodes. The third kind is missed components of $G$. Boundary errors that Topograph marks as "regular" (errors that shift an edge without changing connectivity) are ignored. For each region $R$ we average the decoder's pixel features into one vector $v_R$. Let $t$ be the sentence embedding, $\tau$ a temperature, $R^+$ the ground-truth region, and $\mathcal{N}$ the set of spurious regions. The added loss is
$$ \mathcal{L}_{\text{comp}} = -\log \frac{\exp(\langle t, v_{R^+}\rangle/\tau)}{\exp(\langle t, v_{R^+}\rangle/\tau) + \sum_{R \in \mathcal{N}} \exp(\langle t, v_R\rangle/\tau)}. $$
This loss is added to the standard CRIS objectives with a single weight. Each spurious component contributes the same amount whatever its area, which is the point of working at the component level.
Two design choices follow from the prior work. We use topological components rather than detector boxes because MAF and HD-OVD resolve instance ambiguity only at box level, and a box around a distractor also covers background and parts of the referent. We match spatially rather than with a graph-level distance such as the Gromov-Wasserstein loss in REACT-KD, because a location-free comparison would reward a correctly shaped mask on the wrong zebra. That is the same failure that Betti matching documented for Wasserstein losses.
Research Program
First, we will measure how much of the gap between CRIS's predictions and the ground truth comes from component-level errors, before building anything. Using the instance annotations of the images underlying RefCOCO, we will label each failed prediction as one of four types: wrong instance, fragmented referent, distractor island, or boundary-only error. If boundary-only errors dominate, the premise is wrong and we stop. Second, we will implement the component-level loss on top of CRIS with a frozen threshold schedule. We will also test a soft variant that pools features with the predicted probabilities, so that early-training predictions near the threshold do not flip between components. Third, we will test whether the loss interacts well with AMLRIS-style filtering. One possibility is that component-level negatives make patch filtering unnecessary. The other is that filtering fractures elongated referents such as limbs or poles, which would create spurious "missed components" that corrupt our negatives.
Baselines
The naive reference point is CRIS trained with its own losses. CRIS reports IoU of 70.47% on RefCOCO, 62.27% on RefCOCO+, and 59.87% on G-Ref. We will retrain it ourselves with the same backbone, schedule, and seeds, so that every comparison is against our own reproduction rather than the published number.
The strongest existing method in the file is AMLRIS. It reports the best results across all eight RefCOCO-family splits and an mIoU gain of up to +1.92% on RefCOCO+, but no absolute RefCOCO IoU value was found on Lacuna for AMLRIS. MaskRIS reports +1.82%p oIoU on RefCOCO when added to the CARIS baseline; no absolute CARIS number was found on Lacuna. We will run AMLRIS's filtering on our CRIS backbone, and apply our loss both alone and combined with it, all under the same epoch budget. AMLRIS itself notes a training-time overhead of about 17.2%, so we will also report wall-clock time.
The key ablation adds the same Topograph diagnosis as a mask loss on the critical pixels, as in Topograph, with no contrastive term. A second ablation adds per-pixel text-contrastive negatives on exactly the pixels our method pools. Both ablations share the same tuning budget of an equal number of loss-weight trials. Our method beats them only if it lowers the rate of wrong-instance predictions and raises IoU over both ablations across three seeds on at least RefCOCO+ and G-Ref. RefCOCO+ is where appearance-only disambiguation matters, since its expressions exclude absolute location words.
Why not just…?
Why not just add Topograph or Betti matching as a mask loss to CRIS? This is the most serious threat, and it is the direct Topograph ablation above. We expect it to remove islands and repair fragments. We expect it to help less when the model picks the wrong instance, because Topograph's gradient changes the output logits without telling the representation that the text does not describe the distractor. It also inherits the flat gradient under zero overlap that Betti matching reports. If this ablation matches our method on the wrong-instance rate, then the component-level contrastive term adds nothing, and we will report that result.
Why not just weight hard negative pixels more heavily? This ablation uses the same pixels and differs only in pooling. It tests whether grouping errors into components matters or whether simply finding the hard pixels explains any gain. AMLRIS's finding that dense background alignment is noisy suggests that per-pixel negatives stay noisy even when well chosen. The experiment decides this.
Why not just keep the largest connected component at test time? This removes islands for free, but it cannot fix a mask placed on the wrong instance. It also breaks occluded referents whose ground truth genuinely has several components, a case that spatial matching handles correctly. CRIS also reports that DenseCRF post-processing, a related clean-up method, cannot fix semantic confusion between targets and distractors. We will still report this post-processing applied to every model.
Proposed Experiments
We will train on RefCOCO, RefCOCO+, and G-Ref and report oIoU and mIoU. We will add three structural measures. The first is the error in the number of connected components (Betti-0 error). The second is Topograph's DIU metric, which checks whether the intersection and union of prediction and ground truth have the same topology. The third is the wrong-instance rate from the error taxonomy in the research program. We will also stratify results by the number of same-category distractors in the image. The decisive check is the stratified curve. If component-level negatives work as claimed, their advantage over the Topograph-as-mask-loss ablation should grow with the number of distractors and be concentrated in the wrong-instance category. A uniform small gain would instead suggest generic regularization. Two secondary checks follow. One is a subset of predictions that are fully disjoint from the target early in training, where we compare how quickly each method recovers from zero overlap. The other is the added cost per step, which should remain close to Topograph's reported loss time.
References
- CRIS: CLIP-Driven Referring Image Segmentation
- AMLRIS: Alignment-aware Masked Learning for Referring Image Segmentation
- Topologically Faithful Image Segmentation via Induced Matching of Persistence Barcodes
- Topograph: An Efficient Graph-Based Framework for Strictly Topology Preserving Image Segmentation
- MAF: Multimodal Alignment Framework for Weakly-Supervised Phrase Grounding
- A Hierarchical Semantic Distillation Framework for Open-Vocabulary Object Detection
- REACT-KD: Region-Aware Cross-modal Topological Knowledge Distillation for Interpretable Medical Image Classification