def load_synthetic_questions(pattern):
  """Loads synthetic question generation data from disk.

  Args:
    pattern: Glob file pattern for question generation output files.

  Returns:
    images: Dictionary of image_id to QA data.
  """
  # image --> questions/answers
  images = collections.defaultdict(lambda: collections.defaultdict(list))
  for fname in tf.io.gfile.glob(pattern):
    with tf.io.gfile.GFile(fname, "r") as f:
      for line in f:
        image_id, question, answer, caption = line.split("\t")
        image_id = int(image_id)
        images[image_id]["question_ids"].append(-1)
        images[image_id]["questions"].append(question)
        images[image_id]["answers"].append(answer)
        images[image_id]["captions"].append(caption)
  return images
Loads synthetic question generation data from disk.

  Args:
    pattern: Glob file pattern for question generation output files.

  Returns:
    images: Dictionary of image_id to QA data.
  
language/capwap/preprocessing/coco_text_planner.py