open-mmlab/mmdetection · error · Exception

Please run accumulate() first

Error message

Please run accumulate() first

What it means

summarize() reads the accumulated evaluation arrays (self.eval['precision']/['recall']); if accumulate() was never run (or evalImgs were never processed), self.eval is empty and an Exception is raised prompting to run accumulate() first.

Source

Thrown at mmdet/evaluation/functional/ytviseval.py:570

                0, areaRng='large', maxDets=self.params.maxDets[2])
            return stats

        def _summarizeKps():
            stats = np.zeros((10, ))
            stats[0] = _summarize(1, maxDets=20)
            stats[1] = _summarize(1, maxDets=20, iouThr=.5)
            stats[2] = _summarize(1, maxDets=20, iouThr=.75)
            stats[3] = _summarize(1, maxDets=20, areaRng='medium')
            stats[4] = _summarize(1, maxDets=20, areaRng='large')
            stats[5] = _summarize(0, maxDets=20)
            stats[6] = _summarize(0, maxDets=20, iouThr=.5)
            stats[7] = _summarize(0, maxDets=20, iouThr=.75)
            stats[8] = _summarize(0, maxDets=20, areaRng='medium')
            stats[9] = _summarize(0, maxDets=20, areaRng='large')
            return stats

        if not self.eval:
            raise Exception('Please run accumulate() first')
        iouType = self.params.iouType
        if iouType == 'segm' or iouType == 'bbox':
            summarize = _summarizeDets
        elif iouType == 'keypoints':
            summarize = _summarizeKps
        self.stats = summarize()

    def __str__(self):
        self.summarize()


class Params:
    """Params for coco evaluation api."""

    def setDetParams(self):
        self.vidIds = []
        self.catIds = []
        # np.arange causes trouble.  the data point on arange

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Call the canonical sequence: ev.evaluate(); ev.accumulate(); ev.summarize()
  2. Check that evaluate() did not raise/return early before accumulate()
  3. Guard: if not ev.eval: skip summarize

Example fix

# before
ev = YTVISEval(gt, dt, 'segm')
ev.summarize()  # Exception
# after
ev = YTVISEval(gt, dt, 'segm')
ev.evaluate(); ev.accumulate(); ev.summarize()
Defensive patterns

Strategy: try-catch

Validate before calling

if not ytviseval.eval:
    ytviseval.evaluate(); ytviseval.accumulate()

Try / catch

try:
    ev.summarize()
except Exception as e:
    if 'accumulate' in str(e):
        ev.evaluate(); ev.accumulate(); ev.summarize()
    else:
        raise

Prevention

When it happens

Trigger: Calling ytviseval.summarize() immediately after YTVISEval(...) without evaluate() + accumulate(); calling __str__ (which invokes summarize) before accumulation.

Common situations: Custom eval scripts reordered from the standard Evaluate->Accumulate->Summarize flow; exception in evaluate() silently caught before accumulate.

Related errors


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