mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-11 22:28:31 +00:00
fix: Ensure proper image_scale for generated page images in VLM pipelines (#2728)
* fix: Ensure proper image_scale is used for generated page images in layout+vlm pipeline Signed-off-by: Christoph Auer <cau@zurich.ibm.com> * fix: Ensure proper image_scale output in default VLM pipeline Signed-off-by: Christoph Auer <cau@zurich.ibm.com> --------- Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
@@ -232,9 +232,12 @@ class ThreadedLayoutVlmPipeline(BasePipeline):
|
||||
# Initialize pages
|
||||
start_page, end_page = conv_res.input.limits.page_range
|
||||
pages: List[Page] = []
|
||||
images_scale = self.pipeline_options.images_scale
|
||||
for i in range(conv_res.input.page_count):
|
||||
if start_page - 1 <= i <= end_page - 1:
|
||||
page = Page(page_no=i)
|
||||
if images_scale is not None:
|
||||
page._default_image_scale = images_scale
|
||||
page._backend = backend.load_page(i)
|
||||
if page._backend and page._backend.is_valid():
|
||||
page.size = page._backend.get_size()
|
||||
|
||||
@@ -114,6 +114,9 @@ class VlmPipeline(PaginatedPipeline):
|
||||
|
||||
def initialize_page(self, conv_res: ConversionResult, page: Page) -> Page:
|
||||
with TimeRecorder(conv_res, "page_init"):
|
||||
images_scale = self.pipeline_options.images_scale
|
||||
if images_scale is not None:
|
||||
page._default_image_scale = images_scale
|
||||
page._backend = conv_res.input._backend.load_page(page.page_no) # type: ignore
|
||||
if page._backend is not None and page._backend.is_valid():
|
||||
page.size = page._backend.get_size()
|
||||
|
||||
Reference in New Issue
Block a user