class_docstr: Compute CMC-top-k and mAP metrics in retrieval setup.
class_docstr_tok: ["Compute","CMC-top-k","and","mAP","metrics","in","retrieval","setup","."]
docstr: Add metric specific arguments
docstr_tok: ["Add","metric","specific","arguments"]
code: def add_arguments(
      cls, parser: argparse.ArgumentParser
  ) -> argparse.ArgumentParser:
      """Add metric specific arguments"""
      if cls == RetrievalCMC:
          parser.add_argument(
              "--stats.metrics.retrieval-cmc.subset-fraction",
              type=float,
              default=1.0,
              help="Use fraction of gallery set for CMC calculation when set."
              " Defaults to 1.0",
          )
          parser.add_argument(
              "--stats.metrics.retrieval-cmc.k",
              type=int,
              default=5,
              help="CMC top-k: percentage of query images with at least one same-class"
              " gallery image in their k-NN. Defaults to 5.",
          )
          parser.add_argument(
              "--stats.metrics.retrieval-cmc.distance-metric",
              type=str,
              default="l2",
              choices=["l2", "cosine"],
              help="Distance to use for nearest-neighbor calculation."
              " Defaults to l2",
          )
  
      return parser
  
imports: import argparse
  import copy
  from typing import Dict, Tuple
  import numpy
  import torch
  from sklearn.metrics import average_precision_score
  from torch.nn import functional
  from metrics import METRICS_REGISTRY
  from metrics.metric_base import EpochMetric
  from utils import logger
  from utils.ddp_utils import is_master
  from utils.registry import Registry
label_desc: Use image node_id 2 for calling the RetrievalCMC obj's underlying member method code with example usage: obj.add_arguments(cls, parser) and returns: parser