open-mmlab/mmdetection · error · Exception

unknown iouType for iou computation

Error message

unknown iouType for iou computation

What it means

YTVISEval.computeIoU dispatches on params.iouType and only supports 'segm' (and 'bbox'); any other value (e.g. 'keypoints') reaches the else branch and raises a generic Exception.

Source

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

            dt = self._dts[vidId, catId]
        else:
            gt = [_ for cId in p.catIds for _ in self._gts[vidId, cId]]
            dt = [_ for cId in p.catIds for _ in self._dts[vidId, cId]]
        if len(gt) == 0 and len(dt) == 0:
            return []
        inds = np.argsort([-d['score'] for d in dt], kind='mergesort')
        dt = [dt[i] for i in inds]
        if len(dt) > p.maxDets[-1]:
            dt = dt[0:p.maxDets[-1]]

        if p.iouType == 'segm':
            g = [g['segmentations'] for g in gt]
            d = [d['segmentations'] for d in dt]
        elif p.iouType == 'bbox':
            g = [g['bboxes'] for g in gt]
            d = [d['bboxes'] for d in dt]
        else:
            raise Exception('unknown iouType for iou computation')

        # compute iou between each dt and gt region

        def iou_seq(d_seq, g_seq):
            i = .0
            u = .0
            for d, g in zip(d_seq, g_seq):
                if d and g:
                    i += maskUtils.area(maskUtils.merge([d, g], True))
                    u += maskUtils.area(maskUtils.merge([d, g], False))
                elif not d and g:
                    u += maskUtils.area(g)
                elif d and not g:
                    u += maskUtils.area(d)
            if not u > .0:
                print('Mask sizes in video {} and category {} may not match!'.
                      format(vidId, catId))
            iou = i / u if u > .0 else .0

View on GitHub (pinned to cfd5d3a985)

Solutions

  1. Use iouType='segm' or 'bbox' for YouTube-VIS evaluation
  2. For keypoint tasks, use the COCO eval API (mmdet's CocoMetric) instead of YTVISEval

Example fix

# before
ytvisEval = YTVISEval(gt, dt, iouType='keypoints')
# after
ytvisEval = YTVISEval(gt, dt, iouType='segm')
Defensive patterns

Strategy: validation

Validate before calling

assert iouType in ('segm', 'bbox'), f'YTVIS computeIoU unsupported: {iouType}'

Type guard

def is_ytvis_iou_type(t: str) -> bool:
    return t in ('segm', 'bbox')

Prevention

When it happens

Trigger: Constructing YTVISParams/Eval with iouType='keypoints' or a typo like 'mask', then calling evaluate() which triggers computeIoU.

Common situations: Adapting COCO keypoint eval code to YouTube-VIS; copy-paste from cocoeval where 'keypoints' is valid but unsupported here.

Related errors


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