robertknight / ocrs

Rust library and CLI tool for OCR (extracting text from images)
Apache License 2.0
1.09k stars 44 forks source link

Bump rten v0.10.0 #79

Closed robertknight closed 3 months ago

robertknight commented 3 months ago

The changes include significant performance improvements for the GRU operator, which makes recognition of long text lines faster, as well as adapting the thread pool size to the number of physical rather than logical cores, reducing overhead on systems with SMT / hyperthreading.

To adapt to the thread pool changes, rten::thread_pool().run(...) is now used to run line recognition preprocessing in the same thread pool that is used to execute the recognition model. This avoids contention from having more threads than cores.

Benchmarks:

Testing with the polar-bears.png example on an Ice Lake Intel i5:

cargo build -r -p ocrs-cli
time target/release/ocrs ocrs-cli/test-data/polar-bears.png

Before: ~1.00s After: ~570ms

In contrast with the why-rust.png example, which has a larger image but shorter lines, the impact is smaller:

Before: ~916ms After: ~790ms