Skip to main content

Module preprocessing

Module preprocessing 

Source
Expand description

Shared preprocessing helpers for model adapters.

This module centralizes common preprocessing operations to reduce code duplication across model implementations. It provides:

  • Configuration helpers for common model types
  • Reusable preprocessing pipelines for common patterns
  • Utility functions for image format conversions

Structs§

DetectionResizer
Wrapper for DetResizeForTest to implement DetectionResizeOperation.
PreprocessPipelineBuilder
Builder for common preprocessing pipelines.

Traits§

DetectionResizeOperation
Trait for detection resize operations that return scale information.
ResizeOperation
Trait for resize operations that return only resized images.

Functions§

db_preprocess_for_text_type
Construct a DB preprocessing config based on text type.
db_preprocess_with_limit_side_len
Construct a DB preprocessing config that limits images by side length.
db_preprocess_with_resize_long
Construct a DB preprocessing config that resizes by long edge.
detection_resize_and_normalize
Applies a detection resizer (with scale info) and then normalizes the result.
pp_lcnet_preprocess
Construct a PP-LCNet preprocessing config with a custom input shape.
pp_lcnet_preprocess_with_norm
Construct a PP-LCNet preprocessing config with custom normalization stats.
resize_and_normalize
Applies a resizer and then normalizes the result to a tensor.
rgb_to_dynamic
Converts a batch of RGB images to dynamic images.
wrap_detection_resizer
Convenience function to wrap a DetResizeForTest for use in preprocessing pipelines.