| 103 | |
| 104 | |
| 105 | def augmentation(img, bbox, data_split): |
| 106 | if getattr(cfg, 'no_aug', False): |
| 107 | scale, rot, color_scale, do_flip = 1.0, 0.0, np.array([1, 1, 1]), False |
| 108 | elif data_split == 'train': |
| 109 | scale, rot, color_scale, do_flip = get_aug_config() |
| 110 | else: |
| 111 | scale, rot, color_scale, do_flip = 1.0, 0.0, np.array([1, 1, 1]), False |
| 112 | |
| 113 | img, trans, inv_trans = generate_patch_image(img, bbox, scale, rot, do_flip, cfg.input_img_shape) |
| 114 | focal_scale = cfg.input_img_shape[1] / (bbox[2] * scale) |
| 115 | img = np.clip(img * color_scale[None, None, :], 0, 255) |
| 116 | return img, trans, inv_trans, rot, do_flip, focal_scale |
| 117 | |
| 118 | |
| 119 | def augmentation_seg(img, seg_img, bbox, data_split): |