liveBook · Manning

Box prompt

As explained in Deep Learning with R, Third Edition

A box prompt is an image-segmentation input that approximately bounds the object to be segmented with a rectangular region.

A box prompt is an approximate rectangle around an object that guides an image-segmentation model toward the object’s mask. The rectangle does not need to be precise. section 11.4.4

Segment Anything combines the image embedding with a prompt embedding, then produces several candidate masks. Training creates box prompts by drawing a rectangle around every point inside a selected ground-truth mask. section 11.4.2

Creating a training box

Given an image and a selected object mask, collect all pixels labeled as part of the object and draw the smallest rectangle enclosing them. Pair the image, rectangle, and mask as one training example. section 11.4.2

A box prompt fits into a broader prompting workflow:

  • Use a box when an approximate object boundary is easier to provide than a precise pixel mask. section 11.4.4
  • Combine prompting with Segment Anything’s predicted masks, which can include multiple alternatives ranked by predicted quality. section 11.4.4
  • Treat point prompts as an alternative input, especially when foreground and background points can clarify an ambiguous object. section 11.4.4

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines the prompt and explains its mask-based training construction, but defers prompt-encoder and mask-decoder internals.
Examples
Uses rectangles drawn around selected ground-truth masks and contrasts them with point prompts for objects such as peaches and bananas.
What you can do after
Apply it via Segment Anything to guide object-mask prediction with an approximate rectangular region.
How it connects
Connects image segmentation with point prompts, prompt encoders, mask decoders, and pretrained segmentation models.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.