ObjectDetectionLabelSource#
- class ObjectDetectionLabelSource[source]#
Bases:
LabelSource
A read-only label source for object detection.
Attributes
Bounding box applied to the source.
Extent of the
LabelSource
.- __init__(vector_source: VectorSource, bbox: Optional[Box] = None, ioa_thresh: Optional[float] = None, clip: bool = False)[source]#
Constructor.
- Parameters
vector_source (VectorSource) – A VectorSource.
bbox (Optional[Box], optional) – User-specified crop of the extent. If None, the full extent available in the source file is used.
ioa_thresh (Optional[float], optional) – IOA threshold to apply when retieving labels for a window. Defaults to None.
clip (bool, optional) – Clip bounding boxes to window limits when retrieving labels for a window. Defaults to False.
Methods
__init__
(vector_source[, bbox, ioa_thresh, clip])Constructor.
get_labels
([window, ioa_thresh, clip])Get labels (in global coords) for a window.
set_bbox
(bbox)Set self.extent to the given value.
validate_geojson
(geojson)- __getitem__(key: Any) Tuple[ndarray, ndarray, str] [source]#
Get labels (in window coords) for a window.
Returns a 3-tuple: (npboxes, class_ids, box_format). - npboxes is a float np.ndarray of shape (num_boxes, 4) representing pixel coords of bounding boxes in the form [ymin, xmin, ymax, xmax]. - class_ids is a np.ndarray of shape (num_boxes,) representing the class labels for each of the boxes. - box_format is the format of npboxes which, in this case, is always ‘yxyx’.
- __init__(vector_source: VectorSource, bbox: Optional[Box] = None, ioa_thresh: Optional[float] = None, clip: bool = False)[source]#
Constructor.
- Parameters
vector_source (VectorSource) – A VectorSource.
bbox (Optional[Box], optional) – User-specified crop of the extent. If None, the full extent available in the source file is used.
ioa_thresh (Optional[float], optional) – IOA threshold to apply when retieving labels for a window. Defaults to None.
clip (bool, optional) – Clip bounding boxes to window limits when retrieving labels for a window. Defaults to False.
- get_labels(window: Optional[Box] = None, ioa_thresh: float = 1e-06, clip: bool = False) ObjectDetectionLabels [source]#
Get labels (in global coords) for a window.
- Parameters
- Returns
Labels with sufficient overlap with the window. The returned labels are in global coods (i.e. coords wihtin the full extent of the source).
- Return type
- set_bbox(bbox: Box) None [source]#
Set self.extent to the given value.
Note
This method is idempotent.
- property crs_transformer: CRSTransformer#