liveBook · Manning

Prompt encoder

As explained in Deep Learning with Python, Third Edition

A model component that converts a prompt into an embedded vector representation.

A prompt encoder converts a segmentation prompt into an embedded vector that a mask decoder can combine with an image embedding. In Segment Anything, the prompt identifies the object to segment through either a point inside it or a box around it. section 11.3.2

A typical prompt-to-mask workflow is:

  • Encode the input image into a compact image embedding. section 11.3.2
  • Choose a point prompt or a box prompt and map it to a prompt embedding. section 11.3.2
  • Pass both embeddings to the mask decoder to produce several possible object masks. section 11.3.2

Training prompt inputs

Sample an image and an object mask, then randomly choose a point inside the mask or a box surrounding it. Pair the image and prompt with the ground-truth mask. section 11.3.2

Figure 11.8 The Segment Anything high-level architecture overview
sam architecture

Use the architecture overview to see how the image encoder, prompt encoder, and mask decoder fit together. section 11.3.2

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines the component and data flow but defers its modeling techniques and implementation details.
Examples
Uses points inside object masks and boxes surrounding masks as concrete prompt forms.
What it assumes
Assumes familiarity with image embeddings while introducing point and box prompts as segmentation inputs.
What you can do after
Understand how prompts participate in a multi-component segmentation model and training example.
How it connects
Connects image embeddings, mask decoders, image segmentation, and ground-truth masks.

Related concepts

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