def __init__(self, axes): """ Mirror data across specified axes, randomly during pre-processing, and using all permutations during full pre-processing. :param axes: Dimensions across which data is mirrored. (list) """ # Check first dimension (batch size) is not flipped if 0 in axes: raise ValueError('Cannot flip across dimension 0 (batch size)!') # Prepare amount of crops and size at each dimension self.axes = axes # Call parent initializer Operator.__init__(self, num_modes=2**len(self.axes))
def __init__(self, sizes, amounts=None): """ Crop data across all dimensions, randomly during random pre-processing, and at N evenly spread locations per dimension during full pre-processing. :param sizes: Size of the crop at each dimension. Use -1 to specify full size. (list) :param amounts: Number of evenly-spread crops per dimension during full pre-processing. (list) """ # Prepare amount of crops and size at each dimension amounts = [1] * len(sizes) if amounts is None else amounts self.amounts = amounts if isinstance( amounts, (list, tuple)) else [amounts] * len(self.sizes) self.sizes = sizes # Call parent initializer Operator.__init__(self, num_modes=np.prod(amounts))
def __init__(self, axes, ranges): """ Shift data across specified axes, randomly during pre-processing, doing nothing during full-augmentation. :param axes: Dimensions across which to shift. (list) :param ranges: Range of the shifts across each dimension. (list of lists) """ # Check first dimension (batch size) is not shifted if 0 in axes: raise ValueError('Cannot shift across dimension 0 (batch size)!') # Prepare operator attributes self.axes = axes self.ranges = ranges # Call parent initializer Operator.__init__(self, num_modes=1)
def __init__(self, order): self.order = tuple(order) Operator.__init__(self, num_modes=1)
def __init__(self, args, sess): Operator.__init__(self, args, sess)
def __init__(self, weight=1, bias=0): self.weight = weight self.bias = bias Operator.__init__(self, num_modes=1)