PaddleOcrConfig class

Configuration for PaddleOCR backend.

Configures PaddleOCR text detection and recognition with multi-language support. Uses a builder pattern for convenient configuration.

Examples

use xberg::PaddleOcrConfig;

// Create with default English configuration
let config = PaddleOcrConfig::new("en");

// Create with custom cache directory
let config = PaddleOcrConfig::new("ch")
    .with_cache_dir("/path/to/cache".into());

// Table detection is off by default (unlike `TesseractConfig`); PaddleOCR has no
// per-word table-candidate signal, so unfiltered clustering over-fabricates tables
// on ordinary prose. Enable it explicitly once you've validated it for your corpus.
let config = PaddleOcrConfig::new("en")
    .with_table_detection(true);

Constructors

PaddleOcrConfig({required String language, String? cacheDir, required bool useAngleCls, required bool enableTableDetection, required double detDbThresh, required double detDbBoxThresh, required double detDbUnclipRatio, required PlatformInt64 detLimitSideLen, required PlatformInt64 recBatchNum, required PlatformInt64 padding, required double dropScore, required String modelTier, required String modelVersion, PaddleInferenceBackend? inferenceBackend})
const

Properties

cacheDir → String?
Optional Hugging Face Hub cache root for model files.
final
detDbBoxThresh → double
Box threshold for text bounding box refinement (default: 0.5) Range: 0.0-1.0
final
detDbThresh → double
Database threshold for text detection (default: 0.3) Range: 0.0-1.0, higher values require more confident detections
final
detDbUnclipRatio → double
Unclip ratio for expanding text bounding boxes (default: 1.6) Controls the expansion of detected text regions
final
detLimitSideLen → int
Maximum side length for detection image (default: 1024) Larger images may be resized to this limit for faster inference
final
dropScore → double
Minimum recognition confidence score for text lines (default: 0.5). Text regions with recognition confidence below this threshold are discarded. Matches PaddleOCR Python's drop_score parameter. Range: 0.0-1.0
final
enableTableDetection → bool
Enable table structure detection (default: false, unlike TesseractConfig which defaults to true — see crate::ocr::types::TesseractConfig).
final
hashCode → int
The hash code for this object.
no setteroverride
inferenceBackend → PaddleInferenceBackend?
Explicit inference engine choice.
final
language → String
Language code (e.g., "en", "ch", "jpn", "kor", "deu", "fra")
final
modelTier → String
Model tier controlling detection/recognition model size and accuracy trade-off.
final
modelVersion → String
Model generation: "pp-ocrv6" (default) or "pp-ocrv5".
final
padding → int
Padding in pixels added around the image before detection (default: 10). Large values can include surrounding content like table gridlines.
final
recBatchNum → int
Batch size for recognition inference (default: 6) Number of text regions to process simultaneously
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
useAngleCls → bool
Enable angle classification for rotated text (default: false). Can misfire on short text regions, rotating crops incorrectly before recognition.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override