MCPcopy Create free account
hub / github.com/SceneFun3D/scenefun3d / evaluate

Function evaluate

eval/functionality_segmentation/eval_utils/eval_script.py:339–359  ·  view source on GitHub ↗
(preds: dict, gt_path: str, print_result=True)

Source from the content-addressed store, hash-verified

337 return np.diag(hist) / (hist.sum(1) + hist.sum(0) - np.diag(hist))
338
339def evaluate(preds: dict, gt_path: str, print_result=True):
340 matches = {}
341 for (k, v) in tqdm(preds.items(), desc="evaluate instances"):
342 gt_file = os.path.join(gt_path, k + ".txt")
343 if not os.path.isfile(gt_file):
344 util.print_error('Scan {} does not match any gt file'.format(k), user_fault=True)
345
346 matches_key = os.path.abspath(gt_file)
347 # assign gt to predictions
348 gt2pred, pred2gt = assign_instances_for_scan(v, gt_file)
349 matches[matches_key] = {}
350 matches[matches_key]['gt'] = gt2pred
351 matches[matches_key]['pred'] = pred2gt
352
353 ap_scores = evaluate_matches(matches)
354 avgs = compute_averages(ap_scores)
355
356 if print_result:
357 print_results(avgs)
358
359 return avgs
360
361

Callers 1

mainFunction · 0.90

Calls 4

evaluate_matchesFunction · 0.70
compute_averagesFunction · 0.70
print_resultsFunction · 0.70

Tested by

no test coverage detected