pub struct OcrEngine { /* private fields */ }Expand description
End-to-end OCR pipeline (ocrs-compatible API).
Implementations§
Source§impl OcrEngine
impl OcrEngine
Sourcepub fn from_paths(
detection: impl AsRef<Path>,
recognition: impl AsRef<Path>,
) -> Result<OcrEngine, Error>
pub fn from_paths( detection: impl AsRef<Path>, recognition: impl AsRef<Path>, ) -> Result<OcrEngine, Error>
Build from explicit model paths (.safetensors for native RLX; .rten only with rten-inference).
pub fn from_paths_on_device( detection: impl AsRef<Path>, recognition: impl AsRef<Path>, device: Device, ) -> Result<OcrEngine, Error>
pub fn new(params: OcrEngineParams) -> Result<OcrEngine, Error>
Sourcepub fn from_model_dir(dir: impl AsRef<Path>) -> Result<OcrEngine, Error>
pub fn from_model_dir(dir: impl AsRef<Path>) -> Result<OcrEngine, Error>
Load default HuggingFace checkpoint filenames from a model directory (CPU).
Sourcepub fn from_model_dir_on_device(
dir: impl AsRef<Path>,
device: Device,
) -> Result<OcrEngine, Error>
pub fn from_model_dir_on_device( dir: impl AsRef<Path>, device: Device, ) -> Result<OcrEngine, Error>
Load checkpoints from dir and compile graphs on device.
pub fn prepare_input(&self, source: ImageSource<'_>) -> Result<OcrInput, Error>
pub fn detection_threshold(&self) -> f32
pub fn detect_words(&self, input: &OcrInput) -> Result<Vec<RotatedRect>, Error>
pub fn detect_text_pixels( &self, input: &OcrInput, ) -> Result<TensorBase<Vec<f32>, NdLayout<2>>, Error>
pub fn find_text_lines( &self, _input: &OcrInput, words: &[RotatedRect], ) -> Vec<Vec<RotatedRect>>
pub fn prepare_recognition_input( &self, input: &OcrInput, line: &[RotatedRect], ) -> Result<TensorBase<Vec<f32>, NdLayout<2>>, Error>
pub fn recognize_text( &self, input: &OcrInput, lines: &[Vec<RotatedRect>], ) -> Result<Vec<Option<TextLine>>, Error>
pub fn get_text(&self, input: &OcrInput) -> Result<String, Error>
pub fn config(&self) -> OcrConfig
Auto Trait Implementations§
impl !Freeze for OcrEngine
impl RefUnwindSafe for OcrEngine
impl Send for OcrEngine
impl Sync for OcrEngine
impl Unpin for OcrEngine
impl UnsafeUnpin for OcrEngine
impl UnwindSafe for OcrEngine
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more