[Prompt]
custom: I've been playing with computer vision pipelines lately and keep running into two terms used side by | Hosts: corn, herman

[Response]
Corn: Nine hundred rectangles. That's what a modern vision detector hands you when you ask it to find a bird. Not a bird — nine hundred candidates, and it's your job to decide which ones count. Daniel's been building these pipelines and noticed something odd on the way in: he's got one model drawing boxes from a text prompt, something like Grounding DINO, and a second model, Segment Anything, tracing each box into a pixel-accurate mask. He gets that a box is a rectangle around the thing. What he wants is the handoff — how does the box become a mask, on a concrete job like counting birds on a lake from photos. Why two models instead of one. And he suspects "training a classifier" is the wrong phrase for any of this, which I can already tell him it is.

Herman: It's the wrong phrase, and the fact that he suspects that means he's been paying attention. The pipeline he's describing is the workhorse of the last few years — open-set detector turns text into boxes, SAM turns boxes into masks — and the two models cannot do each other's jobs. SAM can't read a text prompt. It wants a point or a box. Grounding DINO can't draw a mask to save its life.

Corn: One makes rectangles, the other colors them in.

Herman: That's most of it, honestly. The detector's part is text in, rectangles out. The segmenter's part is shape in, outline out. And the thing people picture — the detector "finds a bird" and hands over a tidy bird-shaped thing — never happens. What gets handed over is coordinates and a confidence score. There's a wrinkle here that only landed on the world about a year ago, though. Meta's SAM 3 came out in November of last year, and it does the whole job in one model — you type "bird" and it finds, outlines, and tracks every instance. The two-stage pipeline went from being the way things work to being a choice. A deliberate engineering choice.

Corn: So we're explaining a marriage that's already filed for divorce.

Herman: Amicable divorce. People still choose it, for reasons worth getting to. But you can't understand why anyone would choose two stages until you've seen what the two stages actually produce, and almost nobody explains that part. Let's start with what the detector hands over — because it's not a bird.

Corn: Before you go — nine hundred. Is that a number the model chose, or a number somebody at chose?

Herman: It's a default setting, and that's exactly the right instinct: it's a dial, not a law of nature. The model proposes boxes essentially everywhere, at multiple scales, and the default just says "give me the top nine hundred before anyone starts filtering." You could ask for more, you could ask for fewer. The point is that the raw output is over-proposal by design. The detector would rather show you nine hundred maybes than miss one bird, and the filtering is your job.

Herman: Grounding DINO takes an image and a caption, and by default it outputs nine hundred boxes. Nine hundred. Each one carrying a similarity score against every word in your prompt. The Python API is almost comically honest about it — you get back three things: boxes, logits, phrases. Coordinates, a confidence number, and which word the box thinks it belongs to. That's the output. Not "a bird." A pile of scored rectangles.

Corn: Nine hundred birds on a small lake would be an ecological event.

Herman: Right, so obviously you don't keep the nine hundred. That's what the thresholds are for. There are two knobs. The box threshold — the repo's own example uses 0.35 — keeps only boxes whose best word-similarity clears the bar. The text threshold, 0.25 in the examples, decides which words become the label. Then a third step that the demo code adds: non-maximum suppression, set at 0.8, which collapses overlapping duplicate boxes onto the same object. Without that, you count the same bird several times, because the detector proposes three or four rectangles for one duck and it isn't wrong — it's just not done deciding.

Corn: Walk me through what the knobs actually do to the number, because I think people imagine the thresholds as a volume dial — a little more, a little less. It's not that, is it.

Herman: It's not. It's more like a cliff. Lower the box threshold from 0.35 to 0.2 and you don't get five percent more birds — you get every smudge, every reflection, every white plastic bag in the reeds, and your count doubles or triples. Raise it to 0.5 and you lose the distant birds at the far edge of the frame, the half-hidden ones, exactly the ones that are hard to count by eye. The count you report is a function of where you set the cliff, and two reasonable people can produce counts thirty percent apart from the same photo.

Corn: So the count at the end is partly the model and partly your knob settings. Same photo, two thresholds, two different lakes.

Herman: Counting is a thresholding problem as much as a model problem, and almost nobody talks about that part. There's one more piece of craft in the prompt itself, which trips people up constantly. Grounding DINO's own guidance is to separate your categories with periods. Not "bird, duck, goose" — "bird . duck . goose ." with the dots. The punctuation is part of how the model splits your text into concepts. The phrasing of the prompt is inside the pipeline.

Corn: Punctuation as plumbing.

Herman: It's not ceremonial, is what I mean. You can get noticeably different boxes from the same photo depending on whether you used the periods. Now, you've got your ducks — literally, N boxes after NMS, each with coordinates and a phrase. Here's where the second stage earns its keep, and the reason the handoff is cheap is baked into SAM's architecture. SAM is deliberately split into three parts: a heavyweight image encoder, a lightweight prompt encoder, and a tiny mask decoder. The expensive thing — encoding the whole lake photo — happens once. After that, each box costs about fifty milliseconds to turn into a mask, and that was in a web browser when the paper was written. So you encode the lake once and then feed it forty bird boxes one after another, nearly free.

Corn: Wait — in a web browser? The paper shipped with a demo that ran in a browser?

Herman: That was the flex, yes. The whole point of the architecture split was that the heavy computation could run once, or be shipped pre-computed, and the interactive part — you click, a mask appears — had to be fast enough to feel like magic. Fifty milliseconds per prompt is faster than a mouse click feels. It's a lovely piece of systems design hiding inside a machine learning paper.

Corn: The photo is the expensive part, and you only pay for it once. The boxes are pocket change.

Herman: And SAM has one more trick that matters for the lake. It's ambiguity-aware. It predicts multiple masks per prompt, because a prompt is ambiguous — the paper's example is a point on a shirt, which might mean the shirt or the person. For a box around a bird sitting in reeds, SAM might hand you the bird, the reed clump, and the whole cluster as three candidate masks, each with a score. In practice you take the highest-scoring one. There are fields for this — predicted IoU, a stability score — and the sane pipeline just picks the winner.

Corn: So the actual handoff, walked end to end on the lake. Encode the image once. Run the detector with "bird . duck . goose ." and the thresholds. Nine hundred boxes come back, thresholds cut them down, NMS collapses the duplicates. Then what?

Herman: Then the step that breaks everyone's pipeline. Box format conversion. The detector emits boxes as normalized center-x, center-y, width, height — fractions of the image. SAM wants pixel corner coordinates. Different origin, different units, different shape. This is the single most common bug in these pipelines, and it doesn't crash. That's the evil of it. A slightly wrong conversion produces plausible-looking masks in slightly wrong places, and you get a quiet few-percent drop in quality that you'll blame on the model.

Corn: Give me the failure concretely. What does the bug look like on screen?

Herman: Say your image is 4000 pixels wide and the detector returns a center-x of 0.7. If you forget to multiply by the width, you're prompting SAM with a box at pixel coordinate 0.7 — the far left edge — and it happily masks whatever's there, maybe a corner of reed. Or you swap width and height, and your tall heron box becomes a wide flat box that clips the bird's legs off. Every output looks like a real mask. There's no error message, no traceback. The pipeline runs green and the masks are quietly wrong, and you spend an evening like I did, convinced the model is bad.

Corn: A wrong box doesn't fail. It just finds the wrong bird very accurately.

Herman: I ran into exactly this installing the demo when it shipped — spent an evening convinced the model was bad, and it was my conversion. Then for each surviving box you call the predictor, get one mask, threshold it to binary, and count. And here's the payoff for Daniel's question about what each stage contributes. The detector gives you the how-many — the count is literally the length of your boxes list after NMS. The mask gives you the how-big. Pixel area. Which is how you throw away specks, debris, reflections, half-birds at the edge of a tile. If all you need is a number, the boxes alone are often enough and SAM is a luxury. Masks earn their keep when you need area, or shape, or a clean cutout.

Corn: And Daniel's already found the failure mode that follows from that. Vague text prompt, wrong surface gets boxed, and the mask then traces the wrong thing beautifully.

Herman: That's the whole dependency in one sentence. The mask stage is a faithful employee. Give it a box and it will outline whatever is in that box with total commitment. The survey literature says it plainly — box prompts give strong spatial constraints, but their main limitation is heavy dependence on upstream detection accuracy. Miss a bird in stage one and stage two can never rescue it. SAM will give you a perfect mask of the thing you didn't want.

Corn: We should mention the lake itself. Water is a surface that looks like other surfaces — dark water reads as dark plumage at a distance. That's presumably where his wrong-box came from.

Herman: Plausible. Reflections and glare are classic false positives for any detector over water — a bright smudge where a white gull should be. Now, hold on, we're running long, and... I'm being told Corn's mother has rung the studio, and she is very keen to read this week's parish notices.

Corn: She's been waiting by the phone, Herman. Mum, go ahead. And hello — you're on with Herman too.

Dorothy: Hello dear, it's your mother. I've got the parish notices, from the knitting circle's round robin letter.

Herman: Mrs. Corn! Wonderful to hear from you.

Dorothy: First, Margaret Ashdown reports that the bus shelter on Fennel Lane has been repainted, though nobody remembers agreeing to it, and the paint is still wet on the bench.

Corn: Wet paint on a public bench is the most honest warning local government ever issues.

Herman: I sat on one of those once. There was no sign at all. Continue, please.

Dorothy: Second, Trevor Niblett's shed has been declared structurally sound by a man from the council, which is a relief to everyone except Trevor.

Corn: Trevor wanted it condemned. The shed outlived his hopes.

Dorothy: Third, the vicar asks that whoever has been leaving turnips on the church steps on Tuesdays please continue, as the arrangement suits everybody, and the fourth notice is that the moon will be visible over the recreation ground on Thursday, weather permitting, and Reverend Plum wants a word with whoever keeps turning it off.

Herman: That's the one I want to hear the minutes of.

Dorothy: Anyway. Wrap up warm, sweetheart, and eat something green. Bye bye.

Corn: Love you, Mum.

Herman: The moon one is going to stay with me. Alright — back to the lake, because the obvious next question is sitting right there. Why two models at all? If the handoff has a famous bug and the second stage is only as good as the first, why not one model that does the whole job?

Herman: The classic answers are good ones. Annotation economics first: boxes are far cheaper to label than masks, so "detect first, then segment" turns a hard text-to-mask problem into an easier box-to-mask problem. The models are each trained on their own mountain — Grounding DINO on more than ten million images of detection and grounding pairs, SAM on eleven million images and 1.1 billion masks. And swappability: you can change the detector without touching the segmenter. The Grounded SAM paper leans on that hard — the same assembly with BLIP bolted on gives you fully automatic image annotation, and with Stable Diffusion you get image editing. No retraining anywhere in the chain.

Corn: Say more about the swappability, because that's the one that sounds like an engineer's argument rather than a marketing one.

Herman: It is an engineer's argument, and it's the strongest one. Because the interface between the stages is just a box — four numbers — anything that produces boxes can stand in for Grounding DINO. Tomorrow someone releases a better open-set detector, and you swap it in without retraining SAM, without touching your mask code, without re-validating anything downstream. In a production system, the ability to upgrade one component and leave the rest alone is worth real money. It's the same reason we build anything in layers.

Corn: The Grounded SAM paper — that's the one that formalized this assembly.

Herman: It's from January of twenty twenty-four, and its framing is worth quoting because it's so blunt. It divides open-set segmentation into two components, open-set detection and promptable segmentation, and stresses the whole thing is training-free. And it states the asymmetry plainly too — SAM, despite strong zero-shot performance, cannot identify masked objects from arbitrary text and normally requires point or box prompts. Grounding DINO can detect anything you can describe in words but produces no masks. Each one is the other's missing half.

Corn: Which sounds romantic until you get to the counterargument, which is the dependency we already found. The second stage is a hostage.

Herman: A hostage, yes. If detection misses, segmentation never recovers. And the older detect-then-segment architectures like Mask R-CNN get criticized in the literature exactly this way — segmentation leans on the detector, and the fixed-size regions of interest cap the mask quality. This was a known tax, not a secret. Everyone paid it because the alternative didn't exist.

Corn: Until it did.

Herman: November last year. SAM 3. A unified model that detects, segments, and tracks from a concept prompt — a short noun phrase like "yellow school bus," or a photo example, or both. The numbers are striking. Zero-shot mask AP of 48.8 on LVIS against a previous best of 38.5 — a large jump. Thirty milliseconds per image on an H200 with over a hundred objects detected. And there was a follow-up in March, SAM 3.1, that added object multiplexing — tracking up to sixteen objects in one forward pass, which doubled video throughput from sixteen to thirty-two frames per second on a single H100.

Corn: The photo example as prompt — that's the detail that would matter on the lake, isn't it? If the text is constrained, the picture isn't.

Herman: That's the sleeper feature for a job like Daniel's. If there's a bird species the text prompt keeps missing, you can hand the model one cropped photo of that species and say "more of these." It's promptable detection with an example instead of a word, and for field work — where you often have one good photo of the thing you're trying to find — that's a different workflow from typing nouns and hoping.

Corn: So for Daniel's lake, you type "bird" and the whole two-model pipeline collapses to one word.

Herman: One word, one model, all instances back with masks and unique IDs. That's the honest update to the premise he sent us.

Corn: One caveat on those numbers. The 48.8 is LVIS; the Grounded SAM assembly reports 48.7, but that's on SegInW — a different benchmark. They look like the same score and they're not comparable.

Herman: Correct, and it's a shame, because a clean head-to-head on bird counting specifically hasn't shown up anywhere I've seen. What we have is two models winning on two different tests, which proves nothing except that benchmarks are easy to shop for.

Corn: So why would anyone still choose two stages? You said the reasons are practical.

Herman: Practical to the bone. SAM 3 is about 840 million parameters, roughly 3.4 gigabytes — that's server-scale, not something you glue to a drone. Its text prompts are constrained to simple noun phrases; the paper says outright it's not designed for long referring expressions or queries requiring reasoning. And a specialized fine-tuned detector will still beat a generalist on a narrow domain. The two-stage split survives because it's modular and deployable, not because one model can't do the job.

Corn: Before we get to when you'd train something, the vocabulary — because Daniel's instinct deserves a straight answer. Where do classification, detection, and segmentation each sit?

Herman: Classification is one label per image. "This is a lake." No location, no count. Detection is a label plus a box per object — the what and the roughly-where. Segmentation forks: semantic segmentation gives every pixel a class label but no instance separation, so every bird on the lake becomes one big bird-colored blob. Instance segmentation gives each object its own mask — that's what SAM produces and what you want for counting. And promptable segmentation is SAM's own framing: no fixed label set, just return a valid mask given any prompt.

Corn: Run the lake photo through each of those in my head for a second. Classification says "lake." Detection gives me thirty boxes. Semantic segmentation gives me one giant bird-shaped smear where the flock is.

Herman: And instance segmentation is the only one of those that answers "how many." That's the whole reason the vocabulary matters for Daniel's question — not as taxonomy, but because each word corresponds to a different question you might be asking of the photo, and picking the wrong word means building the wrong pipeline. If he'd built a semantic segmentation pipeline, he'd have a beautiful map of bird-colored pixels and no count.

Corn: So nothing in this pipeline is a classifier in the ImageNet sense. The detector is an open-set detector; the segmenter is a mask generator that answers prompts.

Herman: Right. The one place a classifier could legitimately enter the lake story is downstream — you segment a bird, crop the mask, and ask a classifier which species. Some of the published waterfowl work does exactly that: SAM for the mask, a ResNet classifier for the species.

Corn: Now, when would Daniel actually need to train something versus prompting zero-shot? Give me the rule.

Herman: Zero-shot is enough when three things hold: your concept is a common noun phrase, your images look like web photos, and you need boxes or masks rather than species-level IDs. Grounding DINO scores about 52.5 AP zero-shot on COCO — the larger checkpoint reaches 56.7 — which for a weekend lake count is plenty. Fine-tune when the domain is far from web images. And here's the thing — top-down drone views of birds at a hundred meters altitude are exactly that. Web photos are eye-level, close-up, well-lit. A drone image is a hundred gray smudges on gray water.

Corn: Which is why the waterbird literature trained.

Herman: The Texas coastal work did. Supervised Faster R-CNN and RetinaNet on labeled drone imagery, sixteen species of colonial waterbird. They got 67.9 and 63.1 percent mAP overall — and over 90 and 85 percent on the three dominant classes, which were more than seventy percent of all the birds. That's the honest cost of species-level accuracy: you train, you label, and you get "Laughing Gull" versus "Royal Tern," but you pay for it.

Corn: And note the shape of that result — great on the common species, mediocre on the rare ones. The rare birds are exactly the ones a count might care about most.

Herman: That's the long tail problem, and it's brutal in ecological data. The three dominant classes carry the high scores; the thirteenth most common species might have a handful of training examples and a detector that mostly guesses. The headline mAP hides that completely, which is why you read the per-class table before you read the abstract.

Corn: Their engineering details transfer to the lake even if the training doesn't. The tiling.

Herman: The tiling is the part I love. They cut the UAV images into 640 by 640 crops with a 400-pixel sliding-window shift — about 62.5 percent overlap between tiles — specifically so that at least one tile sees a complete bird. Then NMS at intersection-over-union 0.5 to stop double-counting birds that show up in two tiles. And the qualitative findings from a related study: smaller birds are more likely to be missed, and high-entropy environments like reed beds reduce detection reliability. The reeds are working against you at both ends — the detector can't see through them and the segmenter can't decide what's a reed.

Corn: Here it's the same question one level up.

Herman: There's one more reframe before we can hand Daniel a real answer, and both and Roboflow converge on it from opposite ends. The recommended pattern now is: use the big promptable model — SAM 3 — to label your data, then train a small fast supervised detector that detects exactly what you trained it on, in real time, on cheap hardware. 's data engine claims roughly five times faster annotation than humans with SAM 3. The two-stage pipeline you build once is also the labeling engine for the small model you deploy forever.

Corn: So zero-shot versus train was a false fork. It's a sequence — prompt the giant thing to make labels, train the small thing to ship.

Herman: That's the pattern, and it's why I'd tell Daniel: run the pipeline zero-shot this week, count the birds, and if the count needs to hold up — if it's going in a report, or running monthly — then let the pipeline label its own crops and train the small detector from those. The giant model is a teacher, not a product.

Corn: The teacher doesn't ship. The pupil does.

Herman: The pupil runs on hardware you can afford and only knows what you taught it, which on a lake with sixteen species is a feature.

Corn: Counting birds on a lake: never a committee of one.

Herman: Careful.

Hilbert: They've got it right, both of them. The part nobody says is the counting rule. The model will give you masks all day. Whether two birds overlapping in the frame is one bird or two is a decision, and it's not the model's decision. I've been running a bird count on the reservoir since the start of the month. Photos from the north bank, Tuesday and Saturday, my neighbor Ferrens holds the stopwatch because he insists a count taken under seven minutes doesn't count. He did it in four once and he's never let it go.

Corn: Four minutes.

Hilbert: He's proud of it. I've got a hand tally on graph paper next to the automated count, and I keep the paper, because the machine and I disagree about the flock of grebes by the reeds. Two of them overlap for most of every frame. My rule is: if you can see one eye, it's a separate bird. I've had this argument with Ferrens for three weeks now.

Herman: The eye rule is doing the work the intersection-over-union threshold does in the tiling literature — a fixed, slightly arbitrary line that decides when two detections are one object.

Hilbert: Mine's cheaper to compute. I priced a second-hand lens for the north bank shots, by the way. Four hundred and ten shekels at the camera shop on Agrippas. Didn't buy it. The zoom on the phone does the job if you stand still.

Corn: The graph paper tally is the part I can't let go of. You're running the same audit the Roboflow pattern runs — the big model labels, the human checks — except you kept the human and the disagreement.

Hilbert: The disagreement is the interesting output. The machine says eleven on the grebes some weeks. Paper says nine. Ferrens says don't count the grebes at all, they're barely birds. That's a counting rule too, I suppose.

Herman: Your eye rule might actually be stricter than non-max suppression at 0.5. Two overlapping grebes would survive as two detections — the question is whether your eye rule fires on the pixels you actually have.

Hilbert: It fires when I can see the eye. That's the rule. But... no, you've got a point, Corn, I'm the audit. I'd been calling it the count. It's the audit.

Corn: And the count is Ferrens.

Hilbert: The stopwatch is Ferrens. It's his whole operation, really.

Corn: So which stage would you keep, Herman, if someone forced you to drop one for the lake? The boxes or the masks?

Herman: Depends entirely on what Daniel owes anybody at the end. If the deliverable is a number, keep the detector and skip SAM — the count is the boxes, the masks are overhead, and every extra stage is another place for the format-conversion bug. If the deliverable is a cutout, or a size, or anything you'd put next to a photo as evidence, the boxes were always just scaffolding. The masks were the point and the boxes were how you asked for them.

Corn: I'd keep the detector for one selfish reason: it's the stage where my knob settings live. Thresholds I can defend at a meeting. Masks I just have to trust.

Herman: The knob is real responsibility. You can be wrong at 0.35 versus 0.25 in a way the model can never be wrong for you.

Corn: That's the thing I'd leave Daniel with, I think. The pipeline isn't less technical now that one model can do it all — the counting rule, the eye rule, whatever your eye rule is, moved from the plumbing into the person. The model got simpler; the decision didn't.

Herman: And the label engine hiding inside it. The thing he's prompting for free this week is the same thing that labels the small fast model he ships next month.

Corn: Producer credit to Hilbert Flumingtop, who has been at that desk the whole time and, we now learn, runs a bird census with a stopwatch and graph paper. If today's pipeline plumbing made anything click for you, the reviews are how other listeners find the show — a quick rating helps more than you'd think.

Herman: If you want more of this, try episode nineteen, AI Images; episode eleven, How Does Fine Tuning Work Anyway; and episode three, Safetensors or something else. This has been My Weird Prompts. See you tomorrow, Corn.

Corn: See you tomorrow. Watch the reeds.