Shortcuts

mmedit.datasets.singan_dataset

Module Contents

Classes

SinGANDataset

SinGAN Dataset.

Functions

create_real_pyramid(real, min_size, max_size, ...)

Create image pyramid.

mmedit.datasets.singan_dataset.create_real_pyramid(real, min_size, max_size, scale_factor_init)[源代码]

Create image pyramid.

This function is modified from the official implementation: https://github.com/tamarott/SinGAN/blob/master/SinGAN/functions.py#L221

In this implementation, we adopt the rescaling function from MMCV. :param real: The real image array. :type real: np.array :param min_size: The minimum size for the image pyramid. :type min_size: int :param max_size: The maximum size for the image pyramid. :type max_size: int :param scale_factor_init: The initial scale factor. :type scale_factor_init: float

class mmedit.datasets.singan_dataset.SinGANDataset(data_root, min_size, max_size, scale_factor_init, pipeline, num_samples=- 1)[源代码]

Bases: mmengine.dataset.BaseDataset

SinGAN Dataset.

In this dataset, we create an image pyramid and save it in the cache.

参数
  • img_path (str) – Path to the single image file.

  • min_size (int) – Min size of the image pyramid. Here, the number will be set to the min(H, W).

  • max_size (int) – Max size of the image pyramid. Here, the number will be set to the max(H, W).

  • scale_factor_init (float) – Rescale factor. Note that the actual factor we use may be a little bit different from this value.

  • num_samples (int, optional) – The number of samples (length) in this dataset. Defaults to -1.

full_init()[源代码]

Skip the full init process for SinGANDataset.

load_data_list(min_size, max_size, scale_factor_init)[源代码]

Load annatations for SinGAN Dataset.

参数
  • min_size (int) – The minimum size for the image pyramid.

  • max_size (int) – The maximum size for the image pyramid.

  • scale_factor_init (float) – The initial scale factor.

__getitem__(index)[源代码]

Get :attr:self.data_dict. For SinGAN, we use single image with different resolution to train the model.

参数

idx (int) – This will be ignored in SinGANDataset.

返回

Dict contains input image in different resolution. self.pipeline.

返回类型

dict

__len__()[源代码]

Get the length of filtered dataset and automatically call full_init if the dataset has not been fully init.

返回

The length of filtered dataset.

返回类型

int

Read the Docs v: latest
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.