ImageDataset#
from pssr.data import ImageDataset
- pssr.data.ImageDataset.__init__(self, path: ~pathlib.Path, hr_res: int = 512, lr_scale: int = 4, crappifier: ~pssr.crappifiers.Crappifier = <pssr.crappifiers.Poisson object>, n_frames: list[int] = -1, extension: str = 'tif', 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 images from individual files and returning high-low-resolution pairs, the latter receiving crappification.
Dataset used for pre-tiled image files. For image sheets (e.g. .czi files), use
SlidingDataset
.LR mode (dataset loads only unmodified low-resolution images for prediction) can be enabled by either inputting images less than or equal to LR size (
hr_res
/lr_scale
) or by settinglr_scale
= -1 andhr_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
.n_frames (list[int]) – Amount of stacked frames per image. 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.
extension (str) – File extension of images. Default is “tif”.
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.