| 13 | |
| 14 | class EventAugment(object): |
| 15 | def __init__(self, resolution): |
| 16 | self.resolution = resolution |
| 17 | self.augment_list = [ |
| 18 | (self.identity, 0, 0), |
| 19 | (self.drop_by_time, 0.1, 0.9), |
| 20 | (self.drop_by_area, 0.1, 0.5), |
| 21 | (self.random_drop, 0.1, 0.5), |
| 22 | # (self.drop_by_area_with_cam, 0.1, 0.6), |
| 23 | # (self.random_drop_with_cam, 0.5, 1), |
| 24 | (self.overall_noise, 0.1, 0.9), |
| 25 | (self.region_noise, 0.1, 0.5), |
| 26 | # (self.overall_noise_with_cam, 0.1, 1), |
| 27 | # (self.region_noise_with_cam, 0.1, 0.9), |
| 28 | (self.time_incline_x, 0.05, 0.5), |
| 29 | (self.time_incline_y, 0.05, 0.5), |
| 30 | # (self.random_shift_time, 0.1, 0.8), |
| 31 | |
| 32 | (self.random_shift_xy, 1, 10), |
| 33 | (self.flip_along_x, 0, 0), |
| 34 | (self.flip_along_y, 0, 0), |
| 35 | (self.flip_along_time, 0, 0), |
| 36 | (self.rotate, 0, math.pi / 2), |
| 37 | (self.linear_x, 0, 0.6), |
| 38 | (self.linear_y, 0, 0.6), |
| 39 | (self.shear_x, 0, 1), |
| 40 | (self.shear_y, 0, 1), |
| 41 | (self.scale, 0.2, 2)] |
| 42 | self.ops_name = [] |
| 43 | self.ops_list = [] |
| 44 | self.mags_list = [] |
| 45 | self.l_ops = len(self.augment_list) |
| 46 | self.l_uniq = 0 |
| 47 | for idx, op in enumerate(self.augment_list): |
| 48 | self.ops_name.append(op.__str__().split(' ')[2].split('.')[1]) |
| 49 | |
| 50 | def __call__(self, events): |
| 51 | op_idx = random.randint(0, len(self.augment_list)) - 1 |