Skip to content

qbcompiler.configs.input_process_config

Uint8InputConfig

class Uint8InputConfig(ConfigABC)

Configuration for uint8 input handling.

Defines whether inputs should be treated as uint8 and which specific inputs to apply this to.

Attributes

Name Description
optional
DEFAULTS
py_to_cpp_name
min_max_check

optional

optional = True

DEFAULTS

DEFAULTS = {
    "apply": False,
    "inputs": [],
}

py_to_cpp_name

py_to_cpp_name = {
    "apply": "apply",
}

min_max_check

min_max_check = {}

Methods

Name Description
__init__ Initialize the Uint8InputConfig.
default_config
from_dict Create Uint8InputConfig from dictionary (JSON structure)
to_dict

__init__

def __init__(
    self,
    apply: bool,
    inputs: List[str],
    optional: bool = optional,
)

Initialize the Uint8InputConfig.

Parameters

  • apply — bool. If true, treat specified inputs as uint8.
  • inputs — List[str]. List of input names to treat as uint8. If empty and apply is true, applies to all inputs.
  • optional — bool. Indicates whether this config is optional. Use the default value defined as a class variable.

default_config

def default_config(cls)

from_dict

def from_dict(cls, config_dict: dict)

Create Uint8InputConfig from dictionary (JSON structure)

to_dict

def to_dict(self)

PreprocessingConfig

class PreprocessingConfig(ConfigABC)

Configuration for input preprocessing pipeline.

Defines preprocessing operations to be applied to model inputs, including operations like resize, normalize, color conversion, etc.

Attributes

Name Description
optional
DEFAULTS
py_to_cpp_name
min_max_check

optional

optional = True

DEFAULTS

DEFAULTS = {
    "apply": False,
    "auto_convert_format": False,
    "pipeline": [],
    "input_configs": {},
}

py_to_cpp_name

py_to_cpp_name = {
    "apply": "apply",
    "auto_convert_format": "autoConvertFormat",
}

min_max_check

min_max_check = {}

Methods

Name Description
__init__ Initialize the PreprocessingConfig.
default_config
from_dict Create PreprocessingConfig from dictionary (JSON structure)
to_dict

__init__

def __init__(
    self,
    apply: bool,
    auto_convert_format: bool,
    pipeline: List[Dict[str, Any]],
    input_configs: Dict[str, Any],
    optional: bool = optional,
)

Initialize the PreprocessingConfig.

Parameters

  • apply — bool. If true, apply preprocessing pipeline.
  • auto_convert_format — bool. If true, automatically convert input format.
  • pipeline — List[Dict[str, Any]]. List of preprocessing operations to apply globally. Each operation is a dict with "op" key and operation-specific parameters. Supported operations: colorConvert, resize, centerCrop, pad, letterbox, normalize, clamp, divideByScale, multiplyByScale, reshape, transpose, permute.
  • input_configs — Dict[str, Any]. Per-input preprocessing configurations. Keys are input names, values are dicts containing input-specific pipelines.
  • optional — bool. Indicates whether this config is optional. Use the default value defined as a class variable.

default_config

def default_config(cls)

from_dict

def from_dict(cls, config_dict: dict)

Create PreprocessingConfig from dictionary (JSON structure)

to_dict

def to_dict(self)

InputProcessConfig

class InputProcessConfig(ConfigABC)

Unified configuration for input processing.

Combines uint8 input handling, image channel configuration, and preprocessing pipeline settings into a single configuration object.

Attributes

Name Description
optional
DEFAULTS
py_to_cpp_name
min_max_check

optional

optional = True

DEFAULTS

DEFAULTS = {
    "uint8_input": None,  # Will use Uint8InputConfig.default_config()
    "image_channels": 0,
    "preprocessing": None,  # Will use PreprocessingConfig.default_config()
}

py_to_cpp_name

py_to_cpp_name = {
    "image_channels": "imageChannels",
}

min_max_check

min_max_check = {}

Methods

Name Description
__init__ Initialize the InputProcessConfig.
default_config
from_dict Create InputProcessConfig from dictionary (JSON structure)
to_dict

__init__

def __init__(
    self,
    uint8_input: Optional[Uint8InputConfig],
    image_channels: int,
    preprocessing: Optional[PreprocessingConfig],
    optional: bool = optional,
)

Initialize the InputProcessConfig.

Parameters

  • uint8_input — Uint8InputConfig. Configuration for uint8 input handling. If None, uses default Uint8InputConfig.
  • image_channels — int. Number of image channels (0=auto, 1=grayscale, 3=RGB, 4=RGBA).
  • preprocessing — PreprocessingConfig. Configuration for input preprocessing pipeline. If None, uses default PreprocessingConfig.
  • optional — bool. Indicates whether this config is optional.

default_config

def default_config(cls)

from_dict

def from_dict(cls, config_dict: dict)

Create InputProcessConfig from dictionary (JSON structure)

to_dict

def to_dict(self)

Functions

Name Description
get_uint8_input_config Create Uint8InputConfig with partial parameters merged with defaults.
get_preprocessing_config Create PreprocessingConfig with partial parameters merged with defaults.
get_input_process_config Create InputProcessConfig with partial parameters merged with defaults.

get_uint8_input_config

def get_uint8_input_config(**kwargs) -> Uint8InputConfig

Create Uint8InputConfig with partial parameters merged with defaults.

get_preprocessing_config

def get_preprocessing_config(**kwargs) -> PreprocessingConfig

Create PreprocessingConfig with partial parameters merged with defaults.

get_input_process_config

def get_input_process_config(
    uint8_input_config: Optional[Uint8InputConfig] = None,
    image_channels: int = 0,
    preprocessing_config: Optional[PreprocessingConfig] = None,
) -> InputProcessConfig

Create InputProcessConfig with partial parameters merged with defaults.

Parameters

  • uint8_input_config — Uint8InputConfig. Configuration for uint8 input handling.
  • image_channels — int. Number of image channels (0=auto, 1=grayscale, 3=RGB, 4=RGBA).
  • preprocessing_config — PreprocessingConfig. Configuration for input preprocessing pipeline.

Returns

InputProcessConfig. The configured input process configuration.