module documentation

Parse and validate model conversion configuration.

Config is the root configuration object used by hosted conversion. It accepts either a compact single-stage mapping or an explicit stages mapping. For model formats with embedded metadata, missing tensor shapes and data types are inferred from the source file.

Example

A compact YAML configuration can define preprocessing and target options.

name: detector
input_model: detector.onnx
inputs:
  - name: images
    shape: [1, 3, 640, 640]
    layout: NCHW
    encoding:
      from: RGB
      to: BGR
    mean_values: imagenet
rvc2:
  number_of_shaves: 8
  superblob: true

Top-level tensor shortcuts such as shape, layout, mean_values, and scale_values are propagated to inputs that do not override them. Unknown fields are rejected to catch misspelled options early.

Class BlobBaseConfig Shared OpenVINO Model Optimizer and blob compiler options.
Class Config Root configuration for a single- or multi-stage model.
Class CustomBaseModel Base for strict configuration models that reject unknown fields.
Class EncodingConfig Input channel conversion performed before inference.
Class HailoConfig Hailo Dataflow Compiler and hardware options.
Class InputConfig Tensor metadata and preprocessing for one model input.
Class OutputConfig Shape, layout, and data type of one model output.
Class RVC2Config RVC2 compilation options.
Class RVC3Config RVC3 compilation and POT target options.
Class RVC4Config Qualcomm SNPE conversion, quantization, and graph options.
Class SingleStageConfig Configuration for one model in a conversion pipeline.
Class TargetConfig Options shared by every conversion target.
Constant NAMED_VALUES Undocumented
Function _extract_bin_xml_from_ir Extracts the corresponding second path from a single IR path.
Function _get_onnx_inter_info Try tensor lookup first, then node lookup, for ONNX metadata.
Function _get_onnx_node_info Read shape and dtype information for an ONNX node output.
Function _get_onnx_tensor_info Read shape and dtype information for an ONNX tensor.
NAMED_VALUES: dict[str, dict] =

Undocumented

Value
{'imagenet': {'mean': [123.675, 116.28, 103.53],
              'scale': [58.395, 57.12, 57.375]}}
def _extract_bin_xml_from_ir(ir_path: Any, input_bin_path: Any | None = None) -> tuple[Path, Path]:

Extracts the corresponding second path from a single IR path.

We assume that the base filename matches between the .bin and .xml file unless an explicit input_bin_path is provided.

def _get_onnx_inter_info(model_path: Path, name: str) -> tuple[list[int] | None, DataType | None]:

Try tensor lookup first, then node lookup, for ONNX metadata.

def _get_onnx_node_info(model_path: Path, node_name: str) -> tuple[list[int], DataType]:

Read shape and dtype information for an ONNX node output.

def _get_onnx_tensor_info(model_path: Path | str, tensor_name: str) -> tuple[list[int], DataType]:

Read shape and dtype information for an ONNX tensor.