config
最后更新
hubai_sdk.utils.config解析并验证模型转换配置。Config 是托管转换使用的根配置对象。它接受紧凑的单阶段映射或显式的 stages 映射。对于具有嵌入式元数据的模型格式,将从源文件推断缺失的张量形状和数据类型。示例
紧凑的 YAML 配置可以定义预处理和目标选项。
Yaml
1name: detector
2input_model: detector.onnx
3inputs:
4 - name: images
5 shape: [1, 3, 640, 640]
6 layout: NCHW
7 encoding:
8 from: RGB
9 to: BGR
10 mean_values: imagenet
11rvc2:
12 number_of_shaves: 8
13 superblob: trueshape、layout、mean_values 和 scale_values)会传播到未覆盖它们的输入。未知字段将被拒绝,以便及早捕获拼写错误的选项。类
BlobBaseConfig
属性
compile_tool_args
compress_to_fp16
mo_args
Config
stages 的映射会自动包装为单个阶段。放置在 stages 旁边的共享键将复制到每个阶段,除非该阶段提供自己的值。方法
get_stage_config
Python
1def get_stage_config(stage: str | None) -> SingleStageConfig:属性
name
rich_logging
stages
CustomBaseModel
属性
model_config
EncodingConfig
from_ 是应用程序提供的编码,to 是模型期望的编码。from_ 的输入字段和序列化字段名称是 "from"。属性
from_
HailoConfig
属性
alls
batch_size
compression_level
disable_compilation
hw_arch
optimization_level
InputConfig
"imagenet" 扩展为标准 ImageNet 预处理向量。单通道输入归一化为灰度编码。属性
encoding
encoding_mismatch
frozen_value
is_color_input
mean_values
scale_values
OutputConfig
方法
validate_layout
Python
1def validate_layout(self) -> Self:属性
data_type
layout
"NCHW"。省略时从 shape 推断默认值。name
shape
RVC2Config
number_of_shaves 更改为 8。属性
n_workers
number_of_shaves
superblob
RVC3Config
RVC4Config
属性
compress_to_fp16
disable_calibration
htp_socs
keep_raw_images
optimization_level
snpe_dlc_graph_prepare_args
snpe_dlc_quant_args
snpe_onnx_to_dlc_args
use_per_channel_quantization
use_per_row_quantization
SingleStageConfig
yolo_input_shape。方法
get_target_config
Python
1def get_target_config(target: Target) -> TargetConfig: