Shortcuts

BaseAugTransform

class mmpretrain.datasets.transforms.BaseAugTransform(magnitude_level=10, magnitude_range=None, magnitude_std=0.0, total_level=10, prob=0.5, random_negative_prob=0.5)[source]

The base class of augmentation transform for RandAugment.

This class provides several common attributions and methods to support the magnitude level mapping and magnitude level randomness in RandAugment.

Parameters:
  • magnitude_level (int | float) – Magnitude level.

  • magnitude_range (Sequence[number], optional) – For augmentation have magnitude argument, maybe “magnitude”, “angle” or other, you can specify the magnitude level mapping range to generate the magnitude argument. For example, assume total_level is 10, magnitude_level=3 specify magnitude is 3 if magnitude_range=(0, 10) while specify magnitude is 7 if magnitude_range=(10, 0). Defaults to None.

  • magnitude_std (Number | str) –

    Deviation of magnitude noise applied.

    • If positive number, the magnitude obeys normal distribution \(\mathcal{N}(magnitude, magnitude_std)\).

    • If 0 or negative number, magnitude remains unchanged.

    • If str “inf”, the magnitude obeys uniform distribution \(Uniform(min, magnitude)\).

    Defaults to 0.

  • total_level (int | float) – Total level for the magnitude. Defaults to 10.

  • prob (float) – The probability for performing transformation therefore should be in range [0, 1]. Defaults to 0.5.

  • random_negative_prob (float) – The probability that turns the magnitude negative, which should be in range [0,1]. Defaults to 0.

abstract transform(results)

The transform function. All subclass of BaseTransform should override this method.

This function takes the result dict as the input, and can add new items to the dict or modify existing items in the dict. And the result dict will be returned in the end, which allows to concate multiple transforms into a pipeline.

Parameters:

results (dict) – The result dict.

Returns:

The result dict.

Return type:

dict

Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.