Labels

class geodataset.labels.RasterPolygonLabels(path, associated_raster, labels_gdf=None, geopackage_layer_name=None, main_label_category_column_name=None, other_labels_attributes_column_names=None)[source]

Bases: object

Class to handle the loading and processing of polygon labels associated with a Raster. The labels will automatically be adjusted to the associated Raster pixel coordinate system. For example, this class is instantiated by the LabeledRasterTilerizer to align the Raster and labels.

Parameters:
  • path (str or Path) – Path to the labels file. Supported formats are: .gpkg, .geojson, .shp, .xml, .csv. For .xml and .csv files, only specific formats are supported. Supported .xml and .csv files will also be converted to a GeoDataFrame for downstream uses.

  • associated_raster (Raster) – The instanced Raster object associated with the labels. The labels will automatically be adjusted to this Raster pixel coordinate system.

  • geopackage_layer_name (str, optional) – The name of the layer in the geopackage file to use as labels. Only used if the labels_path is a .gpkg, .geojson or .shp file. Only useful when the labels geopackage file contains multiple layers.

  • main_label_category_column_name (str, optional) – The name of the column in the labels file that contains the main category of the labels.

  • other_labels_attributes_column_names (list of str, optional) – The names of the columns in the labels file that contains other attributes of the labels, which should be kept as a dictionary in the COCO annotations data.