Abstract
Contrastive Language-Image Pre-training (CLIP) has demonstrated impressive capabilities in zero-shot transfer but often struggles with dense prediction tasks due to low spatial resolution and the loss of structural information. To address these limitations, we propose MARS-CLIP (Multi-resolution and Attention Refined Segmentation for CLIP), a novel framework for zero-shot semantic segmentation. Our approach introduces two key strategies: (i) a multi-resolution feature extraction module that fuses local fine-grained features with global context to overcome input resolution constraints, and (ii) an attention refinement mechanism that injects spatial and color biases from intermediate layers into the final self-attention block to accurately restore object boundaries. A set of experiments on six public datasets demonstrates that MARS-CLIP significantly outperforms state-of-the-art methods.
Method
Overview
CLIP is trained to align an entire image with a caption, so its image encoder is optimized for global representations rather than pixel-level detail. This creates two obstacles for dense prediction. First, insufficient spatial resolution: the encoder takes a fixed input size, so feature maps are of a fixed low resolution and existing methods such as MaskCLIP and SCLIP often fail to detect tiny objects or delineate complex boundaries. Second, loss of spatial structure: semantic abstraction in deep ViT layers dilutes the original shape information, and the spatial layouts preserved in intermediate layers, along with low-level cues such as edges and colors, are left unused.
MARS-CLIP attacks both problems at once with two strategies: a multi-resolution feature extraction module that fuses local fine-grained features with global context to circumvent the input resolution limit, and a structure-aware attention refinement mechanism that injects spatial and color biases into the final self-attention block to restore object boundaries. Unlike methods that borrow representations from external foundation models such as DINO or Stable Diffusion, our approach relies only on CLIP's own internal features, so it keeps the computational cost of running a single model.
static/images/overview.svgPipeline
Step 1 — Feature extraction with multi-resolution images. Given an input image \(I \in \mathbb{R}^{3 \times H \times W}\), we first apply reflective padding so that its dimensions become multiples of the crop size \(S_{\mathrm{crop}}\). The padded image is divided into an \(N \times M\) grid of local regions, and each region is resized to the encoder input resolution \(K \times K\). Because \(S_{\mathrm{crop}} < K\), this amounts to zooming into local regions, which is what lets us extract fine-grained detail. The resulting local feature maps are recombined according to their original spatial arrangement into a single high-resolution map \(F_{\mathrm{local}}\). Since processing regions independently discards global context, we also resize the whole image and encode it into \(F_{\mathrm{global}}\). The two are then integrated as
where \(\mathrm{Up}(\cdot)\) is bilinear upsampling that aligns the spatial resolutions and \(\alpha\) balances global against local information. We use \(S_{\mathrm{crop}} = 112\) and \(\alpha = 0.8\), selected by the ablation study below.
Step 2 — Structure-aware attention refinement. The final Transformer block is replaced by a refined attention block that injects spatial and color biases, described in the next subsection.
Step 3 — Zero-shot segmentation. Each class name of the target dataset is inserted into the 80 predefined ImageNet prompt templates, and the text feature \(F^{\mathrm{text}}_k\) for class \(k\) is the average of the resulting embeddings. We compute the cosine similarity between \(F^{\mathrm{text}}_k\) and the image feature at every pixel position, upsample the similarity map to the original image size, and assign to each pixel the class with the maximum score.
Structure-aware attention refinement
The self-attention maps in the final layer of CLIP's ViT encoder group semantics well but leave object boundaries spatially ambiguous. Following SCLIP, we use \(K K^{\top}\) similarity in place of the standard \(Q K^{\top}\), which resolves much of the spatial feature entanglement — yet boundary inconsistencies persist in complex scenes. We therefore add a bias term \(B_{\mathrm{total}} = B_{\mathrm{int}} + B_{\mathrm{color}}\) to the similarity matrix before the softmax.
The internal bias \(B_{\mathrm{int}}\) comes from the attention maps of an intermediate layer that still strongly preserves the spatial layout of the input. We use the 8th layer, which was the most stable choice on average; scores peak around it and decline in deeper layers, consistent with spatial layout being lost as feature abstraction progresses.
The external bias \(B_{\mathrm{color}}\) supplies precise boundary detail that carries no semantic discriminability of its own. We convert the input from sRGB to the CIELAB color space, downsample it to patch-level color features \(c_i \in \mathbb{R}^{3}\), and define the color affinity between patches \(i\) and \(j\) with a Gaussian kernel:
with bandwidth \(\sigma = 30.0\). The color bias is not applied to the class token, which has no spatial position. Finally, following the insight of ClearCLIP, we remove the residual connection and the feed-forward network from the final Transformer block. This keeps the original features from being dominated by the residual component and maximizes the effect of the refined attention.
static/images/attention.svgExperiment
Datasets and metrics
We evaluate on six standard segmentation benchmarks, following the protocols of SCLIP and NACLIP, which yields the eight settings below. All results are reported as mean Intersection over Union (mIoU), averaged over all classes.
| Abbrev. | Dataset | Images | Setting |
|---|---|---|---|
| V21 | PASCAL VOC 2012 | 1,449 | 21 classes (with background) |
| V20 | PASCAL VOC 2012 | 1,449 | 20 classes (without background) |
| PC60 | PASCAL Context | 5,105 | 60 classes |
| PC59 | PASCAL Context | 5,105 | 59 classes |
| ADE | ADE20K | 2,000 | — |
| City | Cityscapes | 500 | — |
| C-Obj | COCO-Object | 5,000 | — |
| C-Stf | COCO-Stuff | 5,000 | — |
Comparison with state-of-the-art methods
MARS-CLIP surpasses existing state-of-the-art methods across all datasets and both settings. The gain is largest on benchmarks with high-resolution images and fine-grained objects: without PAMR post-processing it reaches 38.2% mIoU on "City", outperforming the runner-up NACLIP (35.5%) by 2.7 points. The superiority holds when PAMR is applied — 40.1% versus 38.3% on "City", a 1.8-point improvement — which indicates that our raw masks already possess high spatial consistency rather than depending on post-processing to acquire it.
Table 1. Comparison with state-of-the-art methods. The "PAMR" column indicates the application of post-processing. Best results are bold. (scroll horizontally to see all columns)
| Method | PAMR | V21 | PC60 | C-Obj | V20 | City | PC59 | ADE | C-Stf |
|---|---|---|---|---|---|---|---|---|---|
| CLIP | 18.6 | 7.8 | 6.5 | 49.1 | 6.7 | 11.2 | 3.2 | 5.7 | |
| MaskCLIP | 43.4 | 23.2 | 20.6 | 74.9 | 24.9 | 26.4 | 11.9 | 16.7 | |
| CLIP Surgery | 41.2 | 30.5 | — | — | 31.4 | — | 12.9 | 21.9 | |
| GEM | 46.2 | — | — | — | — | 32.6 | 15.7 | — | |
| SCLIP | 59.1 | 30.4 | 30.5 | 80.4 | 32.2 | 34.2 | 16.1 | 22.4 | |
| ClearCLIP | 51.8 | 32.6 | 33.0 | 80.9 | 30.0 | 35.9 | 16.7 | 23.9 | |
| NACLIP | 58.9 | 32.2 | 33.2 | 79.7 | 35.5 | 35.2 | 17.4 | 23.3 | |
| MARS-CLIP (Ours) | 62.0 | 33.8 | 34.5 | 81.1 | 38.2 | 36.8 | 18.5 | 24.4 | |
| SCLIP | ✓ | 61.7 | 31.5 | 32.1 | 83.5 | 34.1 | 36.1 | 17.8 | 23.9 |
| NACLIP | ✓ | 64.1 | 35.0 | 36.2 | 83.0 | 38.3 | 38.4 | 19.1 | 25.7 |
| MARS-CLIP (Ours) | ✓ | 65.8 | 35.9 | 36.7 | 83.7 | 40.1 | 39.2 | 19.8 | 26.1 |
Ablation study
Fusion weight and crop size. mIoU improves markedly when both resolutions are integrated, compared with using a single resolution — \(\alpha = 0.0\) (local only) or \(\alpha = 1.0\) (global only). Performance saturates and peaks around \(\alpha = 0.8\), which suggests that the right balance keeps CLIP's inherent global semantic understanding as the backbone while local features moderately supplement the missing detail. For the crop size, 112 proved optimal: smaller crops leave insufficient context inside each patch and recognition accuracy drops.
static/images/ablation_alpha.svgFeature source for the bias. We compare our choice against the self-correlations of Q, K, V and against raw feature similarity. Using intermediate attention maps combined with color information achieves the highest accuracy on every dataset. The gain from adding color is substantial, confirming that low-level visual information contributes to defining object boundaries. We also compared extraction layers from L1 to L11; scores peak around the 8th layer and decrease thereafter, so we adopt L8.
Table 2. Ablation study on attention refinement using intermediate features from the 8th layer. "Feat. Sim." indicates cosine similarity between features. The bottom row (Attn. + Color) represents our proposed setting, which adds color similarity bias to the standard attention.
| Source | V21 | PC60 | C-Obj | V20 | City | PC59 | ADE | C-Stf |
|---|---|---|---|---|---|---|---|---|
| Attn. (\(QK^{\top}\)) | 58.6 | 32.6 | 33.8 | 83.0 | 32.7 | 35.9 | 17.1 | 23.9 |
| Feat. Sim. | 58.0 | 32.4 | 33.6 | 82.6 | 32.0 | 35.6 | 16.9 | 23.8 |
| \(KK^{\top}\) | 58.7 | 32.7 | 33.9 | 82.9 | 33.0 | 35.9 | 17.3 | 24.0 |
| \(QQ^{\top}\) | 58.6 | 32.6 | 33.8 | 82.9 | 32.7 | 35.8 | 17.2 | 23.9 |
| \(VV^{\top}\) | 58.5 | 32.6 | 33.8 | 82.8 | 32.7 | 35.8 | 17.1 | 23.9 |
| Attn. + Color | 59.4 | 32.9 | 34.3 | 83.4 | 33.2 | 36.2 | 17.5 | 24.3 |
Contribution of each component. Introducing the multi-resolution strategy alone already yields a significant improvement over the baseline, and combining it with attention refinement improves results further — particularly on datasets with high-definition and complex scenes such as "City" and "ADE". This demonstrates the complementary effects of enhancing resolution and restoring boundary information.
Table 3. Ablation study on the components of MARS-CLIP. "Multi" refers to the adoption of the multi-resolution strategy, and "Bias" denotes attention refinement using low-level features.
| Multi | Bias | V21 | City | ADE | C-Stf | Avg Gain |
|---|---|---|---|---|---|---|
| — | — | 58.9 | 35.0 | 17.4 | 23.4 | — |
| — | ✓ | 59.9 | 35.5 | 17.5 | 23.4 | +0.4 |
| ✓ | — | 61.7 | 37.7 | 18.5 | 24.5 | +1.9 |
| ✓ | ✓ | 62.0 | 38.2 | 18.5 | 24.4 | +2.1 |
Qualitative results
Compared with the conventional method NACLIP, MARS-CLIP detects small objects and regions with complex boundaries more accurately.
static/images/qualitative.svgInference cost
We compare inference cost on "V21" with the shorter side set to 336 pixels and no sliding window. The peak memory matches that of NACLIP because the memory footprint is dominated by the dense image–text similarity rather than by multi-resolution processing, and the 0.0013 s latency overhead is negligible.
| Method | Peak memory | Time per image |
|---|---|---|
| NACLIP | 1.1 GB | 0.0390 s |
| MARS-CLIP (Ours) | 1.1 GB | 0.0403 s |
Limitations
The color affinity bias may degrade in low-light or low-contrast scenes. Although the intermediate-layer spatial bias partially mitigates this, full illumination robustness is left as future work.
BibTeX
@inproceedings{saito2026marsclip,
title={{MARS-CLIP}: Multi-Resolution and Attention Refined Zero-Shot Image Segmentation},
author={Saito, Nagito and Ito, Shintaro and Ito, Koichi and Aoki, Takafumi},
booktitle={Proceedings of the IEEE International Conference on Image Processing (ICIP)},
year={2026}
}