Shortcuts

mmagic.datasets.textual_inversion_dataset

Module Contents

Classes

TextualInversionDataset

Dataset for Textual Inversion and ViCo.

class mmagic.datasets.textual_inversion_dataset.TextualInversionDataset(data_root: str, concept_dir: str, placeholder: str, template: str, with_image_reference: bool = False, pipeline: List[Union[dict, Callable]] = [])[source]

Bases: mmengine.dataset.BaseDataset

Dataset for Textual Inversion and ViCo.

Parameters
  • data_root (str) – Path to the data root.

  • concept_dir (str) – Path to the concept images.

  • placeholder (str) – A string to denote the concept.

  • template (list[str]) – A list of strings like ‘A photo of {}’.

  • with_image_reference (bool) – Is used for vico training.

  • pipeline (list[dict | callable]) – A sequence of data transforms.

load_data_list() list[source]

Load data list from concept_dir and class_dir.

prepare_data(idx)[source]

Get data processed by self.pipeline.

Parameters

idx (int) – The index of data_info.

Returns

Depends on self.pipeline.

Return type

Any

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.