Settings

Theme
Lite Mode (saves mobile data)

In Lite Mode, animations and videos don't play until you tap them, and their size is shown first. Interactive widgets still work.

Text size

Back up or move your progress →

Part 5: Computer Vision and CNNs

Foundation models for vision

P5.1440 min●●● AdvancedReviewed Dec 3, 2026

Why this matters for machine learning

One pretrained model can answer prompts for objects that nobody labelled for your project, so you can cut out or find things without training a new network. You need to know what such a model can do, what it cannot do, and how to check it.

  • The Vision Transformer is the image encoder of both SAM and OWL-ViT. This lesson uses it as a black box, and its patches and layers are taught in the Vision Transformers lesson. (P5.15: Vision Transformers)
  • Open-vocabulary detectors compare a box with a text query in an image-text embedding space, which CLIP-style training builds. (P8.13: CLIP and contrastive image-text learning, coming soon)
  • Segmentation masks are the output of SAM. P5.13 teaches how fixed-class segmenters make them and how masks are scored. (P5.13: Semantic and instance segmentation)

Before this: Object detection basics, Transfer learning and fine-tuning, Semantic and instance segmentation

After this lesson you can

  • Say what makes a model a foundation model, and how a prompt replaces the fixed class list of P5.11 to P5.13
  • Describe SAM's three parts and explain why encoding the image once makes each new click fast
  • Explain why one click gives three masks, what the predicted IoU is, and why SAM names nothing
  • Explain how an open-vocabulary detector turns text into a classifier, and which inputs OWL-ViT and Grounding DINO take

The detectors of P5.11 and P5.12 know a fixed list of classes. A detector trained on the 80 classes of COCO has no output for “window”, and finding a window means collecting boxes, labelling them and training again. This lesson is about models that take the request as an input, when you use them: click on a thing and get its outline, or write “a window” and get its boxes. They are called foundation models. We look at three of them (SAM, OWL-ViT and Grounding DINO) and at where they fail.

What makes a model a foundation model

The term comes from a 2021 report from Stanford: a foundation model is a model trained on broad data at scale that can be adapted to a wide range of downstream tasks. “Broad” means huge and varied data, often with weak labels such as image captions. “Adapted” means one of two things:

  • Prompting. The task is given as an input. A click, a box or a few words selects what you want, and the weights stay the same.
  • Light fine-tuning. The big model is frozen or nearly frozen and a small part is trained on your data, as in P5.10.

A fixed-class detector or segmenter (P5.11 to P5.13) has its classes fixed at training, and a new class needs labelled examples. For a foundation model, the request is an input.

“Zero-shot” means that a model is used on a task or data set it was not trained on, with no examples from it. A later section says what to watch for.

What a mask is, and what a prompt is

A segmentation mask says, for every pixel of an image, yes or no: does this pixel belong to the object? As a NumPy array it has shape (H,W)(H,W) and holds 0 and 1. P5.13 teaches segmentation in full; here masks are only the output.

Promptable segmentation is the task Segment Anything solves: given an image and a prompt that says what to segment, return a valid mask. The prompt can be:

  • Points. A foreground point (on the object) and, optionally, background points (not on it).
  • A box. A rectangle around the object, as in P5.11.
  • A mask. A rough mask, to be refined.
  • Text. An exploration in the paper; the released SAM does not take text.

See it: click, get masks

The scene below is a house with a window, a tree and a sun, drawn on a 48×3248\times32 grid of cells. Tap a cell, and the widget shows the three masks it considers: the smallest, a middle one and the largest that contain your tap. Then try the other prompts: add a point that must be inside the mask or must be outside it, or draw a box by tapping two opposite corners.

Tap the scene, or focus it and use the arrow keys and Enter. Blue shows the mask on display.

Point on the window pane, cell (17, 19). Extra points: 0.

You meant the

Showing window: 25 of 1536 cells (1.6%).

A click-to-segment toy on a drawn scene. It imitates the interface of SAM (a prompt in, three candidate masks out) but runs no neural network: the masks are precomputed from a hand-made hierarchy (pane, window, house), so it cannot segment any other picture. Blue is the mask on display. Each card shows the area in cells and the true IoU with the mask you say you meant. By keyboard: focus the scene, move with the arrow keys, press Enter.

Three things to try:

  1. Tap the window pane. The three masks are the pane (99 cells), the window (2525 cells) and the whole house (272272 cells). Which one is right? The tap does not say. Change “You meant the” and watch the IoUs change: with the middle mask as the target, the pane scores 9/25=0.369/25=0.36 and the house 25/272=0.0925/272=0.09.
  2. Tap the sun. It has no part or whole above it, so in this toy all three masks are the same cells. A real model’s three outputs can still differ, as the real sun click shows below.
  3. Tap the pane, then choose “Add point: exclude” and tap the frame of the window. The window and the house are ruled out. A second prompt resolves the ambiguity, as in the paper, where several prompts give a single mask.

The real model has one big difference: it does not look up a hand-made hierarchy. A network predicts the masks from the pixels of any image.

SAM: the model

SAM (the Segment Anything Model; Kirillov et al., ICCV 2023, Meta AI) has three parts:

  1. Image encoder. A Vision Transformer (P5.15; here a black box) that turns the image into a grid of feature vectors, the image embedding. The paper’s input is resized and padded to 1024×10241024\times1024 pixels, and the embedding is 64×6464\times64 positions with 256 channels, so its shape is (256,64,64)(256,64,64) in the PyTorch order (C,H,W)(C,H,W). The encoder is pretrained with a self-supervised method (MAE, P5.16) before SAM’s own training.
  2. Prompt encoder. It turns points and boxes into vectors (positions plus a learned vector for each kind of prompt), and adds a mask prompt to the embedding.
  3. Mask decoder. A small network that reads the image embedding and the prompt vectors and produces masks and their scores.

The split is the design. The image encoder is large and slow, and runs once per image. The prompt encoder and the mask decoder are small and run once per prompt. The paper says the decoder needs less than 1% of the compute of the image encoder, and that, given the embedding, a prompt is answered in about 50 ms in a web browser on a CPU. This is what lets a person click again and again and get an answer each time.

The encoders have about 91, 308 and 636 million parameters (ViT-B, ViT-L, ViT-H; the paper’s Fig. 13), and the official checkpoint files are about 0.4, 1.2 and 2.6 GB. The paper is frank that the speed is for the prompts: with a heavy encoder the whole pipeline is not real time.

A real run

The code below uses the Hugging Face transformers port of the smallest model, SAM ViT-B (download about 375 MB). The picture is the same house scene as the widget, drawn by code as an image of 768×512768\times512 pixels. The click is at pixel (x,y)=(280,312)(x,y)=(280,312), on the window pane. The code calls the image encoder and the rest separately, to show the split. It was run with transformers 4.57.6 and PyTorch 2.9.1 on a CPU on the machine used for this lesson.

import torch
from transformers import SamModel, SamProcessor

name = "facebook/sam-vit-base"       # about 375 MB
sam = SamModel.from_pretrained(name).eval()
proc = SamProcessor.from_pretrained(name)

# image: a PIL picture, 768 x 512 pixels
# one click at pixel (x, y) = (280, 312)
inputs = proc(image, input_points=[[[280, 312]]],
              input_labels=[[1]], return_tensors="pt")
with torch.no_grad():
    emb = sam.get_image_embeddings(inputs["pixel_values"])
    prompt = {k: v for k, v in inputs.items()
              if k != "pixel_values"}
    out = sam(image_embeddings=emb,
              multimask_output=True, **prompt)

masks = proc.image_processor.post_process_masks(
    out.pred_masks, inputs["original_sizes"],
    inputs["reshaped_input_sizes"])[0][0]   # (3, H, W)
print("embedding:", tuple(emb.shape))
for k in range(3):
    print("mask", k, "pixels:", int(masks[k].sum()),
          "predicted IoU: %.3f" % out.iou_scores[0, 0, k])

Output:

embedding: (1, 256, 64, 64)
mask 0 pixels: 50983 predicted IoU: 0.833
mask 1 pixels: 6395 predicted IoU: 0.950
mask 2 pixels: 2348 predicted IoU: 1.016

The embedding has the shape (N,C,H,W)=(1,256,64,64)(N,C,H,W)=(1,256,64,64) that the paper describes. On this machine the image encoder took about 4.2 seconds and the prompt encoder plus mask decoder about 0.04 seconds, about 100 times less: the encoder cost is paid once (timings change with the hardware).

Ambiguity: three masks and a score

One click gave three masks of 2,3482{,}348, 6,3956{,}395 and 50,98350{,}983 pixels. The drawn scene has 16×16=25616\times16=256 pixels per cell, so the first two are 9.29.2 and 25.025.0 cells: the pane and the window. Comparing them with the drawn truth (computed on the machine used for this lesson), the smallest mask has an IoU of 0.980.98 with the window pane, the middle one 0.9990.999 with the whole window, and the largest 0.730.73 with the house.

A model that returns one mask for this click has to guess, and if it is trained on all three kinds of answers it learns something in between. The paper’s fix is to output three masks at once, because nested masks are often at most three deep: “whole, part and subpart”. In training, the loss is computed for each of the three masks against the true mask, and only the smallest loss is used to update the weights. Each output is then free to specialise.

To rank the three masks, SAM has a head that predicts the IoU between each mask and the object it covers. This predicted IoU is an estimate of the quality of a mask without knowing the true mask. It is a number from a regression head, so it is not limited to 0 to 1: the third mask above scored 1.0161.016. In the paper the same score filters masks in the data engine (next section). When more than one prompt is given, the paper says that ambiguity is much rarer, and SAM returns only one mask.

A click on the sun, which has no part or whole above it, gave masks of 8,1848{,}184 and 8,1578{,}157 pixels (the sun has 32×256=8,19232\times256=8{,}192) and a third of 31,92531{,}925 pixels with a predicted IoU of 0.6860.686, the lowest of the three. The three masks need not be copies of each other, and here the lowest score points at the poor one.

The data engine and SA-1B

There is no web-scale source of masks, as there is for captions. SAM’s authors built the data with a data engine: SAM itself helped to produce its own training data, in three stages.

  1. Assisted-manual. Professional annotators labelled masks with clicks in a browser tool powered by SAM. The model was retrained as data came in (6 times in all), and the average time per mask fell from 34 to 14 seconds. This stage gave 4.3 million masks from 120 thousand images.
  2. Semi-automatic. A box detector found confident masks first, and annotators added the objects it missed, to make the masks more varied. This stage added 5.9 million masks from 180 thousand images (10.2 million in all). The average number of masks per image rose from 44 to 72.
  3. Fully automatic. Once the model was ambiguity-aware, it was prompted with a regular 32×3232\times32 grid of points on each image. For each point it returned its three masks. Masks were kept if their predicted IoU was high and if they were stable (nearly the same when the threshold on the mask probability is moved a little), and duplicates were removed with non-maximum suppression (P5.11).

The result is SA-1B: 11 million licensed images and 1.1 billion masks, about 100 per image. The paper states that 99.1% of the masks the data engine produced were fully automatic, and that SA-1B contains only the automatic ones.

A model that helps to label the data that trains its next version has a risk too: its own errors can end up in the labels.

What SAM does not do

SAM returns masks and no class names. Nothing in its output says “window”. A mask means “here is a coherent thing”, and what the thing is, is up to you. Its automatic mode prompts a regular grid of points, as in stage 3 of the data engine, and gives many masks and no labels. To name them, add another model, such as a classifier on each masked region.

On a suite of 23 other data sets, the paper finds high-quality masks from a single foreground point, often only slightly below the quality of manually annotated ground truth. It also lists limits. SAM can miss fine structures and can hallucinate small disconnected pieces, its boundaries are less crisp than those of slower methods that zoom in, and with many points dedicated interactive methods can do better. It is built for generality: the paper expects domain-specific tools to win in their own domains.

SAM 2 (Ravi et al., Meta, 2024) extends promptable segmentation from images to video, and treats an image as a video of one frame.

Open-vocabulary detection

A detector of P5.11 has a classification layer with a fixed number of outputs, one per class, and its weights were learned for those classes. An open-vocabulary detector has no fixed list. The classes are given as text, when you run it, and the detector decides for each box which of the texts it matches best.

The idea needs a tool you will meet in P8.13: a model that has learned to put an image and a piece of text that describes it close together in one list of numbers. (CLIP is the best known. Here we only use it. Contrastive learning is in P5.16 and CLIP in P8.13.) A text encoder turns a string such as “a window” into a vector q\mathbf{q}, a text embedding. A box has an embedding z\mathbf{z} too. The score of a box for a query is how close the two vectors are, for example their cosine similarity (P1.B3).

sij=zi⋅qj∥zi∥ ∥qj∥.s_{ij}=\frac{\mathbf{z}_i\cdot\mathbf{q}_j}{\lVert\mathbf{z}_i\rVert\,\lVert\mathbf{q}_j\rVert}.

The important consequence: the rows of the classification layer are now the text embeddings. To add a class, add a string. Nothing is retrained. The scoring, thresholding and AP are as in P5.11. This is exactly how OWL-ViT works. Grounding DINO uses the same idea (box features compared with text features), but the text is fused into the image features first.

OWL-ViT

OWL-ViT (“Vision Transformer for Open-World Localization”; Minderer et al., Google Research, ECCV 2022) is a simple design. A standard Vision Transformer and a text encoder are first trained together on image-text pairs. For detection the last pooling step of the image encoder is removed, and a small head on each output token predicts one box and one embedding. So the number of boxes equals the number of tokens: 576 for the base model at 768×768768\times768 pixels with 32×3232\times32 patches. The text queries are encoded separately and are not mixed with the image features, so a query embedding does not depend on the image, and thousands of queries per image are possible. The detector is then fine-tuned on detection data with the matching loss of DETR (P5.12), but it predicts one box per image token and, as the run below shows, can still return near-duplicates. In practice, apply NMS (P5.11) when you see them. The same model can take the embedding of an example image instead of text.

Grounding DINO

Grounding DINO (Liu et al., ECCV 2024) starts from DINO, a detector of the DETR family (P5.12), and a BERT text encoder. Its input is the image and one text string: category names separated by periods, or a longer phrase that describes an object (“the left lion”). The paper calls its way of mixing text and image tight fusion: a feature enhancer, a language-guided choice of the 900 queries that start the decoder, and a cross-modality decoder. In a model with fusion the image features depend on the text, so a new text means another pass through the image model. The OWL-ViT paper gives this cost as its reason for not fusing. The paper reports 52.5 AP on COCO with no COCO training data for its largest (Swin-L) model, and 26.1 mean AP on ODinW. The tiny model run below is smaller and scores lower (the paper lists 48.4 for its Swin-T variant).

Real runs

The code below runs both models on the drawn house scene (a cartoon, not a photograph) with the transformers ports: OWL-ViT base (about 613 MB) and Grounding DINO tiny (about 689 MB), both Apache 2.0 licensed.

from transformers import (OwlViTProcessor,
    OwlViTForObjectDetection)

name = "google/owlvit-base-patch32"  # about 613 MB
proc = OwlViTProcessor.from_pretrained(name)
model = OwlViTForObjectDetection.from_pretrained(name).eval()

queries = ["a house", "a tree", "a sun", "a window", "a cat"]
inputs = proc(text=[queries], images=image, return_tensors="pt")
with torch.no_grad():
    out = model(**inputs)
print("scores:", tuple(out.logits.shape))   # (1, 576, 5)

res = proc.post_process_object_detection(
    out, threshold=0.1,
    target_sizes=torch.tensor([image.size[::-1]]))[0]
for i in res["scores"].argsort(descending=True):
    print(queries[int(res["labels"][i])],
          round(float(res["scores"][i]), 3),
          [round(float(v)) for v in res["boxes"][i]])

Output (boxes are (x1,y1,x2,y2)(x_1,y_1,x_2,y_2) in pixels):

scores: (1, 576, 5)
a tree 0.349 [456, 154, 628, 412]
a house 0.323 [68, 91, 385, 416]
a window 0.156 [238, 285, 307, 342]
a window 0.134 [239, 270, 325, 353]
a tree 0.104 [456, 156, 628, 289]

The logits have one score for every token and every query. Three things stand out. A clearly visible tree has a score of only 0.3490.349, so a threshold of 0.50.5, a habit from classifiers, would return nothing. “A sun” and “a cat” are below the threshold of 0.10.1 (their best scores were 0.0170.017 and 0.0200.020), so the sun is missed in this cartoon. And there are duplicates: the two window boxes have an IoU of about 0.540.54 and the two tree boxes about 0.520.52, so NMS at IoU 0.50.5 (P5.11) would keep three of the five boxes.

from transformers import (AutoProcessor,
    AutoModelForZeroShotObjectDetection)

name = "IDEA-Research/grounding-dino-tiny"   # about 689 MB
proc = AutoProcessor.from_pretrained(name)
model = AutoModelForZeroShotObjectDetection.from_pretrained(name).eval()

for text in ["a house. a tree. a sun. a cat.",
             "a house. a tree."]:
    inputs = proc(images=image, text=text, return_tensors="pt")
    with torch.no_grad():
        out = model(**inputs)
    res = proc.post_process_grounded_object_detection(
        out, inputs.input_ids, threshold=0.3,
        text_threshold=0.25,
        target_sizes=[image.size[::-1]])[0]
    print(repr(text))
    for s, l, b in zip(res["scores"], res["text_labels"],
                       res["boxes"]):
        print("  ", l, round(float(s), 3),
              [round(float(v)) for v in b])

Output:

'a house. a tree. a sun. a cat.'
   a sun 0.765 [588, 29, 693, 133]
   a house 0.65 [75, 92, 373, 421]
   a tree 0.663 [461, 141, 627, 418]
   a cat 0.317 [75, 92, 372, 421]
'a house. a tree.'
   a house 0.824 [78, 93, 370, 419]
   a tree 0.722 [462, 142, 626, 417]

Here the sun is found, with a score of 0.7650.765. But the picture has no cat, and the prompt “a cat” still returned a box at 0.3170.317: the same box as the house, just above the threshold of 0.30.3. Without the cat in the text, the output is clean. threshold is the score a box needs and text_threshold says which words it is matched to (the official README example uses 0.350.35 and 0.250.25). No setting is right for all images.

The Colab notebook P5.14-foundation-models-for-vision.ipynb (source on GitHub) draws the scene and runs the three models, with point and box prompts for SAM. The first run downloads about 1.7 GB in all, and a CPU is enough. Another version or machine can change the last digits.

Zero-shot: what it does and does not mean

Papers report zero-shot results for these models, so read the definition each time. Grounding DINO’s paper says it means that the training split of the test data set was not used in training, while its pretraining still includes other detection and grounding data sets. OWL-ViT’s paper measures “zero-shot” on the rare LVIS classes by removing the annotations of those class names from its detection training data, but its web-scale image-text pretraining can still have contained such objects: zero-shot there means no box labels for them. So zero-shot does not mean that the model never saw anything like the test images. Also remember:

  • The metric is that of P5.11. To report AP you need ground-truth boxes for a fixed list of classes, which you write as the prompt.
  • Detect, then segment. SAM takes a box as a prompt, and the paper notes that a box from a cat detector can prompt SAM to give cat instance segmentation: the names come from the detector and the outlines from SAM.

In practice

  • Cost and hardware. The smallest SAM ran on a CPU here: seconds for the image encoder, a fraction of a second per click. The largest (ViT-H) is a 2.6 GB file, and the README recommends PyTorch with CUDA support. OWL-ViT base and Grounding DINO tiny (153 and 172 million parameters, counted in the runs above) also ran on a CPU for one image. Nothing in this lesson needs a paid key.
  • Licences. SAM’s code and model, the Grounding DINO repository and the Hugging Face ports used here are under Apache 2.0. The SA-1B data set has its own research licence (the paper says “a favorable license agreement for certain research uses”): read it before you use the data, and check the licence of every checkpoint you use.
  • Failure modes. Small and thin objects (the paper says SAM can miss fine structures). An ambiguous click, where the first mask is not the one you meant. A prompt for an absent thing that still returns a box. Images unlike the training images, such as medical scans or satellite images, where results may be worse.
  • Check before you rely on it. Wording and thresholds do not transfer: “a house”, “house” and “building” are different queries, and in the runs above a tree scored 0.3490.349 in one model while a cat that was not there scored 0.3170.317 in another. The scores are not probabilities. Take 50 to 100 labelled images from your own data, and choose the prompt wording and the threshold on this sample.

Depth: three ways to see it

Intuition

SAM is like an assistant who has seen millions of pictures with outlines drawn on them. You point, and they trace the outline of the thing under your finger. They do not say what it is, only where it ends. Pointing at a window could mean the glass, the window or the house, so a good assistant shows three outlines and says how sure they are of each. An open-vocabulary detector is an assistant who can read: you hand over a list of words, and they put a box around everything that matches a word.

The picture breaks in two places. The assistant knows only the pictures it was trained on, and its confidence can be wrong on pictures unlike those. And a model that reads words matches vectors, which is why “a cat” can match a house when nothing better is on offer.

Math

SAM predicts three masks m^1,m^2,m^3\hat m_1,\hat m_2,\hat m_3 for one ambiguous prompt. With mm the true mask and LL the loss for one mask (the paper uses a linear combination of the focal loss and the dice loss), training uses only the best of the three:

Lprompt=min⁡k∈{1,2,3}L(m^k, m).L_{\text{prompt}}=\min_{k\in\{1,2,3\}}L(\hat m_k,\,m).

A separate head predicts IoU^k\widehat{\text{IoU}}_k for each mask, trained with a squared error against the true IoU between m^k\hat m_k and mm.

For an open-vocabulary detector, box ii has an embedding zi\mathbf{z}_i and query jj has an embedding qj\mathbf{q}_j. With unit-length vectors, the similarity is the cosine sij=z^i⋅q^js_{ij}=\hat{\mathbf z}_i\cdot\hat{\mathbf q}_j. A real detector adds learned scaling and a sigmoid before the threshold, and the details differ between models.

Code

In the official segment_anything README, predictor.set_image(image) runs the image encoder once and predictor.predict(...) runs the rest for each prompt.

Try it in Python

The cell below is a toy of the open-vocabulary score. Three boxes have a made-up embedding of 3 numbers each (real models use hundreds of numbers: 512 in the OWL-ViT base model). Four queries have embeddings too. The score is the cosine similarity of P1.B3.

Text queries as classifier rows

Runs real Python in your browser. First run downloads about 9 MB (once; your browser keeps it).

Lower thr to 0.70.7 and watch the “cat” appear: no box is a cat, but two boxes score 0.7470.747 and pass. Then look at “window”: its best scores are 0.7830.783 and 0.7800.780 for two boxes, a near-tie that the threshold 0.80.8 turns into nothing: two boxes are about equally bad matches. What would you do to tell the two apart?

Common mistakes

Quiz

Check your understanding

  1. Why can SAM answer a new click in a fraction of a second, although its image encoder is large?

  2. A click on a window pane returns three masks, each with a predicted IoU. What does the predicted IoU estimate?

  3. How does an open-vocabulary detector such as OWL-ViT classify a box without a fixed list of classes?

Exercises

  1. In the widget, the pane has 99 cells, the window 2525 and the house 272272. If the window is the mask you meant, what are the IoUs of the pane mask and the house mask with it? Why are they not equal to the ratio 9/2729/272?
    Show answerThe pane is inside the window, so the intersection is the pane, 99 cells, and the union is the window, 2525 cells: IoU=9/25=0.36\text{IoU}=9/25=0.36. The house contains the window: the intersection is 2525 cells and the union is 272272 cells, so IoU=25/272≈0.09\text{IoU}=25/272\approx0.09. A ratio of 9/2729/272 would compare the pane with the house, and the target is the window.
  2. SAM’s image embedding for one image has shape (256,64,64)(256,64,64). How many numbers is that, and how many bytes in 32-bit floats (4 bytes each)?
    Show answer256⋅64⋅64=1,048,576256\cdot64\cdot64=1{,}048{,}576 numbers, and 1,048,576⋅4=4,194,3041{,}048{,}576\cdot4=4{,}194{,}304 bytes, which is 44 MiB. This is the small thing that is kept and reused for every click on the image, while the encoder weights are the large part.

Next: P5.15 opens the Vision Transformer that both SAM and OWL-ViT use as their image encoder.

Key takeaways

  • A foundation model is trained once on broad data at scale and adapted to many tasks, by prompts or by light fine-tuning (P5.10). A fixed-class detector or segmenter answers one question, with the classes it was trained on.
  • SAM has three parts. A large Vision Transformer encodes the image once, into a 64×64×25664\times64\times256 embedding for a 1024×10241024\times1024 input. A prompt encoder and a lightweight mask decoder then turn each point, box or mask prompt into masks. The paper reports about 50 ms for these two parts in a web browser.
  • A click can mean a part, an object or a whole, so SAM returns three masks, each with a predicted IoU. In training only the lowest of the three losses is used. The predicted score is not clipped to 1: the run in this lesson gave 1.016.
  • SAM outputs masks and no class names. Its data engine had three stages and produced SA-1B on 11 million licensed images: 99.1% of the 1.1 billion masks the data engine made were fully automatic, and SA-1B holds only automatic masks.
  • An open-vocabulary detector encodes each text query into an embedding and scores every box against it. Adding a class means adding a query, not retraining. OWL-ViT encodes each query separately. Grounding DINO fuses the text into the image features.
  • Zero-shot results depend on the prompt wording, on the threshold and on what the huge pretraining data contained. A prompt for an object that is absent can still return a box above the threshold, so check on labelled examples from your own domain.
Found a mistake? Tell us