predict_images#
from pssr.predict import predict_images
- pssr.predict.predict_images(model: Module, dataset: Dataset, device: str = 'cpu', norm: bool = False, prefix: str = None, out_dir: str = 'preds', callbacks=None)#
Predicts high-resolution images from low-resolution images using a given model.
Only uses evaluation images if applicable. Set
val_split=1
in dataset to use all images.- Parameters:
model (nn.Module) – Model to recieve low-resolution images.
dataset (Dataset) – Dataset to load low-resolution images from.
device (str) – Device to train model on. Default is “cpu”.
norm (bool) – Whether to normalize prediction image intensities to ground truth, which must be provided by a paired dataset. Default is False.
prefix (str) – Prefix to append at the beginning the output file name. Default is None.
out_dir (str) – Directory to save images. A value of None returns images. Default is “preds”.
callbacks (list[Callable]) – Callbacks after each prediction. Can optionally specify an argument for locals to be passed. Default is None.
- Returns:
Returns predicted images if
out_dir
is None.- Return type:
images (list[np.ndarray])