code: def _create_synth_fiftyone_dataset(tmpdir):
      img_dir = Path(tmpdir / "fo_imgs")
      img_dir.mkdir()
  
      Image.new("RGB", (1920, 1080)).save(img_dir / "sample_one.png")
      Image.new("RGB", (1920, 1080)).save(img_dir / "sample_two.png")
  
      dataset = fo.Dataset.from_dir(
          img_dir,
          dataset_type=fo.types.ImageDirectory,
      )
  
      sample1 = dataset[str(img_dir / "sample_one.png")]
      sample2 = dataset[str(img_dir / "sample_two.png")]
  
      d1 = fo.Detection(
          label="person",
          bounding_box=[0.3, 0.4, 0.2, 0.2],
      )
      d2 = fo.Detection(
          label="person",
          bounding_box=[0.05, 0.10, 0.28, 0.15],
      )
      d3 = fo.Detection(
          label="person",
          bounding_box=[0.23, 0.14, 0.09, 0.18],
      )
      d1["iscrowd"] = 1
      d2["iscrowd"] = 0
      d3["iscrowd"] = 0
  
      sample1["ground_truth"] = fo.Detections(detections=[d1])
      sample2["ground_truth"] = fo.Detections(detections=[d2, d3])
  
      sample1.save()
      sample2.save()
  
      return dataset
  
file_path: lightning-flash/tests/image/detection/test_data.py
imports: import json
  import os
  from pathlib import Path
  import pytest
  from flash.core.data.io.input import DataKeys
  from flash.core.utilities.imports import _FIFTYONE_AVAILABLE, _ICEVISION_AVAILABLE, _PIL_AVAILABLE
  from flash.image.detection.data import ObjectDetectionData
label_desc: Use image node_id 5 for calling a global function with example usage: _create_synth_fiftyone_dataset(tmpdir) and returns: dataset