A method, apparatus, device and storage medium for reporting structured processing
By performing image and text recognition and grayscale image processing on physical examination reports, the high cost and low efficiency problems caused by the diversity of physical examination report templates from different medical institutions have been solved, and the compatibility and universality of structured storage have been improved.
Patent Information
- Application Number
- CN202211313554.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-25
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-10-25
AI Technical Summary
Existing technologies require deep learning of physical examination report templates from different medical institutions, resulting in high costs, low efficiency, poor compatibility, and limited universality.
The received messages are processed, and the text boxes and text content are identified based on the image and text recognition module. The partitioning results are determined using a preset partitioning key, and the structured data is determined by combining grayscale image processing.
It reduces the cost of report structuring, improves compatibility and universality, and facilitates the extraction and retrieval of subsequent reports.
Smart Images

Figure CN115620859B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for structuring reports. Background Technology
[0002] With the advancement of science and technology, the medical and insurance fields are gradually moving towards digitalization. The structured storage of medical examination reports is of great significance for institutions to understand users' medical examination results and interpret their health information.
[0003] Existing methods require deep learning of physical examination report templates from different medical institutions to obtain network models corresponding to different templates. Then, the physical examination reports are input into the corresponding network models, and the models are used to perform table lookup and content parsing on the reports.
[0004] Because medical institutions use a wide variety of templates, establishing different network models for physical examination reports for different medical institutions and using these models to structure physical examination reports is costly, inefficient, and lacks compatibility and versatility. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for report structuring, which reduces the cost of report structuring, achieves the effect of structuring storage for various types of reports, improves the compatibility and versatility of report processing, and facilitates the extraction and retrieval of subsequent reports.
[0006] In a first aspect, embodiments of the present invention provide a method for report structuring processing, the method comprising:
[0007] The received messages to be processed are processed to obtain the target report;
[0008] Based on the image and text recognition module, the target report is subjected to text box and text recognition to identify at least one text box and the text content corresponding to the text box.
[0009] Based on the preset partition key, determine the partition result corresponding to the text box, as well as the text content corresponding to the partition result, and take the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored.
[0010] Based on the image to be processed corresponding to the target partitioning result, determine the grayscale image corresponding to the image to be processed; wherein, the image to be processed includes text content corresponding to the target partitioning result;
[0011] Based on the grayscale image and the image to be processed, determine the second structured data to be stored.
[0012] Based on the first and second structured data to be stored, the target structured data corresponding to the message to be processed is determined.
[0013] Secondly, embodiments of the present invention also provide an apparatus for report structuring processing, applied in report structuring processing, the report structuring processing apparatus comprising:
[0014] The message processing module is used to process the received messages to be processed and obtain the target report;
[0015] The text content determination module is used to perform text box and text recognition on the target report based on the image and text recognition module, and determine at least one text box and the text content corresponding to the text box.
[0016] The first structured data to be stored determination module is used to determine the partition result corresponding to the text box and the text content corresponding to the partition result based on the preset partition key, and to use the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored.
[0017] The grayscale image determination module is used to determine the grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partitioning result; wherein, the image to be processed includes text content corresponding to the target partitioning result;
[0018] The second structured data to be stored determination module is used to determine the second structured data to be stored based on the grayscale image and the image to be processed.
[0019] The target structured data determination module is used to determine the target structured data corresponding to the message to be processed based on the first structured data to be stored and the second structured data to be stored.
[0020] Thirdly, the present invention also provides an electronic device comprising:
[0021] At least one processor; and
[0022] A memory that is communicatively connected to at least one processor; wherein,
[0023] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to perform the report structuring processing method according to any embodiment of the present invention.
[0024] Fourthly, the present invention also provides a computer-readable storage medium storing computer instructions for causing a processor to execute a method for report structuring processing according to any embodiment of the present invention.
[0025] The technical solution of this invention involves processing a received message to be processed to obtain a target report; using an image and text recognition module to recognize text boxes and characters in the target report, identifying at least one text box and its corresponding text content; determining the partitioning result corresponding to the text box and its corresponding text content based on a preset partitioning key, and using the partitioning results other than the target partitioning result and their corresponding text content as the first structured data to be stored; determining the grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partitioning result; determining the second structured data to be stored based on the grayscale image and the image to be processed; and determining the target structured data corresponding to the message to be processed based on the first and second structured data to be stored. This solves the problems of high cost, poor compatibility, and weak versatility in report structuring, further optimizing the report structuring method, improving the versatility and compatibility of report structuring, and reducing the cost of report structuring processing.
[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of a report structuring method provided in Embodiment 1 of the present invention;
[0029] Figure 2 This is a flowchart of a report structuring processing method provided in Embodiment 2 of the present invention;
[0030] Figure 3 This is a flowchart of a report structuring processing method provided in Embodiment 3 of the present invention;
[0031] Figure 4 This is a flowchart of a report structuring processing method provided in Embodiment 4 of the present invention;
[0032] Figure 5 This is a flowchart of a report structuring processing method provided in Embodiment 5 of the present invention;
[0033] Figure 6This is a schematic diagram of a report structuring processing device according to Embodiment Six of the present invention;
[0034] Figure 7 This is a schematic diagram of the structure of an electronic device that implements the report structuring processing method of this invention. Detailed Implementation
[0035] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0036] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0037] Example 1
[0038] Figure 1 This is a flowchart illustrating a method for structuring a report according to Embodiment 1 of the present invention. This embodiment is applicable to situations where tables and text content in a report are analyzed and processed to obtain a structured report. This method can be executed by a report structuring device, which can be implemented in hardware and / or software and can be configured in a computer.
[0039] like Figure 1 As shown, the method includes:
[0040] S110. Process the received pending messages to obtain the target report.
[0041] The pending message is the original report received by the system, which can be a paper report, a PDF report file, a report image, etc. The target report refers to the image-formatted report obtained after the system has processed the pending message.
[0042] For example, the received message to be processed is a user's physical examination report in PDF format. Operations such as format conversion, watermark removal, and deletion of headers and footers can be performed on the user's physical examination report to obtain the target report. The processing method for the user's physical examination report is not limited in this embodiment.
[0043] S120. Based on the image and text recognition module, perform text box and text recognition on the target report to determine at least one text box and the text content corresponding to the text box.
[0044] The image and text recognition module is capable of locating and extracting text boxes and text from images. It can be any type of image and text recognition software, and this embodiment does not limit its scope. A text box refers to a table frame in a report, which can contain various text information. Furthermore, since there may be one or more text boxes in a report, at least one text box and its corresponding text content can be identified.
[0045] For example, the target report is the user's physical examination report. Since the same operation is performed on each text box, we will take one of the text boxes as an example and name this text box 1. The target report contains the user's height information of 160cm in text box 1, so we can determine that the text content corresponding to text box 1 is 160cm.
[0046] S130. Based on the preset partition key, determine the partition result corresponding to the text box and the text content corresponding to the partition result, and take the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored.
[0047] In this context, the preset partition keys refer to pre-defined areas corresponding to certain text content, such as areas corresponding to text content related to abnormal situations, suggestions and guidance, and health check-up results. It should be noted that there can be multiple preset partition keys depending on the report; this embodiment does not impose any limitations. The text content extracted from the image-text recognition is matched with the preset partition keys; if the matching result is consistent, the area containing that text content is used as the partition key. The partitioning result is the area to which each text box should be assigned. Furthermore, since health check-up results contain different items, measurement results, units, and reference ranges, the target partitioning result refers to the area corresponding to the health check-up results. The first structured data to be stored refers to text boxes with only a first-level header and their corresponding text content.
[0048] For example, a physical examination report has three sections: Abnormalities, Suggestions and Guidance, and Health Examination Results. The result for Abnormalities is "No abnormalities found," and the result for Suggestions and Guidance is "Strengthen exercise and increase vitamin C intake." The user's physical examination report, after image and text recognition, yields text boxes 1, 2, 3, and 4, along with their corresponding text content: Abnormalities, No abnormalities found, Suggestions and Guidance, Strengthen exercise and increase vitamin C intake. The obtained text content is then matched with preset partition keys to determine the positions of text boxes 1 and 3 corresponding to Abnormalities and Suggestions and Guidance. The partition result for text box 2 between these two text boxes is Abnormalities, and the corresponding text content within text box 2 is determined to be "No abnormalities found." The partition results other than the Health Examination Results—namely, the Abnormalities and Suggestions and Guidance partition results and their corresponding text content: "No abnormalities found" and "Strengthen exercise and increase vitamin C intake"—are stored as the first structured data.
[0049] S140. Based on the image to be processed corresponding to the target partitioning result, determine the grayscale image corresponding to the image to be processed.
[0050] The image to be processed includes text content corresponding to the target partitioning result.
[0051] Here, the image to be processed refers to the entire region corresponding to the target partitioning result. A grayscale image is a single-channel grayscale image with the same size as the image to be processed, where the grayscale value of each pixel is 0 or 225, and the grayscale value of each pixel in the grayscale image is 0. For example, the health examination result area on the user's medical examination form is extracted, and a grayscale image with the same area size as the health examination result area and a grayscale value of 0 is created.
[0052] S150. Based on the grayscale image and the image to be processed, determine the second structured data to be stored.
[0053] The second type of structured data to be stored refers to text content data with two levels of headers.
[0054] Specifically, the grayscale image is processed by pixel settings, vertical projection, and related procedures. The text box positions and text boxes corresponding to each text content in the target partitioning result are analyzed and used as the second structured data to be stored.
[0055] For example, the grayscale image corresponding to the health examination results area on the user's physical examination form is analyzed and processed to obtain the position of each text box in the health examination level. The text box corresponding to each text content is combined with the text content and determined as the second structured data to be stored.
[0056] S160. Based on the first structured data to be stored and the second structured data to be stored, determine the target structured data corresponding to the message to be processed.
[0057] The target structured data refers to all text data in the final user report.
[0058] Specifically, the first and second structured data to be stored are concatenated to obtain the target structured data. For example, the text content corresponding to abnormal situations, suggestions and guidance, and health check-up results is summarized to obtain the structured data of the user's health check-up report.
[0059] The technical solution of this invention involves processing a received message to be processed to obtain a target report; using an image and text recognition module to perform text box and text recognition on the target report to determine at least one text box and the corresponding text content; determining the partition result corresponding to the text box and the corresponding text content based on a preset partition key, and using the partition results to be stored other than the target partition result and the corresponding text content as the first structured data to be stored; determining the grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partition result; determining the second structured data to be stored based on the grayscale image and the image to be processed; and determining the target structured data corresponding to the message to be processed based on the first and second structured data to be stored. This reduces the cost of report structuring, achieves the effect of structured storage for various types of reports, improves the compatibility and versatility of report processing, and provides convenience for subsequent report extraction and retrieval.
[0060] Example 2
[0061] Figure 2 This is a flowchart of a method for structuring a report according to Embodiment 2 of the present invention. Based on the foregoing embodiments, the method can further refine the partitioning results corresponding to the text boxes determined based on preset partitioning keys, as well as the text content corresponding to the partitioning results. The partitioning results to be stored and the corresponding text content other than the target partitioning results can be used as the first structured storage data. For specific implementation methods, please refer to the detailed description of the embodiments of the present invention. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0062] like Figure 2 As shown, the method includes:
[0063] S210. If the message to be processed is in image format, then the message to be processed is denoised and the orientation is corrected to obtain the target report.
[0064] Noise reduction refers to the process of reducing noise in digital images, which results in higher-quality message images. Noise reduction methods are not limited in this embodiment. Orientation correction refers to adjusting the orientation of the image through rotation, facilitating accurate subsequent text recognition.
[0065] S220. If the message to be processed is not in image format, convert the message to be processed into image format and re-execute the step of obtaining the target report.
[0066] Specifically, a format converter can be used to convert non-image format messages to image format, and then the operation in S210 can be performed.
[0067] S230. Based on the image and text recognition module, perform text box and text recognition on the target report to determine at least one text box and the text content corresponding to the text box.
[0068] S240. Based on the preset partition key, match the text content with the keywords to obtain the preset partition key to which the text content belongs, and use it as the partition result.
[0069] Among them, matching refers to comparing the keywords of the preset partition key with the text content.
[0070] For example, if the keywords of the preset partition key are abnormal situations, suggestions and guidance, and health check results, then the entire text content is compared with the fields of abnormal situations, suggestions and guidance, and health check results in the text content. The area where the text content contains the fields of abnormal situations, suggestions and guidance, and health check results is the preset partition key to which the text content belongs, and it is used as the partition result.
[0071] S250. Bind the text content and the corresponding partition result to be stored to obtain the first structured storage data.
[0072] Here, the partition result to be stored refers to the preset partition key to which the text content belongs. Specifically, the preset partition key to which the text content belongs is bound to the content corresponding to the preset partition key to obtain the first structured storage data. For example, taking the case of an anomaly in the preset partition key as an example, the corresponding text content is: "No anomaly found". Then, the case of an anomaly in the preset partition key is bound to "No anomaly found" to obtain the corresponding first structured storage data.
[0073] S260. Based on the image to be processed corresponding to the target partitioning result, determine the grayscale image corresponding to the image to be processed.
[0074] The image to be processed includes text content corresponding to the target partitioning result.
[0075] S270. Based on the grayscale image and the image to be processed, determine the second structured data to be stored.
[0076] S280. Based on the first structured data to be stored and the second structured data to be stored, determine the target structured data corresponding to the message to be processed.
[0077] The technical solution of this invention involves processing the received message to be processed with appropriate formatting, image noise reduction, and orientation correction to obtain a target report; using an image recognition module, text boxes and text are recognized in the target report to determine at least one text box and the corresponding text content; the text content is matched with keywords based on a preset partition key to obtain the preset partition key to which the text content belongs, and this is used as the partitioning result; the text content and the corresponding partitioning result to be stored are bound together to obtain first structured storage data; a grayscale image corresponding to the image to be processed is determined according to the image to be processed corresponding to the target partitioning result; a second structured data to be stored is determined based on the grayscale image and the image to be processed; based on the first and second structured data to be stored, the target structured data corresponding to the message to be processed is determined, and the partition key to which the text content belongs is matched using the preset partition key to obtain the partitioning result and the corresponding text content; the text content and the partitioning result are bound together to accurately partition the report, thereby improving the accuracy of report structuring.
[0078] Example 3
[0079] Figure 3 This is a flowchart of a report structure processing method provided in Embodiment 3 of the present invention. Based on the foregoing embodiments, the grayscale image corresponding to the image to be processed can be determined according to the target partitioning result, and further refined. For specific implementation methods, please refer to the detailed description of the embodiments of the present invention. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0080] like Figure 3 As shown, the method includes:
[0081] S310. Process the received pending messages to obtain the target report.
[0082] S320. Based on the image and text recognition module, perform text box and text recognition on the target report to determine at least one text box and the text content corresponding to the text box.
[0083] S330. Based on the preset partition key, determine the partition result corresponding to the text box, as well as the text content corresponding to the partition result, and use the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored.
[0084] S340. Based on the location information of the target partitioning result in the target report, determine the image to be processed corresponding to the target partitioning result.
[0085] Among them, the location information refers to the coordinate information of the target partition result in the image. For example, the coordinate information of the four vertices a, b, c, and d of the image are (0, 5), (0, 0), (6, 0), and (6, 5), respectively.
[0086] Specifically, the image of the target partition result region is identified as the image to be processed, and then the image to be processed is further structured and stored. Based on the above example, the pixel coordinates of the four vertices of the health check-up form can be obtained through image processing software. Connecting the four vertices yields the closed region, which is the image to be processed.
[0087] S350. Based on the size information of the image to be processed, create an original grayscale image corresponding to the preset grayscale value.
[0088] The size information refers to the area corresponding to the target partitioning result. The preset grayscale value refers to the pre-set grayscale value of the image. The original grayscale image refers to a newly created single-channel grayscale image of the same size as the image to be processed, with all pixels having a grayscale value of 0. In this embodiment, the preset grayscale value of the original grayscale image is 0. Specifically, an original grayscale image of the same size as the image to be processed is created, with all pixels having a grayscale value of 0.
[0089] S360. Determine the grayscale image based on the text content in the original grayscale image and the image to be processed.
[0090] Among them, a grayscale image refers to a grayscale image obtained by resetting the grayscale values of some pixels in an original grayscale image.
[0091] Optionally, based on the text box to which the text content in the image to be processed belongs, the pixel values of the corresponding positions in the original grayscale image are updated to obtain the grayscale image.
[0092] Pixel value is a value assigned by the computer when an image is digitized. It represents the average brightness information of a small square in the image. The range of pixel value is between 0 and 255. The closer the pixel value is to 0, the darker the image part is. The closer the pixel value is to 255, the brighter the image part is. In a single-channel grayscale image, the pixel value can be represented by a number, which is equal to the grayscale value.
[0093] Specifically, the pixel value of the pixel in the initial grayscale image corresponding to the text box containing the text content in the image to be processed is set to 255, thus obtaining the grayscale image corresponding to the image to be processed.
[0094] S370. Based on the grayscale image and the image to be processed, determine the second structured data to be stored.
[0095] S380. Based on the first structured data to be stored and the second structured data to be stored, determine the target structured data corresponding to the message to be processed.
[0096] The technical solution of this invention involves processing a received message to be processed to obtain a target report; using an image and text recognition module to perform text box and text recognition on the target report to determine at least one text box and the text content corresponding to the text box; determining the partition result corresponding to the text box and the text content corresponding to the partition result based on a preset partition key, and using the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored; determining the image to be processed corresponding to the target partition result based on the position information of the target partition result in the target report; creating an original grayscale image corresponding to a preset grayscale value based on the size information of the image to be processed; determining a grayscale image based on the original grayscale image and the text content in the image to be processed; determining the second structured data to be stored based on the grayscale image and the image to be processed; determining the target structured data corresponding to the message to be processed based on the first structured data to be stored and the second structured data to be stored; further analyzing and processing the target partition result to obtain the corresponding grayscale image, which facilitates subsequent structured processing of the text content in the target partition result.
[0097] Example 4
[0098] Figure 4 The flowchart below shows a method for structuring a report according to Embodiment 4 of the present invention. Based on the foregoing embodiments, the method for determining the second structured data to be stored based on the grayscale image and the image to be processed can be further refined. For the specific implementation method, please refer to the detailed description of the embodiments of the present invention. Technical terms that are the same as or corresponding to those in the above embodiments will not be repeated here.
[0099] like Figure 4 As shown, the method includes:
[0100] S410. Process the received pending messages to obtain the target report.
[0101] S420. Based on the image and text recognition module, perform text box and text recognition on the target report to determine at least one text box and the text content corresponding to the text box.
[0102] S430. Based on the preset partition key, determine the partition result corresponding to the text box, as well as the text content corresponding to the partition result, and use the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored.
[0103] S440. Based on the image to be processed corresponding to the target partitioning result, determine the grayscale image corresponding to the image to be processed.
[0104] The image to be processed includes text content corresponding to the target partitioning result.
[0105] S450. Determine the row boundaries based on the pixel values corresponding to each row of pixels in the grayscale image, and determine at least one sub-region based on the row boundaries.
[0106] Here, line boundaries refer to the top and bottom borders of the text box corresponding to each line of text content. Sub-regions refer to the regions corresponding to each piece of text content in the target partitioning result.
[0107] Specifically, the pixels of the grayscale image are projected along the vertical axis, that is, by horizontally projecting the pixels in the grayscale image, each row is divided, and a pixel value distribution map of each row is obtained. This pixel value distribution map can be used to count the pixel values and the number of pixels corresponding to different pixel values in each row. It should be noted that in this embodiment, pixels with a value of 255 are referred to as white pixels. Then, the number of white pixels is counted row by row. The maximum value of the number of white pixels is found, and rows with white pixel values close to 0 are found on both sides of each maximum value, which are determined as row boundaries. Further, the row boundaries are the boundaries of the table borders in the image to be processed. The area between two row boundaries is a sub-region. Since the number of text boxes in the target partitioning result can be one or more, the number of sub-regions can also be one or more.
[0108] S460. Based on the location information of the keywords of the preset secondary header key in the image to be processed, at least one sub-region, and the corresponding text content, determine the second structured data to be stored.
[0109] Among them, the preset secondary header keys refer to the areas corresponding to certain text content that are set in advance. This text is the content of the secondary header in the table.
[0110] Specifically, by performing feature matching between the keywords of the preset secondary header key and the text content in the image to be processed, the secondary header key to which the text content in the image to be processed belongs is obtained, and its position information in the image to be processed is determined; combined with the sub-region and the corresponding text content in step 450, the second structured data to be stored is determined.
[0111] For example, in a health checkup results table, the primary header is "Internal Medicine," which is further divided into secondary headers such as "Examination Items," "Measurement Results," "Units," and "Reference Ranges." The secondary header keys can be the areas containing text content such as "Examination Items," "Measurement Results," "Units," and "Reference Ranges," and the rows containing these secondary header keys can also be called secondary header rows. Since the same operation is performed on all secondary header keys, let's take one of them as an example. The text content in the partition results corresponding to the examination items is: "Cardiopulmonary Function," "Development and Nutrition," and "Abdominal Examination." Through program analysis, the location of the examination items in the image to be processed can be obtained. Combining the positions of the rows containing "Cardiopulmonary Function," "Development and Nutrition," and "Abdominal Examination," along with their corresponding text content, the second structured data to be stored can be determined.
[0112] Optionally, determine the row information corresponding to the keywords of the preset secondary header key in the image to be processed; based on the text boxes of the row information, the text boxes to which at least one sub-region belongs, and the corresponding text content, determine the second structured data to be stored.
[0113] Here, row information refers to the row coordinates of each row of data. Specifically, by determining the row information of the second-level header key, the text box corresponding to each row, the text box to which the sub-region belongs, and the corresponding text content, the second structured data to be stored can be determined.
[0114] S470. Based on the first structured data to be stored and the second structured data to be stored, determine the target structured data corresponding to the message to be processed.
[0115] The technical solution of this invention involves processing a received message to be processed to obtain a target report; performing text box and text recognition on the target report using an image and text recognition module to determine at least one text box and corresponding text content; determining the partition result corresponding to the text box and the corresponding text content based on a preset partition key, and using the partition results to be stored other than the target partition result and the corresponding text content as the first structured data to be stored; determining a grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partition result; determining row boundaries based on the pixel values corresponding to each row of pixels in the grayscale image, and determining at least one sub-region based on the row boundaries; and determining the second structured data to be stored based on the location information of the keywords of the preset secondary header key in the image to be processed, the at least one sub-region, and the corresponding text content. Based on the first and second structured data to be stored, the target structured data corresponding to the message to be processed is determined. The row boundaries are found by analyzing the number of white pixels. The position of the second-level header is found by using the preset second-level header key. The second structured data to be stored is determined according to the row information of each text box and the corresponding text content. The data in the target partitioning result is accurately stored in a structured manner to obtain a complete structured report.
[0116] Example 5
[0117] Figure 5 This is a flowchart illustrating a report structuring method provided by an embodiment of the present invention. This embodiment applies to the analysis and processing of tables and text content in a report to obtain a structured report. Specific implementation details can be found in the detailed description of the embodiments of the present invention, where technical terms identical or corresponding to those in the above embodiments will not be repeated here.
[0118] like Figure 5 As shown, the method includes:
[0119] S501, Receive data and obtain target report.
[0120] For example, upon receiving a report, if it is in image format, proceed to the next step; if it is a PDF file, convert it to image format and proceed to the next step.
[0121] S502. Perform preprocessing on the image.
[0122] For example, the image may be processed, but is not limited to, noise reduction and orientation correction.
[0123] S503. Perform OCR on the processed image to extract text boxes and text recognition results, and filter out useless text and corresponding text boxes, such as headers and footers.
[0124] S504. Preset partition key, perform partitioning, and obtain the first structured data to be stored.
[0125] For example, preset partition keys include areas corresponding to abnormal situations, suggestions and guidance, and health check-up results. The locations where these preset partition keys appear are identified, and partitions are created to obtain the partitioning results. Content other than health check-up results is then structured and stored according to the partition keys and text content, resulting in the first structured data to be stored.
[0126] S505. Extract the image to be processed and create a grayscale image.
[0127] For example, the area of the health checkup results is extracted and referred to as the image to be processed. A grayscale image of the same size as the image to be processed is reconstructed, and all pixels are set to 0.
[0128] S506. Set the pixel value at the position corresponding to the text box in the grayscale image to 255.
[0129] S507. Project the pixels of the grayscale image onto the vertical axis and count the number of pixels with a value of 255 by row.
[0130] S508. Find the maximum value of the number of white pixels. Using each maximum value as the center, find the boundary of pixel value 255 on both sides, which is the row boundary.
[0131] S509. Preset secondary header key: Find the row containing the preset secondary header key, which is the secondary header row.
[0132] For example, the preset secondary header key is the area corresponding to fields such as inspection items, measurement results, units, and reference intervals. The row containing the inspection items, measurement results, units, and reference intervals is the secondary header row.
[0133] S510. Locate the primary header row and table body based on the position of the secondary header row.
[0134] For example, the row above the row containing the inspection item, measurement result, unit, and reference interval is the first-level header row, and the row below the second-level header row to the row above the next first-level header row or the end of the image to be processed is the table body.
[0135] S511. Reconstruct the table based on the table header and body to structure the data.
[0136] For example, the IOU of the text boxes in the second-level header row and each text box in the body is calculated in the row direction, each text box is assigned a header meaning, and then the data is structured in combination with the text content of the text boxes before being stored.
[0137] The technical solution of this invention involves receiving data to obtain a target report; preprocessing the image; performing OCR on the processed image to extract text boxes and text recognition results, filtering out useless text and corresponding text boxes, such as headers and footers; presetting a partition key to divide the data into partitions, obtaining the first structured data to be stored; extracting the image to be processed and creating a grayscale image; setting the pixels in the grayscale image corresponding to the text boxes in the image to be processed to 255; projecting the pixels of the grayscale image onto the vertical axis and counting the number of pixels with a value of 255 by row; finding the maximum value point of the number of white pixels, and using each maximum value point as the center, finding the boundaries of pixel values of 255 on both sides, which are the row boundaries; presetting a secondary header key and finding the row where the preset secondary header key is located, which is the secondary header row; locating the primary header row and table body according to the position of the secondary header row; reconstructing the table based on the header and table body, and structuring the data. This achieves structured processing of various forms of reports, improves the universality and compatibility of report structured processing, and provides convenience for subsequent report extraction and retrieval.
[0138] Example 6
[0139] Figure 6 This is a schematic diagram of a report structuring processing device provided in Embodiment Six of the present invention.
[0140] like Figure 6 As shown, the device includes:
[0141] The message processing module 610 processes the received message to be processed to obtain a target report; the text content determination module 620 performs text box and text recognition on the target report based on the image and text recognition module to determine at least one text box and the text content corresponding to the text box; the first structured data to be stored determination module 630 determines the partition result corresponding to the text box and the text content corresponding to the partition result based on a preset partition key, and uses the partition results to be stored other than the target partition result and the corresponding text content as the first structured data to be stored; the grayscale image determination module 640 determines the grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partition result; wherein the image to be processed includes the text content corresponding to the target partition result; the second structured data to be stored determination module 650 determines the second structured data to be stored based on the grayscale image and the image to be processed; the target structured data determination module 660 determines the target structured data corresponding to the message to be processed based on the first structured data to be stored and the second structured data to be stored.
[0142] Based on the above technical solutions, the message processing module also includes,
[0143] The message processing unit is used to perform noise reduction and orientation correction on the message to be processed if it is in image format, so as to obtain the target report; the message format conversion unit is used to convert the message to be processed into image format if it is not in image format, and re-execute the step of obtaining the target report.
[0144] Based on the above technical solutions, the first structured data to be stored determination module also includes,
[0145] The partitioning result determination unit is used to match text content with keywords based on a preset partitioning key, obtain the preset partitioning key to which the text content belongs, and use it as the partitioning result; the text and partitioning result binding unit is used to bind the text content with the corresponding partitioning result to be stored, and obtain the first structured storage data.
[0146] Based on the above technical solutions, the grayscale image determination module also includes,
[0147] The image to be processed determination unit is used to determine the image to be processed corresponding to the target partitioning result based on the position information of the target partitioning result in the target report; the original grayscale image creation unit is used to create an original grayscale image corresponding to a preset grayscale value based on the size information of the image to be processed; and the grayscale image determination unit is used to determine the grayscale image based on the text content in the original grayscale image and the image to be processed.
[0148] Based on the above technical solutions, the grayscale image determination unit also includes,
[0149] The pixel processing subunit is used to update the pixel values of the original grayscale image according to the text box to which the text content in the image to be processed belongs, so as to obtain the grayscale image.
[0150] Based on the above technical solutions, the second structured data to be stored determination module also includes,
[0151] The sub-region determination unit is used to determine the row boundary based on the pixel value corresponding to each row of pixels in the grayscale image, so as to determine at least one sub-region based on the row boundary; the second structured data to be stored determination unit is used to determine the second structured data to be stored based on the location information of the keywords of the preset secondary header key in the image to be processed, at least one sub-region and the corresponding text content.
[0152] Based on the above technical solutions, the second structured data to be stored determination unit also includes,
[0153] The row information determination subunit is used to determine the row information corresponding to the keywords of the preset secondary header key in the image to be processed; the second structured data to be stored subunit is used to determine the second structured data to be stored based on the text boxes of the row information, the text boxes to which at least one sub-region belongs, and the corresponding text content.
[0154] The technical solution of this invention involves processing a received message to be processed to obtain a target report; using an image and text recognition module to perform text box and text recognition on the target report, identifying at least one text box and its corresponding text content; determining the partitioning result corresponding to the text box and its corresponding text content based on a preset partitioning key, and using the partitioning results other than the target partitioning result and their corresponding text content as the first structured data to be stored; determining the grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partitioning result; determining the second structured data to be stored based on the grayscale image and the image to be processed; and determining the target structured data corresponding to the message to be processed based on the first and second structured data to be stored. This achieves the effect of structured storage for various types of reports, improves the compatibility and versatility of report processing, and provides convenience for subsequent report extraction and retrieval.
[0155] The report structuring apparatus provided in this embodiment of the invention can execute the report structuring method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0156] Example 7
[0157] Figure 7 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0158] like Figure 7As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0159] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0160] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the report structuring processing method of the present invention.
[0161] In some embodiments, the report structuring processing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the report structuring processing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the report structuring processing method by any other suitable means (e.g., by means of firmware).
[0162] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0163] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0164] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0165] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0166] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0167] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0168] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0169] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of reporting structured processing, characterized by, include: The received messages to be processed are processed to obtain the target report; Based on the image and text recognition module, the target report is subjected to text box and text recognition to determine at least one text box and the text content corresponding to the text box; Based on the preset partition key, determine the partition result corresponding to the text box, as well as the text content corresponding to the partition result, and take the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored. Based on the image to be processed corresponding to the target partitioning result, determine the grayscale image corresponding to the image to be processed, including: Based on the location information of the target partitioning result in the target report, determine the image to be processed corresponding to the target partitioning result; Based on the size information of the image to be processed, an original grayscale image corresponding to a preset grayscale value is created; Determining the grayscale image based on the original grayscale image and the text content in the image to be processed includes: The original grayscale image is updated with pixel values based on the text box to which the text content in the image to be processed belongs, to obtain the grayscale image; wherein, the image to be processed includes text content corresponding to the target partitioning result; Based on the grayscale image and the image to be processed, a second structured data to be stored is determined, including: Based on the pixel values corresponding to each row of pixels in the grayscale image, determine the row boundaries, and determine at least one sub-region based on the row boundaries; Based on the location information of keywords in the image to be processed according to the preset secondary header key, the at least one sub-region, and the corresponding text content, the second structured data to be stored is determined, including: Determine the row information corresponding to the keyword of the preset secondary header key in the image to be processed; Based on the text boxes containing the row information, the text boxes to which at least one sub-region belongs, and the corresponding text content, the second structured data to be stored is determined. Based on the first structured data to be stored and the second structured data to be stored, the target structured data corresponding to the message to be processed is determined.
2. The method of claim 1, wherein, The process of processing the received message to obtain the target report includes: If the message to be processed is in image format, then the message to be processed is denoised and oriented to obtain the target report; If the message to be processed is not in image format, then the message to be processed is converted into image format, and the step of obtaining the target report is re-executed.
3. The method of claim 1, wherein, The step of determining the partition result corresponding to the text box based on the preset partition key, and the text content corresponding to the partition result, and storing the partition results to be stored and the corresponding text content other than the target partition result as the first structured storage data, includes: Based on the keywords of the preset partition key, the text content is matched to obtain the preset partition key to which the text content belongs, and this is used as the partition result; The text content is bound to the corresponding partition result to be stored, thus obtaining the first structured storage data.
4. An apparatus for structuring reports, characterized in that, include: The message processing module is used to process the received messages to be processed and obtain the target report; The text content determination module is used to perform text box and text recognition on the target report based on the image and text recognition module, and determine at least one text box and the text content corresponding to the text box; The first structured data to be stored determination module is used to determine the partition result corresponding to the text box and the text content corresponding to the partition result based on the preset partition key, and to use the partition result to be stored and the corresponding text content other than the target partition result as the first structured data to be stored. The grayscale image determination module is used to determine a grayscale image corresponding to the image to be processed based on the image to be processed corresponding to the target partitioning result; wherein, the image to be processed includes text content corresponding to the target partitioning result; The second structured data to be stored determination module is used to determine the second structured data to be stored based on the grayscale image and the image to be processed. The target structured data determination module is used to determine the target structured data corresponding to the message to be processed based on the first structured data to be stored and the second structured data to be stored. The grayscale image determination module further includes: a to-be-processed image determination unit, used to determine the to-be-processed image corresponding to the target partitioning result based on the position information of the target partitioning result in the target report; an original grayscale image creation unit, used to create an original grayscale image corresponding to a preset grayscale value based on the size information of the to-be-processed image; and a grayscale image determination unit, used to determine the grayscale image based on the original grayscale image and the text content in the to-be-processed image. The grayscale image determination unit further includes a pixel processing subunit, used to update the pixel values of the original grayscale image according to the text box to which the text content in the image to be processed belongs, so as to obtain the grayscale image. The second structured data to be stored determination module further includes a sub-region determination unit, used to determine row boundaries based on the pixel values corresponding to each row of pixels in the grayscale image, so as to determine at least one sub-region based on the row boundaries; the second structured data to be stored determination unit is used to determine the second structured data to be stored based on the location information of the keywords of the preset secondary header key in the image to be processed, the at least one sub-region and the corresponding text content. The second structured data to be stored determination unit further includes a row information determination subunit, used to determine the row information corresponding to the keyword of the preset secondary header key in the image to be processed; and a second structured data to be stored subunit, used to determine the second structured data to be stored based on the text box of the row information, the text box to which at least one sub-region belongs, and the corresponding text content.
5. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, which enables the at least one processor to perform the report structuring processing method according to any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method of report structure processing as described in any one of claims 1-3.
Citation Information
Patent Citations
Table format recovery method and device based on OCR and storage medium
CN111325110A
Physical examination report information structuring method and device, readable storage medium and terminal
CN112686258A
Table structure identification method for wireless frame table image
CN114529922A
