IT Vizag
← Computer Vision in Practice

▶ Sign up free for the video, slides & prompts

The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.

Checking…

Computer Vision in Practice · Lesson 10 of 15 · 2 min read · 5 min video

Vision transformers and foundation models

ViT, CLIP and SAM: attention for images, and models that understand text and pictures.

📄 Download slides (PDF)· free sign-up

Transformers changed language AI, then they came for images. Vision transformers and foundation models like CLIP and SAM now power many vision systems, often with little or no training of your own.

Vision Transformer (ViT)

A ViT treats an image like a sentence:

  1. Cut the image into small patches, say 16 × 16 pixels
  2. Turn each patch into a vector, like a word embedding
  3. Add position information, so the model knows where each patch came from
  4. Run attention: every patch looks at every other patch

Unlike a CNN, which builds up from local neighbourhoods, a ViT sees the whole image at once from the first layer. With enough training data it matches or beats CNNs. With little data, CNNs are often still better, or you fine-tune a pre-trained ViT.

CLIP: images and text together

CLIP was trained on hundreds of millions of image–caption pairs. It puts images and text in the same embedding space, so you can:

  • Classify with no training: compare an image with "a photo of an auto-rickshaw", "a photo of a bus" and so on, and pick the closest
  • Search photos with words: "sunset over RK Beach"
  • Find similar images
🔒 Code example: sign up free (above) to unlock it.

SAM: segment anything

Segment Anything outlines almost any object from a click, a box or (in newer versions) a text prompt. It's excellent for speeding up labelling, and for apps that need cut-outs of things it was never specifically trained on.

Multimodal LLMs

Models like GPT-4o, Gemini and Claude can read an image and answer questions about it. They're great for flexible tasks and prototypes, but slower and more expensive per image than a small dedicated model.

Choosing

  • Fixed task, high volume, needs speed: a fine-tuned CNN or a small detector
  • Many changing categories, little labelled data: CLIP or an open-vocabulary detector
  • Exploration and low volume: a multimodal LLM
Tip: Try a foundation model first to see how far it gets with zero training. Fine-tune only when it isn't accurate or fast enough.

In one line

Vision transformers apply attention to image patches, and foundation models like CLIP and SAM bring zero-shot classification, text-to-image search and click-to-segment, often with no training.

Saved on this device. Sign in to keep progress everywhere.

Share with a friend