Labels#
- class Labels[source]#
Bases:
ABC
A 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: Labels)[source]#
Add labels to these labels.
Returns a concatenation of this and the other labels.
- Parameters
other (Labels) –
- abstract filter_by_aoi(aoi_polygons: List[Polygon]) Labels [source]#
Return a copy of these labels filtered by given AOI polygons.
- classmethod from_predictions(windows: Iterable[Box], predictions: Iterable[Any]) Labels [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.