def load_questions(questions_file, vocab):
  """Load and process GQA questions.

  Args:
    questions_file: JSON file containing GQA questions.
    vocab: A text_utils.Vocab instance.

  Returns:
    questions: Dictionary of image_id --> question/answers.
  """
  with tf.io.gfile.GFile(questions_file, "r") as f:
    data = json.load(f)

  total = skipped = 0
  questions = collections.defaultdict(lambda: collections.defaultdict(list))
  for qid, entry in data.items():
    # Convert image ids to integers if not already.
    image_id = entry["imageId"]
    if "n" in image_id:
      image_id = "1000000" + image_id[1:]
    image_id = int(image_id)

    # Filter non-applicable questions.
    total += 1
    if io_utils.filter_question(entry["question"], entry["answer"]):
      skipped += 1
      continue

    question = " ".join(vocab.tokenize(entry["question"]))
    answer = " ".join(vocab.tokenize(entry["answer"]))
    questions[image_id]["question_ids"].append(int(qid))
    questions[image_id]["questions"].append(question)
    questions[image_id]["answers"].append([answer])
  tf.logging.info("Filtered: %d/%d", skipped, total)
  tf.logging.info("Kept: %d", total - skipped)
  return questions
Load and process GQA questions.

  Args:
    questions_file: JSON file containing GQA questions.
    vocab: A text_utils.Vocab instance.

  Returns:
    questions: Dictionary of image_id --> question/answers.
  
language/capwap/preprocessing/gqa_qa.py