def evaluate_captions(caption_file, coco_annotations, vocab):
  """Evaluate reference-based metrics on predicted captions.

  Args:
    caption_file: Path to predicted captions.
    coco_annotations: Path to COCO data directory.
    vocab: Instance of text_utils.Vocab.

  Returns:
    results: Dictionary of BLEU, ROUGE, and CIDEr scores.
  """
  results = {}

  tf.logging.info("Loading predictions...")
  captions = load_predictions(caption_file, vocab)

  # Change to image_id --> [top caption].
  flat = {}
  for image_id, questions in captions.items():
    for captions in questions.values():
      flat[image_id] = captions[:1]
      break
  captions = flat

  tf.logging.info("Loading references...")
  references = load_references(set(captions.keys()), coco_annotations)

  tf.logging.info("Computing BLEU...")
  results.update(bleu_score(captions, references))

  tf.logging.info("Computing ROUGE...")
  results.update(rouge_score(captions, references))

  tf.logging.info("Computing CIDEr...")
  results.update(cider_score(captions, references))

  return results
Evaluate reference-based metrics on predicted captions.

  Args:
    caption_file: Path to predicted captions.
    coco_annotations: Path to COCO data directory.
    vocab: Instance of text_utils.Vocab.

  Returns:
    results: Dictionary of BLEU, ROUGE, and CIDEr scores.
  
language/capwap/utils/metric_utils.py