docstr: Prepapre image for inference by resizing, normalizing and changing dimensions.
  
  Args:
      image: np.ndarray
          Input image with color channel order RGB.
docstr_tok: ["Prepapre","image","for","inference","by","resizing",",","normalizing","and","changing","dimensions",".","Args",":","image",":","np.ndarray","Input","image","with","color","channel","order","RGB","."]
code: def _preprocess_image(
      self, image: np.ndarray, input_shape: Tuple[int, int]
  ) -> np.ndarray:
      """Prepapre image for inference by resizing, normalizing and changing dimensions.
  
      Args:
          image: np.ndarray
              Input image with color channel order RGB.
      """
      input_image = cv2.resize(image, input_shape)
  
      input_image = input_image / 255.0
      input_image = input_image.transpose(2, 0, 1)
      image_tensor = input_image[np.newaxis, :, :, :].astype(np.float32)
  
      return image_tensor
  
imports: import logging
  from typing import Any, Dict, List, Optional, Tuple
  import cv2
  import numpy
  import torch
  from sahi.models.base import DetectionModel
  from sahi.prediction import ObjectPrediction
  from sahi.utils.compatibility import fix_full_shape_list, fix_shift_amount_list
  from sahi.utils.import_utils import check_requirements
  from sahi.utils.yolov8onnx import non_max_supression, xywh2xyxy
label_desc: Use image node_id 5 for calling the Yolov8OnnxDetectionModel obj's underlying member method code with example usage: obj._preprocess_image(image, input_shape) and returns: image_tensor