Expand description
Shared stage processors for the OCR pipeline.
This module provides reusable stage processors that eliminate code duplication across different pipeline flows (single-image, in-memory, dynamic batching, detection-from-memory). Each processor encapsulates the logic for a specific pipeline stage with consistent error handling, logging, and performance characteristics.
§Extensible Pipeline Architecture
The pipeline supports extensible stages through the PipelineStage trait and
StageRegistry system, allowing new stages to be added without modifying core
pipeline code.
§Stage Processor Pattern Abstraction
This module includes helper utilities that reduce code duplication across stage processors by abstracting common lifecycle patterns:
- Timing management - Automatic start/stop timing for operations
- Empty input handling - Consistent behavior for empty input collections
- Parallel processing - Automatic decisions between sequential and parallel processing
- Metrics collection - Standardized success/failure counting and metadata
- Result wrapping - Consistent
StageResultcreation with metrics
These abstractions reduce repetitive code by approximately 25-35% across the orientation, cropping, and recognition processors while maintaining the same functionality and API compatibility.
See [processor_helper] for the concrete helper implementations.
Re-exports§
pub use config::ExtensiblePipelineConfig;pub use config::GlobalPipelineSettings;
Modules§
- config
- Configuration system for extensible pipeline stages.
Structs§
- Batch
Config - Configuration for batch processing behavior
- Batch
Processor - Helper for processing collections with common lifecycle patterns
- Cropping
Config - Configuration for cropping processing
- Cropping
Result - Result of cropping processing
- Cropping
Stage Processor - Processor for text box cropping stage.
- Extensible
Cropping Stage - Extensible cropping stage that implements PipelineStage trait.
- Extensible
Orientation Stage - Extensible orientation stage that implements PipelineStage trait.
- Extensible
Pipeline - Extensible pipeline that uses the stage registry.
- Extensible
Recognition Stage - Extensible recognition stage that implements PipelineStage trait.
- Extensible
Text Detection Stage - Extensible text detection stage that implements PipelineStage trait.
- Extensible
Text Line Orientation Stage - Text line orientation stage for the extensible pipeline.
- Grouping
Strategy Factory - Factory for creating grouping strategies
- Orientation
Config - Configuration for orientation processing
- Orientation
Correction Config - Configuration for orientation correction
- Orientation
Corrector - Component responsible for applying text line orientation corrections
- Orientation
Result - Result of orientation classification processing
- Orientation
Stage Processor - Processor for document orientation classification stage.
- Pipeline
Executor - Pipeline executor for running extensible pipelines.
- Recognition
Config - Configuration for recognition processing
- Recognition
Result - Result of recognition processing
- Recognition
Stage Processor - Processor for text recognition grouping and processing stage.
- Single
Item Processor - Helper for single item processing with timing and metrics
- Stage
Context - Context information available to pipeline stages during execution.
- Stage
Data - Data that flows between pipeline stages.
- StageId
- Unique identifier for a pipeline stage.
- Stage
Metrics - Metrics collected during stage processing.
- Stage
Processor Helper - Helper utility for common stage processing patterns.
- Stage
Result - Result wrapper for stage processing operations.
- Text
Detection Config - Configuration for text detection processing.
- Text
Detection Result - Result of text detection processing.
- Text
Line Orientation Config - Configuration for text line orientation processing.
Enums§
- Grouping
Strategy Config - Configuration for different grouping strategies
- Stage
Dependency - Dependency specification for a pipeline stage.
Traits§
- Grouping
Strategy - Trait for image grouping strategies
- Pipeline
Stage - Trait for extensible pipeline stages.
- Stage
Algorithm - Trait for stage algorithms that can be run with automatic timing and metrics.
- Stage
Processor - Trait for stage processors that follow the common lifecycle pattern.
Functions§
- process_
items - Generic utility function for processing collections with common patterns.
- run_
with_ metrics - Generic stage harness that runs an algorithm with automatic timing and metrics.
- run_
with_ metrics_ and_ fallback - Generic stage harness with custom error handling.