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.
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","."]
code: def perform_inference(self, image: Union[List, np.ndarray]):
      """
      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.
      """
      import torch
  
      # Confirm model is loaded
      if self.model is None:
          raise RuntimeError(
              "Model is not loaded, load it by calling .load_model()"
          )
  
      with torch.no_grad():
          inputs = self.processor(images=image, return_tensors="pt")
          inputs["pixel_values"] = inputs.pixel_values.to(self.device)
          if hasattr(inputs, "pixel_mask"):
              inputs["pixel_mask"] = inputs.pixel_mask.to(self.device)
          outputs = self.model(**inputs)
  
      if isinstance(image, list):
          self._image_shapes = [img.shape for img in image]
      else:
          self._image_shapes = [image.shape]
      self._original_predictions = outputs
  
imports: import logging
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import pybboxes.functional
  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, ensure_package_minimum_version
label_desc: Use image node_id 8 for calling the HuggingfaceDetectionModel obj's underlying member method code with example usage: obj.perform_inference(image) without return types