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:
|
RETURNS | DESCRIPTION |
---|---|
npt.NDArray
|
batched predictions |
SegmentationModel
Model for segmentation
PARAMETER | DESCRIPTION |
---|---|
path |
path to the model
TYPE:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ( |
from_huggingface
classmethod
Creates a segmentation model from the Hugging Face Hub.
PARAMETER | DESCRIPTION |
---|---|
repo |
repository (Hugging Face Hub, e.g., 'user/repo')
TYPE:
|
path |
path to the model (Hugging Face Hub)
TYPE:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ( |
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:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ( |
RETURNS | DESCRIPTION |
---|---|
SegmentationModel
|
segmentation model |
from_config
classmethod
Creates a segmentation model from the configuration.
PARAMETER | DESCRIPTION |
---|---|
config |
configuration
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
SegmentationModel
|
segmentation model |
RAISES | DESCRIPTION |
---|---|
AviaryUserError
|
Invalid configuration |
__call__
Runs the model.
PARAMETER | DESCRIPTION |
---|---|
inputs |
batched inputs
TYPE:
|
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
andpath
path
ATTRIBUTE | DESCRIPTION |
---|---|
path |
path to the model (local or Hugging Face Hub)
TYPE:
|
repo |
repository (Hugging Face Hub, e.g., 'user/repo')
TYPE:
|
name |
name of the model
TYPE:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ('cpu' or 'cuda')
TYPE:
|
ONNXSegmentationModel
Bases: SegmentationModel
ONNX model for segmentation
Implements the Model
protocol.
PARAMETER | DESCRIPTION |
---|---|
path |
path to the model
TYPE:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ( |
from_huggingface
classmethod
Creates a segmentation model from the Hugging Face Hub.
PARAMETER | DESCRIPTION |
---|---|
repo |
repository (Hugging Face Hub, e.g., 'user/repo')
TYPE:
|
path |
path to the model (Hugging Face Hub)
TYPE:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ( |
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:
|
ground_sampling_distance |
ground sampling distance in meters
TYPE:
|
buffer_size |
buffer size in meters (specifies the area around the tile that is additionally fetched)
TYPE:
|
device |
device ( |
RETURNS | DESCRIPTION |
---|---|
SegmentationModel
|
segmentation model |
from_config
classmethod
Creates a segmentation model from the configuration.
PARAMETER | DESCRIPTION |
---|---|
config |
configuration
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
SegmentationModel
|
segmentation model |
RAISES | DESCRIPTION |
---|---|
AviaryUserError
|
Invalid configuration |
__call__
Runs the model.
PARAMETER | DESCRIPTION |
---|---|
inputs |
batched inputs
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
npt.NDArray
|
batched predictions |