MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / load

Method load

projects/SparseRCNN/crowdhumantools/crowdhuman_eval.py:28–69  ·  view source on GitHub ↗

:meth: read the object from a dict

(self, record, body_key, head_key, class_names, gtflag)

Source from the content-addressed store, hash-verified

26 self._dtNum = None
27
28 def load(self, record, body_key, head_key, class_names, gtflag):
29 """
30 :meth: read the object from a dict
31 """
32 if "ID" in record and self.ID is None:
33 self.ID = record['ID']
34 if "width" in record and self._width is None:
35 self._width = record["width"]
36 if "height" in record and self._height is None:
37 self._height = record["height"]
38 if gtflag:
39 self._gtNum = len(record["gtboxes"])
40 body_bbox, head_bbox = self.load_gt_boxes(record, 'gtboxes', class_names)
41 if self.eval_mode == 0:
42 self.gtboxes = body_bbox
43 self._ignNum = (body_bbox[:, -1] == -1).sum()
44 elif self.eval_mode == 1:
45 self.gtboxes = head_bbox
46 self._ignNum = (head_bbox[:, -1] == -1).sum()
47 elif self.eval_mode == 2:
48 gt_tag = np.array(
49 [body_bbox[i, -1] != -1 and head_bbox[i, -1] != -1
50 for i in range(len(body_bbox))]
51 )
52 self._ignNum = (gt_tag == 0).sum()
53 self.gtboxes = np.hstack(
54 (body_bbox[:, :-1], head_bbox[:, :-1], gt_tag.reshape(-1, 1))
55 )
56 else:
57 raise Exception('Unknown evaluation mode!')
58 if not gtflag:
59 self._dtNum = len(record["dtboxes"])
60 if self.eval_mode == 0:
61 self.dtboxes = self.load_det_boxes(record, 'dtboxes', body_key, 'score')
62 elif self.eval_mode == 1:
63 self.dtboxes = self.load_det_boxes(record, 'dtboxes', head_key, 'score')
64 elif self.eval_mode == 2:
65 body_dtboxes = self.load_det_boxes(record, 'dtboxes', body_key)
66 head_dtboxes = self.load_det_boxes(record, 'dtboxes', head_key, 'score')
67 self.dtboxes = np.hstack((body_dtboxes, head_dtboxes))
68 else:
69 raise Exception('Unknown evaluation mode!')
70
71 def compare_caltech(self, thres):
72 """

Callers 15

benchmark.pyFile · 0.80
benchmark_evalFunction · 0.80
do_flopFunction · 0.80
do_activationFunction · 0.80
load_coco_panoptic_jsonFunction · 0.80
load_cityscapes_panopticFunction · 0.80
load_cityscapes_semanticFunction · 0.80
__init__Method · 0.80

Calls 2

load_gt_boxesMethod · 0.95
load_det_boxesMethod · 0.95

Tested by 1

_test_modelMethod · 0.64