MCPcopy Create free account
hub / github.com/MotrixLab/ADHMR / augmentation_seg

Function augmentation_seg

HMR-Scorer/common/utils/preprocessing.py:119–131  ·  view source on GitHub ↗
(img, seg_img, bbox, data_split)

Source from the content-addressed store, hash-verified

117
118
119def augmentation_seg(img, seg_img, bbox, data_split):
120 if getattr(cfg, 'no_aug', False):
121 scale, rot, color_scale, do_flip = 1.0, 0.0, np.array([1, 1, 1]), False
122 elif data_split == 'train':
123 scale, rot, color_scale, do_flip = get_aug_config()
124 else:
125 scale, rot, color_scale, do_flip = 1.0, 0.0, np.array([1, 1, 1]), False
126
127 img, trans, inv_trans = generate_patch_image(img, bbox, scale, rot, do_flip, cfg.input_img_shape)
128 seg_img, _, _ = generate_patch_image(seg_img, bbox, scale, rot, do_flip, cfg.input_img_shape)
129 focal_scale = cfg.input_img_shape[1] / (bbox[2] * scale)
130 img = np.clip(img * color_scale[None, None, :], 0, 255)
131 return img, seg_img, trans, inv_trans, rot, do_flip, focal_scale
132
133
134def generate_patch_image(cvimg, bbox, scale, rot, do_flip, out_shape):

Callers 3

__getitem__Method · 0.90
__getitem__Method · 0.90
__getitem__Method · 0.90

Calls 2

get_aug_configFunction · 0.70
generate_patch_imageFunction · 0.70

Tested by 1

__getitem__Method · 0.72