{"record":{"id":"1af6a6bbdeef8e59","repo":"open-mmlab/mmdetection","slug":"zero-area-box-skipped","errorCode":null,"errorMessage":"Zero area box skipped: {}.","messagePattern":"Zero area box skipped: (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mmdet/models/utils/wbf.py","lineNumber":171,"sourceCode":"            score = scores[t][j]\n            if score < thr:\n                continue\n            label = int(labels[t][j])\n            box_part = boxes[t][j]\n            x1 = float(box_part[0])\n            y1 = float(box_part[1])\n            x2 = float(box_part[2])\n            y2 = float(box_part[3])\n\n            # Box data checks\n            if x2 < x1:\n                warnings.warn('X2 < X1 value in box. Swap them.')\n                x1, x2 = x2, x1\n            if y2 < y1:\n                warnings.warn('Y2 < Y1 value in box. Swap them.')\n                y1, y2 = y2, y1\n            if (x2 - x1) * (y2 - y1) == 0.0:\n                warnings.warn('Zero area box skipped: {}.'.format(box_part))\n                continue\n\n            # [label, score, weight, model index, x1, y1, x2, y2]\n            b = [\n                int(label),\n                float(score) * weights[t], weights[t], t, x1, y1, x2, y2\n            ]\n\n            if label not in new_boxes:\n                new_boxes[label] = []\n            new_boxes[label].append(b)\n\n    # Sort each list in dict by score and transform it to numpy array\n    for k in new_boxes:\n        current_boxes = np.array(new_boxes[k])\n        new_boxes[k] = current_boxes[current_boxes[:, 1].argsort()[::-1]]\n\n    return new_boxes","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/open-mmlab/mmdetection/blob/cfd5d3a985b0249de009b67d04f37263e11cdf3d/mmdet/models/utils/wbf.py#L153-L189","documentation":"prefilter_boxes in WBF drops (continue) any box whose area (x2-x1)*(y2-y1) equals 0.0 and warns with the offending box_part. A zero-area box (a line or point, or a degenerate box where x1==x2 or y1==y2) cannot participate in IoU-based fusion, so it is excluded from the result. This is the only one of the three box checks that actually removes data.","triggerScenarios":"Passing weighted_boxes_fusion() a boxes entry where x2 == x1 or y2 == y2-y1 == 0 — e.g. a clamped box at an image edge, a cxcywh box with w=0 or h=0, or float rounding that collapses a dimension to exactly 0.0. Note the exact == 0.0 comparison: only exactly-zero areas are skipped, not tiny ones.","commonSituations":"Models that regress zero width/height for very small or failed detections; boxes clipped to image bounds where the object is entirely outside so x1==x2 at the border; ensembling overconfidence-prone single-stage detectors that emit degenerate proposals.","solutions":["Filter degenerate boxes before fusion: keep = (b[:, 2] > b[:, 0]) & (b[:, 3] > b[:, 1]) then pass b[keep].","Clamp cxcywh sizes away from zero (w = max(w, eps), h = max(h, eps)) in your conversion code if zero-size boxes are spurious.","Inspect the emitting model if zero-area boxes appear frequently — it usually signals a broken bbox head, bad regression targets, or a data annotation problem.","If occasional drops are acceptable, ignore the warning: warnings.filterwarnings('ignore', message='Zero area box skipped.*')."],"exampleFix":"# before\nlabels, scores, boxes = weighted_boxes_fusion(boxes_list, labels_list, scores_list)\n# after\nboxes_list = [[b for b in bl if (b[2] - b[0]) > 0 and (b[3] - b[1]) > 0] for bl in boxes_list]\nlabels, scores, boxes = weighted_boxes_fusion(boxes_list, labels_list, scores_list)","handlingStrategy":"validation","validationCode":"def drop_degenerate(boxes, labels=None, scores=None):\n    boxes = np.asarray(boxes)\n    keep = (boxes[:, 2] - boxes[:, 0]) > 0\n    if labels is None:\n        return boxes[keep]\n    return boxes[keep], [l for l, k in zip(labels, keep) if k], [s for s, k in zip(scores, keep) if k]","typeGuard":"def all_positive_area(boxes):\n    boxes = np.asarray(boxes)\n    return bool(((boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1]) > 0).all())","tryCatchPattern":null,"preventionTips":["Filter (x2-x1)>0 and (y2-y1)>0 before calling weighted_boxes_fusion.","Clamp w,h in cxcywh space to a small epsilon during conversion.","Investigate the source model if degenerate boxes recur — usually upstream regression issues."],"tags":["mmdetection","wbf","degenerate-box","bounding-box","data-cleaning"],"backgroundTag":"invalid-bbox-coordinates","analyzedSha":"cfd5d3a985b0249de009b67d04f37263e11cdf3d","analyzedAt":"2026-08-27T20:54:20.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}