Expand description
The main OCR pipeline implementation.
This module provides the complete OCR pipeline that combines multiple components to perform document orientation classification, text detection, text recognition, and text line classification.
§Orchestration Architecture
The pipeline has been refactored to use a unified orchestration system that eliminates code duplication and provides better maintainability. The key improvements include:
§Unified Processing Logic
Previously, methods like process_single_image, process_single_image_from_memory,
process_images_individually, and process_images_from_memory contained
duplicated orchestration logic for:
- Parallel vs sequential processing decisions
- Index management and result sorting
- Pipeline stage execution patterns
- Error handling and logging
Now, all these methods use the orchestration module’s abstractions:
ImageProcessingOrchestratorfor batch processing coordinationPipelineExecutorfor unified stage executionProcessingStrategyfor configurable parallelismImageInputSourcefor input abstraction
§Benefits
- Reduced Duplication: ~200 lines of duplicated code eliminated
- Improved Maintainability: Changes to orchestration logic in one place
- Better Testability: Each orchestration component can be tested independently
- Type Safety: Compile-time prevention of invalid configurations
- Consistent Behavior: All processing paths use the same underlying logic
§Backward Compatibility
The public API remains unchanged. All existing code using OAROCR::predict
and related methods will continue to work without modification.
Re-exports§
pub use config::OnnxThreadingConfig;pub use config::ParallelPolicy;
Structs§
- Error
Metrics - Error metrics for monitoring data quality and model performance issues.
- ExtensibleOAROCR
- Integration wrapper that bridges the extensible pipeline with OAROCR.
- ExtensibleOAROCR
Builder - Builder for creating ExtensibleOAROCR instances.
- Image
Processing Orchestrator - Main orchestrator for image processing operations.
- Image
Processor - Image processing utilities for the OAROCR pipeline.
- OAROCR
- The main OCR pipeline that combines multiple components to perform document processing and text recognition.
- OAROCR
Builder - Builder for creating OAROCR instances.
- OAROCR
Config - OAROCR
Result - Result of the OAROCR pipeline execution.
- Pipeline
Executor - Executor for OCR pipeline stages with configurable entry points.
- Pipeline
Stage Config - Configuration for pipeline stage execution
- Single
Image Processing Params - Text
Region - A text region containing detection and recognition results.
Enums§
- Image
Input Source - Represents different sources of image input for processing.
- Pipeline
Stage - Represents different stages in the OCR pipeline
- Processing
Strategy - Strategy for processing multiple images
Functions§
- configure_
thread_ pool_ once - Configures the global rayon thread pool if not already configured.