Skip to content

Commit

Permalink
updated the README
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Staar <[email protected]>
  • Loading branch information
PeterStaar-IBM committed Dec 20, 2024
1 parent 236c9da commit 0a6829d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ docling-eval % poetry run evaluate --help
Usage: evaluate [OPTIONS]

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
* --task -t [create|evaluate] Evaluation task [default: None] [required] │
* --task -t [create|evaluate|visualize] Evaluation task [default: None] [required] │
* --modality -m [end-to-end|layout|tableformer|codeformer] Evaluation modality [default: None] [required] │
* --benchmark -b [DPBench|OmniDcoBench|WordScape|PubLayNet|DocLayNet|Pub1M|PubTabNet|FinTabNet|WikiTabNet] Benchmark name [default: None] [required] │
* --input-dir -i PATH Input directory [default: None] [required] │
Expand All @@ -35,18 +35,31 @@ docling-eval % poetry run evaluate --help
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

If you have DP-Bench locally, you can create the dataset,
## End to End examples

### Table evaluations for DP-Bench

👉 Create the dataset,

```sh
poetry run evaluate -t create -m end-to-end -b DPBench -i <location-of-dpbench> -o ./benchmarks/dpbench-tableformer
poetry run evaluate -t create -m tableformer -b DPBench -i <location-of-dpbench> -o ./benchmarks/dpbench-tableformer
```

or,
👉 Evaluate the dataset,

```sh
poetry run evaluate -t create -m tableformer -b DPBench -i <location-of-dpbench> -o ./benchmarks/dpbench-tableformer
poetry run evaluate -t evaluate -m tableformer -b DPBench -i <location-of-dpbench> -o ./benchmarks/dpbench-tableformer
```

👉 Visualise the dataset,

```sh
poetry run evaluate -t visualize -m tableformer -b DPBench -i <location-of-dpbench> -o ./benchmarks/dpbench-tableformer
```

The final result can be visualised as,

[DPBench_TEDS](./docs/evaluations/evaluation_DPBench_tableformer.pdf)


## Contributing
Expand Down
10 changes: 7 additions & 3 deletions docling_eval/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,22 @@ def visualise(modality:EvaluationModality, benchmark:BenchMarkNames, idir:Path,

# Calculate bin widths
bin_widths = [evaluation.TEDS.bins[i + 1] - evaluation.TEDS.bins[i] for i in range(len(evaluation.TEDS.bins) - 1)]

bin_middle = [(evaluation.TEDS.bins[i + 1] + evaluation.TEDS.bins[i])/2.0 for i in range(len(evaluation.TEDS.bins) - 1)]

for i in range(len(evaluation.TEDS.bins)-1):
logging.info(f"{i:02} [{evaluation.TEDS.bins[i]:.3f}, {evaluation.TEDS.bins[i+1]:.3f}]: {evaluation.TEDS.hist[i]}")

# Plot histogram
plt.bar(evaluation.TEDS.bins[0:-1], evaluation.TEDS.hist, width=bin_widths, edgecolor="black")
plt.bar(bin_middle, evaluation.TEDS.hist, width=bin_widths, edgecolor="black")
#width=(evaluation.TEDS.bins[1] - evaluation.TEDS.bins[0]),

plt.xlabel("TEDS")
plt.ylabel("Frequency")
plt.title(f"benchmark: {benchmark.value}, modality: {modality.value}")
plt.show()

figname = odir / f"evaluation_{benchmark.value}_{modality.value}.pdf"
logging.info(f"saving figure to {figname}")
plt.savefig(figname)

case EvaluationModality.CODEFORMER:
pass
Expand Down
Binary file not shown.

0 comments on commit 0a6829d

Please sign in to comment.