geographer.label_makers package

Submodules

geographer.label_makers.label_maker_base module

Base class for label makers.

Base class for label makers that generate labels (for any kind of computer vision task) from a connector’s vectors.

class geographer.label_makers.label_maker_base.LabelMaker(**data)[source]

Bases: ABC, BaseModel, SaveAndLoadBaseModelMixIn

Base class for label makers.

Base class for label makers. that generate labels (for any kind of computer vision task) from a connector’s vectors.

Return type:

None

abstract delete_labels(connector, raster_names=None)[source]

Delete (pixel) labels from the connector’s labels_dir.

Parameters:
  • raster_names (list[str] | None) – names of rasters for which to delete labels.

  • None (Defaults to)

  • labels. (i.e. all)

  • connector (Connector)

abstract make_labels(connector, raster_names=None)[source]

Create segmentation labels.

Parameters:
  • raster_names (list[str] | None) – raster names to create labels for. Defaults to None (i.e. all raster without a label).

  • connector (Connector)

recompute_labels(connector, raster_names=None)[source]

Recompute labels.

Equivalent to delete_labels followed by make_labels

Parameters:
  • connector (Connector)

  • raster_names (list[str] | None)

geographer.label_makers.label_type_conversion_utils module

Utility functions for label making code.

geographer.label_makers.label_type_conversion_utils.convert_vectors_soft_cat_to_cat(vectors)[source]

Convert vector features geodataframe from soft to categorical.

Take a vectors GeoDataFrame in soft-categorical format and return a copy converted to categorical format.

Return type:

GeoDataFrame

Parameters:

vectors (GeoDataFrame)

geographer.label_makers.seg_label_maker_base module

Base class for segmentation label makers.

class geographer.label_makers.seg_label_maker_base.SegLabelMaker(**data)[source]

Bases: LabelMaker, BaseModel, SaveAndLoadBaseModelMixIn

Base class for segmentation label makers.

Parameters:

add_background_band (bool)

Return type:

None

field add_background_band: bool = True

Whether to add implicit background band.

delete_labels(connector, raster_names=None)[source]

Delete (pixel) labels from the connector’s labels_dir.

Parameters:
  • raster_names (list[str] | None) – names of rasters for which to delete labels.

  • None (Defaults to)

  • labels. (i.e. all)

  • connector (Connector)

make_labels(connector, raster_names=None)[source]

Create segmentation labels.

Parameters:
  • raster_names (list[str] | None) – list of raster names to create labels for. Defaults to None (i.e. all rasters without a label).

  • connector (Connector)

recompute_labels(connector, raster_names=None)

Recompute labels.

Equivalent to delete_labels followed by make_labels

Parameters:
  • connector (Connector)

  • raster_names (list[str] | None)

abstract property label_type: str

Return label type.

geographer.label_makers.seg_label_maker_categorical module

Label maker for categorical segmentation labels.

class geographer.label_makers.seg_label_maker_categorical.SegLabelMakerCategorical(**data)[source]

Bases: SegLabelMaker

Label maker for categorical segmentation labels.

Parameters:

add_background_band (bool)

Return type:

None

field add_background_band: bool = True

Whether to add implicit background band.

delete_labels(connector, raster_names=None)

Delete (pixel) labels from the connector’s labels_dir.

Parameters:
  • raster_names (list[str] | None) – names of rasters for which to delete labels.

  • None (Defaults to)

  • labels. (i.e. all)

  • connector (Connector)

make_labels(connector, raster_names=None)

Create segmentation labels.

Parameters:
  • raster_names (list[str] | None) – list of raster names to create labels for. Defaults to None (i.e. all rasters without a label).

  • connector (Connector)

recompute_labels(connector, raster_names=None)

Recompute labels.

Equivalent to delete_labels followed by make_labels

Parameters:
  • connector (Connector)

  • raster_names (list[str] | None)

property label_type: str

Return label type.

geographer.label_makers.seg_label_maker_soft_categorical module

Label maker for soft-categorical segmentation labels.

Soft-categorical are probabilistic multi-class labels.

class geographer.label_makers.seg_label_maker_soft_categorical.SegLabelMakerSoftCategorical(**data)[source]

Bases: SegLabelMaker

Label maker for soft-categorical segmentation labels.

Soft-categorical are probabilistic multi-class labels.

Assumes the connector’s vectors contains for each segmentation class a “prob_seg_class<seg_class>” column containing the probabilities for that class.

Parameters:

add_background_band (bool)

Return type:

None

field add_background_band: bool [Required]
delete_labels(connector, raster_names=None)

Delete (pixel) labels from the connector’s labels_dir.

Parameters:
  • raster_names (list[str] | None) – names of rasters for which to delete labels.

  • None (Defaults to)

  • labels. (i.e. all)

  • connector (Connector)

make_labels(connector, raster_names=None)

Create segmentation labels.

Parameters:
  • raster_names (list[str] | None) – list of raster names to create labels for. Defaults to None (i.e. all rasters without a label).

  • connector (Connector)

recompute_labels(connector, raster_names=None)

Recompute labels.

Equivalent to delete_labels followed by make_labels

Parameters:
  • connector (Connector)

  • raster_names (list[str] | None)

property label_type

Return label_type.

Module contents