SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_28139 · AAAI · 2024

TagCLIP: A Local-to-Global Framework to Enhance Open-Vocabulary Multi-Label Classification of CLIP without Training

Deng Cai, Minghao Chen, Zheng Yang, Kaipeng Zhang, Binbin Lin, Yuqi Lin, Hengjia Li, Mingming Li, Haifeng Liu, Dongqin Lv

Open in the Atlas

Code that ran

7 of 12 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 4 have no contract verdict; 3 failures of our instrument; 5 no recorded run), measured 2026-11-23; 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/aaai_28139.json · badge: /api/ran/aaai_28139.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/TagCLIP canonical (classifier label)
classifier basis: census
7 ran · 5 no recorded run
FunctionStatusWhere it lives
compute_AP Ran
ran on a synthesized input
linyq2117/TagCLIP/utils.py
code served (permissive licence) · get_code("7b54933686443651")
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 1, dtype family float, shape (4,) 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

torch.manual_seed(0)

# Create small tensors for predictions and labels
# predictions: (batch_size, num_classes) - prediction scores
# labels: (batch_size, num_classes) - binary labels
batch_size = 2
num_classes = 4

predictions = torch.rand(batch_size, num_classes)
labels = torch.randint(0, 2, (batch_size, num_classes)).float()

ARGS = {
    "predictions": predictions,
    "labels": labels,
}
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 1, dtype family float, shape (4,) — shape (4,) 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
print_iou Ran
ran on a synthesized input
linyq2117/TagCLIP/CLIP-ES/eval_cam.py
code served (permissive licence) · get_code("55a670a57e0e5a80")
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 torch
import numpy as np

torch.manual_seed(0)

# The function expects:
# - iou: an indexable object (list, tuple, or array) with len() and integer indexing
# - dname: a string (default 'voc')

# Looking at the function body:
# - It iterates from 0 to len(iou) - 1
# - It accesses iou[i + 1] for each i
# - So iou needs at least 2 elements

# Create a simple list/array with numeric values as the iou parameter
iou = [0.0, 0.5, 0.6, 0.7, 0.8]

ARGS = {
    'iou': iou,
    'dname': 'voc'
}
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 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
reshape_transform Ran
ran; our contract draft was wrong, not the code
linyq2117/TagCLIP/CLIP-ES/generate_cams_coco.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
scoremap2bbox Ran
ran on a synthesized input
linyq2117/TagCLIP/utils.py
code served (permissive licence) · get_code("da657a93f09348c4")
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 tuple. 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
import cv2

# Create a small scoremap (heatmap) with some values
# Make it 2D with distinct dimensions (4x3 instead of 3x3)
height, width = 4, 3
scoremap = np.random.rand(height, width) * 0.8  # Values between 0 and 0.8
# Add a bright region to ensure we get contours
scoremap[1:3, 1:2] = 0.9

# Threshold value between 0 and 1
threshold = 0.5

# Multi-contour evaluation flag
multi_contour_eval = False

ARGS = {
    "scoremap": scoremap,
    "threshold": threshold,
    "multi_contour_eval": multi_contour_eval,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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
scores Ran
ran; our contract draft was wrong, not the code
linyq2117/TagCLIP/CLIP-ES/eval_cam.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 on a synthesized input
linyq2117/TagCLIP/CLIP-ES/generate_cams_coco.py
code served (permissive licence) · get_code("454b870026132c11")
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 tuple. 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 (list of tensors or data points)
dataset = [torch.randn(4) for _ in range(10)]

# Create corresponding labels
all_label_list = list(range(10))

# Number of splits
n_splits = 3

ARGS = {
    "dataset": dataset,
    "all_label_list": all_label_list,
    "n_splits": n_splits,
}
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 tuple — a tuple 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
upsample_pos_emb Ran
ran; our contract draft was wrong, not the code
linyq2117/TagCLIP/clip/clip_model.py
pointer only (licence: MIT); the stored copy get_code serves, from ryanlyang/LearningToLook, is pointer only (licence: NONE) · get_code("335f0f9cd2d9678c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ryanlyang/LearningToLook, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_model Not yet run
unverified (harvested, no recorded run)
linyq2117/TagCLIP/clip/build_model.py
code served (permissive licence) · get_code("4e43649dbeebb1f2")
How it ran

no invocation recorded.

cwr Not yet run
unverified (harvested, no recorded run)
linyq2117/TagCLIP/classify.py
code served (permissive licence) · get_code("588ee916dad36ca2")
How it ran

no invocation recorded.

parse_xml_to_dict Not yet run
unverified (harvested, no recorded run)
linyq2117/TagCLIP/utils.py
code served (permissive licence) · get_code("e9ecfdf5116eb9a6")
How it ran

no invocation recorded.

run_eval_cam Not yet run
unverified (harvested, no recorded run)
linyq2117/TagCLIP/CLIP-ES/eval_cam.py
code served (permissive licence) · get_code("393e6e9efe9211e4")
How it ran

no invocation recorded.

run_eval_cam Not yet run
unverified (harvested, no recorded run)
linyq2117/TagCLIP/CLIP-ES/eval_cam_cocostuff.py
code served (permissive licence) · get_code("afb45fcd8af4982c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 2 later) and 6 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
3 dated earlier, 1 later, 1 same year, order not determinable
2212.09506 (2022-12)
CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation
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
and 2 more not named here
scores 3 other papers
3 dated earlier
2008.01183 (2020-08)
Weakly-Supervised Semantic Segmentation via Sub-category Exploration
2212.09506 (2022-12)
CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation
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
upsample_pos_emb 3 other papers
1 dated earlier, 1 later, 1 same year, order not determinable
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
2406.11189 (2024-06)
Frozen CLIP: A Strong Backbone for Weakly Supervised Semantic Segmentation
2509.21247 (2025-09)
Learning to Look: Cognitive Attention Alignment with Vision-Language Models
parse_xml_to_dict 1 other paper
1 dated earlier
2310.13026 (2023-10)
Weakly-Supervised Semantic Segmentation with Image-Level Labels: from Traditional Models to Foundation Models
print_iou 1 other paper
1 dated earlier
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
split_dataset 1 other paper
1 dated earlier
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

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

Repositories linked to this paper

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

Abstract

Contrastive Language-Image Pre-training (CLIP) has demonstrated impressive capabilities in open-vocabulary classification. The class token in the image encoder is trained to capture the global features to distinguish different text descriptions supervised by contrastive loss, making it highly effective for single-label classification. However, it shows poor performance on multi-label datasets because the global feature tends to be dominated by the most prominent class and the contrastive nature of softmax operation aggravates it. In this study, we observe that the multi-label classification results heavily rely on discriminative local features but are overlooked by CLIP. As a result, we dissect the preservation of patch-wise spatial information in CLIP and proposed a localto-global framework to obtain image tags. It comprises three steps: (1) patch-level classification to obtain coarse scores; (2) dual-masking attention refinement (DMAR) module to refine the coarse scores; (3) class-wise reidentification (CWR) module to remedy predictions from a global perspective. This framework is solely based on frozen CLIP and significantly enhances its multi-label classification performance on various benchmarks without dataset-specific training. Besides, to comprehensively assess the quality and practicality of generated tags, we extend their application to the downstream task, i.e., weakly supervised semantic segmentation (WSSS) with generated tags as image-level pseudo labels. Experiments demonstrate that this classify-then-segment paradigm dramatically outperforms other annotation-free segmentation methods and validates the effectiveness of generated tags. Our code is available at https://github.com/linyq2117/TagCLIP.

For agents

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

get_harvested_code_for_paper("aaai_28139")
get_code_for_paper("aaai_28139")
have("aaai_28139")

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

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

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

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

Connect an agent — have() is free.