code: def _to_detections(result, id2label, image_size):
      detections = []
  
      scores = result["scores"].cpu().numpy()
      labels = result["labels"].cpu().numpy()
      boxes = result["boxes"].cpu().numpy()
      for score, label, box in zip(scores, labels, boxes):
          box = [round(i, 2) for i in box.tolist()]
          box = _convert_bounding_box(box, image_size)
          detections.append(
              fol.Detection(
                  label=id2label[label.item()],
                  bounding_box=box,
                  confidence=score.item(),
              )
          )
  
      return fol.Detections(detections=detections)
  
imports: import numpy
  from fiftyone.core.config import Config
  import fiftyone.core.labels
  from fiftyone.core.models import Model, EmbeddingsMixin
  import fiftyone.core.utils
label_desc: Use image node_id 8 for calling a global function with example usage: _to_detections(result, id2label, image_size) and returns: fol