code: def _merge_annotations(merge_dir, output):
      info = licenses = categories = None
      all_annotations = []
      all_images = []
      for json_file in glob.glob(f"{merge_dir}/*json"):
          with open(json_file) as f:
              coco = json.load(f)
              coco_annotations = coco["annotations"]
              all_annotations.extend(coco_annotations)
              coco_images = coco["images"]
              all_images.extend(coco_images)
              if not info:
                  info = coco["info"]
              if not licenses:
                  licenses = coco["licenses"]
              if not categories:
                  categories = coco["categories"]
  
      merged_coco = {
          "info": info,
          "licenses": licenses,
          "categories": categories,
          "images": all_images,
          "annotations": all_annotations,
      }
  
      os.makedirs(os.path.dirname(output), exist_ok=True)
      with open(output, "w") as f:
          json.dump(merged_coco, f)
  
file_path: fiftyone/fiftyone/utils/sama.py
imports: import os
  import glob
  import random
  import json
  import logging
  import tempfile
  import eta.core.serial
  import eta.core.utils
  import eta.core.web
  import fiftyone.utils.coco
label_desc: Use image node_id 2 for calling a global function with example usage: _merge_annotations(merge_dir, output) without return types