HYPERUU commited on
Commit
3f2e9c9
·
verified ·
1 Parent(s): 27a5997

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md CHANGED
@@ -280,6 +280,37 @@ generate("Multi page parsing.", ["page1.png", "page2.png"], image_mode="base", n
280
  generate("Multi page parsing.", pdf_to_images("your_doc.pdf", dpi=300), image_mode="base", ngram_window=1024)
281
  ```
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
 
284
  ## Visualization
285
 
 
280
  generate("Multi page parsing.", pdf_to_images("your_doc.pdf", dpi=300), image_mode="base", ngram_window=1024)
281
  ```
282
 
283
+ For OmniDocBench evaluation, you need to perform the following post-processing.
284
+ ```python
285
+ def remove_det(raw: str) -> str:
286
+ """
287
+ Strip <|det|>type [bbox]<|/det|> markers, group lines belonging to the
288
+ same block with \\n, and separate different blocks with \\n\\n.
289
+ """
290
+ blocks = []
291
+ cur = None
292
+ for line in raw.splitlines():
293
+ line = line.rstrip()
294
+ if not line:
295
+ continue
296
+ m = DET_RE.match(line)
297
+ if m:
298
+ category, content = m.group(1).strip(), m.group(2).strip()
299
+ if category == 'image':
300
+ continue
301
+ if cur is not None:
302
+ blocks.append(cur)
303
+ cur = [content] if content else []
304
+ continue
305
+ if cur is None:
306
+ cur = []
307
+ cur.append(line)
308
+ if cur is not None:
309
+ blocks.append(cur)
310
+ text = '\n\n'.join('\n'.join(b) for b in blocks).strip()
311
+ return text
312
+ ```
313
+
314
 
315
  ## Visualization
316