Skip to content

Model

Bases: Protocol

Protocol for models

Models are callables that transform inputs into predictions.

Currently implemented models
  • ONNXSegmentationModel: ONNX model for segmentation

__call__

Runs the model.

PARAMETER DESCRIPTION
inputs

batched inputs

TYPE: npt.NDArray

RETURNS DESCRIPTION
npt.NDArray

batched predictions


SegmentationModel

Model for segmentation

PARAMETER DESCRIPTION
path

path to the model

TYPE: Path

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

device

device (CPU or CUDA)

TYPE: Device DEFAULT: Device.CPU

from_huggingface classmethod

Creates a segmentation model from the Hugging Face Hub.

PARAMETER DESCRIPTION
repo

repository (Hugging Face Hub, e.g., 'user/repo')

TYPE: str

path

path to the model (Hugging Face Hub)

TYPE: str

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

device

device (CPU or CUDA)

TYPE: Device DEFAULT: Device.CPU

RETURNS DESCRIPTION
SegmentationModel

segmentation model

from_aviary classmethod

Creates a segmentation model from the name of a model in aviary.

PARAMETER DESCRIPTION
name

name of the model

TYPE: str

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

device

device (CPU or CUDA)

TYPE: Device DEFAULT: Device.CPU

RETURNS DESCRIPTION
SegmentationModel

segmentation model

from_config classmethod

Creates a segmentation model from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: SegmentationModelConfig

RETURNS DESCRIPTION
SegmentationModel

segmentation model

RAISES DESCRIPTION
AviaryUserError

Invalid configuration

__call__

Runs the model.

PARAMETER DESCRIPTION
inputs

batched inputs

TYPE: npt.NDArray

RETURNS DESCRIPTION
npt.NDArray

batched predictions


SegmentationModelConfig

Bases: pydantic.BaseModel

Configuration for the from_config class method of SegmentationModel

The configuration must have one of the following field sets
  • name
  • repo and path
  • path
ATTRIBUTE DESCRIPTION
path

path to the model (local or Hugging Face Hub)

TYPE: str | None

repo

repository (Hugging Face Hub, e.g., 'user/repo')

TYPE: str | None

name

name of the model

TYPE: str | None

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize

device

device ('cpu' or 'cuda')

TYPE: Device


ONNXSegmentationModel

Bases: SegmentationModel

ONNX model for segmentation

Implements the Model protocol.

PARAMETER DESCRIPTION
path

path to the model

TYPE: Path

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

device

device (CPU or CUDA)

TYPE: Device DEFAULT: Device.CPU

from_huggingface classmethod

Creates a segmentation model from the Hugging Face Hub.

PARAMETER DESCRIPTION
repo

repository (Hugging Face Hub, e.g., 'user/repo')

TYPE: str

path

path to the model (Hugging Face Hub)

TYPE: str

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

device

device (CPU or CUDA)

TYPE: Device DEFAULT: Device.CPU

RETURNS DESCRIPTION
SegmentationModel

segmentation model

from_aviary classmethod

Creates a segmentation model from the name of a model in aviary.

PARAMETER DESCRIPTION
name

name of the model

TYPE: str

ground_sampling_distance

ground sampling distance in meters

TYPE: GroundSamplingDistance

buffer_size

buffer size in meters (specifies the area around the tile that is additionally fetched)

TYPE: BufferSize DEFAULT: 0

device

device (CPU or CUDA)

TYPE: Device DEFAULT: Device.CPU

RETURNS DESCRIPTION
SegmentationModel

segmentation model

from_config classmethod

Creates a segmentation model from the configuration.

PARAMETER DESCRIPTION
config

configuration

TYPE: SegmentationModelConfig

RETURNS DESCRIPTION
SegmentationModel

segmentation model

RAISES DESCRIPTION
AviaryUserError

Invalid configuration

__call__

Runs the model.

PARAMETER DESCRIPTION
inputs

batched inputs

TYPE: npt.NDArray

RETURNS DESCRIPTION
npt.NDArray

batched predictions