def apply_bbox_cutout(image, bboxes, pad_fraction):
    'Applies cutout to a single bounding box within image.'
    random_index = tf.random_uniform(shape=[], maxval=tf.shape(bboxes)[0], dtype=tf.int32)
    chosen_bbox = tf.gather(bboxes, random_index)
    (mask, mean) = _cutout_inside_bbox(image, chosen_bbox, pad_fraction)
    replace = (mean if replace_with_mean else 128)
    image = tf.where(tf.equal(mask, 0), tf.cast((tf.ones_like(image, dtype=image.dtype) * replace), dtype=image.dtype), image)
    return image
Applies cutout to a single bounding box within image.
def apply_bbox_cutout(image, bboxes, pad_fraction):
    
    random_index = tf.random_uniform(shape=[], maxval=tf.shape(bboxes)[0], dtype=tf.int32)
    chosen_bbox = tf.gather(bboxes, random_index)
    (mask, mean) = _cutout_inside_bbox(image, chosen_bbox, pad_fraction)
    replace = (mean if replace_with_mean else 128)
    image = tf.where(tf.equal(mask, 0), tf.cast((tf.ones_like(image, dtype=image.dtype) * replace), dtype=image.dtype), image)
    return image