MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / _validate_predictions

Method _validate_predictions

deeplabcut/benchmark/base.py:112–128  ·  view source on GitHub ↗

Validates the submitted predictions object Checks that there is a prediction for each test image, and raises a warning if that is not the case. Returns only predictions made for test images.

(self, name: str, predictions: dict)

Source from the content-addressed store, hash-verified

110 )
111
112 def _validate_predictions(self, name: str, predictions: dict) -> dict:
113 """Validates the submitted predictions object Checks that there is a prediction
114 for each test image, and raises a warning if that is not the case.
115
116 Returns only predictions made for test images.
117 """
118 test_images = deeplabcut.benchmark.metrics.load_test_images(self.ground_truth, self.metadata)
119 missing_images = set(test_images) - set(predictions.keys())
120 if len(missing_images) > 0:
121 warnings.warn(
122 f"Missing {len(missing_images)} test images in the predictions for "
123 f"{name}: {list(missing_images)} Metrics will be computed as if no "
124 "individuals were detected in those images.",
125 stacklevel=2,
126 )
127
128 return {img: predictions.get(img, tuple()) for img in test_images}
129
130
131@dataclasses.dataclass

Callers 1

evaluateMethod · 0.95

Calls 2

keysMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected