code: def get_metric_by_name(
      metric_name: str, metric_impl: str = "TMMetrics", **kwargs
  ) -> Metrics:
      """
      Get the `Metrics` class by metric names, and metric_impl should be the specific implementation class.
  
      Args:
          metric_name (`str`):
              The metric name used to evaluate. (e.g. Accuracy)
          metric_impl (`str`):
              The metric implementation class name. (e.g. TMMetrics)
  
      Returns:
          (`towhee.trainer.metrics.Metrics`)
              Metrics instance which name matches the queried name.
  
      Example:
          >>> from towhee.trainer.metrics import show_avaliable_metrics, get_metric_by_name
          >>> from towhee.trainer.metrics import TMMetrics
          >>> metric = get_metric_by_name('Accuracy', 'TMMetrics')
          >>> isinstance(metric, TMMetrics)
          True
      """
      global _metrics_impls
      return _metrics_impls[metric_impl](metric_name, **kwargs)
  
imports: from typing import Any, Dict
  import torchmetrics
  from torchmetrics.detection.map import MeanAveragePrecision
label_desc: Use image node_id 3 for calling a global function with example usage: get_metric_by_name(metric_name, metric_impl) and returns: _metrics_impls