00 · LANGUAGE CHANGES THE TARGET
LANGUAGE-GROUNDED VISION
How Words Become Boxes, Regions, and Masks
HOW DOES LANGUAGE CHANGE WHICH PART OF THE IMAGE WE PREDICT?
ES 667 · Nipun Batra · 55-minute route
Same image. Change language. Change the target region.
The fixed park scene is an authored illustration. All main teaching overlays are reference annotations; recorded model evidence is identified separately. The child now visibly kicks the red ball; this same drawing is used throughout. Ten dividers include this title slide.
Ask:
Reference answer:
00 · LANGUAGE CHANGES THE TARGET
A detector already gives us locations
“dog”
Box · class label · score
Familiar fixed-class detector
Where is already part of detection. Which target is still constrained by the label set.
Recall the recent detector lecture. These are reference boxes, not measured predictions. Do not assign an invented score to the scene.
Ask: What does the image-level label “dog” leave out?
Reference answer: Location and the number of instances.
00 · LANGUAGE CHANGES THE TARGET
“Person” does not identify one person
“person”
A, B and C all match.
“person wearing red”
B · the attribute selects an instance
A class name is sometimes not enough.
Preserved three-person illustration. Point to all three before adding red. Ask for the selected instance before revealing B.
Ask: What information did “wearing red” add?
Reference answer: An attribute that distinguishes instances of the same class.
00 · LANGUAGE CHANGES THE TARGET
Change the phrase; change the target
“red ball”
Attribute selects the red ball.
“ball beside the dog”
Relation selects that same ball.
“dog beside the red ball”
Now the requested object is the dog.
The head noun names the target; the relation constrains it.
Two boxes remain at the completed state to compare target noun roles. During teaching first point at the ball, then dog. Nearness is obvious in this authored scene. This example alone cannot establish model relational understanding.
Ask: Which object should be returned for “dog beside the red ball”?
Reference answer: The dog. The ball is the reference object, not the requested target.
00 · LANGUAGE CHANGES THE TARGET
The words can ask for unfamiliar evidence
“find the kiln”
“find its chimney”
Same domain. Different spatial target.
Schematic aerial view.
Not a satellite observation.
An open vocabulary does not remove domain shift or missing visual detail.
Preserve kiln opening but compress it. The oval kiln and central chimney illustrate different regions. Recognizing a domain term still requires suitable image evidence and training.
Ask: Would a text encoder make an unresolved chimney visible?
Reference answer: No. The image resolution and domain evidence still limit localization.
01 · CLIP, BUT SPATIAL
CLIP, BUT SPATIAL
01
CLIP matches a description. How do we answer WHERE?
CLIP matches a description. How do we answer WHERE?
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
01 · CLIP, BUT SPATIAL
IF is a different question from WHERE
One global image vector does not specify a box.
Connect to the CLIP matrix intuition. Global matching can support image retrieval. Localizing requires retaining spatial information and learning a geometric output.
Ask: What has pooling removed?
Reference answer: Explicit per-location output structure.
01 · CLIP, BUT SPATIAL
Replace the fixed label representation
Supply the class representation through a text encoder.
Text changes which semantic columns we ask the detector to score.
The first row recalls a conventional linear class head. Then replace learned class weight vectors by encoded descriptions. Actual open-vocabulary models need local feature alignment and detection training.
Ask: Does changing the label list alone teach box geometry?
Reference answer: No. Geometry requires spatial features and a trained box predictor.
01 · CLIP, BUT SPATIAL
One dot product becomes one matrix cell
Normalized, illustrative vectors. These are not measured park features.
The scalar 0.6 answers one region–text comparison.
Go slowly: multiply the first components, then second, then add. Step 5 moves the scalar into the amber outlined cell. The vectors both have unit norm.
Ask: What does 0.6 refer to?
Reference answer: Region 1 compared with the supplied dog vector; not a probability.
01 · CLIP, BUT SPATIAL
Build the matrix from comparisons
ROW: which text fits this region? COLUMN: which region fits this text?
Rows index candidate regions. Columns index supplied text queries.
The full 3×2 matrix appears only after several cells. The r vectors are toy candidates, not semantic labels for the park. No claim is made that row 1 is a dog. Ask row and column interpretations separately.
Ask: For dog, which toy region scores highest?
Reference answer: Column dog: r₂ at 0.8. Row r₁ instead prefers ball at 0.8.
01 · CLIP, BUT SPATIAL
Similarity, logit and probability are distinct
This softmax is a teaching example. Detectors may instead use independent sigmoid scores.
A cosine score is not automatically a calibrated confidence.
No new contrastive-loss derivation. Normalization choices matter. A probability over a supplied list changes if the list changes; it does not prove the correct object exists.
Ask: What happens when we add another text candidate?
Reference answer: The cosine values can remain fixed while the softmax probabilities change.
02 · HOW DOES TEXT BECOME A DETECTION?
HOW DOES TEXT BECOME A DETECTION?
02
Keep the spatial features. Add geometry. Match text.
Keep the spatial features. Add geometry. Match text.
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
02 · HOW DOES TEXT BECOME A DETECTION?
Derive a text-defined detector
CLIP-like semantics + spatial features + box prediction.
Six reveals: visual backbone; spatial features; box head; text embeddings; local text matching; boxes combined with scores. Do not name the exemplar before the mechanism is complete. Scores and geometry are different predictions.
Ask: Where does language enter this design?
Reference answer: Through text embeddings compared with local visual features.
02 · HOW DOES TEXT BECOME A DETECTION?
Example: OWL-ViT-style detection
The local features are trained for detection; this is more than global CLIP retrieval.
Name OWL-ViT now. Simplification: image-token outputs, projections and detection heads stand in for implementation details. OWL-ViT transfers image-text pretraining and fine-tunes localization. Open vocabulary is a capability with limits, not an unlimited guarantee.
Ask: Which branch would fail if box training were missing?
Reference answer: The geometry branch would not have learned to predict useful enclosing boxes.
03 · FROM CATEGORY TO REFERRING EXPRESSION
FROM CATEGORY TO REFERRING EXPRESSION
03
Which particular instance does the phrase mean?
Which particular instance does the phrase mean?
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
03 · FROM CATEGORY TO REFERRING EXPRESSION
A description can add constraints
“dog”
“brown dog”
“dog beside the red ball”
“dog beside the child”
CATEGORY → ATTRIBUTE → RELATION
Phrase grounding links language to the region it refers to.
All four phrases refer to the same dog here. That does not test whether a model uses relations. The next slide adds same-class alternatives. In a single-referent setting this is referring expression comprehension.
Ask: Does success on this one-dog image prove relation understanding?
Reference answer: No. The model could return the only dog for every prompt.
03 · FROM CATEGORY TO REFERRING EXPRESSION
Make the alternatives plausible
“dog”
Three valid instances.
“the sitting dog in the middle”
B · posture and position select it.
A useful grounding test includes competing instances of the same class.
Retain the existing three-dog asset. Use it to distinguish detecting a category from resolving a referring expression. These are reference annotations, not a benchmark.
Ask: Why is this a stronger target-selection test?
Reference answer: Several regions satisfy the noun, so additional words must disambiguate.
03 · FROM CATEGORY TO REFERRING EXPRESSION
“A child stands near a dog and a red ball.”
Language spans and spatial regions need explicit correspondence.
The child is standing on one leg while kicking. The sentence is an example of region-language correspondence, not a generated caption. Span colors identify corresponding objects on this slide; modal colors resume in architecture diagrams.
Ask: Is one whole-image similarity enough to supply these three links?
Reference answer: No. We need phrase-to-region alignment.
04 · LANGUAGE-GUIDED OBJECT QUERIES
LANGUAGE-GUIDED OBJECT QUERIES
04
What if language could affect which queries are useful?
What if language could affect which queries are useful?
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
04 · LANGUAGE-GUIDED OBJECT QUERIES
Recall DETR: queries read the image
A query is a learned request for information, not a preassigned object name.
Recall learned object queries, visual K,V and per-query predictions. The diagram omits query self-attention, positional encodings and repeated layers.
Ask: Do the learned slots begin as “dog query” and “ball query”?
Reference answer: No. Explicit semantic slot labels would be misleading.
04 · LANGUAGE-GUIDED OBJECT QUERIES
The same operation, a spatial question
Earlier: generate the next word.
Here: locate what a phrase refers to.
Beyond Attention → object queries reading visual and multimodal memories.
Make the connection explicit rather than treating multimodal attention as a new primitive. Different sublayers may read visual and textual memories; they need not concatenate everything into one matrix.
Ask: What changes while the operation stays the same?
Reference answer: The query source, memory contents, training targets and output head.
04 · LANGUAGE-GUIDED OBJECT QUERIES
One query mixes three values
Key locations: dog · red ball · background
ILLUSTRATIVE ATTENTION WORKSHEET · spatial labels locate toy keys, not hidden semantics.
Attention produces a value mixture; a downstream head still has to predict geometry.
Calculate raw dot products first, then divide by sqrt(2), then softmax, then weighted values. All vectors are invented for arithmetic, not measured activations. Explain that value coordinates have no assigned dog/red-ball meaning in a real model.
Ask: Is the attention distribution already a box?
Reference answer: No. It is a weighting used to update a representation.
04 · LANGUAGE-GUIDED OBJECT QUERIES
Let text influence feature selection
Language can influence features, selected queries and decoder updates.
Seven reveals: image branch, text branch, feature enhancer, language-guided query selection, decoder, both memory side paths, then box and phrase-score outputs. Query selection retains language-relevant visual positions. No chat interface is implied.
Ask: Which part changes the initial queries supplied to the decoder?
Reference answer: Language-guided query selection.
04 · LANGUAGE-GUIDED OBJECT QUERIES
This is the Grounding DINO design
A language-conditioned detector, with boxes and text alignment as outputs.
Only now attach the name Grounding DINO. Distinguish it from DINO self-supervised visual learning and from a generative chat VLM. The architecture supports language conditioning; robust relational understanding must still be evaluated.
Ask: Why can a longer phrase still fail?
Reference answer: The model may latch onto nouns, confuse relations or select the wrong instance.
05 · TEXT → BOX → MASK
TEXT → BOX → MASK
05
Language selects a region. How do we recover its pixels?
Language selects a region. How do we recover its pixels?
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
05 · TEXT → BOX → MASK
Compose a grounder with a segmenter
Language selects the region. SAM recovers its precise shape.
Six reveals correspond to the requested six frames: query and image; grounder and box; box prompt; cached SAM image embedding; mask decoder; reference mask. Use the same image in both models. Original released SAM accepts spatial prompts; text is handled upstream.
Ask: What passes from the grounder to SAM?
Reference answer: A spatial box after coordinate conversion.
05 · TEXT → BOX → MASK
The user asks for a mask
“segment the dog beside the red ball”
One requested region.
One pixel mask.
Intermediate boxes can disappear from the user’s view.
A clean mask can still belong to the wrong instance.
Show the final text-to-mask view without intermediate box overlays. Grounding and shape quality are separable. The displayed mask is an authored reference. Coordinate bookkeeping is preserved in backup.
Ask: Can the segmenter fix a perfectly confident wrong-object box?
Reference answer: It can produce a precise mask of the wrong object; target selection remains a separate failure.
06 · CAN A VLM GENERATE SPACE?
CAN A VLM GENERATE SPACE?
06
What if the answer is a spatial sequence?
What if the answer is a spatial sequence?
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
06 · CAN A VLM GENERATE SPACE?
A familiar VLM, a different answer grammar
Dedicated head: box coordinates. Sequence decoder: spatial tokens.
Build visual encoder and tokens; connector and instruction; decoder; first coordinate token; remaining spatial sequence. This is a generic VLM pattern, not a claim about a specific model’s exact token syntax. The displayed numeric box is a separate toy box.
Ask: Which part makes the output spatial?
Reference answer: Training the sequence model to emit an agreed spatial grammar and coordinates.
06 · CAN A VLM GENERATE SPACE?
Continuous coordinate → bin → token
Toy convention: 1,000 bins/axis, floor then clip to 999. Decode at bin centres.
Each coordinate becomes a discrete symbol under a declared convention.
Reveal x1, y1, x2, y2 separately. This box demonstrates quantization and is not claimed to enclose the dog or ball. Centre decoding makes the maximum normalized error 0.0005 per coordinate, including clipped endpoints. Real models may use different tokenization.
Ask: Do four discrete indices retain infinite spatial precision?
Reference answer: No. Quantization imposes finite coordinate resolution.
06 · CAN A VLM GENERATE SPACE?
Predict one spatial token at a time
<box><x_120><y_250><x_710><y_830></box>A valid sequence must also describe the correct region.
Do not reveal a complete token sequence first. Each advance adds one token after the initial context pipeline. The toy coordinate grammar is not the literal Kosmos-2 vocabulary.
Ask: Could all tokens be syntactically valid but the box be wrong?
Reference answer: Yes. Syntax and spatial correctness are independent checks.
06 · CAN A VLM GENERATE SPACE?
Example: Kosmos-2 grounds generated phrases
Spatial grammars are model-specific: Kosmos-2 uses two corner tokens.
Attach name after the generic mechanism. Kosmos-2 links phrase text with location tokens; two tokens specify top-left and bottom-right grid cells. Contrast with the preceding four axis-token toy scheme.
Ask: Why should we not copy the toy x/y token strings into its tokenizer?
Reference answer: Its location vocabulary and serialization convention differ.
06 · CAN A VLM GENERATE SPACE?
Example: Florence-2 changes tasks through prompts
The prompt selects an output grammar; a parser turns spatial tokens into geometry.
The displayed task strings are actual processor keys, not the shorthand names from the brief. The referring-expression segmentation route produces polygons; rasterization gives a bitmap. This is an encoder–decoder sequence model.
Ask: Where is the mask bitmap in the segmentation sequence?
Reference answer: The sequence represents polygons; downstream parsing and rasterization produce a mask.
07 · CAN A VLM REASON INTO A MASK?
CAN A VLM REASON INTO A MASK?
07
The target may be implicit in the instruction.
The target may be implicit in the instruction.
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
07 · CAN A VLM REASON INTO A MASK?
From naming to interpreting the target
“segment the dog”
“segment the dog beside the red ball”
“segment the object the child is playing with”
Reference target: red ball.
Visible cue: the child’s foot meets the ball.
The instruction can describe a role without naming the object.
The park scene stays fixed. The child’s foot visibly contacts the ball. Even with a clear authored cue, action interpretation is an inference, and real images may be ambiguous. These reference answers do not claim measured model reasoning.
Ask: Which noun in the final request directly says “ball”?
Reference answer: None. The model must resolve the described interaction.
07 · CAN A VLM REASON INTO A MASK?
The request can depend on world knowledge
“segment the object used to stay dry in rain”
Umbrella
A second controlled illustration.
No umbrella is hidden in the park scene.
Interpret the request, then identify the pixels of the chosen object.
This supplementary scene makes the world-knowledge query answerable without inventing an absent park object. Do not display hidden chain-of-thought; just the instruction and target.
Ask: Would an excellent mask of the ball answer this instruction?
Reference answer: No. Correct shape is insufficient when target identity is wrong.
07 · CAN A VLM REASON INTO A MASK?
Turn a language representation into a mask
Language interprets WHAT is meant; the mask decoder predicts WHICH PIXELS.
First image and query enter a VLM. Then introduce SEG; expose its hidden representation; project it into a segmentation prompt; show spatial image features entering the mask decoder; finally emit a mask. The displayed hidden state is a symbol, not decoded thought.
Ask: Why must the mask decoder also receive image features?
Reference answer: The prompt specifies the target; spatial image features supply location and boundary detail.
07 · CAN A VLM REASON INTO A MASK?
Example: LISA-style reasoning segmentation
A learned segmentation representation connects a VLM to a pixel decoder.
Name LISA after the mechanism. The original implementation projects the selected token hidden representation into a SAM-style prompt and combines it with image embeddings. No full paper architecture or private reasoning transcript is needed.
Ask: How does this differ from text → box → SAM?
Reference answer: It supplies a learned segmentation prompt from the VLM rather than requiring an intermediate box.
08 · FOUR ARCHITECTURES FOR LANGUAGE-GROUNDED VISION
FOUR ARCHITECTURES FOR LANGUAGE-GROUNDED VISION
08
Compare where language enters, what leaves, and what is trained.
Compare where language enters, what leaves, and what is trained.
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
08 · FOUR ARCHITECTURES FOR LANGUAGE-GROUNDED VISION
Four ways to make language spatial
Language entry → output representation → learning signal.
Reveal one complete family per click. The fourth row includes two distinct output paths: generated coordinates versus a segmentation representation plus pixel decoder. Categories describe patterns, not mutually exclusive taxonomic bins.
Ask: Which design naturally exposes an intermediate box?
Reference answer: The modular ground-and-segment system. A learned SEG interface need not expose one.
08 · FOUR ARCHITECTURES FOR LANGUAGE-GROUNDED VISION
A recorded answer can miss the intended target
“ball beside the dog.”
dog · 0.603
ball · 0.476
Recorded alignment scores, not accuracy.
The requested target is the ball.
Keep the raw predictions. Inspect which words and regions they link.
Measured content is loaded from results/grounded_vision_outputs.json. These are actual Grounding DINO tiny outputs on the authored scene at box/text thresholds 0.25. The detector returns noun detections, not a guaranteed single referred instance. Explore all five interfaces, color swap and absent bicycle; use reference mode for unmeasured generative/reasoning examples.
Ask: Which returned box answers the request?
Reference answer: The ball box; the dog is the reference object. Returning both does not resolve the referring expression.
09 · TRAINING / EVALUATION SYNTHESIS
TRAINING / EVALUATION SYNTHESIS
09
The requested output determines supervision and evaluation.
The requested output determines supervision and evaluation.
Use this transition to restate the problem before introducing a mechanism.
Ask:
Reference answer:
09 · TRAINING / EVALUATION SYNTHESIS
What annotation teaches each behavior?
Richer instructions require targets that make their intended region identifiable.
Three training slides total. The ladder represents different annotation types, not an automatic performance ranking. Mask supervision can be paired with explicit or implicit descriptions.
Ask: Can image-level class labels alone specify an exact mask?
Reference answer: No. They do not directly supply spatial boundary targets.
09 · TRAINING / EVALUATION SYNTHESIS
Loss follows the output representation
Train the semantic choice and the spatial answer the system actually produces.
Box objectives commonly combine alignment/classification and geometry such as L1/GIoU after assignment. Mask objectives compare pixels or overlap. Original SAM uses focal and Dice plus quality prediction; LISA uses LM with BCE/Dice. No full derivation in main route.
Ask: Does a coordinate token loss directly optimize IoU?
Reference answer: No. It penalizes next-token errors; spatial quality must still be evaluated.
09 · TRAINING / EVALUATION SYNTHESIS
A teacher can scale labels—and its mistakes
A wrong instance can become a very precise training target.
Audit relations, absence and domain shift. Keep a human-checked held-out set.
More pseudo-labels do not automatically mean better grounding.
Third and final training slide. Link to GLIP-style data expansion without a long training recipe. Teacher confidence cannot replace instance-level validity checks.
Ask: What error can survive perfect mask boundaries?
Reference answer: A wrong region referred to by the instruction.
09 · TRAINING / EVALUATION SYNTHESIS
Evaluate the output and the target identity
State the matching rule, threshold and split; one metric cannot test every failure.
First of two evaluation slides. AP aggregates ranked detections under a defined matching protocol. Referring expression accuracy often uses a box-IoU threshold but also requires the intended instance. Mask IoU/Dice depend on aggregation choice. Arithmetic is in backup.
Ask: Why is valid token syntax insufficient?
Reference answer: The generated box can refer to the wrong object or be shifted.
09 · TRAINING / EVALUATION SYNTHESIS
Separate four failure modes
Diagnose target choice, coordinate mapping, shape and absence separately.
Second and final evaluation slide. The small drawings intentionally illustrate errors, not real predictions. Shifted coordinates show both reference and displaced box; shape failure erases part of the dog mask.
Ask: Which component should we inspect for a consistent shift?
Reference answer: The coordinate transforms and box format before blaming language understanding.
09 · TRAINING / EVALUATION SYNTHESIS
Choose a route; explain the representation
“segment the object the child is playing with”
Where does language enter?
What spatial representation leaves?
What target and loss teach it?
Selection → representation → pixels
Language changes the target. Architecture determines how that choice becomes space.
Close by asking students to propose either modular grounding+SAM or VLM+mask, then identify the loss and a failure case. Do not imply one design always wins. Main lecture ends here.
Ask: How would you tell whether a correct mask came from understanding the instruction?
Reference answer: Use counterfactual queries and same-class alternatives, inspect target identity and score spatial quality separately.
OPTIONAL / BACKUP
Coordinate handoff: the same box in two systems
SAM mask postprocessing: undo SAM resize/padding → original-image mask.
Box format and coordinate frame must be explicit at the interface.
Example: original 800×500; detector resize s=.8 then pad top=120 to 640×640. Detector xyxy [96,296,272,440] → original [120,220,340,400]. SAM longest-side scale1.28 → [153.6,281.6,435.2,512]. Original SAM pads bottom/right, so no added top/left offset. Use library postprocessors.
Ask:
Reference answer:
OPTIONAL / BACKUP
Overlap arithmetic belongs in backup
For nonempty binary masks, Dice = 2 IoU / (1 + IoU).
Two 200×200 boxes offset by50 pixels: intersection30000, union50000. This binary evaluation identity is not a complete specification of a differentiable Dice training loss. Define empty-mask behavior and macro/micro aggregation.
Ask:
Reference answer:
OPTIONAL / BACKUP
Pseudo-labels need an error audit
Keep teacher version, threshold, prompt, image transform and human-audit split.
Confidence filtering cannot repair systematic target confusion.
Use a stratified audit: category, relation, small objects, absent query, new domain. Prevent train/evaluation leakage. Retain low-confidence cases for diagnosis instead of hiding every failure.
Ask:
Reference answer:
OPTIONAL / BACKUP
Optional: language can point into masks
“The [dog] is beside the [child].”
[dog] → dog mask
[child] → child mask
GLaMM connects grounded language and region masks within conversation.
One optional contextual slide. The sentence and masks are illustrative, not a measured output. No additional architecture is required.
Ask:
Reference answer:
OPTIONAL / BACKUP
Specify the evaluation protocol
Box AP: thresholds + class matching + ranked detections.
Referring accuracy: target identity + chosen IoU threshold.
Mask overlap: per-object / per-image / global aggregation.
Absence: false positives on negative queries.
A score without its protocol is not a comparable result.
Retained evaluation detail outside the main flow. Avoid comparing headline AP, mask mIoU and referring accuracy as if they measured the same task.
Ask:
Reference answer:
OPTIONAL / BACKUP
Optional: carry a spatial prompt through video
SAM 2 extends promptable segmentation to video.
Language selection still depends on the surrounding system.
Temporal propagation adds a memory problem beyond this image-only lecture.
Preserves the prior optional extension. This is not needed for the 55-minute route.
Ask:
Reference answer:
OPTIONAL / BACKUP
Primary sources and implementation references
Original diagrams; illustrative examples are labelled separately from recorded inference.
Primary sources checked 4 October 2026. The lecture teaches representative published designs, not a leaderboard.
Ask:
Reference answer:
OPTIONAL / BACKUP
Primary sources and implementation references
Original diagrams; illustrative examples are labelled separately from recorded inference.
Primary sources checked 4 October 2026. The lecture teaches representative published designs, not a leaderboard.
Ask:
Reference answer: