(image, bboxes, k=1, name=None)
Rotate an image counter-clockwise by 90 degrees.

  Args:
    image: A 3-D tensor of shape `[height, width, channels]`.
    k: A scalar integer. The number of times the image is rotated by 90 degrees.
    name: A name for this operation (optional).

  Returns:
    A rotated 3-D tensor of the same type and shape as `image`.
Rotate an image counter-clockwise by 90 degrees.
Rotate an image counter - clockwise by 90 degrees .
def rot90(image, bboxes, k=1, name=None):
  """Rotate an image counter-clockwise by 90 degrees.

  Args:
    image: A 3-D tensor of shape `[height, width, channels]`.
    k: A scalar integer. The number of times the image is rotated by 90 degrees.
    name: A name for this operation (optional).

  Returns:
    A rotated 3-D tensor of the same type and shape as `image`.
  """
  with ops.name_scope(name, 'rot90', [image, k]) as scope:
    image = ops.convert_to_tensor(image, name='image')
    image = control_flow_ops.with_dependencies(
        _Check3DImage(image, require_static=False), image)
    k = ops.convert_to_tensor(k, dtype=dtypes.int32, name='k')
    k.get_shape().assert_has_rank(0)
    k = math_ops.mod(k, 4)

    def _rot_bboxes90(bboxes):
        return tf.stack([1 - bboxes[:, 3], bboxes[:, 0],
                        1 - bboxes[:, 1], bboxes[:, 2]], axis=-1)
    def _rot_bboxes180(bboxes):
        return tf.stack([1 - bboxes[:, 2], 1 - bboxes[:, 3],
                         1 - bboxes[:, 0], 1 - bboxes[:, 1]], axis=-1)
    def _rot_bboxes270(bboxes):
        return tf.stack([bboxes[:, 1], 1 - bboxes[:, 2],
                           bboxes[:, 3], 1 - bboxes[:, 0]], axis=-1)
    def _rot90():
      return array_ops.transpose(array_ops.reverse_v2(image, [1]),
                                 [1, 0, 2]), _rot_bboxes90(bboxes)
    def _rot180():
      return array_ops.reverse_v2(image, [0, 1]), _rot_bboxes180(bboxes)
    def _rot270():
      return array_ops.reverse_v2(array_ops.transpose(image, [1, 0, 2]),
                                  [1]), _rot_bboxes270(bboxes)
    cases = [(math_ops.equal(k, 1), _rot90),
             (math_ops.equal(k, 2), _rot180),
             (math_ops.equal(k, 3), _rot270)]

    ret_image, ret_bbox = control_flow_ops.case(cases, default=lambda: (image, bboxes), exclusive=True,
                                name=scope)
    ret_image.set_shape([None, None, image.get_shape()[2]])
    return ret_image, ret_bbox
def rot90 ( image , bboxes , k = 1 , name = None ) : with ops . name_scope ( name , 'rot90' , [ image , k ] ) as scope : image = ops . convert_to_tensor ( image , name = 'image' ) image = control_flow_ops . with_dependencies ( _Check3DImage ( image , require_static = False ) , image ) k = ops . convert_to_tensor ( k , dtype = dtypes . int32 , name = 'k' ) k . get_shape ( ) . assert_has_rank ( 0 ) k = math_ops . mod ( k , 4 ) def _rot_bboxes90 ( bboxes ) : return tf . stack ( [ 1 - bboxes [ : , 3 ] , bboxes [ : , 0 ] , 1 - bboxes [ : , 1 ] , bboxes [ : , 2 ] ] , axis = - 1 ) def _rot_bboxes180 ( bboxes ) : return tf . stack ( [ 1 - bboxes [ : , 2 ] , 1 - bboxes [ : , 3 ] , 1 - bboxes [ : , 0 ] , 1 - bboxes [ : , 1 ] ] , axis = - 1 ) def _rot_bboxes270 ( bboxes ) : return tf . stack ( [ bboxes [ : , 1 ] , 1 - bboxes [ : , 2 ] , bboxes [ : , 3 ] , 1 - bboxes [ : , 0 ] ] , axis = - 1 ) def _rot90 ( ) : return array_ops . transpose ( array_ops . reverse_v2 ( image , [ 1 ] ) , [ 1 , 0 , 2 ] ) , _rot_bboxes90 ( bboxes ) def _rot180 ( ) : return array_ops . reverse_v2 ( image , [ 0 , 1 ] ) , _rot_bboxes180 ( bboxes ) def _rot270 ( ) : return array_ops . reverse_v2 ( array_ops . transpose ( image , [ 1 , 0 , 2 ] ) , [ 1 ] ) , _rot_bboxes270 ( bboxes ) cases = [ ( math_ops . equal ( k , 1 ) , _rot90 ) , ( math_ops . equal ( k , 2 ) , _rot180 ) , ( math_ops . equal ( k , 3 ) , _rot270 ) ] ret_image , ret_bbox = control_flow_ops . case ( cases , default = lambda : ( image , bboxes ) , exclusive = True , name = scope ) ret_image . set_shape ( [ None , None , image . get_shape ( ) [ 2 ] ] ) return ret_image , ret_bbox