PairedSlidingDataset#
from pssr.data import PairedSlidingDataset
- pssr.data.PairedSlidingDataset.__init__(self, hr_path: Path, lr_path: Path, hr_res: int = 512, lr_scale: int = 4, overlap: int = 128, n_frames: list[int] = -1, stack: str = 'TZ', extension: str = 'czi', preload: bool = True, val_split: float = 1, rotation: bool = True, split_seed: int = None, transforms: list[Module] = None)#
Testing dataset for loading high-low-resolution image tiles from image sheets without crappification. Can also be used for approximating
Crappifier
parameters.Dataset used for image sheets (e.g. .czi files). For pre-tiled image files, use
ImageDataset
.- Parameters:
hr_path (Path) – Path to folder containing high-resolution images. Can also be a str.
lr_path (Path) – Path to folder containing low-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.
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 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 None.
transforms (list[nn.Module]) – Additional final data transforms to apply. Default is None.