> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphext.com/llms.txt
> Use this file to discover all available pages before exploring further.

# embed_images

> Embed images using pretrained DL models. 

An embedding vector is a numerical representation of an image (or text etc.), such that different numerical components
of the vector capture different dimensions of the image's content. Embeddings can be used, for example, to calculate
the *semantic similarity* between pairs of images (see `link_embeddings`, for example, to create a network of images
connected by similarity).

In its current form the step calculates image embeddings using [Clip](https://huggingface.co/docs/transformers/model_doc/clip),
which has been trained on 400M image/text pairs to pick out an image's correct caption from a list of candidates.

## Usage

The following example shows how the step can be used in a recipe.

<Accordion title="Examples" icon="code" defaultOpen="true">
  <Tabs>
    <Tab title="Example 1">
      The step has no required parameters, so the simplest call is simply

      ```stan theme={null}
      embed_images(ds.image_url) -> (ds.embedding)
      ```
    </Tab>

    <Tab title="Signature">
      General syntax for using the step in a recipe. Shows the inputs and outputs the step is expected to receive and will produce respectively. For futher details see sections below.

      ```stan theme={null}
      embed_images(images: url, {
          "param": value,
          ...
      }) -> (embedding: list[number])
      ```
    </Tab>
  </Tabs>
</Accordion>

## Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally
columns (`ds.first_name`), datasets (`ds` or `ds[["first_name", "last_name"]]`) or models (referenced
by name e.g. `"churn-clf"`).

<Accordion title="Inputs" icon="right-to-bracket">
  <ParamField path="images" type="column[url]" required>
    A column of URLs to images to calculate embeddings for.
  </ParamField>
</Accordion>

<Accordion title="Outputs" icon="right-from-bracket">
  <ParamField path="embedding" type="column[list[number]]" required>
    A column of embedding vectors capturing the meaning of each input image.
  </ParamField>
</Accordion>

## Configuration

The following parameters can be used to configure the behaviour of the step by including them in
a json object as the last "input" to the step, i.e. `step(..., {"param": "value", ...}) -> (output)`.

<Accordion title="Parameters" defaultOpen="true" icon="sliders">
  <ParamField path="normalize" type="boolean" default="true">
    Whether to normalize embedding vectors (to length/norm of 1.0).
  </ParamField>
</Accordion>
