MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / ground_eval

Function ground_eval

tools/eval_script.py:26–107  ·  view source on GitHub ↗
(gt_annos, det_annos, iou_thr)

Source from the content-addressed store, hash-verified

24
25
26def ground_eval(gt_annos, det_annos, iou_thr):
27
28 assert len(det_annos) == len(gt_annos)
29
30 pred = {}
31 gt = {}
32
33 object_types = [
34 'Easy', 'Hard', 'View-Dep', 'View-Indep', 'Unique', 'Multi', 'Overall'
35 ]
36
37 for t in iou_thr:
38 for object_type in object_types:
39 pred.update({object_type + '@' + str(t): 0})
40 gt.update({object_type + '@' + str(t): 1e-14})
41
42 for sample_id in range(len(det_annos)):
43 det_anno = det_annos[sample_id]
44 gt_anno = gt_annos[sample_id]['ann_info']
45
46 bboxes = det_anno['bboxes_3d']
47 gt_bboxes = gt_anno['gt_bboxes_3d']
48 bboxes = EulerDepthInstance3DBoxes(bboxes, origin=(0.5, 0.5, 0.5))
49 gt_bboxes = EulerDepthInstance3DBoxes(gt_bboxes,
50 origin=(0.5, 0.5, 0.5))
51 scores = bboxes.tensor.new_tensor(
52 det_anno['scores_3d']) # (num_query, )
53
54 view_dep = gt_anno['is_view_dep']
55 hard = gt_anno['is_hard']
56 unique = gt_anno['is_unique']
57
58 box_index = scores.argsort(dim=-1, descending=True)[:10]
59 top_bboxes = bboxes[box_index]
60
61 iou = top_bboxes.overlaps(top_bboxes, gt_bboxes) # (num_query, 1)
62
63 for t in iou_thr:
64 threshold = iou > t
65 found = int(threshold.any())
66 if view_dep:
67 gt['View-Dep@' + str(t)] += 1
68 pred['View-Dep@' + str(t)] += found
69 else:
70 gt['View-Indep@' + str(t)] += 1
71 pred['View-Indep@' + str(t)] += found
72 if hard:
73 gt['Hard@' + str(t)] += 1
74 pred['Hard@' + str(t)] += found
75 else:
76 gt['Easy@' + str(t)] += 1
77 pred['Easy@' + str(t)] += found
78 if unique:
79 gt['Unique@' + str(t)] += 1
80 pred['Unique@' + str(t)] += found
81 else:
82 gt['Multi@' + str(t)] += 1
83 pred['Multi@' + str(t)] += found

Callers 1

mainFunction · 0.70

Calls 2

overlapsMethod · 0.45

Tested by

no test coverage detected