Shortcuts

mmedit.datasets.transforms.random_degradations

Module Contents

Classes

RandomBlur

Apply random blur to the input.

RandomJPEGCompression

Apply random JPEG compression to the input.

RandomNoise

Apply random noise to the input.

RandomResize

Randomly resize the input.

RandomVideoCompression

Apply random video compression to the input.

DegradationsWithShuffle

Apply random degradations to input, with degradations being shuffled.

Attributes

has_av

allowed_degradations

mmedit.datasets.transforms.random_degradations.has_av = True[源代码]
class mmedit.datasets.transforms.random_degradations.RandomBlur(params, keys)[源代码]

Apply random blur to the input.

Modified keys are the attributed specified in “keys”.

参数
  • params (dict) – A dictionary specifying the degradation settings.

  • keys (list[str]) – A list specifying the keys whose values are modified.

get_kernel(num_kernels: int)[源代码]

This is the function to create kernel.

参数

num_kernels (int) – the number of kernels

返回

_description_

返回类型

_type_

_apply_random_blur(imgs)[源代码]

This is the function to apply blur operation on images.

参数

imgs (Tensor) – images

返回

Images applied blur

返回类型

Tensor

__call__(results)[源代码]
__repr__()[源代码]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomJPEGCompression(params, keys, color_type='color', bgr2rgb=False)[源代码]

Apply random JPEG compression to the input.

Modified keys are the attributed specified in “keys”.

参数
  • params (dict) – A dictionary specifying the degradation settings.

  • keys (list[str]) – A list specifying the keys whose values are modified.

  • bgr2rgb (str) – Whether change channel order. Default: False.

_apply_random_compression(imgs)[源代码]
__call__(results)[源代码]
__repr__()[源代码]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomNoise(params, keys)[源代码]

Apply random noise to the input.

Currently support Gaussian noise and Poisson noise.

Modified keys are the attributed specified in “keys”.

参数
  • params (dict) – A dictionary specifying the degradation settings.

  • keys (list[str]) – A list specifying the keys whose values are modified.

_apply_gaussian_noise(imgs)[源代码]

This is the function used to apply gaussian noise on images.

参数

imgs (Tensor) – images

返回

images applied gaussian noise

返回类型

Tensor

_apply_poisson_noise(imgs)[源代码]
_apply_random_noise(imgs)[源代码]

This is the function used to apply random noise on images.

参数

imgs (Tensor) – training images

返回

_description_

返回类型

_type_

__call__(results)[源代码]
__repr__()[源代码]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomResize(params, keys)[源代码]

Randomly resize the input.

Modified keys are the attributed specified in “keys”.

参数
  • params (dict) – A dictionary specifying the degradation settings.

  • keys (list[str]) – A list specifying the keys whose values are modified.

_random_resize(imgs)[源代码]

This is the function used to randomly resize images for training augmentation.

参数

imgs (Tensor) – training images.

返回

images after radomly resized

返回类型

Tensor

__call__(results)[源代码]
__repr__()[源代码]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomVideoCompression(params, keys)[源代码]

Apply random video compression to the input.

Modified keys are the attributed specified in “keys”.

参数
  • params (dict) – A dictionary specifying the degradation settings.

  • keys (list[str]) – A list specifying the keys whose values are modified.

_apply_random_compression(imgs)[源代码]

This is the function to apply random compression on images.

参数

imgs (Tensor) – training images

返回

images after randomly compressed

返回类型

Tensor

__call__(results)[源代码]
__repr__()[源代码]

Return repr(self).

mmedit.datasets.transforms.random_degradations.allowed_degradations[源代码]
class mmedit.datasets.transforms.random_degradations.DegradationsWithShuffle(degradations, keys, shuffle_idx=None)[源代码]

Apply random degradations to input, with degradations being shuffled.

Degradation groups are supported. The order of degradations within the same group is preserved. For example, if we have degradations = [a, b, [c, d]] and shuffle_idx = None, then the possible orders are

[a, b, [c, d]]
[a, [c, d], b]
[b, a, [c, d]]
[b, [c, d], a]
[[c, d], a, b]
[[c, d], b, a]

Modified keys are the attributed specified in “keys”.

参数
  • degradations (list[dict]) – The list of degradations.

  • keys (list[str]) – A list specifying the keys whose values are modified.

  • shuffle_idx (list | None, optional) – The degradations corresponding to these indices are shuffled. If None, all degradations are shuffled. Default: None.

_build_degradations(degradations)[源代码]
__call__(results)[源代码]
__repr__()[源代码]

Return repr(self).

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.