docstr: Prediction is performed using self.model and the prediction result is set to self._original_predictions.
  Args:
      image: np.ndarray
          A numpy array that contains the image to be predicted. 3 channel image should be in RGB order.
      image_size: int
          Inference input size.
docstr_tok: ["Prediction","is","performed","using","self.model","and","the","prediction","result","is","set","to","self._original_predictions",".","Args",":","image",":","np.ndarray","A","numpy","array","that","contains","the","image","to","be","predicted",".","3","channel","image","should","be","in","RGB","order",".","image_size",":","int","Inference","input","size","."]
code: def perform_inference(
      self, image: np.ndarray, image_size: int = None
  ):
      """
      Prediction is performed using self.model and the prediction result is set to self._original_predictions.
      Args:
          image: np.ndarray
              A numpy array that contains the image to be predicted. 3 channel image should be in RGB order.
          image_size: int
              Inference input size.
      """
      from sahi.utils.torch import to_float_tensor
  
      # arrange model input size
      if self.image_size is not None:
          # get min and max of image height and width
          min_shape, max_shape = min(image.shape[:2]), max(
              image.shape[:2]
          )
          # torchvision resize transform scales the shorter dimension to the target size
          # we want to scale the longer dimension to the target size
          image_size = self.image_size * min_shape / max_shape
          self.model.transform.min_size = (
              image_size,
          )  # default is (800,)
          self.model.transform.max_size = image_size  # default is 1333
  
      image = to_float_tensor(image)
      image = image.to(self.device)
      prediction_result = self.model([image])
  
      self._original_predictions = prediction_result
  
file_path: sahi/sahi/models/torchvision.py
imports: import logging
  from typing import Any, Dict, List, Optional
  import numpy
  from sahi.models.base import DetectionModel
  from sahi.prediction import ObjectPrediction
  from sahi.utils.import_utils import check_requirements
label_desc: Use image node_id 4 for calling the TorchVisionDetectionModel obj's underlying member method code with example usage: obj.perform_inference(image, image_size) without return types