open-mmlab/mmdetection · warning

{self.__class__.__name__} got empty `self.results`. Please e

Error message

{self.__class__.__name__} got empty `self.results`. Please ensure that the processed results are properly added into `self.results` in `process` method.

What it means

CocoVideoMetric.evaluate() warns when self.results is empty before collecting tracking results. The metric's process() never added any predictions, so COCO-style video evaluation (e.g. MOT/VID mAP) cannot be computed and returns nothing useful.

Source

Thrown at mmdet/evaluation/metrics/coco_video_metric.py:57

                    img_data_sample = video_data_samples[frame_id].to_dict()
                    super().process(None, [img_data_sample])
            else:
                # image process
                img_data_sample = video_data_samples[0].to_dict()
                super().process(None, [img_data_sample])

    def evaluate(self, size: int = 1) -> dict:
        """Evaluate the model performance of the whole dataset after processing
        all batches.

        Args:
            size (int): Length of the entire validation dataset.
        Returns:
            dict: Evaluation metrics dict on the val dataset. The keys are the
            names of the metrics, and the values are corresponding results.
        """
        if len(self.results) == 0:
            warnings.warn(
                f'{self.__class__.__name__} got empty `self.results`. Please '
                'ensure that the processed results are properly added into '
                '`self.results` in `process` method.')

        results = collect_tracking_results(self.results, self.collect_device)

        if is_main_process():
            _metrics = self.compute_metrics(results)  # type: ignore
            # Add prefix to metric names
            if self.prefix:
                _metrics = {
                    '/'.join((self.prefix, k)): v
                    for k, v in _metrics.items()
                }
            metrics = [_metrics]
        else:
            metrics = [None]  # type: ignore

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Verify the val dataset length is > 0 and ann_file points to a valid annotation file
  2. Ensure the metric is registered in val_evaluator and the loop actually calls metric.process(data_batch, data_samples)
  3. In a custom process(), append processed samples to self.results before returning
  4. Print len(metric.results) after one val iteration to confirm appends happen

Example fix

# before
val_dataloader = dict(dataset=dict(ann_file='nonexistent.json'))
# after
val_dataloader = dict(dataset=dict(ann_file='data/anno_val.json'))
# and confirm process appends:
def process(self, data_batch, data_samples):
    self.results.extend(data_samples)
Defensive patterns

Strategy: validation

Validate before calling

from mmdet.evaluation import CocoVideoMetric
m = CocoVideoMetric(ann_file=ann)
assert m.dataset_meta is not None
# verify one process call populates results:
# m.process(batch, samples); assert len(m.results) == len(samples)

Prevention

When it happens

Trigger: Running video detection/tracking evaluation with CocoVideoMetric when process() was never called or never appended to self.results — empty val set, broken dataloader, or a subclass/data_sample key mismatch that silently skips appending.

Common situations: Misconfigured val ann_file (empty or wrong path), dataset_type/pipeline mismatch so no samples flow through process(), or subclass overrides of process() that drop results.

Related errors


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