preprocessing
最后更新
modelconverter.utils.preprocessing外部化输入预处理的校准端表示。将预处理移动到 NN Archive 会将其从转换配置中清除,但校准仍然需要它:量化器会看到源模型的输入,而不是携带预处理节点的模型的输入。类
CalibrationPreprocessing
方法
requires_input_preprocessing
Python
1def requires_input_preprocessing(*, reverse_only: bool = False) -> bool:属性
data_type
encoding_from
encoding_mismatch
encoding_to
is_image
mean_values
normalization_required
scale_values
函数
apply_calibration_preprocessing
Python
1def apply_calibration_preprocessing(array: np.ndarray, preprocessing: CalibrationPreprocessing, *, layout: str) -> np.ndarray:layout 描述了数组在此时的存在方式。它可能会省略单例批次轴,即使配置的模型布局有一个,这是解码图像通常到达的方式。channels_last_4d_layout
Python
1def channels_last_4d_layout(layout: str) -> str:channels_last_image_layout
Python
1def channels_last_image_layout(layout: str) -> str:input_preprocessing_required
Python
1def input_preprocessing_required(*, encoding_from: Encoding, encoding_to: Encoding, mean_values: Sequence[float] | None, scale_values: Sequence[float] | None, reverse_only: bool = False) -> bool:is_user_calibration_tensor
Python
1def is_user_calibration_tensor(path: Path, calib: ImageCalibrationConfig) -> bool:normalization_required
Python
1def normalization_required(mean_values: Sequence[float] | None, scale_values: Sequence[float] | None) -> bool:read_user_calibration_tensor
Python
1def read_user_calibration_tensor(path: Path, *, raw_shape: list[int] | tuple[int, ...] | None = None, data_type: DataType, input_name: str) -> np.ndarray:raw_shape,并在验证其元素计数后进行重塑而不重新排序。reorder_layout
Python
1def reorder_layout(array: np.ndarray, source_layout: str, target_layout: str) -> np.ndarray: