def __init__(self, p: float = 0.5): """Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5. """ self.flip_coin_vflip = ops.CoinFlip(probability=p) self.image_vflip = ops.Flip(device='gpu', horizontal=0) self.bbox_vflip = ops.BbFlip(device='cpu', horizontal=0) self.ldmrks_vflip = ops.CoordFlip(layout='xy', device='cpu', flip_x=0)
def __init__(self, device, batch_size, iterator, layout, center_x = None, center_y = None, center_z = None, num_threads=1, device_id=0): super(CoordFlipPipeline, self).__init__(batch_size, num_threads, device_id) self.device = device self.iterator = iterator self.coord_flip = ops.CoordFlip(device = self.device, layout=layout, center_x=center_x, center_y=center_y, center_z=center_z) self.flip_x = ops.CoinFlip(probability = 0.5) self.flip_y = ops.CoinFlip(probability = 0.5) self.flip_z = ops.CoinFlip(probability = 0.5) if len(layout) == 3 else None