def load_karpathy_splits(filename):
  """Load Karpathy COCO ids for train, val, and test."""
  splits = {"train": set(), "val": set(), "test": set()}
  with tf.io.gfile.GFile(filename, "r") as f:
    for image in json.load(f)["images"]:
      split = image["split"] if image["split"] != "restval" else "train"
      splits[split].add(image["cocoid"])
  return splits
Load Karpathy COCO ids for train, val, and test.
language/capwap/utils/io_utils.py