Prediction Utils
Deprecated module.
convert_outputs(predictions, tiled)
Convert the Lightning trainer outputs to the desired form.
This method allows stitching back together tiled predictions.
Parameters:
-
predictions(list) –Predictions that are output from
Trainer.predict. -
tiled(bool) –Whether the predictions are tiled.
Returns:
-
list of numpy.ndarray or numpy.ndarray–list of arrays with the axes SC(Z)YX. If there is only 1 output it will not be in a list.
convert_outputs_pn2v(predictions, tiled)
Convert the Lightning trainer outputs to the desired form.
This method allows stitching back together tiled predictions.
Parameters:
-
predictions(list) –Predictions that are output from
Trainer.predict. Length of list the total number of tiles divided by the batch size. Each element consists of a tuple of ((prediction, mse), tile_info_list). 1st dimension of each tensor is the bs. Length of tile info list is the batch size. -
tiled(bool) –Whether the predictions are tiled.
Returns:
stitch_prediction_single(tiles, tile_infos)
Stitch tiles back together to form a full image.
Tiles are of dimensions SC(Z)YX, where C is the number of channels and can be a singleton dimension.
Parameters:
-
tiles(list of numpy.ndarray) –Cropped tiles and their respective stitching coordinates.
-
tile_infos(list of TileInformation) –List of information and coordinates obtained from
dataset.tiled_patching.extract_tiles.
Returns:
-
ndarray–Full image, with dimensions SC(Z)YX.