SemanticSegmentationLabelSource#
- class SemanticSegmentationLabelSource[source]#
Bases:
LabelSource
A read-only label source for semantic segmentation.
Attributes
Bounding box applied to the source.
Associated
CRSTransformer
.Extent of the
LabelSource
.- __init__(raster_source: RasterSource, class_config: ClassConfig, bbox: rastervision.core.box.Box | None = None)[source]#
Constructor.
- Parameters:
raster_source (RasterSource) – A raster source that returns a single channel raster with class_ids as values.
null_class_id – the null class id used as fill values for when windows go over the edge of the label array. This can be retrieved using
class_config.null_class_id
.bbox (rastervision.core.box.Box | None) – User-specified crop of the extent. If
None
, the full extent available in the source file is used.class_config (ClassConfig) –
Methods
__init__
(raster_source, class_config[, bbox])Constructor.
get_label_arr
([window])Get labels for a window.
get_labels
([window])Get labels for a window.
set_bbox
(bbox)Set self.extent to the given value.
- __init__(raster_source: RasterSource, class_config: ClassConfig, bbox: rastervision.core.box.Box | None = None)[source]#
Constructor.
- Parameters:
raster_source (RasterSource) – A raster source that returns a single channel raster with class_ids as values.
null_class_id – the null class id used as fill values for when windows go over the edge of the label array. This can be retrieved using
class_config.null_class_id
.bbox (rastervision.core.box.Box | None) – User-specified crop of the extent. If
None
, the full extent available in the source file is used.class_config (ClassConfig) –
- get_label_arr(window: rastervision.core.box.Box | None = None) ndarray [source]#
Get labels for a window.
The returned array will be the same size as the input window. If window overflows the extent, the overflowing region will be filled with the ID of the null class as defined by the class_config.
- Parameters:
window (rastervision.core.box.Box | None) – Window (in pixel coords) to get labels for. If
None
, returns a label array covering the full extent of the scene.- Returns:
Label array.
- Return type:
- get_labels(window: rastervision.core.box.Box | None = None) SemanticSegmentationLabels [source]#
Get labels for a window.
- Parameters:
window (rastervision.core.box.Box | None) – Window to get labels for. If None, returns labels covering the full extent of the scene.
- Returns:
The labels.
- Return type:
- set_bbox(bbox: Box) None [source]#
Set self.extent to the given value.
Note
This method is idempotent.
- property crs_transformer: CRSTransformer#
Associated
CRSTransformer
.