A method for identifying huge stone tablet rubbings based on depth cutting

Through deep cutting and deduplication processing technology, the huge inscription and rubbing images are identified in blocks, solving the memory overflow problem of the OCR model when processing huge pictures, and achieving high-accuracy text extraction effect.

CN114821592BActive Publication Date: 2024-11-01宁波市天一阁博物院
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210465392.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-26
Publication Date
2024-11-01
Estimated Expiration
2042-04-26

AI Technical Summary

Technical Problem

When processing huge stele and strokes, the existing OCR recognition model has caused memory overflow abnormalities due to too many texts and too large pixels when processing huge stele and strokes, and cannot return the recognition results normally, and cannot effectively process such images of stele and strokes.

Method used

The depth cutting method is used to til the inscription and post rubbing pictures, and each slice is OCR-identified. Through recursive coordinate conversion and data merging, the final deduplication process is performed to obtain the complete recognition results.

Benefits of technology

In the simulation experiment, using inscription and strokes with pixel width greater than 7000px and height greater than 10000px can successfully obtain the OCR text extraction results, and the text acquisition accuracy is greater than 90%, which significantly improves the recognition effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114821592B_ABST
    Figure CN114821592B_ABST
Patent Text Reader

Abstract

The invention relates to a method for identifying huge inscriptions and calligraphy rubbings based on deep cutting, and the method comprises the following steps: process 1: an OCR recognition request is input, parameters such as an inscription and calligraphy rubbing image, a cutting depth, a single word width and the like are input, and the inscription and calligraphy rubbing image is cut; process 2: OCR text recognition and extraction are respectively performed on the cut image files processed by process 1; process 3: coordinate conversion and data merging are recursively performed on the OCR recognition results obtained by process 2 from the bottom layer upward; process 4: duplicate removal is performed on the processing results of process 3, and in a simulated experimental environment, 5 inscription and calligraphy rubbings images with a pixel width greater than 7000px, a height greater than 10000px and containing more than 3000 characters are used for OCR recognition. After the method of the invention is introduced, the 5 inscription and calligraphy rubbings images can obtain OCR text extraction results, and the text acquisition accuracy is greater than 90%, and the improvement effect is obvious.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for deep cutting of huge inscriptions and calligraphy rubbings and identifying the rubbing text, which is applied to the business needs of digital text extraction of inscriptions and calligraphy. Its features include: dynamically deep cutting inscriptions and calligraphy rubbings into blocks according to the depth level; performing OCR text recognition and extraction for the cut blocks respectively; recursively merging the OCR text extraction results upwards and completing the coordinate conversion at the same time; and de-duplicating and cleaning the merged OCR results. Background Art

[0002] In the application scenario of OCR recognition and text extraction, machine deep learning is usually used to train a recognition model for a specific OCR algorithm, and then use the model for OCR related services. However, due to the limitations of machine hardware performance and corpus size, the current solutions in the industry have a text limit for the detection and recognition corpus fed into the training model, which is mostly 25 words. In this way, if a large image with many words such as rubbings of stone tablets is input for recognition, it will exceed the OCR text recognition limit and cannot return the recognition result. Ordinary OCR recognition models cannot process such images of rubbings of stone tablets. Rubbings of stone tablets have too many words and too large pixels, which exceeds the recognition limit of ordinary OCR recognition models, causing memory overflow exceptions and unable to return recognition results normally. Summary of the invention

[0003] The invention provides a method for identifying huge stone tablet rubbing text based on depth cutting, which solves the technical problems in the prior art.

[0004] The present invention solves the above technical problems by providing a method for identifying characters printed on huge stone tablets and inscriptions based on deep cutting, the method comprising the following steps:

[0005] Process 1: OCR recognition request, inputting parameters such as the inscription image, cutting depth, single word width, etc., and cutting the inscription image;

[0006] Process 2: Perform OCR text recognition and extraction on the cut image files processed in process 1;

[0007] Process 3: Recursively transform the coordinates and merge the data of the OCR recognition results obtained in process 2 from the bottom layer upwards;

[0008] Process 4: De-duplicate the results of process 3. If there is text in the center of the recognized image, the edges of the four equally divided squares will overlap with the text in the cross square, so de-duplicate text is required.

[0009] Based on the above technical solution, the present invention can also be improved as follows.

[0010] Furthermore, the algorithm steps of the method for cutting the inscription rubbing image described in process 1 are as follows:

[0011] Step 1: Take the upper left corner as the initial origin coordinate point and obtain the original four vertex coordinates of the image. The order coordinates are (x1, y1), (x2, y2), (x1, y2), (x2, y2). At this time, the image width is width = x2-x1, and the image height is height = y2-y1;

[0012] Step 2: Cut the image into four equal pieces, obtain the coordinates of the midpoint (x3, y3), and get four slices, p1, p2, p3, p4. At this time, x3 = width / 2, y3 = height / 2;

[0013] Step 3: Divide the text width parameter by 2 to get the offset m = fontwidth / 2, then use the midpoint (x3, y3) to offset each of the top, bottom, left, and right by a displacement of m, and get four rectangular squares p5, p6, p7, and p8. The purpose of cutting this square is to prevent the text from being cut at the center of the image and causing missing words, so the four rectangular strips in the middle of the image are taken within a range of a text width. At this time, the newly added key coordinate points are (x4, y1), (x1, y4), (x2, y5), and (x5, y2), where x4 = x3–m, y4 = y3–m, x5 = x3+m, and y5 = y3+m.

[0014] Step 4: The above is the resource file after a single image is cut. After the cutting is completed, each square can be transferred to the OCR text extraction service to obtain the text in the corresponding square. The present invention is not limited to the OCR recognition framework and model, and any OCR text recognition and extraction model based on deep learning training can be used. If the square after cutting is still too large, adjust the cutting depth, cut the p1, p2, p3, and p4 squares again in this way, and adjust the cutting depth until the square is suitable for OCR text extraction.

[0015] Furthermore, the calculation formula for the number of cut image files in process 2 is:

[0016] picNum=∑ cutLevel 4(cutLevel-1),8 .

[0017] Furthermore, the OCR recognition method for performing OCR text recognition and extraction in process 2 is to perform recognition in units of 8 slices cut from each bottom-level cutting depth square, and obtain 8 independent recognition results respectively.

[0018] Furthermore, the eight independent recognition results are subjected to coordinate transformation relative to the original image.

[0019] Furthermore, the coordinate conversion rules are as follows:

[0020] All text coordinates in the p1 square remain unchanged;

[0021] The x-axis of all text coordinates in the p2 grid is offset by the x3 value, and the y-axis remains unchanged;

[0022] The x-axis coordinates of all the text in the p3 grid remain unchanged, and the y-axis is offset by the y3 value;

[0023] The x-axis of all text coordinates in the p4 grid is offset by x3, and the y-axis is offset by y3;

[0024] All text coordinates in the p5 grid are offset by the x4 value on the x-axis, and the y-axis remains unchanged;

[0025] The x-axis coordinates of all the text in the p6 grid remain unchanged, and the y-axis is offset by the y4 value;

[0026] All text coordinates in the p7 grid are offset by x5 on the x-axis and y4 on the y-axis.

[0027] The x-axis of all text coordinates in the p8 grid is offset by x4, and the y-axis is offset by y5.

[0028] Furthermore, after the eight independent coordinates are transformed, the results are merged, and the recognition result merging function is:

[0029] sublmageOcr=merge_fn(p1_rs, p2_rs, p3_rs, p4_rs, p5_rs, p6_rs, p7_rs, p8_rs).

[0030] Furthermore, when the OCR recognition results obtained in process 2 are recursively converted and data merged from the bottom layer upward as described in process 3, in the case of deep cutting, each slice is a cutting file of its bottom-level square, which may belong to the block interval of its parent. Therefore, the coordinate conversion can be completed by adding the coordinate offset of the upper left vertex in the block to each text coordinate of the result set in the block.

[0031] Furthermore, the method for deduplicating text described in process 4 is: traverse all recognition results, compare them two by two, take the absolute value of the difference between the x-axis and y-axis of the upper left corner vertex of the text, if the difference is less than the value of the text offset coefficient m, then the text result is determined to be repeated, remove the values ​​with larger coordinate numbers, compare and deduplicate in turn, and obtain the final OCR recognition result.

[0032] The beneficial effects of the present invention are as follows: the present invention provides a method for identifying characters in huge stone tablet rubbings based on deep cutting, which has the following advantages:

[0033] In a simulated experimental environment, 5 images of stone tablets and calligraphy rubbings with a pixel width greater than 7000px, a height greater than 10000px, and containing more than 3000 characters were used for OCR recognition. The OCR service was built with the PaddleOCR framework. When the method of the present invention was not used for recognition, there were no recognition results for the 5 images, and null value data was returned. At the same time, the commercial OCR service (Alibaba Cloud OCR recognition, Huawei OCR recognition, Shutongwen OCR recognition) was replaced for experimental testing, and still no results were returned. After introducing the method of the present invention, the 5 images of stone tablets and calligraphy rubbings can obtain OCR text extraction results, and the text acquisition accuracy is greater than 90%, and the improvement effect is obvious.

[0034] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. The specific implementation of the present invention is given in detail by the following embodiments and their accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0036] Figure 1 A diagram of image initialization information acquisition for a method for identifying huge stone tablet rubbings based on deep cutting provided by an embodiment of the present invention;

[0037] Figure 2 for Figure 1 A method for identifying huge stone tablet rubbings based on deep cutting is provided, which includes four-grid image cutting;

[0038] Figure 3 for Figure 1 A cutting cross-grid diagram based on a method for identifying huge stone tablet rubbings based on deep cutting is provided;

[0039] Figure 4 for Figure 1 A method for identifying huge stone tablet rubbings based on deep cutting is provided, when the cutting depth cutLevel=2, the deep cutting schematic diagram;

[0040] Figure 5 for Figure 1 A calculation formula for the number of slices based on a method of identifying characters in huge stone tablet rubbings is provided;

[0041] Figure 6 for Figure 1 An OCR recognition acquisition diagram based on a method of deep cutting to identify huge stone tablet rubbings;

[0042] Figure 7 for Figure 1 A recognition result merging function diagram of a method for recognizing huge stone tablet rubbings based on deep cutting is provided;

[0043] Figure 8 for Figure 1 An upward merged diagram of OCR recognition results of a method for recognizing huge stone tablet rubbings based on deep cutting;

[0044] Fig. 9 for Figure 1 A schematic diagram of coordinate transformation and merging functions of a method for identifying huge stone tablet rubbings based on deep cutting is provided;

[0045] Fig.10 for Figure 1 A schematic diagram of repeated data of a method for identifying text rubbings of huge stone tablets and inscriptions based on deep cutting is provided. DETAILED DESCRIPTION

[0046] The following is combined with Figure 1-10 The principles and features of the present invention are described, and the examples are only used to explain the present invention and are not used to limit the scope of the present invention. In the following paragraphs, the present invention is described in more detail by way of example with reference to the accompanying drawings. The advantages and features of the present invention will become clearer according to the following description and claims. It should be noted that the drawings are all in a very simplified form and are not in precise proportions, and are only used to facilitate and clearly assist in explaining the purpose of the embodiments of the present invention.

[0047] It should be noted that when a component is referred to as being "fixed to" another component, it may be directly on the other component or there may also be a component centered. When a component is considered to be "connected to" another component, it may be directly connected to the other component or there may also be a component centered. When a component is considered to be "set on" another component, it may be directly set on the other component or there may also be a component centered. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0049] like Figure 1-10As shown, the present invention provides a method for identifying huge stone tablet rubbings based on deep cutting, the method comprising the following steps:

[0050] Process 1: OCR recognition request, inputting parameters such as the inscription image, cutting depth, single word width, etc., and cutting the inscription image;

[0051] Process 2: Perform OCR text recognition and extraction on the cut image files processed in process 1;

[0052] Process 3: Recursively transform the coordinates and merge the data of the OCR recognition results obtained in process 2 from the bottom layer upwards;

[0053] Process 4: De-duplicate the results of process 3. If there is text in the center of the recognized image, the edges of the four equally divided squares will overlap with the text in the cross square, so de-duplicate text is required.

[0054] Preferably, the method for cutting the inscription rubbing image in process 1 has the following process algorithm steps:

[0055] Step 1: Take the upper left corner as the initial origin coordinate point and obtain the original four vertex coordinates of the image. The order coordinates are (x1, y1), (x2, y2), (x1, y2), (x2, y2). At this time, the image width is width = x2-x1, and the image height is height = y2-y1;

[0056] Step 2: Cut the image into four equal pieces, obtain the coordinates of the midpoint (x3, y3), and get four slices, p1, p2, p3, p4. At this time, x3 = width / 2, y3 = height / 2;

[0057] Step 3: Divide the text width parameter by 2 to get the offset m = fontwidth / 2, then use the midpoint (x3, y3) to offset each of the top, bottom, left, and right by a displacement of m, and get four rectangular squares p5, p6, p7, and p8. The purpose of cutting this square is to prevent the text from being cut at the center of the image and causing missing words, so the four rectangular strips in the middle of the image are taken within a range of a text width. At this time, the newly added key coordinate points are (x4, y1), (x1, y4), (x2, y5), and (x5, y2), where x4 = x3–m, y4 = y3–m, x5 = x3+m, and y5 = y3+m.

[0058] Step 4: The above is the resource file after a single image is cut. After the cutting is completed, each square can be transferred to the OCR text extraction service to obtain the text in the corresponding square. The present invention is not limited to the OCR recognition framework and model, and any OCR text recognition and extraction model based on deep learning training can be used. If the square after cutting is still too large, adjust the cutting depth, cut the p1, p2, p3, and p4 squares again in this way, and adjust the cutting depth until the square is suitable for OCR text extraction.

[0059] Preferably, the calculation formula for the number of cut image files in process 2 is:

[0060] picNum=∑ cutLevel 4(cutLevel-1)*8 .

[0061] Preferably, the OCR recognition method for performing OCR text recognition and extraction in process 2 is to perform recognition in units of 8 slices cut from each bottom-level cutting depth square, and obtain 8 independent recognition results respectively.

[0062] Preferably, the eight independent recognition results are then subjected to coordinate transformation relative to the original image.

[0063] Preferably, the coordinate transformation rules are as follows:

[0064] All text coordinates in the p1 square remain unchanged;

[0065] The x-axis of all text coordinates in the p2 grid is offset by the x3 value, and the y-axis remains unchanged;

[0066] The x-axis coordinates of all the text in the p3 grid remain unchanged, and the y-axis is offset by the y3 value;

[0067] The x-axis of all text coordinates in the p4 grid is offset by x3, and the y-axis is offset by y3;

[0068] All text coordinates in the p5 grid are offset by the x4 value on the x-axis, and the y-axis remains unchanged;

[0069] The x-axis coordinates of all the text in the p6 grid remain unchanged, and the y-axis is offset by the y4 value;

[0070] All text coordinates in the p7 grid are offset by x5 on the x-axis and y4 on the y-axis.

[0071] The x-axis of all text coordinates in the p8 grid is offset by x4, and the y-axis is offset by y5.

[0072] Preferably, after the 8 independent coordinates are transformed, the results are merged, and the recognition result merging function is:

[0073] sublmageOcr=merge_fn(p1_rs, p2_rs, p3_rs, p4_rs, p5_rs, p6_rs, p7_rs, p8_rs).

[0074] Preferably, when the OCR recognition results obtained in process 2 are recursively converted and data merged from the bottom layer upward in process 3, in the case of deep cutting, each slice is a cutting file of its bottom-level square, which may belong to the block interval of its parent. Therefore, the coordinate conversion can be completed by adding the coordinate offset of the upper left vertex in the block to each text coordinate of the result set in the block.

[0075] Preferably, the method for deduplicating text in process 4 is: traverse all recognition results, compare them two by two, take the absolute value of the difference between the x-axis and y-axis of the upper left corner vertex of the text, if the difference is less than the value of the text offset coefficient m, then the text result is determined to be repeated, remove the values ​​with larger coordinate numbers, compare and deduplicate in turn, and obtain the final OCR recognition result.

[0076] In a simulated experimental environment, 5 images of stone tablets and calligraphy rubbings with a pixel width greater than 7000px, a height greater than 10000px, and containing more than 3000 characters were used for OCR recognition. The OCR service was built with the PaddleOCR framework. When the method of the present invention was not used for recognition, there were no recognition results for the 5 images, and null value data was returned. At the same time, the commercial OCR service (Alibaba Cloud OCR recognition, Huawei OCR recognition, Shutongwen OCR recognition) was replaced for experimental testing, and still no results were returned. After introducing the method of the present invention, the 5 images of stone tablets and calligraphy rubbings can obtain OCR text extraction results, and the text acquisition accuracy is greater than 90%, and the improvement effect is obvious.

[0077] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any ordinary technician in the industry can smoothly implement the present invention as shown in the drawings and described above. However, any equivalent changes, modifications and evolutions made by technicians familiar with the profession without departing from the scope of the technical solution of the present invention using the technical content disclosed above are all equivalent embodiments of the present invention. At the same time, any equivalent changes, modifications and evolutions made to the above embodiments based on the essential technology of the present invention are still within the protection scope of the technical solution of the present invention.

Claims

1. A method for identifying huge stone tablet rubbings based on depth cutting, characterized in that: The method includes the following: Process 1: OCR recognition request, input the inscription image, cutting depth, single word width, and cut the inscription image; Process 2: Perform OCR text recognition and extraction on the cut image files processed in process 1; Process 3: Recursively transform the coordinates and merge the data of the OCR recognition results obtained in process 2 from the bottom layer upwards; Process 4: De-duplicate the results of process 3. If there is text in the center of the recognized image, the edges of the four equally divided squares will overlap with the text in the cross square, so de-duplicate text is required. The algorithm steps of the method for cutting the inscription rubbing image described in process 1 are as follows: Step 1: Take the upper left corner as the initial origin coordinate point, obtain the original four vertex coordinates of the image, and the order coordinates are (x1, y1), (x2, y2), (x1, y2), (x2, y2), and the image width is x2 – x1, and the image height is y2 – y1. Step 2: Cut the image into four equal pieces, obtain the coordinate point of the midpoint (x3, y3), and get four slices, p1, p2, p3, p4. At this time, x3 = width / 2, y3 = height / 2; Step 3: Divide the text width parameter by 2 to get the offset m = fontwidth / 2, then use the midpoint (x3, y3) to offset a displacement of m to the top, bottom, left, and right respectively to obtain four rectangular grids p5, p6, p7, and p8. The purpose of cutting this grid is to prevent the text from being cut at the midline of the image and causing missing words. Therefore, the four rectangular strips in the middle of the image are taken within the range of a text width. At this time, the newly added key coordinate points are (x4, y1), (x1, y4), (x2, y5), and (x5, y2), where x4 = x3 – m, y4 = y3 – m, x5 = x3 + m, and y5 = y3 + m; Step 4: The above is the resource file after a single image is cut. After the cutting is completed, each square can be passed to the OCR text extraction service to obtain the text in the corresponding square. There is no limit on the OCR recognition framework and model. Any OCR text recognition and extraction model based on deep learning training can be used. If the square is still too large after cutting, adjust the cutting depth and cut the p1, p2, p3, and p4 squares again in this way. The cutting depth can be adjusted until the square is suitable for OCR text extraction.

2. According to claim 1, a method for identifying huge stone tablet rubbings based on depth cutting is characterized in that: The calculation formula for the number of cut image files in process 2 is: 。 3. According to claim 1, a method for identifying huge stone tablet rubbings based on depth cutting is characterized in that: The OCR recognition method for OCR text recognition and extraction described in process 2 is to perform recognition in units of 8 slices cut from each bottom-level cutting depth square, and obtain 8 independent recognition results respectively.

4. According to claim 3, a method for identifying huge stone tablet rubbings based on depth cutting is characterized in that: The eight independent recognition results are then subjected to coordinate transformation relative to the original image.

5. According to claim 4, a method for identifying huge stone tablet rubbings based on depth cutting is characterized in that: The coordinate transformation rules are as follows: All text coordinates in the p1 square remain unchanged; The x-axis of all text coordinates in the p2 grid is offset by the x3 value, and the y-axis remains unchanged; The x-axis coordinates of all the text in the p3 grid remain unchanged, and the y-axis is offset by the y3 value; The x-axis of all text coordinates in the p4 grid is offset by x3, and the y-axis is offset by y3; All text coordinates in the p5 grid are offset by the x4 value on the x-axis, and the y-axis remains unchanged; The x-axis coordinates of all the text in the p6 grid remain unchanged, and the y-axis is offset by the y4 value; All text coordinates in the p7 grid are offset by x5 on the x-axis and y4 on the y-axis. The x-axis of all text coordinates in the p8 grid is offset by x4, and the y-axis is offset by y5.

6. The method for identifying huge stone tablet rubbings based on depth cutting according to claim 5 is characterized in that: After the eight independent coordinates are transformed, the results are merged. The recognition result merging function is: 。 7. The method for identifying huge stone tablet rubbings based on depth cutting according to claim 1 is characterized in that: As described in process 3, when the OCR recognition results obtained in process 2 are recursively converted and data merged from the bottom layer upward, in the case of deep cutting, each slice is a cutting file of its bottom-level square, which may belong to the block interval of its parent. Therefore, the coordinate conversion can be completed by adding the coordinate offset of the upper left vertex in the block to each character coordinate of the result set in the block.

8. The method for identifying huge stone tablet rubbings based on depth cutting according to claim 1, characterized in that: The method for deduplicating text described in process 4 is: traverse all recognition results, compare them two by two, take the absolute value of the difference between the x-axis and y-axis of the upper left corner vertex of the text, if the difference is less than the value of the text offset coefficient m, then the text result is determined to be repeated, remove the values ​​with larger coordinate numbers, compare and deduplicate in turn, and obtain the final OCR recognition result.