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

Method __getitem__

datasets/INFERENCE_BEDLAM.py:31–56  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

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