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:
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 |
cutout_const
|
multiplier for applying cutout. |
translate_const
|
multiplier for applying translation. |
Raises | |
|---|---|
ValueError if augmentation_name is unsupported.
|
Methods
deit3_three_augment
@staticmethoddeit3_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
@staticmethoddetection_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
distort(
image: tf.Tensor
) -> tf.Tensor
See base class.
distort_with_boxes
distort_with_boxes(
image: tf.Tensor, bboxes: tf.Tensor
) -> Tuple[tf.Tensor, tf.Tensor]
See base class.
panoptic_deeplab_policy
@staticmethodpanoptic_deeplab_policy()
policy_reduced_cifar10
@staticmethodpolicy_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
@staticmethodpolicy_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
@staticmethodpolicy_simple()
Same as policy_v0, except with custom ops removed.
policy_svhn
@staticmethodpolicy_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
@staticmethodpolicy_test()
Autoaugment test policy for debugging.
policy_v0
@staticmethodpolicy_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
@staticmethodvit()
Autoaugment policy for a generic ViT.
View source on GitHub