pub struct ParallelPolicy {
pub max_threads: Option<usize>,
pub image_threshold: usize,
pub text_box_threshold: usize,
pub batch_threshold: usize,
pub utility_threshold: usize,
pub postprocess_pixel_threshold: usize,
pub onnx_threading: OnnxThreadingConfig,
}Expand description
Centralized configuration for parallel processing behavior across the OCR pipeline.
This struct consolidates parallel processing configuration that was previously scattered across different components, providing a unified way to tune parallelism behavior throughout the OCR pipeline.
Fields§
§max_threads: Option<usize>Maximum number of threads to use for parallel processing. If None, rayon will use the default thread pool size (typically number of CPU cores). Default: None (use rayon’s default)
image_threshold: usizeThreshold for number of images to process sequentially (<= this uses sequential) Default: 1 (process single images sequentially, use parallel for multiple images)
text_box_threshold: usizeThreshold for number of text boxes to crop sequentially (<= this uses sequential) Default: 1 (process single text boxes sequentially, use parallel for multiple boxes)
batch_threshold: usizeThreshold for batch processing operations (<= this uses sequential) Default: 10 (use sequential for small batches, parallel for larger ones)
utility_threshold: usizeThreshold for general utility operations like image loading (<= this uses sequential) Default: 4 (matches DEFAULT_PARALLEL_THRESHOLD constant)
postprocess_pixel_threshold: usizeThreshold for postprocessing operations based on pixel area (<= this uses sequential) Default: 8000 (use sequential for regions with <= 8000 pixels, parallel for larger)
onnx_threading: OnnxThreadingConfigONNX Runtime threading configuration
Implementations§
Source§impl ParallelPolicy
impl ParallelPolicy
Sourcepub fn with_max_threads(self, max_threads: Option<usize>) -> Self
pub fn with_max_threads(self, max_threads: Option<usize>) -> Self
Set the maximum number of threads.
Sourcepub fn with_image_threshold(self, threshold: usize) -> Self
pub fn with_image_threshold(self, threshold: usize) -> Self
Set the image processing threshold.
Sourcepub fn with_text_box_threshold(self, threshold: usize) -> Self
pub fn with_text_box_threshold(self, threshold: usize) -> Self
Set the text box processing threshold.
Sourcepub fn with_batch_threshold(self, threshold: usize) -> Self
pub fn with_batch_threshold(self, threshold: usize) -> Self
Set the batch processing threshold.
Sourcepub fn with_postprocess_pixel_threshold(self, threshold: usize) -> Self
pub fn with_postprocess_pixel_threshold(self, threshold: usize) -> Self
Set the postprocessing pixel threshold.
Sourcepub fn with_onnx_threading(self, config: OnnxThreadingConfig) -> Self
pub fn with_onnx_threading(self, config: OnnxThreadingConfig) -> Self
Set the ONNX threading configuration.
Sourcepub fn with_utility_threshold(self, threshold: usize) -> Self
pub fn with_utility_threshold(self, threshold: usize) -> Self
Set the utility operations threshold.
Trait Implementations§
Source§impl Clone for ParallelPolicy
impl Clone for ParallelPolicy
Source§fn clone(&self) -> ParallelPolicy
fn clone(&self) -> ParallelPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParallelPolicy
impl Debug for ParallelPolicy
Source§impl Default for ParallelPolicy
impl Default for ParallelPolicy
Source§impl<'de> Deserialize<'de> for ParallelPolicy
impl<'de> Deserialize<'de> for ParallelPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ParallelPolicy
impl RefUnwindSafe for ParallelPolicy
impl Send for ParallelPolicy
impl Sync for ParallelPolicy
impl Unpin for ParallelPolicy
impl UnwindSafe for ParallelPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.