Tile Write Strategy
A writing strategy that caches tiles until a whole image is predicted.
TileWriteStrategy
Bases: WriteStrategy
A write strategy that will cache tiles.
Tiles are cached until a whole image is predicted on. Then the stitched prediction is saved.
Parameters:
-
write_func(WriteFunc) –Function used to save predictions.
-
write_extension(str) –Extension added to prediction file paths.
-
write_func_kwargs(dict of {str: Any}) –Extra kwargs to pass to
write_func.
Attributes:
-
write_func(WriteFunc) –Function used to save predictions.
-
write_extension(str) –Extension added to prediction file paths.
-
write_func_kwargs(dict of {str: Any}) –Extra kwargs to pass to
write_func. -
tile_cache(dict of {int: list of ImageRegionData}) –Tiles cached for stitching prediction.
-
tile_info_cache(list of TileInformation) –Cached tile information for stitching prediction.
-
source_base(Path or None) –Common parent of the sources, used to preserve their directory structure. Set via
set_source_base.
__init__(write_func, write_extension, write_func_kwargs)
A write strategy that will cache tiles.
Tiles are cached until a whole image is predicted on. Then the stitched prediction is saved.
Parameters:
set_source_base(source_base)
Set the common parent directory of the sources.
Called by the prediction writer callback so that the directory structure of the sources can be preserved in the output.
Parameters:
-
source_base(Path or None) –Common parent of all prediction sources. If None, outputs are written directly under the output directory without preserving structure.
write_batch(dirpath, predictions)
Cache tiles until the last tile is predicted, then save the stitched image.
Parameters:
-
dirpath(Path) –Path to directory to save predictions to.
-
predictions(list[ImageRegionData]) –Decollated predictions.