ModelInput

Inheritance diagram of ModelInput

ModelInput inheritance diagram

class savant.base.model.ModelInput(object='auto.frame', layer_name=None, shape=None, maintain_aspect_ratio=False, scale_factor=1.0, offsets=(0.0, 0.0, 0.0), color_format=ModelColorFormat.RGB, preprocess_object_meta=None, preprocess_object_image=None)

Model input parameters configuration template. Validates entries in a module config file under model.input.

Example,

model:
    input:
        object: 'frame'
        shape: [3, 240, 240]
        maintain_aspect_ratio: True
object: str = 'auto.frame'

A text label in the form of model_name.object_label. Indicates objects that will be used as input data. Special value frame is used to specify the entire frame as model input.

layer_name: Optional[str] = None

Model input layer name.

shape: Optional[Tuple[int, int, int]] = None

(Channels, Height, Width) tuple that indicates input image shape.

Example

shape: [3, 224, 224]
maintain_aspect_ratio: bool = False

Indicates whether the input preprocessing should maintain image aspect ratio.

scale_factor: float = 1.0

Pixel scaling/normalization factor.

offsets: Tuple[float, float, float] = (0.0, 0.0, 0.0)

Array of mean values of color components to be subtracted from each pixel.

Example

offsets: [0.0, 0.0, 0.0]
color_format: ModelColorFormat = 0

Color format required by the model.

Example

color_format: rgb
# color_format: bgr
# color_format: gray
preprocess_object_meta: Optional[PyFunc] = None

Object metadata preprocessing.

Preprocessing implementation should be written as a subclass of BasePreprocessObjectMeta.

preprocess_object_image: Optional[PreprocessObjectImage] = None

Object image preprocessing Python/C++ function configuration.

property height

Input image height.

property width

Input image width.