Repository navigation
0.5.1 — Reading order on by default, simpler settings
0.5.1 — Reading order on by default, simpler settings, bug fixes
Lines now come out in reading order: multi-column pages are read column by column instead of across.
-
Reading order is on by default (
reading_order=True). Occular finds the layout regions of the page and assigns each line to the text region that covers it. Lines outside any region become their own objects. A small trained model orders the regions and these lines, and lines inside a region are read top to bottom. A region that lies inside a larger one is not treated as a separate block, so a paragraph is never split between "half a column" and "the whole column".- CER on 947 pages with page-level reference text fell from 0.341 to 0.225: OmniDocBench plus two sets of Russian documents, run on GPU.
- On 755 OmniDocBench pages with human-annotated order, the share of line pairs in the right order rose from 85.4 % to 92.0 %. On two-column pages it rose from 72.8 % to 84.3 %, on three-column pages from 63.5 % to 79.3 %.
- A page takes about 14 % longer, and the layout weights (~55 MB) are downloaded on first use.
reading_order=False(CLI--no-reading-order) gives plain top-to-bottom order.
-
ocr()and the CLI keep the reading order in their text output. Both used to re-sort lines top to bottom before printing. -
One
unwarpsetting.unwarp=Falseis the default and turns dewarping off.unwarp=Truedewarps a page only if its text then reads better, andunwarp="always"dewarps every page. The dewarping model is downloaded automatically. -
Removed settings:
experimental_layout_orderandlayout_order_method(including the XY-cut option);unwarp_gateandunwarp_margin;- the older reading-order model.
Code that passes the removed settings now fails with a
TypeError.download_reading_order()andreading_order_ready()still work and now handle the new reading-order weights. -
Bug fixes:
- Changing
languagesorrecognizerwithin one process now takes effect. Previously a cached recognizer was reused. - Unknown language codes raise an error that lists the supported codes.
model_info()andlayout_ready()now detect weights in the Hugging Face cache.
- Changing
This code was briefly published as 0.6.0. That release is yanked; please use 0.5.1.
Full details are in CHANGELOG.md.
Upgrade:
pip install -U occular-ocr==0.5.1With GPU dependencies:
pip install -U "occular-ocr[gpu]==0.5.1"