Skip to main content

preprocessing.write_label_uint8

preprocessing.write_label_uint8(label_path, output_path, *, nodata=None)

Re-write a single-band label GeoTIFF with a clean nodata convention.

The companion to :func:select_bands for the mask side of a segmentation training set. PIL-based loaders in some downstream packages reject masks whose nodata is nan or whose dtype is not a clean integer.

Args: label_path: Existing single-band label raster. output_path: Where to write the cleaned label. nodata: Output nodata value (defaults to None = no nodata).

Returns: Path to the written label GeoTIFF.