Transformations

class dataloader.transform.Compose(transforms)

Bases: Transform

A class that represents a composition of multiple transforms.

transforms

A list of transforms to be applied sequentially.

Type:

list

class dataloader.transform.GammaCorrection(gamma=None)

Bases: Transform

Apply gamma correction to an image.

gamma

The gamma value to be used for gamma correction. If None, a random value between 0.5 and 1.5 will be used.

Type:

float

Returns:

The gamma-corrected image.

Return type:

numpy.ndarray

class dataloader.transform.GrayScale

Bases: Transform

Transform class to convert an image to grayscale.

Returns:

Grayscale image.

class dataloader.transform.Normalize(mean, std)

Bases: Transform

A transformation class to normalize an image.

mean

The mean value(s) for normalization.

Type:

float or tuple

std

The standard deviation value(s) for normalization.

Type:

float or tuple

class dataloader.transform.RandomFlip(probability=0.5)

Bases: Transform

Randomly flips the input image horizontally or vertically with a given probability.

probability

The probability of flipping the image. Defaults to 0.5.

Type:

float

Returns:

The flipped image.

Return type:

numpy.ndarray

class dataloader.transform.RandomRotation(probability=0.5, angle=None)

Bases: Transform

Randomly rotates an image by a specified angle or a random angle within a range.

probability

The probability of rotating the image. Defaults to 0.5.

Type:

float

angle

The angle of rotation in degrees. If None, a random angle between -180 and 180 will be used.

Type:

float

Returns:

The rotated image.

Return type:

numpy.ndarray

class dataloader.transform.Resize(size)

Bases: Transform

A transformation class to resize an image to a specified size.

size

The desired size of the image after resizing.

Type:

tuple

class dataloader.transform.Transform

Bases: object

A base class for data transformations.

This class provides a template for implementing custom data transformations. Subclasses should override the __call__ method to define the specific transformation logic.