Labels#
- class Labels[source]#
Bases:
ABCA source-agnostic, in-memory representation of labels in a scene.
This class can represent labels obtained via a
LabelSource, aLabelStore, or directly from model predictions.- __init__()#
Methods
__init__()filter_by_aoi(aoi_polygons)Return a copy of these labels filtered by given AOI polygons.
from_predictions(windows, predictions)Instantiate from windows and their corresponding predictions.
Instantiate an empty instance of this class.
save(uri)Save to file.
- abstract __add__(other: Self)[source]#
Add labels to these labels.
Returns a concatenation of this and the other labels.
- Parameters
other (Self) –
- abstract filter_by_aoi(aoi_polygons: list['Polygon']) Self[source]#
Return a copy of these labels filtered by given AOI polygons.
- Parameters
aoi_polygons (list['Polygon']) – List of AOI polygons to filter by, in pixel coordinates.
- Return type
Self
- classmethod from_predictions(windows: Iterable[Box], predictions: Iterable[Any]) Self[source]#
Instantiate from windows and their corresponding predictions.
This makes no assumptions about the type or format of the predictions. Subclasses should implement the __setitem__ method to correctly handle the predictions.