{"record":{"id":"a1b55da698a73ed2","repo":"roboflow/supervision","slug":"recall-metric-requires-confidence-on-predictions","errorCode":null,"errorMessage":"Recall metric requires `confidence` on predictions.","messagePattern":"Recall metric requires `confidence` on predictions\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/recall.py","lineNumber":258,"sourceCode":"                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                    )\n\n                else:\n                    if predictions.confidence is None:\n                        raise ValueError(\n                            \"Recall metric requires `confidence` on predictions.\"\n                        )\n                    prediction_class_ids = np.asarray(\n                        predictions.class_id, dtype=np.int32\n                    )\n                    target_class_ids = np.asarray(targets.class_id, dtype=np.int32)\n                    prediction_confidence = np.asarray(\n                        predictions.confidence, dtype=np.float32\n                    )\n                    if self._metric_target == MetricTarget.BOXES:\n                        # BOXES target never yields CompactMask; narrow for mypy.\n                        iou = box_iou_batch(\n                            cast(npt.NDArray[np.number], target_contents),\n                            cast(npt.NDArray[np.number], prediction_contents),\n                        )\n                    elif self._metric_target == MetricTarget.MASKS:\n                        iou = mask_iou_batch(target_contents, prediction_contents)\n                    elif self._metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/recall.py#L240-L276","documentation":"Error \"Recall metric requires `confidence` on predictions.\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/recall.py:258 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set confidence on the prediction Detections before computing Recall.","If your model does not output scores, supply a placeholder confidence array (e.g. all ones)."],"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-15T22:17:37.221Z"}