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§
- Detection
Resizer - Wrapper for DetResizeForTest to implement DetectionResizeOperation.
- Preprocess
Pipeline Builder - Builder for common preprocessing pipelines.
Traits§
- Detection
Resize Operation - Trait for detection resize operations that return scale information.
- Resize
Operation - 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.