MARS-CLIP: Multi-Resolution and Attention Refined Zero-Shot Image Segmentation

Nagito Saito, Shintaro Ito, Koichi Ito, Takafumi Aoki
Graduate School of Information Sciences, Tohoku University, Japan
IEEE International Conference on Image Processing (ICIP) 2026

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.

Overview of MARS-CLIP
Figure not found — place it at static/images/overview.svg
Figure 1. Overview of MARS-CLIP. Global and local features are fused by a multi-resolution strategy. The final layer injects spatial and color biases to refine boundaries, as detailed in Figure 2.

Pipeline

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

\[ F_{\mathrm{refined}} = \alpha \cdot \mathrm{Up}(F_{\mathrm{global}}) + (1 - \alpha) \cdot F_{\mathrm{local}}, \]

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:

\[ B_{\mathrm{color}}(i, j) = \exp\!\left( -\frac{\lVert c_i - c_j \rVert_2^2}{2\sigma^2} \right), \]

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.

Details of the refined attention block
Figure not found — place it at static/images/attention.svg
Figure 2. Details of the proposed refined attention block. Unlike standard self-attention, we employ \(K K^{\top}\) similarity instead of \(Q K^{\top}\) and inject spatial biases from intermediate layers along with color affinity biases from the input image.

Experiment

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.DatasetImagesSetting
V21PASCAL VOC 20121,44921 classes (with background)
V20PASCAL VOC 20121,44920 classes (without background)
PC60PASCAL Context5,10560 classes
PC59PASCAL Context5,10559 classes
ADEADE20K2,000
CityCityscapes500
C-ObjCOCO-Object5,000
C-StfCOCO-Stuff5,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)

MethodPAMRV21PC60C-Obj V20CityPC59ADEC-Stf
CLIP18.67.86.549.16.711.23.25.7
MaskCLIP43.423.220.674.924.926.411.916.7
CLIP Surgery41.230.531.412.921.9
GEM46.232.615.7
SCLIP59.130.430.580.432.234.216.122.4
ClearCLIP51.832.633.080.930.035.916.723.9
NACLIP58.932.233.279.735.535.217.423.3
MARS-CLIP (Ours)62.033.834.581.138.236.818.524.4
SCLIP61.731.532.183.534.136.117.823.9
NACLIP64.135.036.283.038.338.419.125.7
MARS-CLIP (Ours)65.835.936.783.740.139.219.826.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.

Impact of fusion weight alpha across crop sizes
Figure not found — place it at static/images/ablation_alpha.svg
Figure 3. Impact of fusion weight \(\alpha\) across different crop sizes on "V21".

Feature 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.

SourceV21PC60C-Obj V20CityPC59ADEC-Stf
Attn. (\(QK^{\top}\))58.632.633.883.032.735.917.123.9
Feat. Sim.58.032.433.682.632.035.616.923.8
\(KK^{\top}\)58.732.733.982.933.035.917.324.0
\(QQ^{\top}\)58.632.633.882.932.735.817.223.9
\(VV^{\top}\)58.532.633.882.832.735.817.123.9
Attn. + Color59.432.934.383.433.236.217.524.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.

MultiBiasV21CityADEC-StfAvg Gain
58.935.017.423.4
59.935.517.523.4+0.4
61.737.718.524.5+1.9
62.038.218.524.4+2.1

Qualitative results

Compared with the conventional method NACLIP, MARS-CLIP detects small objects and regions with complex boundaries more accurately.

Qualitative comparison with existing methods
Figure not found — place it at static/images/qualitative.svg
Figure 4. Qualitative comparison between existing methods and the proposed method.

Inference 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.

MethodPeak memoryTime per image
NACLIP1.1 GB0.0390 s
MARS-CLIP (Ours)1.1 GB0.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}
}