qbcompiler.calibration.preprocess.preproc_builder Class Reference

qbcompiler.calibration.preprocess.preproc_builder Class Reference#

Mobilint SDK qb Compiler: qbcompiler.calibration.preprocess.preproc_builder Class Reference
Mobilint SDK qb Compiler v1.2
MCS002-EN
qbcompiler.calibration.preprocess.preproc_builder Class Reference

Build a calibration preprocessing pipeline from a YAML or dict configuration. More...

Public Member Functions

 __init__ (self, args, to_tensor=False)
 __call__ (self, img)
 __repre__ (self)
 __str__ (self)
 get_pre_list (self, args)
 check_yaml_pre (self, args)

Public Attributes

list preprocess = []
 to_tensor = to_tensor
 args = args
 datatype = args["Datatype"]
 loadtype = DTYPE_GETDATA_MAP[self.datatype]

Detailed Description

Build a calibration preprocessing pipeline from a YAML or dict configuration.

Supported preprocessing types:

  • Datatype: Selects how input data is loaded. Supported value: Image.
  • GetImage: Loads an image tensor via OpenCV or PIL. Must appear before other operators.
  • Pre-Order: Explicit list of preprocessing stages to execute sequentially; entries must match the preprocessing definitions.
  • Pad: Adds padding to the tensor.
  • Normalize: Applies mean/std normalization.
  • ResizeTorch: Resizes images using torchvision.transforms.functional.resize.
  • Resize: Resizes images using cv2.resize.
  • CenterCrop: Performs a center crop.
  • SetOrder: Reorders axes; must be the final operator.
YAML structure
[Pre-processing Type]
[Parameter]: [Argument]
...
# Example
Datatype: Image
GetImage:
to_float32: false
channel_order: RGB
Pre-Order: [ResizeTorch, CenterCrop, Normalize, SetOrder]
Pre-processing:
ResizeTorch:
size: [256, 256]
interpolation: blinear
CenterCrop:
size: [224, 224]
Normalize:
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
to_float_div255: true
SetOrder:
shape: HWC
Operator parameters
  • GetImage: to_float32 (bool, default False); channel_order (string, default "bgr").
  • Pad: shape (tuple[int]); size_divisor (int); pad_val (float, default 0); right_bottom (bool, default False).
  • Normalize: mean (list/ndarray); std (list/ndarray); to_float_div255 (bool, default False).
  • ResizeTorch: size (list[int]); interpolation (nearest|bilinear|bicubic|box|hamming|lanczos).
  • Resize: img_scale (float or tuple[int, int]); keep_ratio (bool, default False); interpolation (nearest|bilinear|bicubic|area|lanczos).
  • CenterCrop: size (list[int]).
  • SetOrder: shape (HWC|CHW|BHWC|BCHW, default HWC).
Parameters
argsdict. Parsed preprocessing configuration.
to_tensorbool. When True, converts the resulting NumPy array to a Torch tensor.

Definition at line 719 of file preprocess.py.

Constructor & Destructor Documentation

◆ __init__()

qbcompiler.calibration.preprocess.preproc_builder.__init__ ( self,
args,
to_tensor = False )

Definition at line 775 of file preprocess.py.

Member Function Documentation

◆ __call__()

qbcompiler.calibration.preprocess.preproc_builder.__call__ ( self,
img )

Definition at line 781 of file preprocess.py.

◆ __repre__()

qbcompiler.calibration.preprocess.preproc_builder.__repre__ ( self)

Definition at line 788 of file preprocess.py.

◆ __str__()

qbcompiler.calibration.preprocess.preproc_builder.__str__ ( self)

Definition at line 797 of file preprocess.py.

◆ get_pre_list()

qbcompiler.calibration.preprocess.preproc_builder.get_pre_list ( self,
args )

Definition at line 800 of file preprocess.py.

◆ check_yaml_pre()

qbcompiler.calibration.preprocess.preproc_builder.check_yaml_pre ( self,
args )

Definition at line 819 of file preprocess.py.

Member Data Documentation

◆ preprocess

list qbcompiler.calibration.preprocess.preproc_builder.preprocess = []

Definition at line 776 of file preprocess.py.

◆ to_tensor

qbcompiler.calibration.preprocess.preproc_builder.to_tensor = to_tensor

Definition at line 777 of file preprocess.py.

◆ args

qbcompiler.calibration.preprocess.preproc_builder.args = args

Definition at line 778 of file preprocess.py.

◆ datatype

qbcompiler.calibration.preprocess.preproc_builder.datatype = args["Datatype"]

Definition at line 837 of file preprocess.py.

◆ loadtype

qbcompiler.calibration.preprocess.preproc_builder.loadtype = DTYPE_GETDATA_MAP[self.datatype]

Definition at line 838 of file preprocess.py.


The documentation for this class was generated from the following file: