oar_ocr/core/batch/dynamic/
mod.rs

1//! Dynamic batching for OCR pipeline components.
2//!
3//! This module provides functionality for dynamically batching images based on
4//! shape compatibility and performance requirements.
5//! It supports both same-image batching (multiple images) and cross-image
6//! batching (text regions from multiple images).
7//!
8//! # Features
9//!
10//! - **Shape Compatibility**: Group images by exact dimensions, aspect ratio, or custom strategies
11//! - **Flexible Batching**: Support for detection and recognition batching
12//! - **Performance Metrics**: Track batching performance and efficiency
13//! - **Cross-Image Batching**: Batch text regions from multiple images together
14//!
15//! # Example
16//!
17//! ```rust,no_run
18//! use oar_ocr::core::{DynamicBatchConfig, DefaultDynamicBatcher, DynamicBatcher};
19//! use image::RgbImage;
20//!
21//! let config = DynamicBatchConfig::default();
22//! let batcher = DefaultDynamicBatcher::new();
23//! let images = vec![(0, RgbImage::new(100, 100)), (1, RgbImage::new(100, 100))];
24//!
25//! let batches = batcher.group_images_by_compatibility(images, &config).unwrap();
26//! ```
27
28mod config;
29mod processor;
30mod types;
31
32// Re-export public types
33pub use config::{DynamicBatchConfig, PaddingStrategy, ShapeCompatibilityStrategy};
34pub use processor::{DefaultDynamicBatcher, DynamicBatcher};
35pub use types::{
36    BatchPerformanceMetrics, CompatibleBatch, CrossImageBatch, CrossImageItem, DynamicBatchResult,
37};