lazyslide_models.base.DensePredictionModel

lazyslide_models.base.DensePredictionModel#

class DensePredictionModel#

Bases: ModelBase

Base class for models returning one value per pixel.

predict should return the model’s final, post-activation output. Whatever activation the model was trained with is applied inside predict, so a caller never applies one.

Attributes:
output_mppfloat, optional

Resolution of the output. None means the output lands on the input tile’s own grid, which is the common case; set it when the model predicts onto a coarser or finer grid than it was given.

output_rangetuple of float, optional

(low, high) bounds the post-activation values fall within, so a runner can pick a storage dtype instead of defaulting to float32. None means unbounded, which is also what a model with a linear output head should declare.

abstractmethod predict(image)#

Predict from a [B, C, H, W] tile batch.

Returns a float tensor of shape [B, C, H, W], already activated and within output_range when that is declared.