docling-project / docling-project/docling

Setting settings.debug.visualize_cells=True/False causes different table output

Open
#1,289 2 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
I have pre-ocr pdf with following layout.
```
Logo Page Header
Key-value Items Figure

Section Header1
Table1

Section Header2
Table2
```

1. settings.debug.visualize_cells=False, only Table2 is detected.
2. settings.debug.visualize_cells=True, Table1 and Table2 are detected and merged to one table.
Both outcomes are wrong .

Second case can be solved by modifying file docling/models/page_preprocessing_model.py
before:
```
if settings.debug.visualize_cells:
draw_text_boxes(page.get_image(scale=1.0), page.cells)
```

after:
```
if settings.debug.visualize_cells:
draw_text_boxes(page.get_image(scale=1.0).copy(), page.cells)
```

...

### Steps to reproduce
Play with settings.debug.visualize_cells
...

### Docling version
Docling version: 2.28.4
Docling Core version: 2.25.0
Docling IBM Models version: 3.4.1
Docling Parse version: 4.0.0
Python: cpython-310 (3.10.15)
Platform: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35
...

### Python version
Python 3.10.15
...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.