Skip to main content

ImageEmbeddingConverter

Converter
DashAI.back.converters.hugging_face.ImageEmbeddingConverter

HuggingFace image embedding converter.

Encodes every image column into dense float columns using a pretrained vision model. Unlike the text Embedding converter this template is based on, the source image column is kept by default, controlled by keep_source_column, so a later stage can still reach the original pixels of the same saved dataset.

Parameters

model_name : string, default=DINOv2 small
Pretrained vision model used to encode images. All options are Apache 2.0 licensed, which is compatible with this project.
device : string, default=CPU
Device to use for computation.
batch_size : integer, default=32
Number of images to process at once.
keep_source_column : boolean, default=True
When enabled, the original image column is kept alongside the new embedding columns instead of being removed.

Methods

fit(self, x: 'DashAIDataset', y: 'DashAIDataset' = None) -> 'ImageEmbeddingConverter'

Defined on ImageEmbeddingConverter

Validate the input dataset and load the vision model if needed.

Parameters

x : DashAIDataset
Input dataset whose columns must all be image typed.
y : DashAIDataset or None, optional
Ignored. Present for API compatibility. Default None.

Returns

ImageEmbeddingConverter
The fitted converter instance (self).

get_output_type(self, column_name: str = None) -> DashAI.back.types.dashai_data_type.DashAIDataType

Defined on ImageEmbeddingConverter

Return the DashAI type produced for a given output column.

Parameters

column_name : str or None, optional
Name of the output column. Default None.

Returns

DashAIDataType
The type recorded in :attr:column_types when column_name is one of the original columns carried through, for example the source image column when keep_source_column is true. Otherwise, a DashAI Float type backed by pyarrow.float32(), since every column this converter adds is an embedding column.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_metadata(cls) -> 'Dict[str, Any]'

Defined on BaseConverter

Get metadata for the converter, used by the DashAI frontend.

Parameters

cls : type
The converter class (injected automatically by Python for classmethods).

Returns

Dict[str, Any]
Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

transform(self, x: 'DashAIDataset', y: 'DashAIDataset' = None) -> 'DashAIDataset'

Defined on HuggingFaceWrapper

Transform the input dataset by running inference in batches.

Parameters

x : DashAIDataset
The dataset to transform. Must have been fitted first.
y : DashAIDataset or None, optional
Ignored. Present for API compatibility. Default None.

Returns

DashAIDataset
Transformed dataset with output types set per column.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.