tfm.vision.augment.AutoAugment

View source on GitHub

Applies the AutoAugment policy to images.

Inherits From: ImageAugment

tfm.vision.augment.AutoAugment(
 augmentation_name: str = 'v0',
 policies: Optional[Iterable[Iterable[Tuple[str, float, float]]]] = None,
 cutout_const: float = 100,
 translate_const: float = 250
)

AutoAugment is from the paper: https://arxiv.org/abs/1805.09501

Args

augmentation_name The name of the AutoAugment policy to use. The available options are v0, test, reduced_cifar10, svhn and reduced_imagenet. v0 is the policy used for all of the results in the paper and was found to achieve the best results on the COCO dataset. v1, v2 and v3 are additional good policies found on the COCO dataset that have slight variation in what operations were used during the search procedure along with how many operations are applied in parallel to a single image (2 vs 3). Make sure to set policies to None (the default) if you want to set options using augmentation_name.
policies list of lists of tuples in the form (func, prob, level), func is a string name of the augmentation function, prob is the probability of applying the func operation, level (or magnitude) is the input argument for func. For example:

[[('Equalize', 0.9, 3), ('Color', 0.7, 8)],
 [('Invert', 0.6, 5), ('Rotate', 0.2, 9), ('ShearX', 0.1, 2)], ...]

The outer-most list must be 3-d. The number of operations in a sub-policy can vary from one sub-policy to another. If you provide policies as input, any option set with augmentation_name will get overriden as they are mutually exclusive.

cutout_const multiplier for applying cutout.
translate_const multiplier for applying translation.

Raises

ValueError if augmentation_name is unsupported.

Methods

deit3_three_augment

View source

@staticmethod
deit3_three_augment()

Autoaugment policy for three augmentations.

Proposed in paper: https://arxiv.org/abs/2204.07118

Each tuple is an augmentation operation of the form (operation, probability, magnitude). Each element in policy is a sub-policy that will be applied on the image. Randomly chooses one of the three augmentation to apply on image.

Returns
the policy.

detection_policy_v0

View source

@staticmethod
detection_policy_v0()

Autoaugment policy that was used in AutoAugment Paper for Detection.

https://arxiv.org/pdf/1906.11172

Each tuple is an augmentation operation of the form (operation, probability, magnitude). Each element in policy is a sub-policy that will be applied sequentially on the image.

Returns
the policy.

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.

panoptic_deeplab_policy

View source

@staticmethod
panoptic_deeplab_policy()

policy_reduced_cifar10

View source

@staticmethod
policy_reduced_cifar10()

Autoaugment policy for reduced CIFAR-10 dataset.

Result is from the AutoAugment paper: https://arxiv.org/abs/1805.09501

Each tuple is an augmentation operation of the form (operation, probability, magnitude). Each element in policy is a sub-policy that will be applied sequentially on the image.

Returns
the policy.

policy_reduced_imagenet

View source

@staticmethod
policy_reduced_imagenet()

Autoaugment policy for reduced ImageNet dataset.

Result is from the AutoAugment paper: https://arxiv.org/abs/1805.09501

Each tuple is an augmentation operation of the form (operation, probability, magnitude). Each element in policy is a sub-policy that will be applied sequentially on the image.

Returns
the policy.

policy_simple

View source

@staticmethod
policy_simple()

Same as policy_v0, except with custom ops removed.

policy_svhn

View source

@staticmethod
policy_svhn()

Autoaugment policy for SVHN dataset.

Result is from the AutoAugment paper: https://arxiv.org/abs/1805.09501

Each tuple is an augmentation operation of the form (operation, probability, magnitude). Each element in policy is a sub-policy that will be applied sequentially on the image.

Returns
the policy.

policy_test

View source

@staticmethod
policy_test()

Autoaugment test policy for debugging.

policy_v0

View source

@staticmethod
policy_v0()

Autoaugment policy that was used in AutoAugment Paper.

Each tuple is an augmentation operation of the form (operation, probability, magnitude). Each element in policy is a sub-policy that will be applied sequentially on the image.

Returns
the policy.

vit

View source

@staticmethod
vit()

Autoaugment policy for a generic ViT.

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.