A method and device for synthesizing table recognition data based on web page rendering

Through a web page rendering-based method, table structure templates are randomly selected and the GPT4 model is used to generate table content, which solves the problem of complex labeling of table recognition data in the existing technology, realizes the automatic generation of complex and diverse table recognition data, and improves data generation efficiency and flexibility.

CN119360392BActive Publication Date: 2025-09-26ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411323395.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2025-09-26
Estimated Expiration
2044-09-23

AI Technical Summary

Technical Problem

Existing table recognition tasks rely on complex and tedious training data annotation, which leads to heavy pressure on data collection and makes it difficult to efficiently generate massive, complex and diverse table recognition data.

Method used

By randomly selecting a table structure template, generating table size and style parameters, using the GPT4 model to generate semantically correct table filling text, and automatically generating HTML files and JavaScript scripts, combined with web page rendering and screenshots, automatically generating table recognition data.

Benefits of technology

It realizes the automatic generation of massive, complex and diverse table recognition data, saves annotation time, can customize table structure template types, and improves the flexibility and efficiency of data generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119360392B_ABST
    Figure CN119360392B_ABST
Patent Text Reader

Abstract

A method and device for synthesizing table recognition data based on web page rendering, comprising: randomly generating the size of a table; randomly generating the number, position, and span of merged cells; generating table style parameters, including border style, border color, background color, font size, font color, and alignment; using a GPT4 model to generate table fill text that matches the table structure and conforms to normal semantics; generating an HTML representation file and CSS style file for the table; generating a JavaScript script file to configure the screenshot parameter settings required after HTML front-end rendering and the function logic for obtaining the coordinate box position of each cell element in the table represented in the HTML language; rendering the generated HTML file in a web browser, and using the generated JavaScript script to take a screenshot of the web page to obtain a synthesized table image while retaining the coordinate box position information of each cell in the table; and finally, combining the HTML file and the retained cell coordinate box position information to generate complete table recognition annotation content. Finally, the system saves the annotation results as a JSON format file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical field:

[0001] The present invention relates to a table recognition data synthesis method and device based on web page rendering, belonging to the field of computer technology software. Background technology:

[0002] In the internet age, the rapid development of information technology has led to the constant transmission and storage of vast amounts of data in the form of images. These images often contain vast amounts of textual content, placing increasingly complex demands on their utilization. Tables, as efficient structures for carrying textual information, frequently appear in images containing informational presentations. Identifying the structure and cell content of these table images is crucial.

[0003] Currently, the mainstream methods for table recognition tasks are designed based on deep learning. These methods are more dependent on training data. However, the annotation of training data for table recognition is usually complex and tedious, which brings great pressure on researchers in table recognition tasks to collect training data. Summary of the invention:

[0004] To address these challenges, the present invention proposes a method and device for synthesizing table recognition data based on web page rendering. This method can automatically generate massive amounts of table recognition data, including its complex annotations, while also enabling customized table structure template types to generate complex and diverse table recognition data.

[0005] The first aspect of the present invention relates to a method for synthesizing table recognition data based on web page rendering, which comprises the following steps:

[0006] S101: randomly selecting a table structure template from a pre-defined table structure template library, and then the system randomly generates the size of the table, that is, the number of rows and columns of the table;

[0007] S102: Randomly generate the number of merged cells, the position of the merged cells, and the merge span of the merged cells;

[0008] S103: Generate table style parameters according to the set table template type, including border style (such as solid line, dashed line, line thickness), border color, background color, font size, font color, alignment, etc.;

[0009] S104: Based on the generated table structure, use the GPT4 model to generate table filling text that matches the table structure and conforms to normal semantics;

[0010] S105: Generate an HTML representation file and a CSS style file of the table according to the generated table structure, table style parameters, and table fill text;

[0011] S106: Automatically generate a JavaScript script file according to the set template, configure the screenshot parameter settings required after HTML front-end rendering and the function logic for obtaining the coordinate box position of each cell element of the table represented by the HTML language;

[0012] S107: Render the generated HTML file in a web browser and use the generated JavaScript script to take a screenshot of the webpage to obtain a composite table image while retaining the coordinate box position information of each cell in the table. Finally, combine the HTML file and the retained cell coordinate box position information to generate complete table recognition and annotation content. Finally, the system saves the annotation results as a JSON format file.

[0013] Specifically, in step S101, a table structure template is randomly selected from a pre-defined table structure template library. The table structure templates include five types of table structure templates: table without header, table with only row header, table with only column header, table with both row and column headers, and complex nested table.

[0014] Specifically, in step S103, the style parameters of the table are generated according to the set table template type, including border style (such as solid line, dashed line, line thickness), border color, background color, font size, font color, alignment, etc. The border style is set by the CSS property border-style; the border thickness is set by the CSS property border-width; the border color is set by the CSS property border-color; the background color is set by the CSS property background-color; the font size is set by the CSS property font-size; the font color is set by the CSS property color; and the alignment is set by the CSS properties text-align and vertical-align.

[0015] Specifically, in step S104, based on the generated table structure, the GPT4 model is used to generate table filling text that matches the table structure and conforms to normal semantics. Specifically, the API interface of the OpenAI chatbot program is called, and the set table structure template type and the generated table structure are organized into prompt statements of the input model to guide the GPT4 model to generate semantically consistent table filling content.

[0016] Specifically, in step S107, the Selenium WebDriver tool is used to simulate the user's operation in the browser. The system selects the appropriate WebDriver driver according to the set browser type and version, and configures the browser's startup parameters and options to achieve the correct loading and rendering of the HTML file. The system calls the generated JavaScript script to take a screenshot of the rendered HTML page as a synthesized table image; the script also outputs the pixel-level coordinate position of each cell element of the table represented by the HTML language as the cell detection annotation of the table recognition data. The HTML content string representing the table is then combined with the previously obtained cell coordinate box position information to form a complete table recognition data annotation content.

[0017] A second aspect of the present invention relates to a table recognition data synthesis device based on web page rendering, comprising a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a table recognition data synthesis method based on web page rendering of the present invention.

[0018] A second aspect of the present invention relates to a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements a table recognition data synthesis method based on web page rendering of the present invention.

[0019] The present invention achieves automatic table generation by randomly selecting a table structure template, generating table dimensions, and setting style parameters. Simultaneously, the GPT4 model is used to generate table filler text that conforms to semantic logic, and to generate HTML presentation files and CSS style files. The system also automatically generates JavaScript scripts for capturing webpage screenshots and obtaining table cell location information. Finally, the system renders the HTML file in a browser, generating a table image while retaining cell location information, and saving the annotation results in JSON format. This invention can automatically generate massive amounts of table recognition data and can also highly freely define table structure template types to generate complex and diverse table recognition data, promising promising applications.

[0020] In summary, the present invention has created a table recognition data synthesis system based on web page rendering, which has the following beneficial effects: (1) It can automatically generate a large amount of table recognition data, including its complex annotation content, saving a lot of labor time in annotating table recognition data. (2) It can customize the table structure template type to generate complex and diverse table recognition data. Description of the drawings:

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 It is an overall flow chart of the method of the present invention.

[0023] Figure 2 This is an example of the format of the annotation content of the table identification data synthesized by the present invention. Specific implementation methods:

[0024] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0025] Example 1

[0026] This embodiment relates to a method for synthesizing table recognition data based on web page rendering, which includes the following specific steps:

[0027] S101: randomly selecting a table structure template from a pre-defined table structure template library, and then the system randomly generates the size of the table, that is, the number of rows and columns of the table;

[0028] S102: Randomly generate the number of merged cells, the position of the merged cells, and the merge span of the merged cells;

[0029] S103: Generate table style parameters according to the set table template type, including border style (such as solid line, dashed line, line thickness), border color, background color, font size, font color, alignment, etc.;

[0030] S104: Based on the generated table structure, use the GPT4 model to generate table filling text that matches the table structure and conforms to normal semantics;

[0031] S105: Generate an HTML representation file and a CSS style file of the table according to the generated table structure, table style parameters, and table fill text;

[0032] S106: Automatically generate a JavaScript script file according to the set template, configure the screenshot parameter settings required after HTML front-end rendering and the function logic for obtaining the coordinate box position of each cell element of the table represented by the HTML language;

[0033] S107: Render the generated HTML file in a web browser and use the generated JavaScript script to take a screenshot of the webpage to obtain a composite table image while retaining the coordinate box position information of each cell in the table. Finally, combine the HTML file and the retained cell coordinate box position information to generate complete table recognition and annotation content. Finally, the system saves the annotation results as a JSON format file.

[0034] Specifically, in step S101, a table structure template is randomly selected from a pre-defined table structure template library. The table structure templates include five types of table structure templates: table without header, table with only row header, table with only column header, table with both row and column headers, and complex nested table.

[0035] Specifically, in step S103, the style parameters of the table are generated according to the set table template type, including border style (such as solid line, dashed line, line thickness), border color, background color, font size, font color, alignment, etc. The border style is set by the CSS property border-style; the border thickness is set by the CSS property border-width; the border color is set by the CSS property border-color; the background color is set by the CSS property background-color; the font size is set by the CSS property font-size; the font color is set by the CSS property color; and the alignment is set by the CSS properties text-align and vertical-align.

[0036] Specifically, in step S104, based on the generated table structure, the GPT4 model is used to generate table filling text that matches the table structure and conforms to normal semantics. Specifically, the API interface of the OpenAI chatbot program is called, and the set table structure template type and the generated table structure are organized into prompt statements of the input model to guide the GPT4 model to generate semantically consistent table filling content.

[0037] Specifically, in step S107, the Selenium WebDriver tool is used to simulate the user's operation in the browser. The system selects the appropriate WebDriver driver according to the set browser type and version, and configures the browser's startup parameters and options to achieve the correct loading and rendering of the HTML file. The system calls the generated JavaScript script to take a screenshot of the rendered HTML page as a synthesized table image; the script also outputs the pixel-level coordinate position of each cell element of the table represented by the HTML language as the cell detection annotation of the table recognition data. Then the HTML content string representing the table is combined with the cell coordinate box position information obtained previously to form a complete table recognition data annotation content.

[0038] Example 2

[0039] A second aspect of the present invention relates to a table recognition data synthesis device based on web page rendering, comprising a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the deep learning-based e-commerce table image recognition method of Example 1.

[0040] Example 3

[0041] A third aspect of the present invention relates to a computer-readable storage medium having a program stored thereon. When the program is executed by a processor, the deep learning-based e-commerce table image recognition method of embodiment 1 is implemented.

[0042] The foregoing is merely an embodiment of the present invention and is not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.

Claims

1. A table recognition data synthesis method based on web page rendering, characterized in that: The following steps are involved: S101: The system randomly selects a table structure template from a pre-defined table structure template library, and then randomly generates the size of the table, that is, the number of rows and columns of the table; S102: The system randomly generates the number of merged cells, the position of the merged cells, and the merge span of the merged cells; S103: The system generates table style parameters according to the set table template type, including border style, border color, background color, font size, font color, and alignment; S104: Based on the generated table structure, the system uses the GPT4 model to generate table filling text that matches the table structure and conforms to normal semantics; S105: The system generates an HTML representation file and a CSS style file for the table based on the generated table structure, table style parameters, and table fill text; S106: The system automatically generates a JavaScript script file based on the set template, configures the screenshot parameter settings required after HTML front-end rendering, and obtains the function logic of the coordinate box position of each cell element of the table represented by the HTML language; S107: The system renders the generated HTML file in a web browser and uses the generated JavaScript script to take a screenshot of the web page to obtain a synthesized table image, while retaining the coordinate box position information of each cell in the table; finally, the system combines the HTML file and the retained cell coordinate box position information to generate complete table recognition and annotation content; finally, the system saves the annotation results as a JSON format file.

2. The method for synthesizing table recognition data based on web page rendering according to claim 1, characterized in that: In step S101, a table structure template is randomly selected from a pre-defined table structure template library; the table structure template includes five types of table structure templates: a table without a header, a table containing only row headers, a table containing only column headers, a table containing both row headers and column headers, and a complex nested table.

3. The method for synthesizing table recognition data based on web page rendering according to claim 1, characterized in that: In step S103, the style parameters of the table are generated according to the set table template type, including border style, border color, background color, font size, font color, and alignment; the border style is set by the CSS property border-style; the border thickness is set by the CSS property border-width; the border color is set by the CSS property border-color; the background color is set by the CSS property background-color; the font size is set by the CSS property font-size; the font color is set by the CSS property color; and the alignment is set by the CSS properties text-align and vertical-align.

4. The method for synthesizing table recognition data based on web page rendering according to claim 1, characterized in that: In step S104, based on the generated table structure, the GPT4 model is used to generate table filling text that matches the table structure and conforms to normal semantics. The set table structure template type and the generated table structure are organized as prompt statements of the input model to guide the GPT4 model to generate semantically correct table filling content.

5. The method for synthesizing table recognition data based on web page rendering according to claim 1, characterized in that: In step S107, the Selenium WebDriver tool is used to simulate user operations in the browser. The system selects the appropriate WebDriver driver according to the set browser type and version, and configures the browser's startup parameters and options to correctly load and render the HTML file. The system calls the generated JavaScript script to take a screenshot of the rendered HTML page as a synthesized table image. The script also outputs the pixel-level coordinate position of each cell element of the table represented by the HTML language as the cell detection annotation of the table recognition data; then it combines the HTML content string representing the table with the cell coordinate box position information obtained previously to form a complete table recognition data annotation content.

6. A table recognition data synthesis device based on web page rendering, characterized in that: The method comprises a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a table recognition data synthesis method based on web page rendering according to any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that A program is stored thereon, and when the program is executed by a processor, a table recognition data synthesis method based on web page rendering according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Training data generation method and system

    CN112200158A

  • Webpage table generation method and device and computer readable storage medium

    CN114327434A