{"record":{"id":"36e867043663d7c0","repo":"open-mmlab/mmdetection","slug":"metric-metric-is-not-supported","errorCode":null,"errorMessage":"metric {metric} is not supported.","messagePattern":"metric (.+?) is not supported\\.","errorType":"validation","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"mmdet/evaluation/metrics/mot_challenge_metric.py","lineNumber":107,"sourceCode":"                 collect_device: str = 'cpu',\n                 prefix: Optional[str] = None) -> None:\n        super().__init__(collect_device=collect_device, prefix=prefix)\n        if trackeval is None:\n            raise RuntimeError(\n                'trackeval is not installed,'\n                'please install it by: pip install'\n                'git+https://github.com/JonathonLuiten/TrackEval.git'\n                'trackeval need low version numpy, please install it'\n                'by: pip install -U numpy==1.23.5')\n        if isinstance(metric, list):\n            metrics = metric\n        elif isinstance(metric, str):\n            metrics = [metric]\n        else:\n            raise TypeError('metric must be a list or a str.')\n        for metric in metrics:\n            if metric not in self.allowed_metrics:\n                raise KeyError(f'metric {metric} is not supported.')\n        self.metrics = metrics\n        self.format_only = format_only\n        if self.format_only:\n            assert outfile_prefix is not None, 'outfile_prefix must be not'\n            'None when format_only is True, otherwise the result files will'\n            'be saved to a temp directory which will be cleaned up at the end.'\n        self.use_postprocess = use_postprocess\n        self.postprocess_tracklet_cfg = postprocess_tracklet_cfg.copy()\n        self.postprocess_tracklet_methods = [\n            TASK_UTILS.build(cfg) for cfg in self.postprocess_tracklet_cfg\n        ]\n        assert benchmark in self.allowed_benchmarks\n        self.benchmark = benchmark\n        self.track_iou_thr = track_iou_thr\n        self.tmp_dir = tempfile.TemporaryDirectory()\n        self.tmp_dir.name = get_tmpdir()\n        self.seq_info = defaultdict(\n            lambda: dict(seq_length=-1, gt_tracks=[], pred_tracks=[]))","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/evaluation/metrics/mot_challenge_metric.py#L89-L125","documentation":"MOTChallengeMetric.__init__ raises KeyError when a requested metric name is not in self.allowed_metrics (the MOT trackeval-supported set such as 'mot Challenge' metrics: mota, motp, idf1, hota, etc., built earlier in __init__). This is a value-validation error for the metric list contents.","triggerScenarios":"Passing metric=['map'] or metric='accuracy' to MOTChallengeMetric — names valid for detection metrics but not supported by the MOT evaluator's allowed_metrics set.","commonSituations":"Reusing a CocoMetric config block (metric='bbox') as the val_evaluator for a MOT config; typos/case errors like 'MOTA' vs 'mota'; assuming detection metrics are available in tracking evaluation.","solutions":["Use only MOT-supported metric names, e.g. metric=['mota', 'motp', 'idf1', 'hota', 'recall', 'precision'] — check allowed_metrics in mot_challenge_metric.py for the exact set","Fix case/typos: metric names are lowercase ('mota', not 'MOTA')","Remove detection-only metrics like 'bbox'/'segm' from the MOT evaluator config, or switch to CocoMetric if you meant detection evaluation"],"exampleFix":"// before\nval_evaluator=dict(type='MOTChallengeMetric', metric=['bbox'])\n// after\nval_evaluator=dict(type='MOTChallengeMetric', metric=['mota', 'idf1'])","handlingStrategy":"validation","validationCode":"from mmdet.evaluation.metrics.mot_challenge_metric import MOTChallengeMetric\nallowed = MOTChallengeMetric.allowed_metrics if hasattr(MOTChallengeMetric, 'allowed_metrics') else \\\n          {'mota', 'motp', 'idf1', 'hota', 'recall', 'precision'}\nmetrics = metric if isinstance(metric, list) else [metric]\nbad = [m for m in metrics if m not in allowed]\nassert not bad, f'Unsupported MOT metrics: {bad}; allowed: {sorted(allowed)}'","typeGuard":"def is_valid_mot_metric_names(metric, allowed: set) -> bool:\n    vals = metric if isinstance(metric, (list, tuple)) else [metric]\n    return all(isinstance(m, str) and m in allowed for m in vals)","tryCatchPattern":"try:\n    m = MOTChallengeMetric(metric=metric)\nexcept KeyError as e:\n    raise ValueError(f'Unsupported MOT metric in {metric}: {e}') from e","preventionTips":["Check allowed_metrics in mot_challenge_metric.py for your mmdet version","Never reuse CocoMetric metric names in MOT configs","Use lowercase metric names"],"tags":["mmdetection","tracking","mot","argument-validation","config"],"backgroundTag":"value-not-in-allowed-set","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}