Commit 36220d69 authored by myhloli's avatar myhloli

refactor(draw_bbox): clear cuda cache and update bbox sorting

- Added CUDA cache clearing after layoutreader prediction to free up GPU memory.
- Modified the bbox sorting logic to sort text and title blocks separately.
- Adjusted drawing colors for better distinction in debug visualizations.
parent 00cda7a6
...@@ -341,10 +341,13 @@ def draw_layout_sort_bbox(pdf_info, pdf_bytes, out_path, filename): ...@@ -341,10 +341,13 @@ def draw_layout_sort_bbox(pdf_info, pdf_bytes, out_path, filename):
for page in pdf_info: for page in pdf_info:
page_line_list = [] page_line_list = []
for block in page['preproc_blocks']: for block in page['preproc_blocks']:
if block['type'] == 'text' or block['type'] == 'title': if block['type'] == 'text' or block['type'] == 'title' or block['type'] == 'interline_equation':
for line in block['lines']: for line in block['lines']:
bbox = line['bbox'] bbox = line['bbox']
page_line_list.append(bbox) page_line_list.append(bbox)
if block['type'] == 'table' or block['type'] == 'image':
bbox = block['bbox']
page_line_list.append(bbox)
# 使用layoutreader排序 # 使用layoutreader排序
page_size = page['page_size'] page_size = page['page_size']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment