KuanCao320 commited on
Commit
2af97ec
·
1 Parent(s): 299ee20

first commit

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
README.md CHANGED
@@ -1,3 +1,135 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ task_categories:
4
+ - image-to-image
5
+ language:
6
+ - en
7
+ - zh
8
+ tags:
9
+ - VAE
10
+ - text-rich document
11
+ - text-reconstruction
12
+ - benchmark
13
+ size_categories:
14
+ - 1K<n<10K
15
+ pretty_name: OmniDoc-TokenBench
16
  ---
17
+
18
+ # OmniDoc-TokenBench
19
+
20
+ Technical report and dataset are coming soon.
21
+
22
+ ---
23
+
24
+ ## Introduction
25
+
26
+ **OmniDoc-TokenBench** is a curated benchmark of ~3K text-rich document images for evaluating VAE reconstruction on textual content, alongside an evaluation toolkit supporting PSNR, SSIM, LPIPS, FID, and OCR-based NED metrics. It spans nine categories (*book*, *slides*, *color textbook*, *exam paper*, *academic paper*, *magazine*, *financial report*, *newspaper*, *note*) in both English and Chinese.
27
+
28
+ <p align="center">
29
+ <img src="assets/bench.png" alt="OmniDoc-TokenBench" style="max-width: 1328px; width: 100%; height: auto;" />
30
+ <p>
31
+
32
+ Derived from OmniDocBench, each sample is cropped from a text block and resized to 256x256 with reference character sizes of 16px (Chinese) and 10px (English). We filter for sufficient character density ([200, 600] for Chinese, [300, 600] for English), deduplicate via n-gram overlap, and manually inspect for quality.
33
+
34
+ **Evaluation.** Beyond standard traditional metrics (PSNR, SSIM, LPIPS, FID), we use **NED** (Normalized Edit Distance) as the primary text-fidelity metric. NED compares the OCR outputs of the original and reconstructed images using Levenshtein distance:
35
+
36
+ $$
37
+ \mathrm{NED} = \frac{1}{N}\sum_{i=1}^{N}\left(1 - \frac{d_{\mathrm{edit}}(s_{\mathrm{gt}}^{(i)}, s_{\mathrm{recon}}^{(i)})}{\max(|s_{\mathrm{gt}}^{(i)}|, |s_{\mathrm{recon}}^{(i)}|)}\right)
38
+ $$
39
+
40
+ ---
41
+
42
+ ## Results
43
+
44
+ We conduct a comprehensive evaluation on OmniDoc-TokenBench (~3K text-rich images, 256×256). Models are grouped by spatial compression factor and sorted by NED within each group.
45
+
46
+ <p align="center">
47
+ <img src="assets/results.png" alt="Eval-Results" style="max-width: 1024px; width: 100%; height: auto;" />
48
+ <p>
49
+
50
+ ---
51
+
52
+ ## Evaluation
53
+
54
+ ### Installation
55
+
56
+ ```bash
57
+ pip install torch torchvision piq lpips pytorch-fid pillow numpy tqdm
58
+ pip install paddleocr python-Levenshtein # required for NED
59
+ ```
60
+
61
+ ### Usage
62
+
63
+ Place your ground-truth images in `gt_dir/` and reconstructed images in `recon_dir/` (filenames must match one-to-one).
64
+
65
+ ```bash
66
+ # Compute NED only (default)
67
+ python eval_metrics.py --gt_dir ./gt_dir --recon_dir ./recon_dir
68
+
69
+ # Compute traditional metrics (PSNR / SSIM / LPIPS / FID)
70
+ python eval_metrics.py --gt_dir ./gt_dir --recon_dir ./recon_dir --mode pixel
71
+
72
+ # Compute all metrics
73
+ python eval_metrics.py --gt_dir ./gt_dir --recon_dir ./recon_dir --mode all
74
+
75
+ # Specify output directory and device
76
+ python eval_metrics.py --gt_dir ./gt_dir --recon_dir ./recon_dir --save_path ./results --device cuda
77
+ ```
78
+
79
+ ### Output
80
+
81
+ The script writes results to the `--save_path` directory (default: `./eval_results`):
82
+
83
+ - `results.json` --- Aggregated metrics (example):
84
+ ```json
85
+ {
86
+ "num_samples": 100,
87
+ "PSNR": 30.45,
88
+ "SSIM": 0.9706,
89
+ "LPIPS": 0.0523,
90
+ "FID": 1.98,
91
+ "NED": 0.9617,
92
+ "NED_samples": 98
93
+ }
94
+ ```
95
+
96
+ - `ned_details.json` --- Per-image OCR results and NED scores (generated when `--mode` is `ned` or `all`):
97
+ ```json
98
+ {
99
+ "avg_ned": 0.9617,
100
+ "total_samples": 100,
101
+ "valid_samples": 98,
102
+ "details": [
103
+ {
104
+ "file": "0001.png",
105
+ "gt_ocr": "The quick brown fox...",
106
+ "recon_ocr": "The quick brown fox...",
107
+ "ned": 0.9764
108
+ }
109
+ ]
110
+ }
111
+ ```
112
+
113
+ ### Notes
114
+
115
+ - `FID` and `LPIPS` require downloading model checkpoints on the first run (InceptionV3 ~90MB for FID, VGG16 ~530MB for LPIPS). Ensure network access or pre-download the weight files.
116
+ - PaddleOCR defaults to CPU inference. For large-scale evaluation, consider switching to GPU by setting `device="gpu"` in `compute_ned()`.
117
+ - The progress bar for PSNR/SSIM/LPIPS displays running means in real time.
118
+
119
+ ---
120
+
121
+ ## Citation
122
+
123
+ If you use OmniDoc-TokenBench or this evaluation toolkit in your research, please cite:
124
+
125
+ ```bibtex
126
+ % TODO
127
+ ```
128
+
129
+ ---
130
+
131
+ ## License
132
+
133
+ - OmniDoc-TokenBench is a derivative dataset based on [OmniDocBench](https://github.com/opendatalab/OmniDocBench), developed by the Qwen Team at Alibaba Group.
134
+
135
+ - This project is licensed under the [Apache License 2.0](LICENSE).
assets/bench.png ADDED

Git LFS Details

  • SHA256: 2903a1839f6c62a754a128f92fb4d6df86c4ac2c113708d200842e18561a3b54
  • Pointer size: 132 Bytes
  • Size of remote file: 6.6 MB
assets/results.png ADDED

Git LFS Details

  • SHA256: dadbe715c4c553307f933b678e4a74f7b4a1547696bead71904225359efdeb32
  • Pointer size: 132 Bytes
  • Size of remote file: 1.82 MB
data/0001.png ADDED

Git LFS Details

  • SHA256: 81ac7540bcd9b6654fe52c0bc86da5c2347145761ad1d0b6d1a3e2fbba3bb3ac
  • Pointer size: 130 Bytes
  • Size of remote file: 61.9 kB
data/0002.png ADDED

Git LFS Details

  • SHA256: 1c1d229e015910e9b8fe5a514adfd61b7fea31f266ee4f978c8f9c2223c745b5
  • Pointer size: 130 Bytes
  • Size of remote file: 79.8 kB
data/0003.png ADDED

Git LFS Details

  • SHA256: a21795c6ea9b5b7ba767132f81160328149fec2945f2d9b48f7dd8957b290d67
  • Pointer size: 131 Bytes
  • Size of remote file: 128 kB
data/0004.png ADDED

Git LFS Details

  • SHA256: 00116505ed349b32a81cda76478073a7fa5a9ad2ea2c7c91665d5c912c77cac3
  • Pointer size: 131 Bytes
  • Size of remote file: 113 kB
data/0005.png ADDED

Git LFS Details

  • SHA256: 6479c9e4970799860712f8bb1f86772c892eccee3b64f9c80a91e65b73d72b04
  • Pointer size: 131 Bytes
  • Size of remote file: 133 kB
data/0006.png ADDED

Git LFS Details

  • SHA256: 221a07fa261c28b57ddb455a05a8420665a1b2b41827a4ab331bafa47892d55f
  • Pointer size: 131 Bytes
  • Size of remote file: 106 kB
data/0007.png ADDED

Git LFS Details

  • SHA256: 23cd921a851e44c3285edb22791b931fe23370e006caac3ccd8e81630011086e
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB
data/0008.png ADDED

Git LFS Details

  • SHA256: 54010c6666b72108a20af80d1b665597fad62977aa75ad7d9eeeda61cd3ad363
  • Pointer size: 130 Bytes
  • Size of remote file: 85.1 kB
data/0009.png ADDED

Git LFS Details

  • SHA256: 0b713af0df6d418d742d553f8c0bff2e797a129620a1aa8c5a5fe21b0f38b6b9
  • Pointer size: 130 Bytes
  • Size of remote file: 97.4 kB
data/0010.png ADDED

Git LFS Details

  • SHA256: ff3f57261ba1a86aff392a15738a4aac6a7919b6a514ede3d056aca0acb9c2dd
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB
data/0011.png ADDED

Git LFS Details

  • SHA256: 91e404daa5be3ef7db23e5d741463aff8ad129aa918a4474f1195a5a882b8999
  • Pointer size: 130 Bytes
  • Size of remote file: 54.4 kB
data/0012.png ADDED

Git LFS Details

  • SHA256: c5ece790d96c4b4e5b807fff64c78217395bf76e9ed73e6c6058f9fe24e1f686
  • Pointer size: 131 Bytes
  • Size of remote file: 106 kB
data/0013.png ADDED

Git LFS Details

  • SHA256: 8408a1ea2739c7731aab5e0b35e8a64229ca1776619f724b0cbc45fe17e5616b
  • Pointer size: 131 Bytes
  • Size of remote file: 113 kB
data/0014.png ADDED

Git LFS Details

  • SHA256: a51e487bea6c6070b09636e0fc1b2e83e9cf558b620249bec7e1b33c356eb2f5
  • Pointer size: 130 Bytes
  • Size of remote file: 98.6 kB
data/0015.png ADDED

Git LFS Details

  • SHA256: 4a00cb6c05958259f8184e3baa3cf67c287e244422453f9cb1aff5eca5ab4745
  • Pointer size: 131 Bytes
  • Size of remote file: 104 kB
data/0016.png ADDED

Git LFS Details

  • SHA256: 80aaa674cafbcc8b9121a1cb80e0b822b838c9117e58c4e09ae7484db1142875
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
data/0017.png ADDED

Git LFS Details

  • SHA256: 2aba3197b3bee748375905a80dad717d2da4c87d36c1757fbb2d92355474623e
  • Pointer size: 130 Bytes
  • Size of remote file: 95.8 kB
data/0018.png ADDED

Git LFS Details

  • SHA256: 611138657d0ec1f6da98db0c5c2cd585ad6b13d0ea8b2f10c80bfaed95d7c915
  • Pointer size: 130 Bytes
  • Size of remote file: 79.9 kB
data/0019.png ADDED

Git LFS Details

  • SHA256: 8eb338822f8f390ffb7d2054a7ab2e5a5faec511e07858ead6ad3c53a0ad49b7
  • Pointer size: 130 Bytes
  • Size of remote file: 67.7 kB
data/0020.png ADDED

Git LFS Details

  • SHA256: 5afdaed3eb4c52b02650e9b1ab7bee3c60e7c20fd4f74314037d858472801947
  • Pointer size: 130 Bytes
  • Size of remote file: 77.5 kB
data/0021.png ADDED

Git LFS Details

  • SHA256: 52a9213ecbdde364287cfaf5bde0e895c849d83ec9dc95dde0892e05c90e68d3
  • Pointer size: 130 Bytes
  • Size of remote file: 74.3 kB
data/0022.png ADDED

Git LFS Details

  • SHA256: 9c93e797ed7da2182bdd949897fbbf51aea73a0965423398dc35ad6022e3c6ab
  • Pointer size: 130 Bytes
  • Size of remote file: 76.5 kB
data/0023.png ADDED

Git LFS Details

  • SHA256: ade79d42dac4975cf729ba56bf3f857ba077c1a7c286b7236fd12a6f68ff6b06
  • Pointer size: 130 Bytes
  • Size of remote file: 81.8 kB
data/0024.png ADDED

Git LFS Details

  • SHA256: 8c4c6633bfbc837ab575f1deca658ea53c3fa685039eb98bdca0d006b62cfa03
  • Pointer size: 130 Bytes
  • Size of remote file: 60.9 kB
data/0025.png ADDED

Git LFS Details

  • SHA256: f149340cd70f5eebf4fccb2e3c5ddfe74650fd6394f7033ea7316411cedd3c27
  • Pointer size: 130 Bytes
  • Size of remote file: 66 kB
data/0026.png ADDED

Git LFS Details

  • SHA256: 80e99e553b5244971bdfcfb75e4c863db43cc3822c8528e837f02d2e72436c54
  • Pointer size: 130 Bytes
  • Size of remote file: 91.9 kB
data/0027.png ADDED

Git LFS Details

  • SHA256: 7e4babe6a424aba3ca2fb66c48c647aa158ccc077aaf3d51969d1293a92f25b6
  • Pointer size: 130 Bytes
  • Size of remote file: 75.4 kB
data/0028.png ADDED

Git LFS Details

  • SHA256: 96eec68ae2ae3d1761bee1cb4058134131c563e0a859e82ea3e17d27d1939d3c
  • Pointer size: 130 Bytes
  • Size of remote file: 64.1 kB
data/0029.png ADDED

Git LFS Details

  • SHA256: 7736d9cc046238dd0eb8d69f403a4ca1230361895c75207b3b538522c5f6f195
  • Pointer size: 130 Bytes
  • Size of remote file: 78.5 kB
data/0030.png ADDED

Git LFS Details

  • SHA256: 9aba11d23fef8b060492a02cc506c607288b461431e586349ad9c1653589e939
  • Pointer size: 130 Bytes
  • Size of remote file: 72.3 kB
data/0031.png ADDED

Git LFS Details

  • SHA256: dfa7769dbce7093aa8dc2dbfa215e0854579091a6d52cbaa6192cbfd6961adbb
  • Pointer size: 130 Bytes
  • Size of remote file: 87.2 kB
data/0032.png ADDED

Git LFS Details

  • SHA256: 28dffef32bc885869a2a74d94bfd461c1ca7d083812f0d273d5b6f539c508748
  • Pointer size: 130 Bytes
  • Size of remote file: 76 kB
data/0033.png ADDED

Git LFS Details

  • SHA256: e0bba1c81c81d52a9719eaf0d0c4f680d74b617b7f08d8b6597ef58e8162bf48
  • Pointer size: 130 Bytes
  • Size of remote file: 53 kB
data/0034.png ADDED

Git LFS Details

  • SHA256: f3497c889265656184d8498fdc3a188c4ac1e4d6a7017f1782955b7a7dbaccff
  • Pointer size: 130 Bytes
  • Size of remote file: 71.4 kB
data/0035.png ADDED

Git LFS Details

  • SHA256: d701098a54060d1a5bfe9bbb83851b34b32c950188a49009e4956f2376be4685
  • Pointer size: 130 Bytes
  • Size of remote file: 72.9 kB
data/0036.png ADDED

Git LFS Details

  • SHA256: 09fdb6587552717484714ba38efe9605f1f4ec7d7f36423416ed012cedc9a38b
  • Pointer size: 130 Bytes
  • Size of remote file: 71.5 kB
data/0037.png ADDED

Git LFS Details

  • SHA256: 1dec500b4b7ca5086b1eb2e22ca51daf064fd5df5d6f2a0d38d0a6a9729037a7
  • Pointer size: 130 Bytes
  • Size of remote file: 78.4 kB
data/0038.png ADDED

Git LFS Details

  • SHA256: 19783358d3c8f143eeb5ad99e40c6e07b56900b151a5afe5c4476c57fc31cc03
  • Pointer size: 130 Bytes
  • Size of remote file: 86.5 kB
data/0039.png ADDED

Git LFS Details

  • SHA256: a5777d6300d1fc23fd3007d52544b53ffc43139dd3584e9805a209c066189bea
  • Pointer size: 130 Bytes
  • Size of remote file: 54.5 kB
data/0040.png ADDED

Git LFS Details

  • SHA256: 244da159df6bbedfda8a7c2d7f67b204a9725f35c9695270ae029916801778ce
  • Pointer size: 130 Bytes
  • Size of remote file: 88.8 kB
data/0041.png ADDED

Git LFS Details

  • SHA256: 2306910a9cd74f1893975291f1251614768ca5083f98d0df6b1404ea5b2dc6bb
  • Pointer size: 130 Bytes
  • Size of remote file: 53.1 kB
data/0042.png ADDED

Git LFS Details

  • SHA256: 9398a9a73af12bd27211ecafa9af54d9341c50eedf352e6ebc0f84c196adcade
  • Pointer size: 130 Bytes
  • Size of remote file: 86.6 kB
data/0043.png ADDED

Git LFS Details

  • SHA256: 5c159cd2a7b8b5a44861dd511ed6fbc004f2520b5836b32b96e6b2c28771f97d
  • Pointer size: 130 Bytes
  • Size of remote file: 87 kB
data/0044.png ADDED

Git LFS Details

  • SHA256: 64c146164235ab5e7e4857a34eed8801d07e50506fcdd54204922cb05cc67c64
  • Pointer size: 130 Bytes
  • Size of remote file: 66.6 kB
data/0045.png ADDED

Git LFS Details

  • SHA256: fbd546009d425c627aca6bf6c0ba33d4e426e7d6ece9cdf8ccff526a5b2b25f1
  • Pointer size: 130 Bytes
  • Size of remote file: 81.6 kB
data/0046.png ADDED

Git LFS Details

  • SHA256: 8b0e6ee615e9865e75ae3e3e8cd2b10ef8ecdda5068f038339f6e9c833d15898
  • Pointer size: 130 Bytes
  • Size of remote file: 93.7 kB
data/0047.png ADDED

Git LFS Details

  • SHA256: aaec3cf8a06d36bf9717d71be7ae6b18b9c4cffd01ee4681b00053b00dc57073
  • Pointer size: 130 Bytes
  • Size of remote file: 88.6 kB