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

Method __getitem__

datasets/INFERENCE.py:80–105  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

78 return len(self.img_paths)
79
80 def __getitem__(self, idx):
81
82 img = load_img(self.img_paths[idx],'BGR')
83 img_whole_bbox = np.array([0, 0, img.shape[1],img.shape[0]])
84 img, img2bb_trans, bb2img_trans, _, _ = \
85 augmentation_keep_size(img, img_whole_bbox, 'test')
86
87 cropped_img_shape=img.shape[:2]
88 img = (img.astype(np.float32))
89
90 inputs = {'img': img}
91 targets = {
92 'body_bbox_center': np.array(img_whole_bbox[None]),
93 'body_bbox_size': np.array(img_whole_bbox[None])}
94 meta_info = {
95 'ori_shape':np.array(self.resolution),
96 'img_shape': np.array(img.shape[:2]),
97 'img2bb_trans': img2bb_trans,
98 'bb2img_trans': bb2img_trans,
99 'ann_idx': idx}
100 result = {**inputs, **targets, **meta_info}
101
102 result = self.normalize(result)
103 result = self.format(result)
104
105 return result
106
107 def inference(self, outs):
108 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