neuro_morpho.model.transforms

Image transformations for data augmentation and preprocessing.

Classes

Standardize

Standardize an image.

Norm2One

Normalize an image to the range [0, 1].

DownSample

Downsample an image by a given factor.

Module Contents

class neuro_morpho.model.transforms.Standardize(eps: float = 1e-08)

Bases: torch.nn.Module

Standardize an image.

This transform subtracts the mean and divides by the standard deviation.

eps = 1e-08
forward(x: torch.Tensor) torch.Tensor

Apply the standardization.

class neuro_morpho.model.transforms.Norm2One(eps: float = 1e-08)

Bases: torch.nn.Module

Normalize an image to the range [0, 1].

eps = 1e-08
forward(x: torch.Tensor) torch.Tensor

Apply the normalization.

class neuro_morpho.model.transforms.DownSample(in_size: tuple[int, int], factors: int | float | tuple[float, Ellipsis] | list[float])

Bases: torch.nn.Module

Downsample an image by a given factor.

This transform can downsample an image by a single factor or multiple factors.

_single_factor
forward(x: torch.Tensor) torch.Tensor | tuple[torch.Tensor, Ellipsis]

Apply the downsampling.

Parameters:

x (torch.Tensor) – The input tensor.

Returns:

The downsampled tensor(s).

Return type:

torch.Tensor | tuple[torch.Tensor, …]