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

Function _evaluate

tests/core/metrics/test_metrics_map_computation.py:253–278  ·  view source on GitHub ↗
(gt: dict[str, np.ndarray], pred: dict[str, np.ndarray])

Source from the content-addressed store, hash-verified

251
252
253def _evaluate(gt: dict[str, np.ndarray], pred: dict[str, np.ndarray]):
254 for k, v in gt.items():
255 print(20 * "-")
256 print(k)
257 print("GT")
258 print(v)
259 print("PR")
260 print(pred[k])
261
262 data = prepare_evaluation_data(gt, pred)
263 oks = compute_oks(data, oks_bbox_margin=0)
264
265 num_joints = gt[list(gt.keys())[0]].shape[1]
266 coco_gt = _to_coco_ground_truth(gt, num_joints, bbox_margin=0)
267 coco_pred = _to_coco_predictions(coco_gt, pred, bbox_margin=0)
268 coco_oks = eval_coco(coco_gt, coco_pred, num_joints)
269 print(20 * "-")
270 print("dlc mAP:")
271 for k, v in oks.items():
272 print(k)
273 print(v)
274 print(20 * "-")
275 print(f"pycocotools mAP: {coco_oks}")
276 print()
277 dlc_map = oks["mAP"] / 100
278 assert_almost_equal(dlc_map, coco_oks)
279
280
281def _to_coco_ground_truth(

Calls 7

prepare_evaluation_dataFunction · 0.90
compute_oksFunction · 0.90
itemsMethod · 0.80
keysMethod · 0.80
_to_coco_ground_truthFunction · 0.70
_to_coco_predictionsFunction · 0.70
eval_cocoFunction · 0.70

Tested by

no test coverage detected