@tf.autograph.experimental.do_not_convert
def distort_image_with_autoaugment(image, bboxes, augmentation_name):
    'Applies the AutoAugment policy to `image` and `bboxes`.\n\n  Args:\n    image: `Tensor` of shape [height, width, 3] representing an image.\n    bboxes: `Tensor` of shape [N, 4] representing ground truth boxes that are\n      normalized between [0, 1].\n    augmentation_name: The name of the AutoAugment policy to use. The available\n      options are `v0`, `v1`, `v2`, `v3` and `test`. `v0` is the policy used for\n      all of the results in the paper and was found to achieve the best results\n      on the COCO dataset. `v1`, `v2` and `v3` are additional good policies\n      found on the COCO dataset that have slight variation in what operations\n      were used during the search procedure along with how many operations are\n      applied in parallel to a single image (2 vs 3).\n\n  Returns:\n    A tuple containing the augmented versions of `image` and `bboxes`.\n  '
    logging.info('Using autoaugmention policy: %s', augmentation_name)
    available_policies = {'v0': policy_v0, 'v1': policy_v1, 'v2': policy_v2, 'v3': policy_v3, 'test': policy_vtest}
    if (augmentation_name not in available_policies):
        raise ValueError('Invalid augmentation_name: {}'.format(augmentation_name))
    policy = available_policies[augmentation_name]()
    augmentation_hparams = hparams_config.Config(dict(cutout_max_pad_fraction=0.75, cutout_bbox_replace_with_mean=False, cutout_const=100, translate_const=250, cutout_bbox_const=50, translate_bbox_const=120))
    return build_and_apply_nas_policy(policy, image, bboxes, augmentation_hparams)
Applies the AutoAugment policy to `image` and `bboxes`.

Args:
  image: `Tensor` of shape [height, width, 3] representing an image.
  bboxes: `Tensor` of shape [N, 4] representing ground truth boxes that are
    normalized between [0, 1].
  augmentation_name: The name of the AutoAugment policy to use. The available
    options are `v0`, `v1`, `v2`, `v3` and `test`. `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).

Returns:
  A tuple containing the augmented versions of `image` and `bboxes`.
@tf.autograph.experimental.do_not_convert
def distort_image_with_autoaugment(image, bboxes, augmentation_name):
    'Applies the AutoAugment policy to `image` and `bboxes`.\n\n  Args:\n    image: `Tensor` of shape [height, width, 3] representing an image.\n    bboxes: `Tensor` of shape [N, 4] representing ground truth boxes that are\n      normalized between [0, 1].\n    augmentation_name: The name of the AutoAugment policy to use. The available\n      options are `v0`, `v1`, `v2`, `v3` and `test`. `v0` is the policy used for\n      all of the results in the paper and was found to achieve the best results\n      on the COCO dataset. `v1`, `v2` and `v3` are additional good policies\n      found on the COCO dataset that have slight variation in what operations\n      were used during the search procedure along with how many operations are\n      applied in parallel to a single image (2 vs 3).\n\n  Returns:\n    A tuple containing the augmented versions of `image` and `bboxes`.\n  '
    logging.info('Using autoaugmention policy: %s', augmentation_name)
    available_policies = {'v0': policy_v0, 'v1': policy_v1, 'v2': policy_v2, 'v3': policy_v3, 'test': policy_vtest}
    if (augmentation_name not in available_policies):
        raise ValueError('Invalid augmentation_name: {}'.format(augmentation_name))
    policy = available_policies[augmentation_name]()
    augmentation_hparams = hparams_config.Config(dict(cutout_max_pad_fraction=0.75, cutout_bbox_replace_with_mean=False, cutout_const=100, translate_const=250, cutout_bbox_const=50, translate_bbox_const=120))
    return build_and_apply_nas_policy(policy, image, bboxes, augmentation_hparams)