NERVE: Neighbourhood & Entropy-guided Random-walk for training free open-Vocabulary sEgmentation

Kunal Mahatha, Jose Dolz, Christian Desrosiers · DOI

Abstract

Open-Vocabulary Semantic Segmentation (OVSS) aims to segment images into arbitrary categories defined by text prompts. While training-free methods offer a cost-effective alternative to supervised models, they often struggle with noisy attention maps and rigid spatial refinement. We present NERVE (Neighbourhood & Entropy-guided Random-walk), a novel framework that utilizes the internal knowledge of CLIP and Stable Diffusion. By combining global and local affinities via an entropy-guided fusion and a stochastic random walk, NERVE achieves state-of-the-art results on seven benchmarks, outperforming existing methods by an average of 4.3% mIoU without requiring additional training or expensive post-processing.

Introduction

Traditional semantic segmentation models are typically "closed-set," restricted to recognizing only the classes they were specifically trained on. Open-Vocabulary Semantic Segmentation (OVSS) addresses this limitation, enabling models to recognize and segment any object described in natural language. Training-free approaches are particularly attractive as they leverage large-scale pre-trained models like CLIP and Stable Diffusion without requiring expensive fine-tuning on new datasets.

However, current training-free OVSS methods face significant hurdles. First, they often rely on computationally heavy post-processing strategies to refine noisy segmentation masks. Second, they typically employ naive fusion strategies, such as simple averaging of Transformer attention heads, which fails to account for the varying noise levels across different layers. Finally, many methods use fixed Gaussian kernels for spatial smoothing, which are "shape-blind" and fail to capture complex, arbitrary object boundaries.

Methodology

NERVE addresses these challenges through a multi-stage refinement process that treats the image as a graph of pixel relationships, leveraging the spatial structure inherent in generative models.

The NERVE architecture combines global and local affinities from Stable Diffusion with CLIP-based cross-attention maps, refined through an entropy-guided stochastic random walk.

Dual Affinity and Entropy-Guided Fusion

NERVE extracts features from Stable Diffusion to compute two types of relationships:

  1. Global Affinity: Captures long-range dependencies across the entire image.
  2. Local Affinity: Focuses on immediate pixel neighborhoods to preserve fine details.

A key technical innovation is the Entropy-Guided Fusion. Rather than treating all attention maps from the Transformer equally, NERVE calculates the uncertainty (entropy) of each map. High-entropy maps, which are typically noisy or contain "hallucinations," are suppressed, while low-entropy maps that clearly delineate object boundaries are given higher weights.

Stochastic Random Walk

To refine the initial segmentation masks, NERVE implements a stochastic random walk. By treating pixels as nodes in a graph, the model allows semantic information to flow naturally along connected, related areas. Unlike fixed Gaussian blurs, this random walk is "shape-aware," following the actual edges and textures present in the image's feature space. Furthermore, NERVE leverages the low-rank structure of attention matrices to ensure that this process scales linearly ($O(N)$) with the number of pixels, making it efficient for high-resolution imagery.

Experiments and Results

The researchers evaluated NERVE on seven popular semantic segmentation benchmarks, including PASCAL VOC 2012, ADE20K, PASCAL Context, and COCO-Stuff. These datasets cover a wide range of indoor and outdoor scenes with varying numbers of object categories.

Quantitative comparison of NERVE against state-of-the-art training-free and post-processing-based OVSS methods across multiple benchmarks.

As shown in the results, NERVE establishes a new state-of-the-art for training-free OVSS. On the PASCAL VOC 2012 (V21) benchmark, it achieved 69.7% mIoU, significantly outperforming previous leaders like SCLIP (59.1%) and NACLIP (58.9%). Across all tested datasets, NERVE demonstrated a consistent average improvement of +4.3% mIoU compared to the next best training-free baseline. Notably, NERVE outperforms many methods that utilize heavy post-processing (like CRFs or PAMR), despite being a single-pass, "clean" algorithm.

Discussion and Conclusion

The success of NERVE highlights two critical insights. First, uncertainty is a valuable signal: by explicitly modeling the entropy of attention layers, the model can automatically ignore noise inherent in diffusion layers. Second, random walks are superior to Gaussian blurs for spatial refinement because they respect the underlying image geometry and object shapes.

While NERVE is highly effective, its performance remains tied to the quality of its underlying backbones. If the pre-trained models have not encountered a specific rare concept, the system may struggle to segment it. Future work may involve extending this random-walk framework to other dense prediction tasks beyond segmentation, such as depth estimation or edge detection, where shape-aware refinement is equally crucial.

Summary updated

BibTeX
@inproceedings{mahatha2026nerve,
  author = {Kunal Mahatha and Jose Dolz and Christian Desrosiers},
  title = {{NERVE: Neighbourhood \& Entropy-guided Random-walk for training free open-Vocabulary sEgmentation}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2026},
}
Figure