code: def to_detections(results, id2label, image_sizes):
      """Converts the Transformers detection results to FiftyOne format.
  
      Args:
          results: Transformers detection results
          id2label: Transformers ID to label mapping
          image_sizes: the list of image sizes
  
      Returns:
          a single or list of :class:`fiftyone.core.labels.Detections`
      """
      if isinstance(results, dict):
          return _to_detections(results, id2label, image_sizes[0])
  
      if len(results) == 1:
          return _to_detections(results[0], id2label, image_sizes[0])
  
      return [
          _to_detections(result, id2label, image_sizes[i])
          for i, result in enumerate(results)
      ]
  
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 7 for calling a global function with example usage: to_detections(results, id2label, image_sizes) and returns: unknown, _to_detections, _to_detections