Caption linked to the wrong picture when a figure's caption sits in a side column (right on 2.111.0, wrong on 2.152.0)
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 40/100
Research direction
The payload names no source file, so start from the reproduction script: convert the same single-page PDF with docling 2.111.0 and 2.152.0 and compare PictureItem.captions for each picture. Find where caption-to-picture association changed between those releases, since the boxes match and only the link differs. Done means picture B links to the caption directly below it, and the two side-column captions no longer cross-link. The reporter has offered to share the page privately.
Written by the indexing model from the issue text.
Description
Bug
On a textbook page with two figures, PictureItem.captions points to the caption of the other figure on 2.152.0. The same page is correct on 2.111.0. Picture boxes are identical in both versions (IoU > 0.99); only the caption link changes.
Page layout (PDF points, bottom-left origin, page 1 of a 6-page excerpt):
- Picture A: l=73, t=709, r=354, b=564 (top of page, wide). Its caption "Figure 15-7 …" is printed to its right, in the margin column (l=381).
- Picture B: l=382, t=359, r=512, b=220 (lower, in the margin column). Its caption "Figure 15-8 …" is printed directly below it (l=381).
| Picture A | Picture B | |
|---|---|---|
| 2.111.0 | no caption | "Figure 15-8 …" (correct) |
| 2.152.0 | no caption | "Figure 15-7 …" (wrong: that is A's caption) |
Both caption texts are detected with label caption in both versions. So on 2.152.0 picture B takes the first caption of its column instead of the one below it, and "Figure 15-8" is left unlinked.
Two related cases from the same run (20 excerpts, 129 pictures matched by IoU between versions):
- a caption directly below its picture keeps label
captionbut is no longer inpicture.captions(linked on 2.111.0); - a caption that was
captionon 2.111.0 becomes plaintexton 2.152.0, so the picture has none.
Steps to reproduce
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
opts = PdfPipelineOptions()
opts.do_ocr = False
conv = DocumentConverter(format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=opts)})
doc = conv.convert("page.pdf").document
for pic in doc.pictures:
print(pic.prov[0].bbox, [c.resolve(doc).text[:40] for c in pic.captions])
Run under both versions and compare. The page is from a copyrighted textbook, so I cannot attach it here; I can share it privately with a maintainer, and I am happy to test a patch.
Docling version
Wrong: docling 2.152.0, docling-core 2.108.0, docling-ibm-models 4.0.4, docling-parse 7.27.1.
Right: docling 2.111.0, docling-core 2.92.0, docling-ibm-models 3.13.3, docling-parse 7.16.0.
Python version
Python 3.12, Linux x86_64, CPU only.
- Dominant language
- Python
- Stars
- 71k
- Forks
- 5.4k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 161
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docling-project/docling
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
docling-project/docling#5592 ·
Maintainers usually reply within 2 days
-
`api_image_request` logs and propagates the raw error response body, leaking the request's API key on 401Possibly taken @prassu017 claimed this 7 days ago. Openbug priority:critical
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
docling-project/docling#5486 · 1 comment · 1 reaction ·
Maintainers usually reply within 2 days
-
AFP: export_to_doctags() raises ZeroDivisionError because every page has size 0x0Possibly taken @Krushil-Dhankecha claimed this 12 days ago. Openbug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
docling-project/docling#5355 · 1 comment ·
Maintainers usually reply within 2 days
-
AsciiDoc: thematic breaks and page breaks are kept as text or turned into list itemsPossibly taken @sohailshk claimed this 12 days ago. Openasciidoc bug priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
docling-project/docling#5331 · 1 comment ·
Maintainers usually reply within 2 days
-
Merged paragraph across pages of different heights: continuation bbox uses the first page's heightPossibly taken @galer1us claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
docling-project/docling#5286 ·
Maintainers usually reply within 2 days
All issues in docling-project/docling
Similar issues
-
Task select patterns with uppercase letters never matchPossibly taken @manobhisriram claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
app: scripts status: backlog type: housekeeping
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
netbox-community/netbox-scripts#239 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
developmentseed/titiler-cmr#341 ·
Maintainers usually reply within 1 day
-
Card tables add "..." to every value in a DataFrame column when any value is longer than 30 charactersPossibly taken @omkarbandikatte claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day