Shortcuts

mmagic.datasets.unpaired_image_dataset

Module Contents

Classes

UnpairedImageDataset

General unpaired image folder dataset for image generation.

Attributes

IMG_EXTENSIONS

mmagic.datasets.unpaired_image_dataset.IMG_EXTENSIONS = ('.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP', '.tif',...[source]
class mmagic.datasets.unpaired_image_dataset.UnpairedImageDataset(data_root, pipeline, io_backend: Optional[str] = None, test_mode=False, domain_a='A', domain_b='B')[source]

Bases: mmengine.dataset.BaseDataset

General unpaired image folder dataset for image generation.

It assumes that the training directory of images from domain A is ‘/path/to/data/trainA’, and that from domain B is ‘/path/to/data/trainB’, respectively. ‘/path/to/data’ can be initialized by args ‘dataroot’. During test time, the directory is ‘/path/to/data/testA’ and ‘/path/to/data/testB’, respectively.

Parameters
  • dataroot (str | Path) – Path to the folder root of unpaired images.

  • pipeline (List[dict | callable]) – A sequence of data transformations.

  • io_backend (str, optional) – The storage backend type. Options are “disk”, “ceph”, “memcached”, “lmdb”, “http” and “petrel”. Default: None.

  • test_mode (bool) – Store True when building test dataset. Default: False.

  • domain_a (str, optional) – Domain of images in trainA / testA. Defaults to ‘A’.

  • domain_b (str, optional) – Domain of images in trainB / testB. Defaults to ‘B’.

load_data_list()[source]

Load the data list.

Returns

The data info list of source and target domain.

Return type

list

_load_domain_data_list(dataroot)[source]

Load unpaired image paths of one domain.

Parameters

dataroot (str) – Path to the folder root for unpaired images of one domain.

Returns

List that contains unpaired image paths of one domain.

Return type

list[dict]

get_data_info(idx) dict[source]

Get annotation by index and automatically call full_init if the dataset has not been fully initialized.

Parameters

idx (int) – The index of data.

Returns

The idx-th annotation of the dataset.

Return type

dict

__len__()[source]

The length of the dataset.

scan_folder(path)[source]

Obtain image path list (including sub-folders) from a given folder.

Parameters

path (str | Path) – Folder path.

Returns

Image list obtained from the given folder.

Return type

list[str]

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.