SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2212.09506 · 2022

CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2212.09506.json · badge: /api/ran/2212.09506.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
linyq2117/clip-es canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
reshape_transform Ran
ran; our contract draft was wrong, not the code
linyq2117/clip-es/generate_cams_voc12.py
code served (permissive licence) · get_code("5bd180a934a83565")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (5, 4, 2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The function reshape_transform takes:
# 1. tensor: a torch tensor that will be permuted and reshaped
# 2. height: an integer (default 28)
# 3. width: an integer (default 28)

# Analyzing the function body:
# - tensor.permute(1, 0, 2) - expects 3D tensor
# - tensor[:, 1:, :].reshape(...) - slices and reshapes
# - result.transpose(2, 3).transpose(1, 2) - expects 4D after reshape
#
# Working backwards from reshape:
# reshape(tensor.size(0), height, width, tensor.size(2)) creates a 4D tensor
# Before reshape, tensor is 3D with shape (size(0), size(1), size(2))
# After permute(1, 0, 2), the original tensor was (0, 1, 2) -> (1, 0, 2)
# So original tensor shape before permute should be (batch, seq, channels)
# After permute(1, 0, 2): (seq, batch, channels)
# After [:, 1:, :]: we remove first element from dim 1, so (seq, batch-1, channels)
# Then reshape to (seq, height, width, channels)
# This means: seq * (batch-1) * channels must equal seq * height * width * channels
# Simplifying: batch - 1 = height * width
# So if height=28, width=28, then batch-1 = 784, batch = 785

# But let's use smaller values to keep it tiny
# Let height=2, width=3, then batch-1 = 6, batch = 7
# Let's use batch=7, channels=4

height = 2
width = 3
batch = 7
channels = 4
seq = 5

# Original tensor shape before any operation: (batch, seq, channels) = (7, 5, 4)
# After permute(1, 0, 2): (seq, batch, channels) = (5, 7, 4)
# After [:, 1:, :]: (seq, batch-1, channels) = (5, 6, 4)
# Reshape to (seq, height, width, channels) = (5, 2, 3, 4)
# This requires seq * (batch-1) * channels = seq * height * width * channels
# 5 * 6 * 4 = 5 * 2 * 3 * 4 = 120 ✓

tensor = torch.randn(batch, seq, channels)

ARGS = {
    "tensor": tensor,
    "height": height,
    "width": width,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (5, 4, 2, 3) — shape (5, 4, 2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
scores Ran
ran; our contract draft was wrong, not the code
linyq2117/clip-es/eval_cam_with_crf.py
code served (permissive licence) · get_code("4d8fbe9ff0f1714e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct small test data for the scores function
# The function expects:
# - label_trues: list of arrays with true labels
# - label_preds: list of arrays with predicted labels
# - n_class: number of classes

n_class = 4

# Create small 2D label arrays (simulating image segmentation outputs)
# Using distinct sizes for clarity: 2x3 spatial dimensions
label_true_1 = np.array([[0, 1, 2], [3, 1, 0]])
label_pred_1 = np.array([[0, 1, 1], [3, 1, 0]])

label_true_2 = np.array([[2, 2, 1], [0, 3, 3]])
label_pred_2 = np.array([[2, 1, 1], [0, 3, 2]])

label_trues = [label_true_1, label_true_2]
label_preds = [label_pred_1, label_pred_2]

ARGS = {
    'label_trues': label_trues,
    'label_preds': label_preds,
    'n_class': n_class
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
split_dataset Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
linyq2117/clip-es/generate_cams_voc12.py
code served (permissive licence) · get_code("198c3be080d6e91e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create a simple dataset-like object that supports indexing and len()
class SimpleDataset:
    def __init__(self, size):
        self.data = torch.randn(size, 4)
    
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        if isinstance(idx, slice):
            return SimpleDataset._from_tensor(self.data[idx])
        return self.data[idx]
    
    @staticmethod
    def _from_tensor(tensor):
        obj = SimpleDataset.__new__(SimpleDataset)
        obj.data = tensor
        return obj

# Create a dataset with 10 samples
dataset = SimpleDataset(10)

# Define arguments for the function
ARGS = {
    "dataset": dataset,
    "n_splits": 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 3 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 3 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
reshape_transform 5 other papers
5 later
Lin_CLIP_Is_Also_an_Efficient_Segmenter_A_Text-Driven_Approach_for_CVPR_2023_paper (2023 (year only))
CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation
2310.13026 (2023-10)
Weakly-Supervised Semantic Segmentation with Image-Level Labels: from Traditional Models to Foundation Models
aaai_28139 (2024 (year only))
TagCLIP: A Local-to-Global Framework to Enhance Open-Vocabulary Multi-Label Classification of CLIP without Training
and 2 more not named here
scores 3 other papers
1 dated earlier, 2 later
2008.01183 (2020-08)
Weakly-Supervised Semantic Segmentation via Sub-category Exploration
Lin_CLIP_Is_Also_an_Efficient_Segmenter_A_Text-Driven_Approach_for_CVPR_2023_paper (2023 (year only))
CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation
aaai_28139 (2024 (year only))
TagCLIP: A Local-to-Global Framework to Enhance Open-Vocabulary Multi-Label Classification of CLIP without Training
split_dataset 2 other papers
2 later
Lin_CLIP_Is_Also_an_Efficient_Segmenter_A_Text-Driven_Approach_for_CVPR_2023_paper (2023 (year only))
CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation
2310.13026 (2023-10)
Weakly-Supervised Semantic Segmentation with Image-Level Labels: from Traditional Models to Foundation Models

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Weakly supervised semantic segmentation (WSSS) with image-level labels is a challenging task. Mainstream approaches follow a multi-stage framework and suffer from high training costs. In this paper, we explore the potential of Contrastive Language-Image Pre-training models (CLIP) to localize different categories with only image-level labels and without further training. To efficiently generate high-quality segmentation masks from CLIP, we propose a novel WSSS framework called CLIP-ES. Our framework improves all three stages of WSSS with special designs for CLIP: 1) We introduce the softmax function into GradCAM and exploit the zero-shot ability of CLIP to suppress the confusion caused by non-target classes and backgrounds. Meanwhile, to take full advantage of CLIP, we re-explore text inputs under the WSSS setting and customize two text-driven strategies: sharpness-based prompt selection and synonym fusion. 2) To simplify the stage of CAM refinement, we propose a real-time class-aware attention-based affinity (CAA) module based on the inherent multi-head self-attention (MHSA) in CLIP-ViTs. 3) When training the final segmentation model with the masks generated by CLIP, we introduced a confidence-guided loss (CGL) focus on confident regions. Our CLIP-ES achieves SOTA performance on Pascal VOC 2012 and MS COCO 2014 while only taking 10% time of previous methods for the pseudo mask generation. Code is available at https://github.com/linyq2117/CLIP-ES.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2212.09506")
get_code_for_paper("2212.09506")
have("2212.09506")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2212.09506.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2212.09506.svg)](https://syntology.ai/paper/2212.09506)

Connect an agent — have() is free.