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)
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
towhee/trainer/metrics.py