class_docstr: COCOEvalCap code is adopted from https://github.com/tylin/coco-caption
class_docstr_tok: ["COCOEvalCap","code","is","adopted","from","https",":","\/\/github.com\/tylin\/coco-caption"]
code: def evaluate(self):
      gts = self.coco
      res = self.coco_res
  
      # =================================================
      # Set up scorers
      # =================================================
      print("tokenization...")
      tokenizer = PTBTokenizer()
      gts = tokenizer.tokenize(gts)
      res = tokenizer.tokenize(res)
  
      # =================================================
      # Set up scorers
      # =================================================
      print("setting up scorers...")
      scorers = [
          (Bleu(4), ["Bleu_1", "Bleu_2", "Bleu_3", "Bleu_4"]),
          (Meteor(), "METEOR"),
          (Rouge(), "ROUGE_L"),
          (Cider(), "CIDEr"),
          (Spice(), "SPICE"),
      ]
  
      # =================================================
      # Compute scores
      # =================================================
      for scorer, method in scorers:
          print("computing %s score..." % (scorer.method()))
          score, scores = scorer.compute_score(gts, res)
          if type(method) == list:
              for sc, scs, m in zip(score, scores, method):
                  self.set_eval(sc, m)
                  self.set_img_to_eval_imgs(scs, gts.keys(), m)
                  print(f"{m}: {sc:0.3f}")
          else:
              self.set_eval(score, method)
              self.set_img_to_eval_imgs(scores, gts.keys(), method)
              print(f"{method}: {score:0.3f}")
      self.set_eval_imgs()
  
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 2 for calling the COCOEvalCap obj's underlying member method code with example usage: obj.evaluate() without return types