Skip to main content

Module core

Module core 

Source

Modules§

batch
Batch processing utilities for the OCR pipeline.
config
Configuration management for the OCR pipeline.
constants
Constants used throughout the OCR pipeline.
errors
Error types for the OCR pipeline.
image_reader
Default implementation of the ImageReader trait used by inference builders.
inference
Structures and helpers for ONNX Runtime inference.
macros
Macros for the OCR pipeline.
traits
Trait definitions for the OCR pipeline.
validation
Input Validation Utilities

Structs§

AdapterInfo
Information about a model adapter.
AdapterTask
A wrapper that implements Task for an adapter’s task type.
BatchData
Data structure for holding batched input data.
BatchPerformanceMetrics
Speed metrics for batch operations
BatchSampler
A sampler that creates batches of data with a specified batch size.
CompatibleBatch
A batch of compatible images that can be processed together
CrossImageBatch
Batch of cross-image items
CrossImageItem
Cross-image item for batching (e.g., text regions from multiple images)
DefaultDynamicBatcher
Default implementation of dynamic batcher
DefaultImageReader
Reads RGB images from disk with optional parallel batching.
DynamicBatchConfig
Configuration for dynamic batching
DynamicBatchResult
Result of dynamic batch processing
ImageTaskInput
Common input type for image-based tasks.
ModelInferenceConfig
Configuration for model inference and ONNX Runtime session setup.
OpaqueError
A simple, opaque error wrapper for cases where the original error type is not Send or doesn’t implement std::error::Error.
OrientationResult
Represents an orientation angle with confidence information
OrtInfer
Core ONNX Runtime inference engine with support for pooling and configurable sessions.
TaskRunner
A task runner that executes tasks using a model adapter.
TaskSchema
Schema definition for task inputs and outputs.
ToBatch
A struct for converting image data into batched tensor format.
TransformRegistry
A registry for managing transform configurations.

Enums§

ConfigError
Errors that can occur when validating configuration parameters.
OCRError
Enum representing various errors that can occur in the OCR pipeline.
OwnedPredictionResult
Enum representing owned prediction results.
PaddingStrategy
Strategy for padding images to uniform size
PredictionResult
Enum representing different types of prediction results.
ProcessingStage
Enum representing different stages of processing in the OCR pipeline.
ShapeCompatibilityStrategy
Strategy for determining shape compatibility
TaskType
Represents the type of OCR task being performed.
TensorInput
Represents a tensor input of various dimensions for generic inference.
TensorOutput
Generic tensor output supporting multiple data types.
TransformConfig
Configuration for different transform types.
TransformType
Enumeration of available transform types.

Constants§

DEFAULT_BATCH_SIZE
The default number of items processed together in a batch.
DEFAULT_CLASSIFICATION_INPUT_SHAPE
The default shape (height, width) for classification images.
DEFAULT_LIMIT_SIDE_LEN
The default size to which image sides are limited during processing. Matches the official PaddleOCR DBNet default of 960 (was previously 736).
DEFAULT_MAX_IMG_WIDTH
The default maximum width for images in the OCR pipeline.
DEFAULT_MAX_SIDE_LIMIT
The default maximum size for any side of an image.
DEFAULT_PARALLEL_THRESHOLD
The minimum number of items required before parallel processing is used.
DEFAULT_REC_IMAGE_SHAPE
The default shape (channels, height, width) for recognition images.
DEFAULT_TOPK
The default number of top results to select in classification tasks.
MAX_TENSOR_SIZE
The maximum number of elements allowed in a tensor, to prevent memory issues.

Traits§

AdapterBuilder
Builder trait for creating model adapters.
ConfigValidator
A trait for validating configuration parameters.
ConfigValidatorExt
Extension trait for ConfigValidator that provides error wrapping utilities.
DynamicBatcher
Enhanced trait for dynamic batching functionality
GranularImageReader
Trait for image reading and I/O operations.
ImageReader
Trait for reading images.
IntoOwnedPrediction
Trait for converting a type into an owned prediction result.
IntoPrediction
Trait for converting a type into a prediction result.
ModelAdapter
Core trait for model adapters.
Postprocessor
Trait for postprocessing operations.
Preprocessor
Trait for image preprocessing operations.
Sampler
Trait for sampling data into batches.
Task
Core trait for OCR tasks.

Functions§

apply_document_orientation
Rotates the image by the detected document orientation (0/90/180/270°); unsupported angles return the image unchanged.
apply_text_line_orientation
Rotates the text-line image by the detected orientation (0/180°); unsupported angles return the image unchanged.
format_orientation_label
Converts a numeric orientation label (e.g. “90”) to a degree string (e.g. “90°”).
get_document_orientation_labels
Gets the standard document orientation labels
get_text_line_orientation_labels
Gets the standard text line orientation labels
load_session
Loads a session with default logging configuration.
parse_document_orientation
Parses document orientation from classifier output
parse_orientation_angle
Parses an orientation angle from a label, accepting numeric (“0”, “90.0”) and descriptive (“upright”, “inverted”, …) forms, validated against valid_angles. Unknown or out-of-set labels yield an uncertain result.
parse_text_line_orientation
Parses text line orientation from classifier output
validate_batch_size
Validates that tensor batch size is positive.
validate_division
Validates division operands to prevent division by zero.
validate_finite
Validates that a float value is finite (not NaN or infinite).
validate_image_dimensions
Validates image dimensions.
validate_index_bounds
Validates that array index is within bounds.
validate_non_empty
Validates that a collection is not empty.
validate_non_negative
Validates that a value is non-negative (>= 0).
validate_normalization_params
Validates normalization parameters (mean and std).
validate_positive
Validates that a value is positive (> 0).
validate_range
Validates that a value is within a specified range (inclusive).
validate_same_length
Validates that two collections have the same length.
validate_tensor_shape
Validates tensor shape dimensions.

Type Aliases§

OcrResult
Convenient result alias for OCR operations.