docstr: self._original_predictions is converted to a list of prediction.ObjectPrediction and set to
  self._object_prediction_list_per_image.
  Args:
      shift_amount_list: list of list
          To shift the box and mask predictions from sliced image to full sized image, should
          be in the form of List[[shift_x, shift_y],[shift_x, shift_y],...]
      full_shape_list: list of list
          Size of the full image after shifting, should be in the form of
          List[[height, width],[height, width],...]
docstr_tok: ["self._original_predictions","is","converted","to","a","list","of","prediction.ObjectPrediction","and","set","to","self._object_prediction_list_per_image",".","Args",":","shift_amount_list",":","list","of","list","To","shift","the","box","and","mask","predictions","from","sliced","image","to","full","sized","image",",","should","be","in","the","form","of","List","[","[","shift_x",",","shift_y","]",",","[","shift_x",",","shift_y","]",",","...","]","full_shape_list",":","list","of","list","Size","of","the","full","image","after","shifting",",","should","be","in","the","form","of","List","[","[","height",",","width","]",",","[","height",",","width","]",",","...","]"]
code: def _create_object_prediction_list_from_original_predictions(
      self,
      shift_amount_list: Optional[List[List[int]]] = [[0, 0]],
      full_shape_list: Optional[List[List[int]]] = None,
  ):
      """
      self._original_predictions is converted to a list of prediction.ObjectPrediction and set to
      self._object_prediction_list_per_image.
      Args:
          shift_amount_list: list of list
              To shift the box and mask predictions from sliced image to full sized image, should
              be in the form of List[[shift_x, shift_y],[shift_x, shift_y],...]
          full_shape_list: list of list
              Size of the full image after shifting, should be in the form of
              List[[height, width],[height, width],...]
      """
      original_predictions = self._original_predictions
  
      # compatilibty for sahi v0.8.15
      shift_amount_list = fix_shift_amount_list(shift_amount_list)
      full_shape_list = fix_full_shape_list(full_shape_list)
  
      # handle all predictions
      object_prediction_list_per_image = []
      for image_ind, image_predictions_in_xyxy_format in enumerate(
          original_predictions.xyxy
      ):
          shift_amount = shift_amount_list[image_ind]
          full_shape = (
              None
              if full_shape_list is None
              else full_shape_list[image_ind]
          )
          object_prediction_list = []
  
          # process predictions
          for prediction in (
              image_predictions_in_xyxy_format.cpu().detach().numpy()
          ):
              x1 = prediction[0]
              y1 = prediction[1]
              x2 = prediction[2]
              y2 = prediction[3]
              bbox = [x1, y1, x2, y2]
              score = prediction[4]
              category_id = int(prediction[5])
              category_name = self.category_mapping[str(category_id)]
  
              # fix negative box coords
              bbox[0] = max(0, bbox[0])
              bbox[1] = max(0, bbox[1])
              bbox[2] = max(0, bbox[2])
              bbox[3] = max(0, bbox[3])
  
              # fix out of image box coords
              if full_shape is not None:
                  bbox[0] = min(full_shape[1], bbox[0])
                  bbox[1] = min(full_shape[0], bbox[1])
                  bbox[2] = min(full_shape[1], bbox[2])
                  bbox[3] = min(full_shape[0], bbox[3])
  
              # ignore invalid predictions
              if not (bbox[0] < bbox[2]) or not (bbox[1] < bbox[3]):
                  logger.warning(
                      f"ignoring invalid prediction with bbox: {bbox}"
                  )
                  continue
  
              object_prediction = ObjectPrediction(
                  bbox=bbox,
                  category_id=category_id,
                  score=score,
                  bool_mask=None,
                  category_name=category_name,
                  shift_amount=shift_amount,
                  full_shape=full_shape,
              )
              object_prediction_list.append(object_prediction)
          object_prediction_list_per_image.append(
              object_prediction_list
          )
  
      self._object_prediction_list_per_image = (
          object_prediction_list_per_image
      )
  
file_path: sahi/sahi/models/yolov5.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.compatibility import fix_full_shape_list, fix_shift_amount_list
  from sahi.utils.import_utils import check_package_minimum_version, check_requirements
label_desc: Use image node_id 8 for calling the Yolov5DetectionModel obj's underlying member method code with example usage: obj._create_object_prediction_list_from_original_predictions(shift_amount_list, full_shape_list) without return types