code: def get_sliced_prediction(
      self,
      image: Union[PIL.Image.Image, np.ndarray, Path, str],
      keep_sahi_format: bool = False,
      display_label: bool = True,
      display_bbox: bool = True,
      display_score: bool = True,
      font_path: Optional[os.PathLike] = get_default_font(),
      font_size: Union[int, float] = 10,
      return_as_pil_img=True,
      return_img=True,
      **kwargs,
  ):
      if isinstance(image, Path):
          image = str(image)
  
      pred = sahi_get_sliced_prediction(
          image=image, detection_model=self, **kwargs
      )
      if keep_sahi_format:
          return pred
      else:
          scores = []
          label_ids = []
          bboxes = []
          record = BaseRecord(
              (
                  BBoxesRecordComponent(),
                  InstancesLabelsRecordComponent(),
                  ScoresRecordComponent(),
                  ImageRecordComponent(),
              )
          )
  
          for pred in pred.object_prediction_list:
              scores.append(pred.score.value)
              label_ids.append(pred.category.name)
              bboxes.append(
                  BBox.from_xyxy(
                      pred.bbox.minx,
                      pred.bbox.miny,
                      pred.bbox.maxx,
                      pred.bbox.maxy,
                  )
              )
  
          record.detection.set_class_map(self.class_map)
          record.detection.add_labels(label_ids)
          record.detection.add_bboxes(bboxes)
          record.detection.set_scores(np.array(scores))
  
          img_path = str(image)
          if isinstance(image, (str, Path)):
              image = open_img(img_path, ensure_no_data_convert=True)
  
          record.set_img(image)
  
          img_size = get_img_size(img_path)
  
          if return_img:
              pred_img = draw_record(
                  record=record,
                  class_map=self.class_map,
                  display_label=display_label,
                  display_score=display_score,
                  display_bbox=display_bbox,
                  font_path=font_path,
                  font_size=font_size,
                  return_as_pil_img=return_as_pil_img,
              )
          else:
              record._unload()
  
          pred_dict = record.as_dict()
  
          if return_img:
              pred_dict["img"] = pred_img
          else:
              pred_dict["img"] = None
  
          pred_dict["width"] = img_size.width
          pred_dict["height"] = img_size.height
  
          del pred_dict["common"]
  
          return pred_dict
  
imports: from types import ModuleType
  from icevision.imports import *
  from icevision.imports import *
  from icevision.core import *
  from icevision.data import *
  from icevision.utils.imageio import *
  from icevision.visualize.draw_data import *
  from icevision.visualize.utils import *
  from icevision.tfms.albumentations import albumentations_adapter
  from sahi.models.base import DetectionModel
  from sahi.prediction import ObjectPrediction
  from sahi.predict import get_sliced_prediction
label_desc: Use image node_id 6 for calling the IceSahiModel obj's underlying member method code with example usage: obj.get_sliced_prediction(image, keep_sahi_format, display_label, display_bbox, display_score, font_path, font_size, return_as_pil_img, return_img) and returns: pred, pred_dict