Vision Models & Image Understanding
Read a little, play a little. No scary maths, and no rush.
Teaching models to see (roughly how you do)
You recognize a dog instantly, from any angle, partially hidden. Vision models get there in two stages: first chop the image into patches and learn each patch's features (Vision Transformer, or ViT — the same transformer idea as language, applied to image tiles), then learn what those visual features mean by matching them against language.
CLIP: images and words in one map
CLIP trained on hundreds of millions of image-caption pairs with one goal: put matching images and texts close together in a shared space. The payoff is zero-shot classification — to detect "a broken traffic light," you never train a traffic-light model; you just ask which text prompt ("a photo of a broken traffic light" vs "…working…") sits closest to the image. New categories cost a sentence, not a dataset.
Three jobs, three setups
- Captioning: "describe this image" — one output per image, great for alt-text generation.
- VQA (visual question answering): "how many mugs are on the left shelf?" — image plus question in, answer out. Harder, more useful.
- Visual search: embed your catalog once, then "find images like this one" becomes nearest-neighbor math (yes — the same embeddings idea as text RAG).
Beginner pitfalls (and their cheap fixes)
Vision models confidently misread small text, count poorly past a handful, and hallucinate details in blurry regions. Fixes that actually work: send higher resolution crops of the region that matters, ask narrow questions ("is there a red sticker on the box?") instead of "describe everything," and resize + cache embeddings because vision tokens are hungry — costs scale with pixels.
A worked example: reading receipts
An expenses app turns phone photos of receipts into records.
- Prepare the image. Straighten and crop to the receipt, and keep enough resolution for the small print.
- Ask for structure. Request JSON with fixed fields (merchant, date, total, currency) instead of a description, combining vision with structured output.
- Validate. Check that the date is real and that the line items add up to the total. A mismatch usually means a misread digit.
- Route the doubtful ones. Receipts that fail validation go to a person for a quick look rather than straight into someone's accounts.
OCR or a vision model?
For clean printed text at high volume, dedicated text recognition (OCR) is cheaper, faster, and very accurate at reading characters. A vision model earns its cost when the task needs understanding: which number is the total, what a chart shows, whether a form was filled in correctly. Many pipelines use both: OCR reads the text, and a language model interprets it.
Images carry more than you can see
Photos often include faces, other people's documents, and hidden metadata such as the GPS location where the photo was taken. Strip metadata before storing or sending images, send only the region you need, and make sure users know where their images go.
Remember this
- ViT sees in patches; CLIP connects pictures to words, enabling zero-shot categories.
- Crop tight, ask narrow, cache embeddings — vision bills by the pixel.
Check your understanding
5 questions · first-try answers earn the most XP
My notes
Saved in this browser. Highlight a line above and save it, or write it in your own words.
Nothing saved yet. Your highlights will live here.
References
Finished reading?
Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.
Related chapters
Spotted a mistake or want a topic covered? Report an issue