tfm.vision.augment.RandAugment
Stay organized with collections
Save and categorize content based on your preferences.
Applies the RandAugment policy to images.
Inherits From: ImageAugment
tfm.vision.augment.RandAugment(
num_layers: int = 2,
magnitude: float = 10.0,
cutout_const: float = 40.0,
translate_const: float = 100.0,
magnitude_std: float = 0.0,
prob_to_apply: Optional[float] = None,
exclude_ops: Optional[List[str]] = None
)
RandAugment is from the paper https://arxiv.org/abs/1909.13719
Args |
num_layers
|
Integer, the number of augmentation transformations to apply
sequentially to an image. Represented as (N) in the paper. Usually best
values will be in the range [1, 3].
|
magnitude
|
Integer, shared magnitude across all augmentation operations.
Represented as (M) in the paper. Usually best values are in the range
[5, 10].
|
cutout_const
|
multiplier for applying cutout.
|
translate_const
|
multiplier for applying translation.
|
magnitude_std
|
randomness of the severity as proposed by the authors of
the timm library.
|
prob_to_apply
|
The probability to apply the selected augmentation at each
layer.
|
exclude_ops
|
exclude selected operations.
|
Methods
build_for_detection
View source
@classmethod
build_for_detection(
num_layers: int = 2,
magnitude: float = 10.0,
cutout_const: float = 40.0,
translate_const: float = 100.0,
magnitude_std: float = 0.0,
prob_to_apply: Optional[float] = None,
exclude_ops: Optional[List[str]] = None
)
Builds a RandAugment that modifies bboxes for geometric transforms.
distort
View source
distort(
image: tf.Tensor
) -> tf.Tensor
See base class.
distort_with_boxes
View source
distort_with_boxes(
image: tf.Tensor, bboxes: tf.Tensor
) -> Tuple[tf.Tensor, tf.Tensor]
See base class.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-02-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-02-02 UTC."],[],[],null,["# tfm.vision.augment.RandAugment\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/augment.py#L2351-L2498) |\n\nApplies the RandAugment policy to images.\n\nInherits From: [`ImageAugment`](../../../tfm/vision/augment/ImageAugment) \n\n tfm.vision.augment.RandAugment(\n num_layers: int = 2,\n magnitude: float = 10.0,\n cutout_const: float = 40.0,\n translate_const: float = 100.0,\n magnitude_std: float = 0.0,\n prob_to_apply: Optional[float] = None,\n exclude_ops: Optional[List[str]] = None\n )\n\nRandAugment is from the paper \u003chttps://arxiv.org/abs/1909.13719\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `num_layers` | Integer, the number of augmentation transformations to apply sequentially to an image. Represented as (N) in the paper. Usually best values will be in the range \\[1, 3\\]. |\n| `magnitude` | Integer, shared magnitude across all augmentation operations. Represented as (M) in the paper. Usually best values are in the range \\[5, 10\\]. |\n| `cutout_const` | multiplier for applying cutout. |\n| `translate_const` | multiplier for applying translation. |\n| `magnitude_std` | randomness of the severity as proposed by the authors of the timm library. |\n| `prob_to_apply` | The probability to apply the selected augmentation at each layer. |\n| `exclude_ops` | exclude selected operations. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `build_for_detection`\n\n[View source](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/augment.py#L2401-L2430) \n\n @classmethod\n build_for_detection(\n num_layers: int = 2,\n magnitude: float = 10.0,\n cutout_const: float = 40.0,\n translate_const: float = 100.0,\n magnitude_std: float = 0.0,\n prob_to_apply: Optional[float] = None,\n exclude_ops: Optional[List[str]] = None\n )\n\nBuilds a RandAugment that modifies bboxes for geometric transforms.\n\n### `distort`\n\n[View source](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/augment.py#L2488-L2491) \n\n distort(\n image: tf.Tensor\n ) -\u003e tf.Tensor\n\nSee base class.\n\n### `distort_with_boxes`\n\n[View source](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/augment.py#L2493-L2498) \n\n distort_with_boxes(\n image: tf.Tensor, bboxes: tf.Tensor\n ) -\u003e Tuple[tf.Tensor, tf.Tensor]\n\nSee base class."]]