def _apply_bbox_augmentation(image, bbox, augmentation_func, *args):
    'Applies augmentation_func to the subsection of image indicated by bbox.\n\n  Args:\n    image: 3D uint8 Tensor.\n    bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n      of type float that represents the normalized coordinates between 0 and 1.\n    augmentation_func: Augmentation function that will be applied to the\n      subsection of image.\n    *args: Additional parameters that will be passed into augmentation_func\n      when it is called.\n\n  Returns:\n    A modified version of image, where the bbox location in the image will\n    have `ugmentation_func applied to it.\n  '
    image_height = tf.to_float(tf.maximum(tf.shape(image)[0], 10))
    image_width = tf.to_float(tf.maximum(tf.shape(image)[1], 10))
    min_y = tf.to_int32((image_height * bbox[0]))
    min_x = tf.to_int32((image_width * bbox[1]))
    max_y = tf.to_int32((image_height * bbox[2]))
    max_x = tf.to_int32((image_width * bbox[3]))
    image_height = tf.to_int32(image_height)
    image_width = tf.to_int32(image_width)
    max_y = tf.minimum(max_y, (image_height - 1))
    max_x = tf.minimum(max_x, (image_width - 1))
    bbox_content = image[min_y:(max_y + 1), min_x:(max_x + 1), :]
    augmented_bbox_content = augmentation_func(bbox_content, *args)
    augmented_bbox_content = tf.pad(augmented_bbox_content, [[min_y, ((image_height - 1) - max_y)], [min_x, ((image_width - 1) - max_x)], [0, 0]])
    mask_tensor = tf.zeros_like(bbox_content)
    mask_tensor = tf.pad(mask_tensor, [[min_y, ((image_height - 1) - max_y)], [min_x, ((image_width - 1) - max_x)], [0, 0]], constant_values=1)
    image = ((image * mask_tensor) + augmented_bbox_content)
    return image
Applies augmentation_func to the subsection of image indicated by bbox.

Args:
  image: 3D uint8 Tensor.
  bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)
    of type float that represents the normalized coordinates between 0 and 1.
  augmentation_func: Augmentation function that will be applied to the
    subsection of image.
  *args: Additional parameters that will be passed into augmentation_func
    when it is called.

Returns:
  A modified version of image, where the bbox location in the image will
  have `ugmentation_func applied to it.
def _apply_bbox_augmentation(image, bbox, augmentation_func, *args):
    'Applies augmentation_func to the subsection of image indicated by bbox.\n\n  Args:\n    image: 3D uint8 Tensor.\n    bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n      of type float that represents the normalized coordinates between 0 and 1.\n    augmentation_func: Augmentation function that will be applied to the\n      subsection of image.\n    *args: Additional parameters that will be passed into augmentation_func\n      when it is called.\n\n  Returns:\n    A modified version of image, where the bbox location in the image will\n    have `ugmentation_func applied to it.\n  '
    image_height = tf.to_float(tf.maximum(tf.shape(image)[0], 10))
    image_width = tf.to_float(tf.maximum(tf.shape(image)[1], 10))
    min_y = tf.to_int32((image_height * bbox[0]))
    min_x = tf.to_int32((image_width * bbox[1]))
    max_y = tf.to_int32((image_height * bbox[2]))
    max_x = tf.to_int32((image_width * bbox[3]))
    image_height = tf.to_int32(image_height)
    image_width = tf.to_int32(image_width)
    max_y = tf.minimum(max_y, (image_height - 1))
    max_x = tf.minimum(max_x, (image_width - 1))
    bbox_content = image[min_y:(max_y + 1), min_x:(max_x + 1), :]
    augmented_bbox_content = augmentation_func(bbox_content, *args)
    augmented_bbox_content = tf.pad(augmented_bbox_content, [[min_y, ((image_height - 1) - max_y)], [min_x, ((image_width - 1) - max_x)], [0, 0]])
    mask_tensor = tf.zeros_like(bbox_content)
    mask_tensor = tf.pad(mask_tensor, [[min_y, ((image_height - 1) - max_y)], [min_x, ((image_width - 1) - max_x)], [0, 0]], constant_values=1)
    image = ((image * mask_tensor) + augmented_bbox_content)
    return image