SlidingDataset#

from pssr.data import SlidingDataset
pssr.data.SlidingDataset.__init__(self, path: ~pathlib.Path, hr_res: int = 512, lr_scale: int = 4, crappifier: ~pssr.crappifiers.Crappifier = <pssr.crappifiers.Poisson object>, overlap: int = 128, n_frames: list[int] = -1, stack: str = 'TZ', extension: str = 'czi', preload: bool = True, val_split: float = 0.1, rotation: bool = True, split_seed: int = 0, transforms: list[~torch.nn.modules.module.Module] = None)#

Training dataset for loading high-resolution image tiles from image sheets and returning high-low-resolution pairs, the latter receiving crappification.

Dataset used for image sheets (e.g. .czi files). For pre-tiled image files, use ImageDataset.

LR mode (dataset loads only unmodified low-resolution images for prediction) can be enabled by setting lr_scale = -1 and hr_res = LR resolution.

Parameters:
  • path (Path) – Path to folder containing high-resolution images. Can also be a str.

  • hr_res (int) – Resolution of high-resolution images. Images larger than this will be downscaled to this resolution. Images smaller will be padded. Default is 512.

  • lr_scale (int) – Downscaling factor for low-resolution images to simulate undersampling. Choose a power of 2 for best results. Default is 4.

  • crappifier (Crappifier) – Crappifier for degrading low-resolution images to simulate undersampling. Not used in LR mode. Default is Poisson.

  • overlap (int) – Overlapping pixels between neighboring tiles to increase effective dataset size. Default is 128.

  • n_frames (list[int]) – Amount of stacked frames per image tile. Can also be list of low-resolution and high-resolution stack amounts respectively. A value of -1 uses all stacked image frames. Default is -1.

  • stack (str) – Multiframe stack handling mode, e.g “T” for time stack, “Z” for z dimension stack, “TZ” or “ZT” for both, determining flattenting order. Only applicable if loading from czi. Default is “TZ”.

  • extension (str) – File extension of images. Default is “czi”.

  • preload (bool) – Whether to preload images in memory (not VRAM) for faster dataloading. Default is True.

  • val_split (float) – Proportion of images to be held out for evaluation/prediction. Default is 0.1.

  • rotation (bool) – Whether to randomly rotate and/or flip images when loading data. Only applicable during training. Default is True.

  • split_seed (int) – Seed for random train/evaluation data splitting. A value of None splits the last images as evaluation. Default is 0.

  • transforms (list[nn.Module]) – Additional final data transforms to apply. Default is None.