docling-project / docling-project/docling

Incomplete picture extraction on scanned PDFs with OCR disabled

Open
#3,367 1 comment 0 reactions 0 assignees View on GitHub
bug pdf triage/close-stale
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

Summary
When processing scanned PDFs with OCR disabled, many pictures are missing or only partially extracted.
I traced the behavior to the special cluster confidence filtering in LayoutPostprocessor._process_special_clusters.

Environment
- OS: Linux
- Docling version: 2.90.0
- Python version: 3.11
- Pipeline options:
- do_ocr = False
- generate_picture_images = True
- do_picture_description = True (also reproduced without relying on this)

Problem
For scanned PDFs, picture extraction is incomplete:
- In the original behavior, almost all pictures are reduced to small cropped parts.
- After bypassing confidence filtering for special clusters, extraction is significantly better (from “almost all broken” to “only one picture still partially cropped”).

What I tested
I first tried a monkey patch (install_docling_fullpage_picture_patch) intended to keep near-full-page pictures on scan-heavy pages, but it had no effect in my case.

Then I commented out the confidence threshold filtering inside _process_special_clusters:

special_clusters = [
c
for c in self.special_clusters
if c.confidence >= self.CONFIDENCE_THRESHOLDS[c.label]
]

and replaced it with effectively:

special_clusters = self.special_clusters

This change clearly improved results.

Expected behavior
Scanned PDFs with OCR disabled should preserve picture regions robustly, without dropping most picture clusters due to confidence thresholds.

Actual behavior
Picture clusters appear to be filtered out too aggressively, causing missing images or heavily cropped outputs.

Hypothesis
For scanned pages (especially with low text signal and OCR disabled), picture cluster confidence may often be below current thresholds, so valid picture clusters are removed too early.
There may also be a secondary issue in overlap removal causing the remaining partially cropped image.

Reproduction
1. Use a scanned PDF (image-based pages).
2. Run DocumentConverter with:
- do_ocr = False
- generate_picture_images = True
3. Observe missing or cropped picture outputs.
4. Bypass confidence filtering in _process_special_clusters and compare results.

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.