SemanticSegmentation#

class SemanticSegmentation[source]#

Bases: RVPipeline

Attributes

commands

Built-in mutable sequence.

gpu_commands

Built-in mutable sequence.

split_commands

Built-in mutable sequence.

__init__(config: RVPipelineConfig, tmp_dir: str)#

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)#

Constructor

Parameters:
  • config (RVPipelineConfig) – the configuration of this pipeline

  • tmp_dir (str) – the root any temporary directories created by running this pipeline

analyze()#

Run each analyzer over training scenes.

build_backend(uri: str | None = None) None#
Parameters:

uri (str | None) –

Return type:

None

bundle()#

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.

chip(split_ind: int = 0, num_splits: int = 1)#

Save training and validation chips.

Parameters:
  • split_ind (int) –

  • num_splits (int) –

eval()#

Evaluate predictions against ground truth.

get_train_labels(window: Box, scene: Scene) Labels#

Return the training labels in a window for a scene.

Returns:

Labels that lie within window

Parameters:
Return type:

Labels

get_train_windows(scene: Scene) list[rastervision.core.box.Box]#

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:

list[rastervision.core.box.Box]

post_process_batch(windows: list[rastervision.core.box.Box], chips: ndarray, labels: Labels) Labels#

Post-process a batch of predictions.

Parameters:
Return type:

Labels

post_process_predictions(labels: Labels, scene: Scene) Labels#

Post-process all labels at end of prediction.

Parameters:
Return type:

Labels

post_process_sample(sample: DataSample) DataSample#

Post-process sample in pipeline-specific way.

This should be called before writing a sample during chipping.

Parameters:

sample (DataSample) –

Return type:

DataSample

predict(split_ind=0, num_splits=1)#

Make predictions over each validation and test scene.

This uses a sliding window.

predict_scene(scene: Scene) Labels#
Parameters:

scene (Scene) –

Return type:

Labels

test_cpu(split_ind: int = 0, num_splits: int = 1)#

A command to test the ability to run split jobs on CPU.

Parameters:
  • split_ind (int) –

  • num_splits (int) –

test_gpu()#

A command to test the ability to run on GPU.

train()#

Train a model and save it.

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.