code: def test_custom_detection_dataset_imports(basedir):
      # Types of detection datasets to test
      dataset_types = [
          fo.types.FiftyOneImageDetectionDataset,
          fo.types.COCODetectionDataset,
          fo.types.VOCDetectionDataset,
          fo.types.KITTIDetectionDataset,
          fo.types.YOLOv4Dataset,
          fo.types.YOLOv5Dataset,
          fo.types.TFObjectDetectionDataset,
          fo.types.CVATImageDataset,
      ]
  
      # Load a small detection dataset
      ddataset = foz.load_zoo_dataset(
          "coco-2017",
          split="validation",
          dataset_name="detection-dataset",
          shuffle=True,
          max_samples=20,
          num_workers=1,  # pytest crashes without this
      )
  
      # Remove labels from some samples
      for s in ddataset.take(10):
          s.ground_truth = None
          s.save()
  
      # Test custom imports
      for dataset_type in dataset_types:
          print(dataset_type.__name__)
  
          # COCODetectionDataset and TFObjectDetectionDataset formats cannot
          # distinguish between an unlabeled image and a labeled image with zero
          # detections
          num_unlabeled = 10
          if dataset_type in (
              fo.types.COCODetectionDataset,
              fo.types.TFObjectDetectionDataset,
          ):
              num_unlabeled = None
  
          export_dir = os.path.join(
              basedir, "custom-imports", dataset_type.__name__
          )
          _run_custom_imports(
              ddataset,
              export_dir,
              dataset_type,
              num_unlabeled=num_unlabeled,
              max_samples=3,
          )
  
imports: import random
  import os
  import numpy
  import pytest
  import eta.core.utils
  import fiftyone
  import fiftyone.utils.image
  import fiftyone.brain
  import fiftyone.zoo
  from fiftyone import ViewField
label_desc: Use image node_id 19 for calling a global function with example usage: test_custom_detection_dataset_imports(basedir) without return types