Class Transforms

java.lang.Object
ai.beestream.jitnn.data.Transforms

public final class Transforms extends Object
Per-sample transforms for DataLoader, applied in place to one CHW sample on the host: the usual image augmentations and normalisation. A transform draws from the random stream it is given, which the loader derives from its seed, the epoch and the sample, so batches do not depend on the number of workers.
  • Method Details

    • randomHorizontalFlip

      public static Transforms.Transform randomHorizontalFlip()
      Mirrors the image left to right with probability 1/2 (torchvision's RandomHorizontalFlip).
    • randomCrop

      public static Transforms.Transform randomCrop(int pad)
      Pads the image with pad zeros on every side and crops the original size back at a random offset (torchvision's RandomCrop(size, padding)).
    • normalize

      public static Transforms.Transform normalize(float[] mean, float[] std)
      (x - mean[c]) / std[c] per channel (torchvision's Normalize).