def __call__(self, data): if random.random() < self.prob: data['img'] = functional.horizontal_flip(data['img']) for key in data.get('gt_fields', []): data[key] = functional.horizontal_flip(data[key]) return data
def __call__(self, im, im_info=None, label=None): if random.random() < self.prob: im = functional.horizontal_flip(im) if label is not None: label = functional.horizontal_flip(label) if label is None: return (im, im_info) else: return (im, im_info, label)