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[source]
class mmedit.datasets.transforms.random_degradations.RandomBlur(params, keys)[source]

Apply random blur to the input.

Modified keys are the attributed specified in “keys”.

Parameters
  • 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)[source]

This is the function to create kernel.

Parameters

num_kernels (int) – the number of kernels

Returns

_description_

Return type

_type_

_apply_random_blur(imgs)[source]

This is the function to apply blur operation on images.

Parameters

imgs (Tensor) – images

Returns

Images applied blur

Return type

Tensor

__call__(results)[source]
__repr__()[source]

Return repr(self).

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

Apply random JPEG compression to the input.

Modified keys are the attributed specified in “keys”.

Parameters
  • 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)[source]
__call__(results)[source]
__repr__()[source]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomNoise(params, keys)[source]

Apply random noise to the input.

Currently support Gaussian noise and Poisson noise.

Modified keys are the attributed specified in “keys”.

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

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

_apply_gaussian_noise(imgs)[source]

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

Parameters

imgs (Tensor) – images

Returns

images applied gaussian noise

Return type

Tensor

_apply_poisson_noise(imgs)[source]
_apply_random_noise(imgs)[source]

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

Parameters

imgs (Tensor) – training images

Returns

_description_

Return type

_type_

__call__(results)[source]
__repr__()[source]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomResize(params, keys)[source]

Randomly resize the input.

Modified keys are the attributed specified in “keys”.

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

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

_random_resize(imgs)[source]

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

Parameters

imgs (Tensor) – training images.

Returns

images after radomly resized

Return type

Tensor

__call__(results)[source]
__repr__()[source]

Return repr(self).

class mmedit.datasets.transforms.random_degradations.RandomVideoCompression(params, keys)[source]

Apply random video compression to the input.

Modified keys are the attributed specified in “keys”.

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

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

_apply_random_compression(imgs)[source]

This is the function to apply random compression on images.

Parameters

imgs (Tensor) – training images

Returns

images after randomly compressed

Return type

Tensor

__call__(results)[source]
__repr__()[source]

Return repr(self).

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

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”.

Parameters
  • 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)[source]
__call__(results)[source]
__repr__()[source]

Return repr(self).

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

Free document hosting provided by Read the Docs.