OpenAI CLIP: The Model That Learnt Zero-Shot Image Recognition Using Text

· Source: ByteByteGo Newsletter · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Computer Vision, Natural Language Processing · Depth: Intermediate, medium

Summary

OpenAI's CLIP (Contrastive Language-Image Pre-training), released in January 2021, is a neural network that fundamentally shifts computer vision by connecting visual and linguistic understanding. Unlike traditional models requiring millions of labeled images for specific tasks, CLIP learns from 400 million image-text pairs scraped from the internet. It trains by matching images to their correct text descriptions from a batch of 32,768 options, enabling "zero-shot" classification without task-specific retraining. This approach addresses the high cost of dataset creation, models' narrow specialization, and their tendency to "cheat" on benchmarks. Technically, CLIP uses separate image and text encoders that project data into a shared embedding space, optimized via a contrastive loss function and backpropagation. Key design choices included contrastive learning over caption generation and the adoption of Vision Transformers for the image encoder, making its training computationally feasible on 256 GPUs over two weeks. CLIP achieved 76.2% accuracy on ImageNet and significantly outperformed traditional models on stress tests like ImageNet Sketch (60.2% vs. 25.2%) and adversarial examples (77.1% vs. 2.7%).

Key takeaway

For AI Scientists and Computer Vision Engineers developing new classification systems, CLIP offers a powerful alternative to traditional, data-intensive methods. Its zero-shot capability means you can classify images into novel categories using only text prompts, eliminating the need for extensive, task-specific labeled datasets and retraining. This flexibility allows for rapid prototyping and deployment across diverse applications, from content moderation to medical imaging, by simply adjusting your text descriptions. Be mindful of potential biases inherited from internet data and the need for prompt engineering to optimize results.

Key insights

CLIP connects vision and language through contrastive learning on internet-scale image-text pairs, enabling zero-shot image classification.

Principles

Method

CLIP trains two encoders (image, text) to produce similar embeddings for matching pairs and dissimilar for non-matching pairs, using a contrastive loss function over 400 million image-text pairs.

In practice

Topics

Best for: Computer Vision Engineer, AI Scientist, Research Scientist, AI Engineer, Machine Learning Engineer, Data Scientist

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by ByteByteGo Newsletter.