Commit graph

1358 commits

Author SHA1 Message Date
kba
103c007368 . 2025-11-26 14:37:00 +01:00
kba
0149147e95 . 2025-11-25 13:45:47 +01:00
Robert Sachunsky
e428e7ad78 ensure separators stay within image bounds 2025-11-16 16:35:18 +01:00
Robert Sachunsky
406288b1fe fixup 72d059f3: forgot to update other writer calls 2025-11-16 16:32:45 +01:00
Robert Sachunsky
028ed16921 adapt ocrd-sbb-binarize 2025-11-15 17:17:37 +01:00
Robert Sachunsky
49ab269e08 fix typos found by ruff 2025-11-15 15:49:51 +01:00
Robert Sachunsky
72d059f3c9 reading order: simplify assignment / counting
- `do_order_of_regions`: simplify aggregating per-box orders
  for paragraphs and headings to overall order passed to
  `xml_reading_order`; no need for `order_and_id_of_texts`,
  no need to return `id_of_texts_tot`
- `do_order_of_regions_with_model`: no need to return `region_ids`
- writer: no need to pass `id_of_texts_tot` in `build_pagexml`
2025-11-15 14:34:12 +01:00
Robert Sachunsky
5a778003fd contour matching for deskewed image: ensure matches for both sides 2025-11-15 14:32:22 +01:00
Robert Sachunsky
3c15c4f7d4 back to rotate_image instead of rotation_image_new for deskewing
(because the latter does not preserve coordinates;
 it scales, even when resizing the image;
 this caused coordinate problems when matching deskewed contours)
2025-11-15 14:29:41 +01:00
Robert Sachunsky
4475183f08 improve rules governing column split
- reduce `sigma` for smoothing of input to `find_peaks`
  (so we get deeper gaps between columns)
- allow column boundaries closer to the margins
  (50 instead of 100 or 200 px, 170 instead of 370 px)
- allow column boundaries closer to each other
  (300 instead of 400 px)
- add a secondary `grenze` criterion for depth of gap
  (relative to lowest minimum, if that is smaller than
   the old criterion relative to lowest maximum)
- for calls to `find_num_col` within parts of a page,
  do allow unbalanced column boundaries
2025-11-14 13:15:09 +01:00
Robert Sachunsky
4abc2ff572 rewrite/simplify manual reading order using recursive algorithm
- rename `return_x_start_end_mothers_childs_and_type_of_reading_order`
  → `return_multicol_separators_x_start_end`, and drop all the analysis
  pertaining to mother/child relationships and full-span separators,
  also drop the separator unification rules;
  instead of the latter, try to combine neighbouring separators more
  generally: join column spans iff there is nothing in between
  (which also necessitates passing the region mask), and keep only
  one of every such redundant pair;
  add the top (of each page part) as full-span separator up front,
  and return separators already ordered by y
- `return_boxes_of_images_by_order_of_reading_new`:
  - also pass regions with separators, so they do not have to be
    reconstructed from the separator coordinates, and also contain
    images and other non-text region types, when trying to elongate
    separators to maximize their span (without introducing overlaps)
  - determine connected components of the region mask, i.e. labels
    and their respective bboxes, in order to
    1. gain additional multi-column separators, if possible
    2. avoid cutting through regions which do cross column boundaries
       later on
  - whenever adding a new bbox, first look up the label map to see if
    there are any multi-column regions extending to the right of the
    current column; if there are, then advance not just one column
    to the right, but as many as necessary to avoid cutting through
    these regions
  - new core algorithm: iterate separators sorted by y and then column
    by column, but whenever the next separator ends in the same column
    as the current one or even further left, recurse (i.e. finish that
    span first before continuing with the top iteration)
2025-11-14 13:14:53 +01:00
Robert Sachunsky
95f76081d1 rename some more identifiers:
- `lines` → `seps` (to distinguish from textlines)
- `text_regions_p_1_n` → `text_regions_p_d` (because all other
  deskewed variables are called like this)
- `pixel` → `label`
2025-11-14 13:13:50 +01:00
Robert Sachunsky
1a76ce177d do_order_of_regions: round contour centers
(so we can be sure they do not fall through the
 "pixel cracks": bboxes are delimited by integers,
 and we do not want to assign contours between
 boxes)
2025-11-14 13:08:10 +01:00
kba
67003b837c . 2025-11-13 16:56:04 +01:00
kba
d66549012f . 2025-11-13 14:57:28 +01:00
kba
b9bc8e79c0 github ci: cache models with model_zoo default config as key 2025-11-13 13:58:38 +01:00
kba
b34329dd61 tests: more path fixes 2025-11-13 12:21:48 +01:00
kba
9aeff6d155 tests: typo 2025-11-13 11:49:09 +01:00
kba
a72be69958 tests: fix model download URL 2025-11-13 11:48:23 +01:00
kba
3afbce023d tests: adapt paths 2025-11-13 11:46:31 +01:00
vahidrezanezhad
ed5b5c13dd Add test images; call TrOCR processor from the same directory as the TrOCR model 2025-11-07 12:47:21 +01:00
kba
8732007aaf . 2025-11-06 16:33:39 +01:00
kba
f902756ce1 try importing torch, then shapely, then tensorflow 2025-11-06 13:10:35 +01:00
kba
44037bc05d add layout marginalia test 2025-11-06 12:42:57 +01:00
kba
d224b0f7e8 try with shapely.set_precision(...mode="keep_collpased") 2025-11-06 11:55:40 +01:00
kba
0d84e7da16 Merge remote-tracking branch 'origin/docs_and_minor_fixes' into model-zoo
# Conflicts:
#	README.md
#	train/README.md
2025-11-06 11:37:10 +01:00
kba
53e879e289 make *test: another typo; 2025-11-05 16:19:55 +01:00
kba
e449dbab6d make *test: fix paths 2025-11-05 15:28:41 +01:00
kba
0bef6e297b make models: unzip to the versioned directory 2025-11-05 15:19:16 +01:00
kba
2c211095d7 make deps-test should not depend on the models 2025-11-05 15:02:55 +01:00
kba
b6c7283b4d further debugging 2025-11-05 14:41:18 +01:00
cneud
f90259d6e2 fix docs links 2025-10-30 22:24:54 +01:00
cneud
d5b7089bad Merge branch 'docs_and_minor_fixes' of https://github.com/qurator-spk/eynollah into docs_and_minor_fixes 2025-10-30 22:17:41 +01:00
cneud
9dbac280cc Revert "remove unnecessary backslash"
This reverts commit f212ffa22d.
2025-10-30 22:16:53 +01:00
cneud
2d35a0598d Revert "replace list declaration with list literal (faster)"
This reverts commit 9733d575bf.
2025-10-30 22:16:48 +01:00
cneud
70d8577a15 Revert "remove redundant parentheses"
This reverts commit 20a95365c2.
2025-10-30 22:16:41 +01:00
Clemens Neudecker
c9efbe1871
refactor image layout in examples.md 2025-10-30 16:52:59 +01:00
kba
8782ef17b2 CI: 🔥 upgrade torch for debugging 2025-10-30 12:19:35 +01:00
kba
62d05917c5 test_layout: str(Path) 2025-10-30 12:17:38 +01:00
cneud
b1e191b2ea reformat cli options table 2025-10-29 22:30:58 +01:00
cneud
f6c0f56348 Update README.md 2025-10-29 22:23:56 +01:00
cneud
46a45f6b0e Create examples.md 2025-10-29 22:23:48 +01:00
kba
15e6ecb95d make models: update URL 2025-10-29 21:27:10 +01:00
kba
600ebfeb50 make: fix to use single-archive ZIP 2025-10-29 21:07:49 +01:00
kba
9ab565fa02 model basedir might be a symlink 2025-10-29 21:02:42 +01:00
kba
4772fd17e2 missed changing override mechanism in eynollah_ocr 2025-10-29 20:47:13 +01:00
kba
29c273685f fix merge issues 2025-10-29 20:15:19 +01:00
kba
de76eabc1d Merge branch 'cli-logging' into model-zoo 2025-10-29 19:41:01 +01:00
kba
5e22e9db64 model_zoo: make type str to reduce importing overhead 2025-10-29 19:16:35 +01:00
kba
a913bdf7dc make --model-basedir and --model-overrides top-level CLI options 2025-10-29 18:48:41 +01:00