{"record":{"id":"caecc70afb843afd","repo":"roboflow/supervision","slug":"recall-metric-requires-class-id-on-both-predicti","errorCode":null,"errorMessage":"Recall metric requires `class_id` on both predictions and targets.","messagePattern":"Recall metric requires `class_id` on both predictions and targets\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/recall.py","lineNumber":236,"sourceCode":"                    continue\n                stats.append(\n                    (\n                        np.zeros(\n                            (len(prediction_class_ids), iou_thresholds.size),\n                            dtype=np.bool_,\n                        ),\n                        np.zeros(\n                            (len(prediction_class_ids), iou_thresholds.size),\n                            dtype=np.bool_,\n                        ),\n                        prediction_confidence,\n                        prediction_class_ids,\n                        np.zeros((0,), dtype=np.int32),\n                    )\n                )\n            elif len(targets) > 0:\n                if predictions.class_id is None or targets.class_id is None:\n                    raise ValueError(\n                        \"Recall metric requires `class_id` on both predictions \"\n                        \"and targets.\"\n                    )\n                if len(predictions) == 0:\n                    target_class_ids = np.asarray(targets.class_id, dtype=np.int32)[\n                        target_size_mask\n                    ]\n                    if len(target_class_ids) == 0:\n                        continue\n                    stats.append(\n                        (\n                            np.zeros((0, iou_thresholds.size), dtype=bool),\n                            np.zeros((0, iou_thresholds.size), dtype=bool),\n                            np.zeros((0,), dtype=np.float32),\n                            np.zeros((0,), dtype=int),\n                            target_class_ids,\n                        )\n                    )","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/recall.py#L218-L254","documentation":"Error \"Recall metric requires `class_id` on both predictions and targets.\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/recall.py:236 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set class_id on both prediction and target Detections before computing Recall.","Map your model's labels and the dataset's labels to integer class_id arrays."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}