open-mmlab/mmdetection · error · NotImplementedError

GPU collecting has not been supported yet

Error message

GPU collecting has not been supported yet

What it means

Even though 'gpu' is accepted as a device name, GPU result collection has never been implemented; after asserting tmpdir is None it unconditionally raises NotImplementedError. In practice only CPU collection works.

Source

Thrown at mmdet/evaluation/metrics/base_video_metric.py:114

    Args:
        results (list): Result list containing result parts to be
            collected. Each item of ``result_part`` should be a picklable
            object.
        device (str): Device name. Optional values are 'cpu' and 'gpu'.
        tmpdir (str | None): Temporal directory for collected results to
            store. If set to None, it will create a temporal directory for it.
            ``tmpdir`` should be None when device is 'gpu'. Defaults to None.

    Returns:
        list or None: The collected results.
    """
    if device not in ['gpu', 'cpu']:
        raise NotImplementedError(
            f"device must be 'cpu' or 'gpu', but got {device}")

    if device == 'gpu':
        assert tmpdir is None, 'tmpdir should be None when device is "gpu"'
        raise NotImplementedError('GPU collecting has not been supported yet')
    else:
        return collect_tracking_results_cpu(results, tmpdir)


def collect_tracking_results_cpu(result_part: list,
                                 tmpdir: Optional[str] = None
                                 ) -> Optional[list]:
    """Collect results on cpu mode.

    Saves the results on different gpus to 'tmpdir' and collects them by the
    rank 0 worker.

    Args:
        result_part (list): The part of prediction results.
        tmpdir (str): Path of directory to save the temporary results from
            different gpus under cpu mode. If is None, use `tempfile.mkdtemp()`
            to make a temporary path. Defaults to None.

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Use collect_device='cpu' for all video metrics
  2. Keep tmpdir=None when doing so is irrelevant; for cpu you may pass tmpdir for multi-node gathering

Example fix

# before
MOTMetric(collect_device='gpu')
# after
MOTMetric(collect_device='cpu')
Defensive patterns

Strategy: fallback

Validate before calling

if collect_device == 'gpu':
    collect_device = 'cpu'  # GPU collecting unsupported; use CPU

Try / catch

try:
    metric.evaluate()
except NotImplementedError as e:
    if 'GPU collecting' in str(e):
        metric.collect_device = 'cpu'
        metric.evaluate()
    else:
        raise

Prevention

When it happens

Trigger: Configuring any video tracking metric (e.g. MOTMetric, YouTubeVISMetric) with collect_device='gpu' and running distributed evaluation.

Common situations: Users assuming GPU collection is faster and flipping collect_device; copy from older configs that suggested 'gpu'.

Related errors


AI-assisted analysis of open-mmlab/mmdetection@cfd5d3a985 (2026-08-27). Data as JSON: /api/errors/8f87bfab1b47d518. Report an issue: GitHub.