class_docstr: mIoU evaluation metric.
  
  Args:
      iou_metrics (list[str] | str): Metrics to be calculated, the options
          includes 'mIoU', 'mDice' and 'mFscore'.
      beta (int): Determines the weight of recall in the combined score.
          Default: 1.
      collect_device (str): Device name used for collecting results from
          different ranks during distributed training. Must be 'cpu' or
          'gpu'. Defaults to 'cpu'.
      output_dir (str): The directory for output prediction. Defaults to
          None.
      format_only (bool): Only format result for results commit without
          perform evaluation. It is useful when you want to save the result
          to a specific format and submit it to the test server.
          Defaults to False.
      backend_args (dict, optional): Arguments to instantiate the
          corresponding backend. Defaults to None.
      prefix (str, optional): The prefix that will be added in the metric
          names to disambiguate homonymous metrics of different evaluators.
          If prefix is not provided in the argument, self.default_prefix
          will be used instead. Defaults to None.
class_docstr_tok: ["mIoU","evaluation","metric",".","Args",":","iou_metrics","(","list","[","str","]","|","str",")",":","Metrics","to","be","calculated",",","the","options","includes","'mIoU","'",",","'mDice","'","and","'mFscore","'",".","beta","(","int",")",":","Determines","the","weight","of","recall","in","the","combined","score",".","Default",":","1.","collect_device","(","str",")",":","Device","name","used","for","collecting","results","from","different","ranks","during","distributed","training",".","Must","be","'cpu","'","or","'gpu","'",".","Defaults","to","'cpu","'",".","output_dir","(","str",")",":","The","directory","for","output","prediction",".","Defaults","to","None",".","format_only","(","bool",")",":","Only","format","result","for","results","commit","without","perform","evaluation",".","It","is","useful","when","you","want","to","save","the","result","to","a","specific","format","and","submit","it","to","the","test","server",".","Defaults","to","False",".","backend_args","(","dict",",","optional",")",":","Arguments","to","instantiate","the","corresponding","backend",".","Defaults","to","None",".","prefix","(","str",",","optional",")",":","The","prefix","that","will","be","added","in","the","metric","names","to","disambiguate","homonymous","metrics","of","different","evaluators",".","If","prefix","is","not","provided","in","the","argument",",","self.default_prefix","will","be","used","instead",".","Defaults","to","None","."]
docstr: Compute the metrics from processed results.
  
  Args:
      results (list): The processed results of each batch.
  
  Returns:
      Dict[str, float]: The computed metrics. The keys are the names of
          the metrics, and the values are corresponding results. The key
          mainly includes aAcc, mIoU, mAcc, mDice, mFscore, mPrecision,
          mRecall.
docstr_tok: ["Compute","the","metrics","from","processed","results",".","Args",":","results","(","list",")",":","The","processed","results","of","each","batch",".","Returns",":","Dict","[","str",",","float","]",":","The","computed","metrics",".","The","keys","are","the","names","of","the","metrics",",","and","the","values","are","corresponding","results",".","The","key","mainly","includes","aAcc",",","mIoU",",","mAcc",",","mDice",",","mFscore",",","mPrecision",",","mRecall","."]
code: def compute_metrics(self, results: list) -> Dict[str, float]:
      """Compute the metrics from processed results.
  
      Args:
          results (list): The processed results of each batch.
  
      Returns:
          Dict[str, float]: The computed metrics. The keys are the names of
              the metrics, and the values are corresponding results. The key
              mainly includes aAcc, mIoU, mAcc, mDice, mFscore, mPrecision,
              mRecall.
      """
      logger: MMLogger = MMLogger.get_current_instance()
      if self.format_only:
          logger.info(
              f"results are saved to {osp.dirname(self.output_dir)}"
          )
          return OrderedDict()
  
      ret_metrics = self.get_return_metrics(results)
  
      # summary table
      ret_metrics_summary = OrderedDict(
          {
              ret_metric: np.round(
                  np.nanmean(ret_metric_value) * 100, 2
              )
              for ret_metric, ret_metric_value in ret_metrics.items()
          }
      )
      metrics = dict()
      for key, val in ret_metrics_summary.items():
          if key == "aAcc":
              metrics[key] = val
          else:
              metrics["m" + key] = val
  
      print_semantic_table(
          ret_metrics, self.dataset_meta["classes"], logger
      )
  
      return metrics
  
imports: import os.path
  from collections import OrderedDict
  from typing import Dict, Optional, Sequence, Union
  import numpy
  import torch
  from mmcv import imwrite
  from mmengine.dist import is_main_process
  from mmengine.evaluator import BaseMetric
  from mmengine.logging import MMLogger, print_log
  from mmengine.utils import mkdir_or_exist
  from PIL import Image
  from mmdet.registry import METRICS
label_desc: Use image node_id 3 for calling the SemSegMetric obj's underlying member method code with example usage: obj.compute_metrics(results) and returns: metrics, OrderedDict