Shortcuts

mmagic.datasets.textual_inversion_dataset

Module Contents

Classes

TextualInversionDataset

Dataset for DreamBooth.

Attributes

imagenet_templates_small

imagenet_style_templates_small

mmagic.datasets.textual_inversion_dataset.imagenet_templates_small = ['a photo of a {}', 'a rendering of a {}', 'a cropped photo of the {}', 'the photo of a {}', 'a...[源代码]
mmagic.datasets.textual_inversion_dataset.imagenet_style_templates_small = ['a painting in the style of {}', 'a rendering in the style of {}', 'a cropped painting in the...[源代码]
class mmagic.datasets.textual_inversion_dataset.TextualInversionDataset(data_root: str, concept_dir: str, placeholder: str, is_style: bool = False, pipeline: List[Union[dict, Callable]] = [])[源代码]

Bases: mmengine.dataset.BaseDataset

Dataset for DreamBooth.

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

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

  • is_style (bool) –

  • prompt (str) – Prompt of the concept.

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

load_data_list() list[源代码]

Load data list from concept_dir and class_dir.

prepare_data(idx)[源代码]

Get data processed by self.pipeline.

参数

idx (int) – The index of data_info.

返回

Depends on self.pipeline.

返回类型

Any