Skip to content

Commit

Permalink
chore: Add reading_order evaluation and visualization in the examples…
Browse files Browse the repository at this point in the history
… for dp-bench and omnidocbench

Add the doc_id in the evaluation report

Signed-off-by: Nikos Livathinos <[email protected]>
  • Loading branch information
nikos-livathinos committed Jan 14, 2025
1 parent 36b0722 commit 96a7d88
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docling_eval/evaluators/readingorder_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@


class PageReadingOrderEvaluation(BaseModel):
doc_id: str

# BBoxes are in BOTTOMLEFT origin and in the true order
bboxes: List[Tuple[float, float, float, float]]
pred_order: List[int]
Expand Down Expand Up @@ -75,6 +77,7 @@ def __call__(
ards.append(ard)

page_evaluation = PageReadingOrderEvaluation(
doc_id=doc_id,
bboxes=[b.as_tuple() for b in reading_order["bboxes"]],
pred_order=reading_order["pred_order"],
ard=ard,
Expand Down
12 changes: 12 additions & 0 deletions docs/examples/benchmark_dpbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ def main():
idir=odir_lay,
odir=odir_lay,
)
evaluate(
modality=EvaluationModality.READING_ORDER,
benchmark=BenchMarkNames.DPBENCH,
idir=odir_lay,
odir=odir_lay,
)
visualise(
modality=EvaluationModality.READING_ORDER,
benchmark=BenchMarkNames.DPBENCH,
idir=odir_lay,
odir=odir_lay,
)

if True:
create_dpbench_tableformer_dataset(
Expand Down
12 changes: 12 additions & 0 deletions docs/examples/benchmark_omnidocbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ def main():
idir=odir_lay,
odir=odir_lay,
)
evaluate(
modality=EvaluationModality.READING_ORDER,
benchmark=BenchMarkNames.OMNIDOCBENCH,
idir=odir_lay,
odir=odir_lay,
)
visualise(
modality=EvaluationModality.READING_ORDER,
benchmark=BenchMarkNames.OMNIDOCBENCH,
idir=odir_lay,
odir=odir_lay,
)

if True:
create_omnidocbench_tableformer_dataset(
Expand Down

0 comments on commit 96a7d88

Please sign in to comment.