ModelInput
- 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.
- shape: Tuple[int, int, int] | None = 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.
- 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: PyFunc | None = None
Object metadata preprocessing.
Preprocessing implementation should be written as a subclass of
BasePreprocessObjectMeta
.
- preprocess_object_image: PreprocessObjectImage | None = None
Object image preprocessing Python/C++ function configuration.