embed_images

Function

Vectorizes a given image.

Prototype

def embed_images(images, batch_size)

Parameters

Parameter

Data Type

Required/Optional

Description

images

Union[List[str], List[Image.Image]]

Required

For the List[str] type, each element in the list is a string corresponding to the Base64-encoded image. The list length range is [1, 1000], and the length range of each element is [1, 10 × 1024 × 1024]. The List[Image.Image] type indicates that the input data type is PIL.Image.Image.

batch_size

Integer

Optional

Batch size. images of batch_size is combined for embedding each time. The value range is [1, 1024]. The default value is 32. The value is determined by the device's graphics memory.

Return Value

Data Type

Description

List[List[float]]

Vector array after the conversion of images.

If images is an array whose length is 4 and the output of the embedding model is a 512-dimensional vector, the final output result is an array of size (4, 512).