code: def get_coco(root, image_set, transforms, mode="instances"):
      anno_file_template = "{}_{}2017.json"
      PATHS = {
          "train": (
              "train2017",
              os.path.join(
                  "annotations",
                  anno_file_template.format(mode, "train"),
              ),
          ),
          "val": (
              "val2017",
              os.path.join(
                  "annotations", anno_file_template.format(mode, "val")
              ),
          ),
          # "train": ("val2017", os.path.join("annotations", anno_file_template.format(mode, "val")))
      }
  
      t = [ConvertCocoPolysToMask()]
  
      if transforms is not None:
          t.append(transforms)
      transforms = Compose(t)
  
      img_folder, ann_file = PATHS[image_set]
      img_folder = os.path.join(root, img_folder)
      ann_file = os.path.join(root, ann_file)
  
      dataset = CocoDetection(
          img_folder, ann_file, transforms=transforms
      )
  
      if image_set == "train":
          dataset = _coco_remove_images_without_annotations(dataset)
  
      # dataset = torch.utils.data.Subset(dataset, [i for i in range(500)])
  
      return dataset
  
imports: import copy
  import os
  import torch
  import torch.utils.data
  import torchvision
  from pycocotools import mask
  from pycocotools.coco import COCO
  from examples.tvdetection.transforms import Compose
label_desc: Use image node_id 5 for calling a global function with example usage: get_coco(root, image_set, transforms, mode) and returns: dataset