minerva.transforms

Submodules

Classes

Flip

Flip the input data along the specified axis.

PerlinMasker

Zeroes entries of a tensor according to the sign of Perlin noise. Seed for the noise generator given by torch.randint

TransformPipeline

Apply a sequence of transforms to a single sample of data and return the

_Transform

This class is a base class for all transforms. Transforms is just a

Package Contents

class minerva.transforms.Flip(axis=0)

Bases: _Transform

Flip the input data along the specified axis.

Flip the input data along the specified axis.

Parameters

axisint | List[int], optional

One or more axis to flip the input data along, by default 0. If a list of axis is provided, the input data is flipped along all the specified axis in the order they are provided.

__call__(x)

Flip the input data along the specified axis. if axis is an integer, the input data is flipped along the specified axis. if axis is a list of integers, the input data is flipped along all the specified axis in the order they are provided. The input must have the same, or less, number of dimensions as the length of the list of axis.

Parameters:

x (numpy.ndarray)

Return type:

numpy.ndarray

Parameters:

axis (int | List[int])

class minerva.transforms.PerlinMasker(octaves, scale=1)

Bases: _Transform

Zeroes entries of a tensor according to the sign of Perlin noise. Seed for the noise generator given by torch.randint

Zeroes entries of a tensor according to the sign of Perlin noise. Seed for the noise generator given by torch.randint

Parameters

octaves: int

Level of detail for the Perlin noise generator

scale: float = 1

Optionally rescale the Perlin noise. Default is 1 (no rescaling)

__call__(x)

Zeroes entries of a tensor according to the sign of Perlin noise.

Parameters

x: np.ndarray

The tensor whose entries to zero.

Parameters:

x (numpy.ndarray)

Return type:

numpy.ndarray

Parameters:
  • octaves (int)

  • scale (float)

class minerva.transforms.TransformPipeline(transforms)

Bases: _Transform

Apply a sequence of transforms to a single sample of data and return the transformed data.

Apply a sequence of transforms to a single sample of data and return the transformed data.

Parameters

transformsList[_Transform]

A list of transforms to be applied to the input data.

__call__(x)

Apply a sequence of transforms to a single sample of data and return the transformed data.

Parameters:

x (Any)

Return type:

Any

Parameters:

transforms (Sequence[_Transform])

class minerva.transforms._Transform

This class is a base class for all transforms. Transforms is just a fancy word for a function that takes an input and returns an output. The input and output can be anything. However, transforms operates over a single sample of data and does not require any additional information to perform the transformation. The __call__ method should be overridden in subclasses to define the transformation logic.

abstract __call__(*args, **kwargs)

Implement the transformation logic in this method. Usually, the transformation is applyied on a single sample of data.

Return type:

Any