SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2308.01313 · ICLR · 2024

PerceptionCLIP: Visual Classification by Inferring and Conditioning on Contexts

Sicheng Zhu, Furong Huang, Bang An, Michael-Andrei Panaitescu-Liess, Chaithanya Mummadi

arXiv · PDF · Open in the Atlas

Code that ran

4 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 0 have no contract verdict; 4 failures of our instrument; 8 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/2308.01313.json · badge: /api/ran/2308.01313.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
umd-huang-lab/perceptionCLIP canonical (classifier label)
classifier basis not recorded on the link
3 ran · 3 no recorded run
umd-huang-lab/perceptionclip community
Papers with Code archive
1 ran · 5 no recorded run
FunctionStatusWhere it lives
basic_clean Ran
ran; our contract draft was wrong, not the code
umd-huang-lab/perceptionCLIP/clip/tokenizer.py
pointer only (licence: MIT); the stored copy get_code serves, from ltpwy/MSCI, is pointer only (licence: NONE) · get_code("98f385d847636a3e")
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 ltpwy/MSCI, 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.

get_pairs Ran
ran; our contract draft was wrong, not the code
umd-huang-lab/perceptionCLIP/clip/tokenizer.py
code served (permissive licence) · get_code("d919ae32e5e4e616")
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) and returned set. 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

torch.manual_seed(0)

# The function get_pairs takes a word parameter
# A word is represented as a tuple of symbols (variable-length strings)
# The function iterates through the word and creates pairs of consecutive symbols

word = ("hello", "world", "test")

ARGS = {
    "word": word
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
maybe_dictionarize Ran
ran; our contract draft was wrong, not the code
umd-huang-lab/perceptionclip/src/zero_shot_inference/perceptionclip_two_step.py
code served (permissive licence) · get_code("b1e9e0d3d7d7e615")
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)

# Test case 1: batch as a dict (should return as-is)
batch_dict = {
    'images': torch.randn(2, 4),
    'labels': torch.randint(0, 10, (2,))
}

# Test case 2: batch as tuple with 2 elements
batch_tuple_2 = (
    torch.randn(2, 4),
    torch.randint(0, 10, (2,))
)

# Test case 3: batch as tuple with 3 elements
batch_tuple_3 = (
    torch.randn(2, 4),
    torch.randint(0, 10, (2,)),
    {'sample_id': [0, 1]}
)

# Use the dict case for ARGS
ARGS = {
    'batch': batch_dict
}
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
whitespace_clean Ran
ran; our contract draft was wrong, not the code
umd-huang-lab/perceptionCLIP/clip/tokenizer.py
pointer only (licence: MIT); the stored copy get_code serves, from ltpwy/MSCI, is pointer only (licence: NONE) · get_code("9542161e9640b858")
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 ltpwy/MSCI, 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.

FeatureDataset Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionclip/src/zero_shot_inference/perceptionclip_two_step.py
code served (permissive licence) · get_code("b2ca442256677f59")
How it ran

no invocation recorded.

build_model Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionCLIP/clip/model.py
pointer only (licence: MIT); the stored copy get_code serves, from HesamAsad/TRACER, is pointer only (licence: NONE) · get_code("b64f67bec6a093b9")
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 HesamAsad/TRACER, 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. No invocation recorded.

classify Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionclip/src/zero_shot_inference/perceptionclip_two_step.py
code served (permissive licence) · get_code("707f6200db45227e")
How it ran

no invocation recorded.

gather_features Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionCLIP/clip/loss.py
pointer only (licence: MIT); the stored copy get_code serves, from lxa9867/imagefolder, is pointer only (licence: NOASSERTION) · get_code("ddcbd45e940484ee")
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 lxa9867/imagefolder, and GitHub could not classify the licence of that repository (NOASSERTION). 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. No invocation recorded.

get_dataloader Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionclip/src/zero_shot_inference/perceptionclip_two_step.py
code served (permissive licence) · get_code("d72e4be63bb4c2b4")
How it ran

no invocation recorded.

get_features Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionclip/src/zero_shot_inference/perceptionclip_two_step.py
code served (permissive licence) · get_code("69f5c5edbc89d5b8")
How it ran

no invocation recorded.

get_features Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionCLIP/src/datasets/common.py
pointer only (licence: MIT); the stored copy get_code serves, from ganglii/devsafety, is pointer only (licence: NONE) · get_code("7727c964cfcd56e6")
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 ganglii/devsafety, 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. No invocation recorded.

get_features_helper Not yet run
unverified (harvested, no recorded run)
umd-huang-lab/perceptionclip/src/zero_shot_inference/perceptionclip_two_step.py
code served (permissive licence) · get_code("74edffa1dfc39e58")
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 11 distinct functions with an identity, 8 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 5 the same month, 8 later) and 3 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
get_pairs 258 other papers
66 dated earlier, 6 the same month, 178 later, 7 same year, order not determinable, 1 undated · 4 only as an assembly brick
1802.06474 (2018-02)
A Closed-form Solution to Photorealistic Image Stylization
1803.01128 (2018-03)
Seq2Sick: Evaluating the Robustness of Sequence-to-Sequence Models with Adversarial Examples
1809.00125 (2018-09)
Simple Fusion: Return of the Language Model
and 255 more not named here
whitespace_clean 231 other papers
50 dated earlier, 6 the same month, 169 later, 5 same year, order not determinable, 1 undated · 4 only as an assembly brick
1901.07441 (2019-01)
PadChest: A large chest x-ray image dataset with multi-label annotated reports
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2108.10904 (2021-08)
SimVLM: Simple Visual Language Model Pretraining with Weak Supervision
and 228 more not named here
basic_clean 218 other papers
50 dated earlier, 6 the same month, 156 later, 5 same year, order not determinable, 1 undated · 4 only as an assembly brick
1901.07441 (2019-01)
PadChest: A large chest x-ray image dataset with multi-label annotated reports
2107.06383 (2021-07)
How Much Can CLIP Benefit Vision-and-Language Tasks?
2108.10904 (2021-08)
SimVLM: Simple Visual Language Model Pretraining with Weak Supervision
and 215 more not named here
gather_features 57 other papers
9 dated earlier, 2 the same month, 46 later · 1 only as an assembly brick
2206.01670 (2022-06)
Egocentric Video-Language Pretraining
2212.00638 (2022-12)
Finetune like you pretrain: Improved finetuning of zero-shot vision models
2301.07094 (2023-01)
Learning Customized Visual Models with Retrieval-Augmented Knowledge
and 54 more not named here
maybe_dictionarize
brick of this paper's assembly: helper
13 other papers
1 the same month, 12 later · 1 only as an assembly brick
2308.12213 (2023-08)
CLIPN for Zero-Shot OOD Detection: Teaching CLIP to Say No
2311.01723 (2023-11)
Towards Calibrated Robust Fine-Tuning of Vision-Language Models
2312.02546 (2023-12)
Machine Vision Therapy: Multimodal Large Language Models Can Enhance Visual Robustness via Denoising In-Context Learning
and 10 more not named here
build_model 8 other papers
3 dated earlier, 5 later
2208.05592 (2022-08)
Patching open-vocabulary models by interpolating weights
2212.00638 (2022-12)
Finetune like you pretrain: Improved finetuning of zero-shot vision models
2302.13602 (2023-02)
The Role of Pre-training Data in Transfer Learning
and 5 more not named here
get_features_helper
brick of this paper's assembly: helper
4 other papers
4 later
2311.01723 (2023-11)
Towards Calibrated Robust Fine-Tuning of Vision-Language Models
2312.02546 (2023-12)
Machine Vision Therapy: Multimodal Large Language Models Can Enhance Visual Robustness via Denoising In-Context Learning
2410.03955 (2024-10)
A Retention-Centric Framework for Continual Learning with Guaranteed Model Developmental Safety
and 1 more not named here
get_features
brick of this paper's assembly: helper
3 other papers
3 later
2312.02546 (2023-12)
Machine Vision Therapy: Multimodal Large Language Models Can Enhance Visual Robustness via Denoising In-Context Learning
2410.03955 (2024-10)
A Retention-Centric Framework for Continual Learning with Guaranteed Model Developmental Safety
2411.19757 (2024-11)
Dual Risk Minimization: Towards Next-Level Robustness in Fine-tuning Zero-Shot 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

Vision-language models like CLIP are widely used in zero-shot image classification due to their ability to understand various visual concepts and natural language descriptions. However, how to fully leverage CLIP's unprecedented human-like understanding capabilities to achieve better performance is still an open question. This paper draws inspiration from the human visual perception process: when classifying an object, humans first infer contextual attributes (e.g., background and orientation) which help separate the foreground object from the background, and then classify the object based on this information. Inspired by it, we observe that providing CLIP with contextual attributes improves zero-shot image classification and mitigates reliance on spurious features. We also observe that CLIP itself can reasonably infer the attributes from an image. With these observations, we propose a training-free, two-step zero-shot classification method PerceptionCLIP. Given an image, it first infers contextual attributes (e.g., background) and then performs object classification conditioning on them. Our experiments show that PerceptionCLIP achieves better generalization, group robustness, and interpretability. Our code is available at https://github.com/umd-huang-lab/perceptionCLIP.

For agents

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

get_harvested_code_for_paper("2308.01313")
get_code_for_paper("2308.01313")
have("2308.01313")

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

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

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

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

Connect an agent — have() is free.