code: def _resize_image(
      image: np.ndarray, target_size: Tuple[int, int]
  ) -> Tuple[np.ndarray, np.ndarray]:
      """
      Args:
          image (np.ndarray): image (np.ndarray)
      Returns:
          image (np.ndarray): processed image (np.ndarray)
      """
  
      origin_shape = image.shape[:2]
  
      resize_h, resize_w = target_size
      # im_scale_y: the resize ratio of Y
      im_scale_y = resize_h / float(origin_shape[0])
      # the resize ratio of X
      im_scale_x = resize_w / float(origin_shape[1])
  
      # resize image
      image = cv2.resize(
          image,
          None,
          None,
          fx=im_scale_x,
          fy=im_scale_y,
          interpolation=2,
      )
      scale_factor = np.array([im_scale_y, im_scale_x]).astype(
          "float32"
      )
      return image, scale_factor
  
file_path: layout-parser/src/layoutparser/models/paddledetection/layoutmodel.py
imports: from typing import List, Union, Dict, Any, Tuple
  import os
  from functools import reduce
  import warnings
  from PIL import Image
  import cv2
  import numpy
  from .catalog import PathManager, LABEL_MAP_CATALOG, MODEL_CATALOG
  from ..base_layoutmodel import BaseLayoutModel
  from ...elements import Rectangle, TextBlock, Layout
  from ...file_utils import is_paddle_available
label_desc: Use image node_id 1 for calling a global function with example usage: _resize_image(image, target_size) and returns: image,  scale_factor