class_docstr: Class for handling detection model predictions.
class_docstr_tok: ["Class","for","handling","detection","model","predictions","."]
docstr: Returns fiftyone.Detection representation of ObjectPrediction.
docstr_tok: ["Returns","fiftyone.Detection","representation","of","ObjectPrediction","."]
code: def to_fiftyone_detection(self, image_height: int, image_width: int):
      """
      Returns fiftyone.Detection representation of ObjectPrediction.
      """
      try:
          import fiftyone as fo
      except ImportError:
          raise ImportError(
              'Please run "pip install -U fiftyone" to install fiftyone first for fiftyone conversion.'
          )
  
      x1, y1, x2, y2 = self.bbox.to_xyxy()
      rel_box = [
          x1 / image_width,
          y1 / image_height,
          (x2 - x1) / image_width,
          (y2 - y1) / image_height,
      ]
      fiftyone_detection = fo.Detection(
          label=self.category.name,
          bounding_box=rel_box,
          confidence=self.score.value,
      )
      return fiftyone_detection
  
imports: import copy
  from typing import Dict, List, Optional, Union
  import numpy
  from PIL import Image
  from sahi.annotation import ObjectAnnotation
  from sahi.utils.coco import CocoAnnotation, CocoPrediction
  from sahi.utils.cv import read_image_as_pil, visualize_object_predictions
  from sahi.utils.file import Path
label_desc: Use image node_id 4 for calling the ObjectPrediction obj's underlying member method code with example usage: obj.to_fiftyone_detection(image_height, image_width) and returns: fiftyone_detection