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

  Args:
    questions_file: JSON file containing V7W 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)["images"]

  total = skipped = 0
  questions = collections.defaultdict(lambda: collections.defaultdict(list))
  for image in data:
    for entry in image["qa_pairs"]:
      # Filter non-applicable questions.
      total += 1
      if io_utils.filter_question(entry["question"], entry["answer"]):
        skipped += 1
        continue

      image_id = image["image_id"]
      question = " ".join(vocab.tokenize(entry["question"]))
      answer = " ".join(vocab.tokenize(entry["answer"]))
      questions[image_id]["question_ids"].append(entry["qa_id"])
      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 V7W questions.

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

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