ChipClassificationLabels#
- class ChipClassificationLabels[source]#
Bases:
Labels
Represents a spatial grid of cells associated with classes.
Methods
__init__
([cell_to_label])extend
(labels)Adds cells contained in labels.
filter_by_aoi
(aoi_polygons)Return a copy of these labels filtered by given AOI polygons.
from_predictions
(windows, predictions)Overrid to convert predictions to (class_id, scores) pairs.
get_cell_class_id
(cell)Return class_id for a cell.
get_cell_scores
(cell)Return scores for a cell.
Return list of all cells (list of Box).
Return list of class_ids for all cells.
Return list of scores for all cells.
get_singleton_labels
(cell)Return Labels object representing a single cell.
Return list of class_ids and scores for all cells.
Instantiate an empty instance of this class.
save
(uri, class_config, crs_transformer)Save labels as a GeoJSON file.
set_cell
(cell, class_id[, scores])Set cell and its class_id.
- __add__(other: ChipClassificationLabels) ChipClassificationLabels [source]#
Add labels to these labels.
Returns a concatenation of this and the other labels.
- Parameters
other (ChipClassificationLabels) –
- Return type
- __getitem__(cell: Box) ClassificationLabel [source]#
- Parameters
cell (Box) –
- Return type
- extend(labels: ChipClassificationLabels) None [source]#
Adds cells contained in labels.
- Parameters
labels (ChipClassificationLabels) – ChipClassificationLabels
- Return type
None
- filter_by_aoi(aoi_polygons: Iterable[Polygon])[source]#
Return a copy of these labels filtered by given AOI polygons.
- classmethod from_predictions(windows: Iterable[Box], predictions: Iterable[Any]) Labels [source]#
Overrid to convert predictions to (class_id, scores) pairs.
- get_singleton_labels(cell: Box)[source]#
Return Labels object representing a single cell.
- Parameters
cell (Box) – (Box)
- get_values() List[ClassificationLabel] [source]#
Return list of class_ids and scores for all cells.
- Return type
- classmethod make_empty() ChipClassificationLabels [source]#
Instantiate an empty instance of this class.
- Returns
An object of the Label subclass on which this method is called.
- Return type
- save(uri: str, class_config: ClassConfig, crs_transformer: CRSTransformer) None [source]#
Save labels as a GeoJSON file.
- Parameters
uri (str) – URI of the output file.
class_config (ClassConfig) – ClassConfig to map class IDs to names.
crs_transformer (CRSTransformer) – CRSTransformer to convert from pixel-coords to map-coords before saving.
- Return type
None