chore: Add debugging logs in LayoutModel

Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
This commit is contained in:
Nikos Livathinos
2025-08-28 13:45:33 +02:00
parent 78f81e2c59
commit d8ca358ae8

View File

@@ -205,12 +205,30 @@ class LayoutModel(BasePageModel):
conv_res, page, clusters, mode_prefix="raw"
)
#################################################################################
# Debug: Print the un-processed clusters
#
for i, cl in enumerate(clusters):
print(
f"{i}: Cluster: {cl.id} | {cl.label} | {cl.bbox} | {cl.confidence}"
)
#################################################################################
# Apply postprocessing
processed_clusters, processed_cells = LayoutPostprocessor(
page, clusters, self.options
).postprocess()
# Note: LayoutPostprocessor updates page.cells and page.parsed_page internally
#################################################################################
# Debug: Print the processed clusters
#
for i, cl in enumerate(processed_clusters):
print(
f"{i}: Processed Cluster: {cl.id} | {cl.label} | {cl.bbox} | {cl.confidence}"
)
#################################################################################
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",