Agent skill

CLIP Image-Text Matching

by Orchestra-Research in Orchestra-Research/AI-Research-SKILLs

Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

MITAuto-check passedAI & LLM Engineering

Install CLIP Image-Text Matching

skills CLI
$ npx skills add Orchestra-Research/AI-Research-SKILLs --skill clip -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Orchestra-Research/AI-Research-SKILLs clip --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Orchestra-Research/AI-Research-SKILLs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/18-multimodal/clip .claude/skills/clip && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
clip
GitHub stars
13k
Used in
7 other repos
Token cost
~1.7k tokens
SKILL.md length
221 words
Files
2 (incl. references)
Skills in repo
96
Repo updated
First seen
Licence
MIT

At a glance

Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns.

  • Works in 7 steps: Use ViT-B/32 for most cases - Good balance → Normalize embeddings - Required for… → Batch processing - More efficient → …
  • Classifying images into custom labels without training data
  • SKILL.md covers When to use CLIP, Quick start, Available models and Image-text similarity, plus 8 more sections
  • Calls pip; reaches github.com

What it does

CLIP relates images and natural language, trained on 400M image-text pairs, so it can classify images with no task-specific training data. The skill lists when to use it, among them zero-shot classification, image-text similarity, semantic image search, content moderation and cross-modal retrieval in either direction, and points to BLIP-2 for captioning, LLaVA for vision-language chat and Segment Anything for segmentation.

Installation is a pip install from the OpenAI CLIP repository plus torch, torchvision, ftfy, regex and tqdm. Code sections show zero-shot classification, a model list from RN50 through ViT-B/32 to ViT-L/14 with parameter counts, similarity between image and text embeddings, building a searchable image index, a moderation category pattern, batch processing and storing embeddings in Chroma or FAISS.

Best-practice notes recommend ViT-B/32 for most cases, normalizing embeddings for cosine similarity, batching, caching embeddings, descriptive labels and a GPU for faster encoding. A reference file covers further applications.

When your agent uses it

  • Classifying images into custom labels without training data
  • Building semantic search over an image collection
  • Screening images for unsafe content with text categories
  • Matching text queries to images and the reverse

Example prompts

  • “Classify the photos in ./images into cat, dog and bird with CLIP, no training.”
  • “Build a text-to-image search over my product photos and store embeddings in Chroma.”
  • “Flag images in this folder that match the category violence or nudity.”

Requirements

  • Python with torch, torchvision, ftfy, regex and tqdm
  • A GPU is recommended for speed

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Use ViT-B/32 for most cases - Good balance
  2. Normalize embeddings - Required for cosine similarity
  3. Batch processing - More efficient
  4. Cache embeddings - Expensive to recompute
  5. Use descriptive labels - Better zero-shot performance
  6. GPU recommended - 10-50× faster
  7. Preprocess images - Use provided preprocess function

What it can do on your machine

Read from SKILL.md and the folder at commit 773a529. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    Also links to:

    • arxiv.org
    • colab.research.google.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

CLIP Image-Text Matching loads about 1.7k tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 77 tokens; SKILL.md has 221 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~77
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Orchestra-Research/AI-Research-SKILLs at commit 773a529, republished under its MIT licence (© Orchestra-Research). 221 words, ~1,719 tokens.

Download SKILL.mdSave it as .claude/skills/clip/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
clip
description
OpenAI's model connecting vision and language. Enables zero-shot image classification, image-text matching, and cross-modal retrieval. Trained on 400M image-text pairs. Use for image search, content moderation, or vision-language tasks without fine-tuning. Best for general-purpose image understanding.
version
1.0.0
author
Orchestra Research
license
MIT
tags
Multimodal, CLIP, Vision-Language, Zero-Shot, Image Classification, OpenAI, Image Search, Cross-Modal Retrieval, Content Moderation
dependencies
transformers, torch, pillow

CLIP - Contrastive Language-Image Pre-Training

OpenAI's model that understands images from natural language.

When to use CLIP

Use when:

  • Zero-shot image classification (no training data needed)
  • Image-text similarity/matching
  • Semantic image search
  • Content moderation (detect NSFW, violence)
  • Visual question answering
  • Cross-modal retrieval (image→text, text→image)

Metrics:

  • 25,300+ GitHub stars
  • Trained on 400M image-text pairs
  • Matches ResNet-50 on ImageNet (zero-shot)
  • MIT License

Use alternatives instead:

  • BLIP-2: Better captioning
  • LLaVA: Vision-language chat
  • Segment Anything: Image segmentation

Quick start

Installation
bash
pip install git+https://github.com/openai/CLIP.git
pip install torch torchvision ftfy regex tqdm
Zero-shot classification
python
import torch
import clip
from PIL import Image

# Load model
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)

# Load image
image = preprocess(Image.open("photo.jpg")).unsqueeze(0).to(device)

# Define possible labels
text = clip.tokenize(["a dog", "a cat", "a bird", "a car"]).to(device)

# Compute similarity
with torch.no_grad():
    image_features = model.encode_image(image)
    text_features = model.encode_text(text)

    # Cosine similarity
    logits_per_image, logits_per_text = model(image, text)
    probs = logits_per_image.softmax(dim=-1).cpu().numpy()

# Print results
labels = ["a dog", "a cat", "a bird", "a car"]
for label, prob in zip(labels, probs[0]):
    print(f"{label}: {prob:.2%}")

Available models

python
# Models (sorted by size)
models = [
    "RN50",           # ResNet-50
    "RN101",          # ResNet-101
    "ViT-B/32",       # Vision Transformer (recommended)
    "ViT-B/16",       # Better quality, slower
    "ViT-L/14",       # Best quality, slowest
]

model, preprocess = clip.load("ViT-B/32")
ModelParametersSpeedQuality
RN50102MFastGood
ViT-B/32151MMediumBetter
ViT-L/14428MSlowBest

Image-text similarity

python
# Compute embeddings
image_features = model.encode_image(image)
text_features = model.encode_text(text)

# Normalize
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)

# Cosine similarity
similarity = (image_features @ text_features.T).item()
print(f"Similarity: {similarity:.4f}")
python
# Index images
image_paths = ["img1.jpg", "img2.jpg", "img3.jpg"]
image_embeddings = []

for img_path in image_paths:
    image = preprocess(Image.open(img_path)).unsqueeze(0).to(device)
    with torch.no_grad():
        embedding = model.encode_image(image)
        embedding /= embedding.norm(dim=-1, keepdim=True)
    image_embeddings.append(embedding)

image_embeddings = torch.cat(image_embeddings)

# Search with text query
query = "a sunset over the ocean"
text_input = clip.tokenize([query]).to(device)
with torch.no_grad():
    text_embedding = model.encode_text(text_input)
    text_embedding /= text_embedding.norm(dim=-1, keepdim=True)

# Find most similar images
similarities = (text_embedding @ image_embeddings.T).squeeze(0)
top_k = similarities.topk(3)

for idx, score in zip(top_k.indices, top_k.values):
    print(f"{image_paths[idx]}: {score:.3f}")

Content moderation

python
# Define categories
categories = [
    "safe for work",
    "not safe for work",
    "violent content",
    "graphic content"
]

text = clip.tokenize(categories).to(device)

# Check image
with torch.no_grad():
    logits_per_image, _ = model(image, text)
    probs = logits_per_image.softmax(dim=-1)

# Get classification
max_idx = probs.argmax().item()
max_prob = probs[0, max_idx].item()

print(f"Category: {categories[max_idx]} ({max_prob:.2%})")

Batch processing

python
# Process multiple images
images = [preprocess(Image.open(f"img{i}.jpg")) for i in range(10)]
images = torch.stack(images).to(device)

with torch.no_grad():
    image_features = model.encode_image(images)
    image_features /= image_features.norm(dim=-1, keepdim=True)

# Batch text
texts = ["a dog", "a cat", "a bird"]
text_tokens = clip.tokenize(texts).to(device)

with torch.no_grad():
    text_features = model.encode_text(text_tokens)
    text_features /= text_features.norm(dim=-1, keepdim=True)

# Similarity matrix (10 images × 3 texts)
similarities = image_features @ text_features.T
print(similarities.shape)  # (10, 3)

Integration with vector databases

python
# Store CLIP embeddings in Chroma/FAISS
import chromadb

client = chromadb.Client()
collection = client.create_collection("image_embeddings")

# Add image embeddings
for img_path, embedding in zip(image_paths, image_embeddings):
    collection.add(
        embeddings=[embedding.cpu().numpy().tolist()],
        metadatas=[{"path": img_path}],
        ids=[img_path]
    )

# Query with text
query = "a sunset"
text_embedding = model.encode_text(clip.tokenize([query]))
results = collection.query(
    query_embeddings=[text_embedding.cpu().numpy().tolist()],
    n_results=5
)

Best practices

  1. Use ViT-B/32 for most cases - Good balance
  2. Normalize embeddings - Required for cosine similarity
  3. Batch processing - More efficient
  4. Cache embeddings - Expensive to recompute
  5. Use descriptive labels - Better zero-shot performance
  6. GPU recommended - 10-50× faster
  7. Preprocess images - Use provided preprocess function

Performance

OperationCPUGPU (V100)
Image encoding~200ms~20ms
Text encoding~50ms~5ms
Similarity compute<1ms<1ms

Limitations

  1. Not for fine-grained tasks - Best for broad categories
  2. Requires descriptive text - Vague labels perform poorly
  3. Biased on web data - May have dataset biases
  4. No bounding boxes - Whole image only
  5. Limited spatial understanding - Position/counting weak

Resources

© Orchestra-Research, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in 18-multimodal/clip of Orchestra-Research/AI-Research-SKILLs.

  • SKILL.md
  • references/applications.md

Open the folder on GitHubat commit 773a529

Used in 7 other repositories

We found 7 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 7 other GitHub owners. This page covers the copy in Orchestra-Research/AI-Research-SKILLs, which our catalogue first saw on October 7, 2026.

Compare with similar skills

CLIP Image-Text Matching next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

CLIP Image-Text Matching compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
CLIP Image-Text Matching this skillOrchestra-Research/AI-Research-SKILLs13k7 repos~1.7kAutomated safety check: PassMIT
Scholar Computejoshzyj/open-scholar-skill168—~15kAutomated safety check: PassCustom licence
Matlab Integrate Pytorch Visionmatlab/matlab-agentic-toolkit1.1k—~3.7kAutomated safety check: PassCustom licence
Re AI Modeldslsdzc/rev-skills135—~2.4kAutomated safety check: PassApache-2.0
Alphagenome Predictionsgenomicsxai/alphagenome-pytorch162—~868Automated safety check: PassApache-2.0
ExecuTorch Model Exportpytorch/executorch5.1k—~238Automated safety check: PassCustom licence

Similar skills

  • Scholar Compute

    joshzyj/open-scholar-skill

    Design and execute computational social science analyses across 11 modules: text-as-data/NLP (STM, BERTopic, Wordfish, BERT, conText embedding regression, LLM annotation + DSL bias correction…

    168 GitHub stars~15k tokensUpdated 22 days ago
    AI & LLM EngineeringAuto-check passed
  • Matlab Integrate Pytorch Vision

    matlab/matlab-agentic-toolkit

    Creates MATLAB interfaces to Python image processing and computer vision models from GitHub repositories or pip-installable packages using MPyReq.

    1.1k GitHub stars~3.7k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Re AI Model

    dslsdzc/rev-skills

    AI 模型文件逆向与静态分析:ONNX/PyTorch/Safetensors/TFLite 格式解析、 网络结构还原、权重提取、文件级水印分析(权重 pattern/metadata/tensor hash/embedding 异常)。

    135 GitHub stars~2.4k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check passed
  • Alphagenome Predictions

    genomicsxai/alphagenome-pytorch

    Run AlphaGenome-PyTorch to get genomic track predictions — via the agt predict CLI (single locus, BED regions, whole chromosomes, raw FASTA sequences, or per-gene count tables/AnnData), variant…

    162 GitHub stars~868 tokensUpdated 25 days ago
    AI & LLM EngineeringAuto-check passed
  • ExecuTorch Model Export

    pytorch/executorch

    Export a PyTorch model to .pte format for ExecuTorch. Use when converting models, lowering to edge, or generating .pte files.

    5.1k GitHub stars~238 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Uv Pypi Publish

    ML4ITS/TimeVQVAE

    Publish a Python package to PyPI using uv with credentials loaded from a local .secrets file.

    166 GitHub stars~178 tokensUpdated 7 mo ago
    AI & LLM EngineeringAuto-check passed

More from Orchestra-Research/AI-Research-SKILLs

All 96 skills in this repo
  • AudioCraft Audio Generation

    Orchestra-Research/AI-Research-SKILLs

    Generates music from text descriptions with MusicGen and sound effects with AudioGen, using Meta's AudioCraft PyTorch library with melody and style conditioning.

    13k GitHub starsUsed in 8 repos~3.9k tokens
    Auto-check passed
  • LLM Benchmarking with lm-evaluation-harness

    Orchestra-Research/AI-Research-SKILLs

    Runs lm-evaluation-harness to benchmark language models on academic suites such as MMLU, GSM8K and HumanEval, compare models and track training checkpoints.

    13k GitHub starsUsed in 8 repos~3k tokens
    Auto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 8 repos~3.3k tokens
    Auto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    Auto-check passed
  • Whisper Speech Recognition

    Orchestra-Research/AI-Research-SKILLs

    Transcribes audio with OpenAI's Whisper: 99 languages, translation to English, language detection, six model sizes and word-level timestamps, from Python or the CLI.

    13k GitHub starsUsed in 7 repos~1.9k tokens
    Auto-check: notes
  • FAISS Similarity Search

    Orchestra-Research/AI-Research-SKILLs

    Sets up FAISS for fast nearest-neighbor search over large collections of dense vectors, choosing between Flat, IVF, HNSW and product quantization indexes.

    13k GitHub starsUsed in 6 repos~1.3k tokens
    Auto-check passed

Questions about CLIP Image-Text Matching

What does CLIP Image-Text Matching do?

Explains OpenAI's CLIP model for zero-shot image classification, image-text similarity, semantic image search and content moderation, with install steps and code patterns. CLIP relates images and natural language, trained on 400M image-text pairs, so it can classify images with no task-specific training data. The skill lists when to use it, among them zero-shot classification, image-text similarity, semantic image search, content moderation and cross-modal retrieval in either direction, and points to BLIP-2 for captioning, LLaVA for vision-language chat and Segment Anything for segmentation.

When should I use CLIP Image-Text Matching?

CLIP Image-Text Matching fits situations like: classifying images into custom labels without training data; building semantic search over an image collection; screening images for unsafe content with text categories; matching text queries to images and the reverse.

How do I install CLIP Image-Text Matching in Claude Code?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill clip -a claude-code`. Or copy the skill folder (18-multimodal/clip in Orchestra-Research/AI-Research-SKILLs) into .claude/skills/clip in your project. Claude Code loads it when a task matches its description.

How do I install CLIP Image-Text Matching in Codex?

Run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill clip -a codex`. Or copy the skill folder (18-multimodal/clip in Orchestra-Research/AI-Research-SKILLs) into .agents/skills/clip in your project. Codex loads it when a task matches its description.

Can I use CLIP Image-Text Matching in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Orchestra-Research/AI-Research-SKILLs --skill clip -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clip, .gemini/skills/clip, .github/skills/clip and .opencode/skills/clip in your project.

What does CLIP Image-Text Matching need to run?

Going by SKILL.md and its folder, CLIP Image-Text Matching needs the command-line tools its instructions call (pip). Our summary lists: Python with torch, torchvision, ftfy, regex and tqdm; A GPU is recommended for speed.

Does CLIP Image-Text Matching access the network?

SKILL.md names 3 domains. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. As links in the text: arxiv.org and colab.research.google.com. This is read from the text; nothing was executed.

Is CLIP Image-Text Matching safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does CLIP Image-Text Matching use?

CLIP Image-Text Matching is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does CLIP Image-Text Matching use?

About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.3k tokens, read only when the agent opens those files.

What are the alternatives to CLIP Image-Text Matching?

Skills that share tags, products or a category with CLIP Image-Text Matching: Scholar Compute (joshzyj/open-scholar-skill, 168 stars), Matlab Integrate Pytorch Vision (matlab/matlab-agentic-toolkit, 1.1k stars), Re AI Model (dslsdzc/rev-skills, 135 stars) and Alphagenome Predictions (genomicsxai/alphagenome-pytorch, 162 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains CLIP Image-Text Matching?

Orchestra-Research (a GitHub organization) maintains it in Orchestra-Research/AI-Research-SKILLs, which has 13,405 GitHub stars. The repository holds 96 skills in this directory. The repository was last updated on June 16, 2026.

Source: Orchestra-Research/AI-Research-SKILLs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.