Skip to content

Exporter

Bases: Protocol

Protocol for exporters

Exporters are callables that export predictions. The exporter is used by the pipeline to export the batched output of the model's inference.

Currently implemented exporters
  • SegmentationExporter: Exports segmentation predictions

__call__

Exports the predictions.

PARAMETER DESCRIPTION
preds

batched predictions

TYPE: npt.NDArray[np.uint8]

coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet


SegmentationExporter

Bases: FromConfigMixin

Exporter for segmentation predictions

Implements the Exporter protocol.

The predictions (i.e. raster data) are transformed to geospatial data (i.e. vector data). The resulting geodataframe contains the geometry of the polygons and their class that is stored in the field field_name as the pixel value of the prediction. The segmentation exporter creates a geopackage named output.gpkg and exports the geodataframe of each tile dynamically. The coordinates of the bottom left corner of the processed tiles are exported dynamically to a JSON file named processed_coordinates.json.

Notes
  • The segmentation exporter uses multiple threads to vectorize and export the predictions
PARAMETER DESCRIPTION
path

path to the output directory

TYPE: Path

tile_size

tile size in meters

TYPE: TileSize

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

epsg_code

EPSG code

TYPE: EPSGCode

field_name

name of the field in the geodataframe

TYPE: str DEFAULT: 'class'

num_workers

number of workers

TYPE: int DEFAULT: 4

from_config classmethod

Creates a segmentation exporter from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: SegmentationExporterConfig

RETURNS DESCRIPTION
SegmentationExporter

segmentation exporter

__call__

Exports the predictions.

PARAMETER DESCRIPTION
preds

batched predictions

TYPE: npt.NDArray[np.uint8]

coordinates

coordinates (x_min, y_min) of each tile

TYPE: CoordinatesSet


SegmentationExporterConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of SegmentationExporter

ATTRIBUTE DESCRIPTION
path

path to the output directory

TYPE: Path

tile_size

tile size in meters

TYPE: TileSize

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

epsg_code

EPSG code

TYPE: EPSGCode

field_name

name of the field in the geodataframe

TYPE: str

num_workers

number of workers

TYPE: int