MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / __getitem__

Method __getitem__

datasets/INFERENCE_AGORA.py:33–55  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

31 return len(self.img_paths)
32
33 def __getitem__(self, idx):
34 img = load_img(self.img_paths[idx],'BGR')
35 img_whole_bbox = np.array([0, 0, img.shape[1],img.shape[0]])
36 img, img2bb_trans, bb2img_trans, _, _ = \
37 augmentation_keep_size(img, img_whole_bbox, 'test')
38 img = (img.astype(np.float32))
39
40 inputs = {'img': img}
41 targets = {
42 'body_bbox_center': np.array(img_whole_bbox[None]),
43 'body_bbox_size': np.array(img_whole_bbox[None])}
44 meta_info = {
45 'ori_shape':np.array(self.resolution),
46 'img_shape': np.array(img.shape[:2]),
47 'img2bb_trans': img2bb_trans,
48 'bb2img_trans': bb2img_trans,
49 'ann_idx': idx}
50 result = {**inputs, **targets, **meta_info}
51
52 result = self.normalize(result)
53 result = self.format(result)
54
55 return result
56
57 def inference(self, outs):
58 img_paths = self.img_paths

Callers

nothing calls this directly

Calls 2

load_imgFunction · 0.90
augmentation_keep_sizeFunction · 0.90

Tested by

no test coverage detected