{"record":{"id":"26b2e57c7cb4d314","repo":"roboflow/supervision","slug":"evaluating-predictions-with-keypoints-is-not-suppo","errorCode":null,"errorMessage":"Evaluating predictions with keypoints is not supported.","messagePattern":"Evaluating predictions with keypoints is not supported\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/mean_average_precision.py","lineNumber":546,"sourceCode":"        ids = [pred[\"image_id\"] for pred in predictions]\n\n        # Make sure the image ids from predictions exist in the current dataset.\n        # A plain ``assert`` would be stripped under ``python -O``, so validate\n        # this public-input contract with an explicit exception instead.\n        if not set(ids) <= set(self.get_image_ids()):\n            raise ValueError(\"Results do not correspond to current coco set\")\n\n        # Check if the predictions contain any unsupported keys\n        if \"caption\" in predictions[0]:\n            raise NotImplementedError(\n                \"Evaluating predictions with caption is not supported.\"\n            )\n        elif \"segmentation\" in predictions[0]:\n            raise NotImplementedError(\n                \"Evaluating predictions with segmentation is not supported.\"\n            )\n        elif \"keypoints\" in predictions[0]:\n            raise NotImplementedError(\n                \"Evaluating predictions with keypoints is not supported.\"\n            )\n\n        elif \"bbox\" in predictions[0] and not predictions[0][\"bbox\"] == []:\n            predictions_dataset.dataset[\"categories\"] = copy.deepcopy(\n                self.dataset[\"categories\"]\n            )\n\n            # Prepare fields for every prediction of the given image\n            for idx, pred in enumerate(predictions):\n                x, y, w, h = pred[\"bbox\"]\n                x1, x2, y1, y2 = [x, x + w, y, y + h]\n\n                # Make segmentation from bounding box coordinates\n                if \"segmentation\" not in pred:\n                    pred[\"segmentation\"] = [[x1, y1, x1, y2, x2, y2, x2, y1]]\n                # Use provided area if available\n                if \"area\" not in pred:","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/mean_average_precision.py#L528-L564","documentation":"EvaluationDataset.load_predictions() implements box-detection evaluation only. This NotImplementedError fires when the first prediction dict contains a 'keypoints' key — the COCO keypoint-result format (person keypoints, pose models). Keypoint/pose evaluation is out of scope for this backend, so the input is rejected explicitly rather than evaluated incorrectly.","triggerScenarios":"Feeding COCO pose results (dicts with image_id, category_id, keypoints, score) into load_predictions; evaluating pose-model exports (e.g. from a keypoint detector) saved in official COCO keypoint format; mixed-task results files whose first record is a keypoint result.","commonSituations":"Running pose estimation benchmarks and reaching for supervision's mAP; reusing detection eval scripts on pose outputs; converting between COCO task JSONs without dropping task-specific keys.","solutions":["Use box results (image_id, category_id, bbox, score) for this API","For pose evaluation use pycocotools COCOeval with iouType='keypoints' or a pose-specific library","Filter mixed result files by key before evaluation","For supervision-native keypoint workflows, use supervision.key_points classes rather than the COCO mAP path"],"exampleFix":"# before\npose_results = [{'image_id': 1, 'category_id': 1,\n                 'keypoints': [...], 'score': 0.87}]\ncoco_det = coco_gt.load_predictions(pose_results)\n\n# after\nbox_results = [{'image_id': 1, 'category_id': 1,\n                'bbox': [x, y, w, h], 'score': 0.87}]\ncoco_det = coco_gt.load_predictions(box_results)","handlingStrategy":"validation","validationCode":"if predictions and 'keypoints' in predictions[0]:\n    raise TypeError('keypoint results unsupported; use pycocotools keypoint eval')","typeGuard":"def is_box_only_results(preds: list) -> bool:\n    \"\"\"True when no unsupported task keys appear in the first result.\"\"\"\n    if not preds:\n        return True\n    return not ({'caption', 'segmentation', 'keypoints'} & set(preds[0]))","tryCatchPattern":"try:\n    dataset.load_predictions(results)\nexcept NotImplementedError as e:\n    if 'keypoints' in str(e):\n        raise RuntimeError('route pose results to COCOeval(iouType=\"keypoints\")') from e\n    raise","preventionTips":["Use pycocotools COCOeval keypoints mode for pose evaluation","Keep pose and detection results in separate files","Inspect the first record's keys to route each results file"],"tags":["metrics","mean-average-precision","coco","keypoints","not-implemented"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}