ChipClassificationLabels#
- class ChipClassificationLabels[source]#
Bases:
Labels
Represents a spatial grid of cells associated with classes.
- __init__(cell_to_label: dict[rastervision.core.box.Box, tuple[int, Optional[Sequence[float]]]] | None = None)[source]#
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[, bbox])Save labels as a GeoJSON file.
set_cell
(cell, class_id[, scores])Set cell and its class_id.
- __add__(other: Self) Self [source]#
Add labels to these labels.
Returns a concatenation of this and the other labels.
- Parameters:
other (Self) –
- Return type:
Self
- __getitem__(cell: Box) ClassificationLabel [source]#
- Parameters:
cell (Box) –
- Return type:
- __init__(cell_to_label: dict[rastervision.core.box.Box, tuple[int, Optional[Sequence[float]]]] | None = None)[source]#
- extend(labels: Self) None [source]#
Adds cells contained in labels.
- Parameters:
labels (Self) – 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])[source]#
Overrid to convert predictions to (class_id, scores) pairs.
- get_cells() list[rastervision.core.box.Box] [source]#
Return list of all cells (list of Box).
- Return type:
- get_singleton_labels(cell: Box)[source]#
Return Labels object representing a single cell.
- Parameters:
cell (Box) – (Box)
- get_values() list[rastervision.core.data.label.chip_classification_labels.ClassificationLabel] [source]#
Return list of class_ids and scores for all cells.
- classmethod make_empty() Self [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, bbox: rastervision.core.box.Box | None = None) 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.
bbox (rastervision.core.box.Box | None) – User-specified crop of the extent. Must be provided if the corresponding RasterSource has bbox != extent.
- Return type:
None