Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add readingorder model #44

Merged
merged 32 commits into from
Feb 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
156a98a
added ReadingOrder model
PeterStaar-IBM Oct 26, 2024
93aaa57
updated the ReadinOrder
PeterStaar-IBM Oct 26, 2024
20fa950
finished the first porting of the reading-order
PeterStaar-IBM Oct 27, 2024
ee95a52
added a test and refactored the reading-order-model
PeterStaar-IBM Oct 28, 2024
860ab95
tests scripts are WIP
PeterStaar-IBM Oct 28, 2024
7e3a202
first running reading order model
PeterStaar-IBM Nov 12, 2024
f1ddd85
merged with main
PeterStaar-IBM Jan 25, 2025
a07f5e2
work in progress
PeterStaar-IBM Jan 25, 2025
3856504
got RO, to-captions and to-footnotes working
PeterStaar-IBM Jan 26, 2025
b18f2da
chore: Code styling for ReadingOrderPredictor
nikos-livathinos Jan 27, 2025
b83a748
merged with mypy cleaning
PeterStaar-IBM Jan 27, 2025
715b9e8
working on the reading-order
PeterStaar-IBM Jan 29, 2025
5c4e4a8
fixed the sorting of heads
PeterStaar-IBM Jan 30, 2025
804d8c9
implemented new to_captions method
PeterStaar-IBM Feb 5, 2025
9d8f5d5
added datasets for reading-order
PeterStaar-IBM Feb 5, 2025
57fc9ef
updated the checks to python 3.13
PeterStaar-IBM Feb 5, 2025
5edb94c
updated the pyproject to have the latest torch-vision compatible with…
PeterStaar-IBM Feb 5, 2025
26aa6ad
updated tests for layout
PeterStaar-IBM Feb 5, 2025
e05a4b1
updated the tests with reading-order on docling-dpbench
PeterStaar-IBM Feb 5, 2025
f19c954
cleaned up the pyproject
PeterStaar-IBM Feb 5, 2025
39066dd
cleaned up the test
PeterStaar-IBM Feb 5, 2025
ea14c07
cleanup pyproject and lock for py3.13
dolfim-ibm Feb 5, 2025
086706e
Merge pull request #77 from DS4SD/pin-pyproject
PeterStaar-IBM Feb 5, 2025
8f913a7
finalised the reading order
PeterStaar-IBM Feb 6, 2025
1d2dd93
cleaned code
PeterStaar-IBM Feb 6, 2025
2f88418
fix for multipage reading-order
PeterStaar-IBM Feb 7, 2025
6892adf
Fixes for to_caption
cau-git Feb 10, 2025
6f16878
Fix styling
cau-git Feb 19, 2025
a02e75d
Merge from main
cau-git Feb 19, 2025
27cfa15
Fix mypy
cau-git Feb 19, 2025
ffa4adf
Update test units
cau-git Feb 19, 2025
a49b993
Fix usage of iterate_items
cau-git Feb 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merged with main
Signed-off-by: Peter Staar <[email protected]>
PeterStaar-IBM committed Jan 25, 2025

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit f1ddd850cee8241875d13e59c2460efe36f540a5
19 changes: 9 additions & 10 deletions tests/test_layout_predictor.py
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
#
import os
import json
from pathlib import Path

import torch
import numpy as np
@@ -74,19 +75,17 @@ def test_layoutpredictor(init: dict):

true_layout_fn = img_fn+".json"
with Image.open(img_fn) as img:
pred_layout=[]


w, h = img.size

# Load images as PIL objects
for i, pred in enumerate(lpredictor.predict(img)):
print("PIL pred: {}".format(pred))
pred_layout.append({
"label": pred["label"],
"t": pred["t"].item(),
"b": pred["b"].item(),
"l": pred["l"].item(),
"r": pred["r"].item(),
})
print(pred_layout)
assert pred["l"] >= 0 and pred["l"] <= w
assert pred["t"] >= 0 and pred["t"] <= h
assert pred["r"] >= 0 and pred["r"] <= w
assert pred["b"] >= 0 and pred["b"] <= h

assert i + 1 == init["pred_bboxes"]

if os.path.exists(true_layout_fn):
You are viewing a condensed version of this merge commit. You can view the full changes here.