code: def calculate_metrics(img_ids, dataset_gts, dataset_res):
      img_to_anns_gts = {id: [] for id in img_ids}
      for ann in dataset_gts["annotations"]:
          img_to_anns_gts[ann["image_id"]] += [ann]
  
      img_to_anns_res = {id: [] for id in img_ids}
      for ann in dataset_res["annotations"]:
          img_to_anns_res[ann["image_id"]] += [ann]
  
      eval_obj = COCOEvalCap(img_ids, img_to_anns_gts, img_to_anns_res)
      eval_obj.evaluate()
      return eval_obj.eval
  
file_path: mmf/tools/scripts/coco/coco_caption_eval.py
imports: import argparse
  import json
  from pycocoevalcap.bleu.bleu import Bleu
  from pycocoevalcap.cider.cider import Cider
  from pycocoevalcap.meteor.meteor import Meteor
  from pycocoevalcap.rouge.rouge import Rouge
  from pycocoevalcap.spice.spice import Spice
  from pycocoevalcap.tokenizer.ptbtokenizer import PTBTokenizer
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_metrics(img_ids, dataset_gts, dataset_res) and returns: eval_obj