# Path: preprocessing/tf_image.py
# def _assert(cond, ex_type, msg):
# def _is_tensor(x):
# def _ImageDimensions(image):
# def _Check3DImage(image, require_static=True):
# def fix_image_flip_shape(image, result):
# def bboxes_crop_or_pad(bboxes,
#                        height, width,
#                        offset_y, offset_x,
#                        target_height, target_width):
# def resize_image_bboxes_with_crop_or_pad(image, bboxes,
#                                          target_height, target_width):
#         def max_(x, y):
#         def min_(x, y):
#         def equal_(x, y):
# def resize_image(image, size,
#                  method=tf.image.ResizeMethod.BILINEAR,
#                  align_corners=False):
# def random_flip_left_right(image, bboxes, seed=None):
#     def flip_bboxes(bboxes):
# def random_flip_up_down(image, bboxes, seed=None):
#     def flip_bboxes(bboxes):
# def random_rot90(image, bboxes, seed=None):
#     def _rot_bboxes(bboxes):


from enum import Enum, IntEnum
from tensorflow.python.ops import control_flow_ops
from preprocessing import tf_image
import numpy as np
import tensorflow as tf
import tf_extended as tfe
    with tf.name_scope(scope):
        if image.get_shape().ndims != 3:
            raise ValueError('Input must be of size [height, width, C>0]')

        image = tf.to_float(image)
        image = tf_image_whitened(image, [_R_MEAN, _G_MEAN, _B_MEAN])

        # Add image rectangle to bboxes.
        bbox_img = tf.constant([[0., 0., 1., 1.]])
        if bboxes is None:
            bboxes = bbox_img
        else:
            bboxes = tf.concat([bbox_img, bboxes], axis=0)

        if resize == Resize.NONE:
            # No resizing...
            pass
        elif resize == Resize.CENTRAL_CROP:
            # Central cropping of the image.
            image, bboxes = tf_image.resize_image_bboxes_with_crop_or_pad(
                image, bboxes, out_shape[0], out_shape[1])
        elif resize == Resize.PAD_AND_RESIZE:
            # Resize image first: find the correct factor...
            shape = tf.shape(image)
            factor = tf.minimum(tf.to_double(1.0),
                                tf.minimum(tf.to_double(out_shape[0] / shape[0]),
                                           tf.to_double(out_shape[1] / shape[1])))
            resize_shape = factor * tf.to_double(shape[0:2])
            resize_shape = tf.cast(tf.floor(resize_shape), tf.int32)


# Path: preprocessing/tf_image.py
# def _assert(cond, ex_type, msg):
# def _is_tensor(x):
# def _ImageDimensions(image):
# def _Check3DImage(image, require_static=True):
# def fix_image_flip_shape(image, result):
# def bboxes_crop_or_pad(bboxes,
#                        height, width,
#                        offset_y, offset_x,
#                        target_height, target_width):
# def resize_image_bboxes_with_crop_or_pad(image, bboxes,
#                                          target_height, target_width):
#         def max_(x, y):
#         def min_(x, y):
#         def equal_(x, y):
# def resize_image(image, size,
#                  method=tf.image.ResizeMethod.BILINEAR,
#                  align_corners=False):
# def random_flip_left_right(image, bboxes, seed=None):
#     def flip_bboxes(bboxes):
# def random_flip_up_down(image, bboxes, seed=None):
#     def flip_bboxes(bboxes):
# def random_rot90(image, bboxes, seed=None):
#     def _rot_bboxes(bboxes):


# Path: preprocessing/ssd_vgg_preprocessing.py
from enum import Enum, IntEnum
from tensorflow.python.ops import control_flow_ops
from preprocessing import tf_image
import numpy as np
import tensorflow as tf
import tf_extended as tfe

    with tf.name_scope(scope):
        if image.get_shape().ndims != 3:
            raise ValueError('Input must be of size [height, width, C>0]')

        image = tf.to_float(image)
        image = tf_image_whitened(image, [_R_MEAN, _G_MEAN, _B_MEAN])

        # Add image rectangle to bboxes.
        bbox_img = tf.constant([[0., 0., 1., 1.]])
        if bboxes is None:
            bboxes = bbox_img
        else:
            bboxes = tf.concat([bbox_img, bboxes], axis=0)

        if resize == Resize.NONE:
            # No resizing...
            pass
        elif resize == Resize.CENTRAL_CROP:
            # Central cropping of the image.
            image, bboxes = tf_image.resize_image_bboxes_with_crop_or_pad(
                image, bboxes, out_shape[0], out_shape[1])
        elif resize == Resize.PAD_AND_RESIZE:
            # Resize image first: find the correct factor...
            shape = tf.shape(image)
            factor = tf.minimum(tf.to_double(1.0),
                                tf.minimum(tf.to_double(out_shape[0] / shape[0]),
                                           tf.to_double(out_shape[1] / shape[1])))
            resize_shape = factor * tf.to_double(shape[0:2])
            resize_shape = tf.cast(tf.floor(resize_shape), tf.int32)


            image = tf_image.resize_image(image, resize_shape,