Skip to content

TableFormer V1 & V2 mishandling merged rows and columns, irrespective if cell_matching True or False #3698

Description

@peterjohnlawrence

Bug

The ScheduleTable.pdf test case attached contains a table with both column and row mergeing. We found no combination of TableTransformer V1 or V2, with or without cell matching that would correctly capture the table structure.

Image

The results are summarized here, with the details in the comments

Image

ScheduleTable.docx

ScheduleTable.pdf

The source PDF document contains the same table as a table strucure and as an image of the table.
The PDF was exported from the attached DOCX
...

Steps to reproduce

Using the ScheduleTable.pdf as the source document
with the following options:

        #pipeline_options.table_structure_options = TableStructureV2Options() 
        pipeline_options.table_structure_options.mode = TableFormerMode.ACCURATE        
        pipeline_options.table_structure_options.do_cell_matching = True 
        pipeline_options.images_scale = 2.0
        pipeline_options.generate_picture_images = False   
        pipeline_options.generate_page_images = True 

        converter = DocumentConverter(    format_options={
                InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
            })
        conversion= converter.convert(source)
        doc: DoclingDocument = conversion.document     

Four permutations were tested:

V1 vs V2 and cell_matching True vs. False

The 'output' for each of the test runs show the tables as jpeg, html, and otsl and these are available for each of the 4 permutations if that would help (see comment below)

We understand that the table has a challenging structure!!!
...

Docling version

docling ==2.107.0
...

Python version

Python 3.12.6
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions