{"record":{"id":"352aa48d47e06c99","repo":"open-mmlab/mmdetection","slug":"metrics-iou-metrics-is-not-supported-only-suppo","errorCode":null,"errorMessage":"metrics {iou_metrics} is not supported. Only supports mIoU/mDice/mFscore.","messagePattern":"metrics (.+?) is not supported\\. Only supports mIoU/mDice/mFscore\\.","errorType":"validation","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"mmdet/evaluation/metrics/semseg_metric.py","lineNumber":62,"sourceCode":"            names to disambiguate homonymous metrics of different evaluators.\n            If prefix is not provided in the argument, self.default_prefix\n            will be used instead. Defaults to None.\n    \"\"\"\n\n    def __init__(self,\n                 iou_metrics: Sequence[str] = ['mIoU'],\n                 beta: int = 1,\n                 collect_device: str = 'cpu',\n                 output_dir: Optional[str] = None,\n                 format_only: bool = False,\n                 backend_args: dict = None,\n                 prefix: Optional[str] = None) -> None:\n        super().__init__(collect_device=collect_device, prefix=prefix)\n\n        if isinstance(iou_metrics, str):\n            iou_metrics = [iou_metrics]\n        if not set(iou_metrics).issubset(set(['mIoU', 'mDice', 'mFscore'])):\n            raise KeyError(f'metrics {iou_metrics} is not supported. '\n                           f'Only supports mIoU/mDice/mFscore.')\n        self.metrics = iou_metrics\n        self.beta = beta\n        self.output_dir = output_dir\n        if self.output_dir and is_main_process():\n            mkdir_or_exist(self.output_dir)\n        self.format_only = format_only\n        self.backend_args = backend_args\n\n    def process(self, data_batch: dict, data_samples: Sequence[dict]) -> None:\n        \"\"\"Process one batch of data and data_samples.\n\n        The processed results should be stored in ``self.results``, which will\n        be used to compute the metrics when all batches have been processed.\n\n        Args:\n            data_batch (dict): A batch of data from the dataloader.\n            data_samples (Sequence[dict]): A batch of outputs from the model.","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/metrics/semseg_metric.py#L44-L80","documentation":"IoUMetric (semantic segmentation) validates iou_metrics is a subset of {'mIoU','mDice','mFscore'}; anything else raises this KeyError at construction. The argument may be a single string or list, but only those three statistic names are implemented.","triggerScenarios":"Passing iou_metrics=['mIoU','mAcc','aAcc'] or iou_metrics='dice' (wrong casing/name) to IoUMetric; confusing semanticseg metrics with classification metrics.","commonSituations":"Copy-pasting metric lists from mmcls or older mmseg configs (mAcc/aAcc moved elsewhere or removed); misspelling 'mFscore' as 'f1' or 'mF1'.","solutions":["Restrict iou_metrics to mIoU, mDice, mFscore (any subset, exact casing)","Remove mAcc/aAcc from the list; note overall accuracy is reported separately by the metric where supported","Set iou_metrics='mIoU' (the common default) if unsure"],"exampleFix":"# before\nval_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU', 'mAcc', 'aAcc'])\n# after\nval_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU'])","handlingStrategy":"validation","validationCode":"SUPPORTED = {'mIoU','mDice','mFscore'}\nbad = set(iou_metrics if isinstance(iou_metrics, list) else [iou_metrics]) - SUPPORTED\nassert not bad, f'unsupported iou_metrics: {bad}'","typeGuard":"def are_valid_iou_metrics(v) -> bool:\n    items = [v] if isinstance(v, str) else v\n    return isinstance(items, list) and set(items).issubset({'mIoU','mDice','mFscore'})","tryCatchPattern":null,"preventionTips":["Restrict iou_metrics to mIoU/mDice/mFscore","Don't mix mmcls/mmseg metric names","Start from official seg configs"],"tags":["mmdet","semantic-segmentation","iou-metric","config","validation"],"backgroundTag":null,"analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}