Backend#

class Backend[source]#

Bases: ABC

Abstraction around core ML functionality used by an RVPipeline.

This should be subclassed to enable use of a third party ML library with an RVPipeline. There is a one-to-many relationship from RVPipeline to Backend.

__init__()#

Methods

__init__()

chip_dataset(dataset, chip_options)

Create and write chips for scenes in a DatasetConfig.

get_sample_writer()

Returns a SampleWriter for this Backend.

load_model([uri])

Load the model in preparation for one or more prediction calls.

predict_scene(scene, predict_options)

Return predictions for an entire scene using the model.

train()

Train a model.

abstract chip_dataset(dataset: DatasetConfig, chip_options: ChipOptions) None[source]#

Create and write chips for scenes in a DatasetConfig.

Parameters:
Return type:

None

abstract get_sample_writer()[source]#

Returns a SampleWriter for this Backend.

abstract load_model(uri: str | None = None)[source]#

Load the model in preparation for one or more prediction calls.

Parameters:

uri (str | None) – Optional URI to load the model from.

abstract predict_scene(scene: Scene, predict_options: PredictOptions) Labels[source]#

Return predictions for an entire scene using the model.

Parameters:
  • scene (Scene) – Scene to run inference on.

  • predict_options (PredictOptions) – Prediction options.

Returns:

Labels object containing predictions

Return type:

Labels

abstract train()[source]#

Train a model.

This should download chips created by the SampleWriter, train the model, and then saving it to disk.