neuro_morpho.model.transforms ============================= .. py:module:: neuro_morpho.model.transforms .. autoapi-nested-parse:: Image transformations for data augmentation and preprocessing. Classes ------- .. autoapisummary:: neuro_morpho.model.transforms.Standardize neuro_morpho.model.transforms.Norm2One neuro_morpho.model.transforms.DownSample Module Contents --------------- .. py:class:: Standardize(eps: float = 1e-08) Bases: :py:obj:`torch.nn.Module` Standardize an image. This transform subtracts the mean and divides by the standard deviation. .. py:attribute:: eps :value: 1e-08 .. py:method:: forward(x: torch.Tensor) -> torch.Tensor Apply the standardization. .. py:class:: Norm2One(eps: float = 1e-08) Bases: :py:obj:`torch.nn.Module` Normalize an image to the range [0, 1]. .. py:attribute:: eps :value: 1e-08 .. py:method:: forward(x: torch.Tensor) -> torch.Tensor Apply the normalization. .. py:class:: DownSample(in_size: tuple[int, int], factors: int | float | tuple[float, Ellipsis] | list[float]) Bases: :py:obj:`torch.nn.Module` Downsample an image by a given factor. This transform can downsample an image by a single factor or multiple factors. .. py:attribute:: _single_factor .. py:method:: forward(x: torch.Tensor) -> torch.Tensor | tuple[torch.Tensor, Ellipsis] Apply the downsampling. :param x: The input tensor. :type x: torch.Tensor :returns: The downsampled tensor(s). :rtype: torch.Tensor | tuple[torch.Tensor, ...]