class_docstr: this is modified from `howto100m/metrics.py`.
  History of changes:
  refactor as a class.
  add metric_key in __init__
class_docstr_tok: ["this","is","modified","from","`","howto100m\/metrics.py","`",".","History","of","changes",":","refactor","as","a","class",".","add","metric_key","in","__init__"]
code: def __init__(self, config, metric_names=["R1", "R5", "R10", "MR"]):
      super().__init__(config, metric_names)
      self.error = False
  
imports: import numpy
  import json
label_desc: Use image node_id 1 to create a new RetrievalMetric object from inherited base classes: Metric with example: obj = RetrievalMetric(config, metric_names)