code: def affine_transform_image_np(
      image,
      center,
      side_size,
      input_size,
      interpolation_mode=cv2.INTER_LINEAR,
  ):
      """Affine transform numpy."""
      input_w, input_h = input_size.numpy()[0], input_size.numpy()[1]
      trans_input = image_utils.get_affine_transform(
          center.numpy(), side_size.numpy(), 0, [input_w, input_h]
      )
      image_np = image.numpy()
      if image_np.ndim >= 4:
          image_np_shape = image_np.shape
          image_np = np.reshape(image_np, (-1, *image_np_shape[-3:]))
          input_images = []
          for ii in range(image_np.shape[0]):
              warped_input_image = cv2.warpAffine(
                  image_np[ii, ...],
                  trans_input,
                  (input_w, input_h),
                  flags=interpolation_mode,
              )
              if warped_input_image.ndim != image_np[ii, ...].ndim:
                  warped_input_image = warped_input_image[..., None]
              input_images.append(warped_input_image)
  
          input_image = np.stack(input_images, axis=0)
          input_image = np.reshape(
              input_image,
              (*image_np_shape[:-3], *input_image.shape[-3:]),
          )
      else:
          input_image = cv2.warpAffine(
              image_np,
              trans_input,
              (input_w, input_h),
              flags=interpolation_mode,
          )
      return input_image.astype(np.float32)
  
imports: import functools
  import cv2
  import numpy
  import tensorflow
  from tensorflow_graphics.projects.points_to_3Dobjects.utils import image
  from google3.third_party.tensorflow_models.object_detection.core import preprocessor
label_desc: Use image node_id 12 for calling a global function with example usage: affine_transform_image_np(image, center, side_size, input_size, interpolation_mode) and returns: input_image