* Misc fixes Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Make DatasetRecord tolerant to old parquet files Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Make DatasetRecord tolerant to old parquet files (2) Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Fix docvqa test, more cleanup Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Important fixes for layout mAP computation Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Adding modes for missing_prediction_strategy and label_filtering_strategy Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Fixes for mismatched docs Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Add F1 no_picture metrics to layout evaluator Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Fixed commands on all READMEs Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Remove extract_images ambiguity, use utility and fix errors on visualizer Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Upgrade to latest docling_core Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Fix ocrmac dep, upgrade uv.lock Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Fix for tableformer provider Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * Remove code redundancy Signed-off-by: Christoph Auer <cau@zurich.ibm.com> --------- Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
6.3 KiB
Creating Groundtruth dataset using the CVAT annotation tool
Prerequisites: create dataset in parquet
To start creating ground-truth, you first need to have a dataset in parquet format. The most straightforward way is to use an existing dataset (e.g. DPBench), which comes with pre-annotated tables, formulas, etc. Hence, you can run the create script of that particular benchmark.
# Make the ground-truth
docling-eval create-gt --benchmark DPBench --output-dir ./benchmarks/DPBench-GT/
Alternatively, you can first create a plain dataset from a folder of PDF or image files to start from (without any annotations).
# Make the ground-truth
docling-eval create-gt --benchmark PlainFiles --dataset-source ./tests/data/files --output-dir ./benchmarks/my_dataset/
If you want to pre-annotate the dataset (eg with Docling), then use
docling-eval create --benchmark PlainFiles --dataset-source ./tests/data/files --output-dir ./benchmarks/my_dataset/ --prediction-provider Docling
Pre-annotation with Docling
Now you can create the files you need to upload to CVAT. These files will be created using the create-cvat function of the docling-eval CLI.
❯ docling-eval create-cvat --help
Usage: docling-eval create-cvat [OPTIONS]
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ * --output-dir PATH Output directory [default: None] [required] │
│ * --gt-dir PATH Dataset source path [default: None] [required] │
│ --bucket-size INTEGER Size of CVAT tasks [default: 20] │
│ --use-predictions --no-use-predictions use predictions [default: no-use-predictions] │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
For example, try:
docling-eval create-cvat \
--gt-dir ./benchmarks/DPBench-GT/gt_dataset/test/ \
--output-dir ./benchmarks/DPBench-CVAT/ \
--no-use-predictions
In essence, this will read the parquet files and set up a new directory structure (designated output) that has the following layout,
./legacy/<output-dir>
├── cvat_annotations
│ ├── xmls
│ └── zips
├── cvat_description.json
├── cvat_overview.json
├── cvat_bins
├── cvat_tasks
│ └── task_00
├── datasets
│ ├── test
│ └── train
├── html_annotations
├── html_comparisons
├── json_annotations
├── json_groundtruth
└── page_imgs
The definition of the annotation items (DocItemLabel and Lines) can be found in cvat_description.json. All the other data you need is in the cvat_tasks,
tree ./benchmarks/layout_bench_cvat/cvat_tasks
./benchmarks/layout_bench_cvat/cvat_tasks
├── task_00
│ ├── doc_03f0ba705b60a81144dd4669945f41e9ce1d5a399ee671f7e95ee15a73f3388b_page_000001.png
│ ├── doc_041e0f3a476814054ccc97b9dcecd6e46fef2a687297cf2bcbe0f3d1d42c543c_page_000001.png
...
│ └── doc_f85bda78041c552c58faa1c83d9bb5cf48265fbe96330c4476e4b75725c0c71a_page_000001.png
└── task_00_preannotate.xml
Here we have,
- the page-images in
task_<xx> - the annotations for each page-image in xml
Online Annotation
Packaging the annotations into new dataset
After you have annotated all images, you can export the annotations,
You move the zip file into cvat_annotations/zips and then run the create-gt CLI function. For example:
docling-eval create-gt \
--benchmark CVAT \
--output-dir ./benchmarks/DPBench-CVAT-GT/ \
--dataset-source ./benchmarks/DPBench-CVAT/
This should do all the heavy lifting for you.








