RVPipeline#
- class RVPipeline[source]#
Bases:
Pipeline
Base class of all Raster Vision Pipelines.
This can be subclassed to implement Pipelines for different computer vision tasks over geospatial imagery. The commands and what they produce include:
analyze: metrics on the imagery and labels
chip: small training and validation images taken from larger scenes
train: model trained on chips
predict: predictions over entire validation and test scenes
eval: evaluation metrics for predictions generated by model
bundle: bundle containing model and any other files needed to make
predictions using the Predictor.
Attributes
Built-in mutable sequence.
Built-in mutable sequence.
Built-in mutable sequence.
- __init__(config: RVPipelineConfig, tmp_dir: str)[source]#
Constructor
- Parameters:
config (RVPipelineConfig) – the configuration of this pipeline
tmp_dir (str) – the root any temporary directories created by running this pipeline
Methods
__init__
(config, tmp_dir)Constructor
analyze
()Run each analyzer over training scenes.
build_backend
([uri])bundle
()Save a model bundle with whatever is needed to make predictions.
chip
([split_ind, num_splits])Save training and validation chips.
eval
()Evaluate predictions against ground truth.
get_train_labels
(window, scene)Return the training labels in a window for a scene.
get_train_windows
(scene)Return the training windows for a Scene.
post_process_batch
(windows, chips, labels)Post-process a batch of predictions.
post_process_predictions
(labels, scene)Post-process all labels at end of prediction.
post_process_sample
(sample)Post-process sample in pipeline-specific way.
predict
([split_ind, num_splits])Make predictions over each validation and test scene.
predict_scene
(scene)test_cpu
([split_ind, num_splits])A command to test the ability to run split jobs on CPU.
test_gpu
()A command to test the ability to run on GPU.
train
()Train a model and save it.
- __init__(config: RVPipelineConfig, tmp_dir: str)[source]#
Constructor
- Parameters:
config (RVPipelineConfig) – the configuration of this pipeline
tmp_dir (str) – the root any temporary directories created by running this pipeline
- build_backend(uri: str | None = None) None [source]#
- Parameters:
uri (str | None) –
- Return type:
None
- bundle()[source]#
Save a model bundle with whatever is needed to make predictions.
The model bundle is a zip file and it is used by the Predictor and predict CLI subcommand.
- get_train_labels(window: Box, scene: Scene) Labels [source]#
Return the training labels in a window for a scene.
- get_train_windows(scene: Scene) list[rastervision.core.box.Box] [source]#
Return the training windows for a Scene.
Each training window represents the spatial extent of a training chip to generate.
- Parameters:
scene (Scene) – Scene to generate windows for
- Return type:
- post_process_batch(windows: list[rastervision.core.box.Box], chips: ndarray, labels: Labels) Labels [source]#
Post-process a batch of predictions.
- Parameters:
windows (list[rastervision.core.box.Box]) –
chips (ndarray) –
labels (Labels) –
- Return type:
- post_process_predictions(labels: Labels, scene: Scene) Labels [source]#
Post-process all labels at end of prediction.
- post_process_sample(sample: DataSample) DataSample [source]#
Post-process sample in pipeline-specific way.
This should be called before writing a sample during chipping.
- Parameters:
sample (DataSample) –
- Return type:
- predict(split_ind=0, num_splits=1)[source]#
Make predictions over each validation and test scene.
This uses a sliding window.
- test_cpu(split_ind: int = 0, num_splits: int = 1)#
A command to test the ability to run split jobs on CPU.
- test_gpu()#
A command to test the ability to run on GPU.
- property commands#
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- property gpu_commands#
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- property split_commands#
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.