Method, device and computer equipment for recognizing medical bill layout
By training the semantic segmentation model and calculating the target matrix, the problems of large processing volume and low accuracy in medical bill layout recognition are solved, and efficient and accurate layout recognition is achieved.
Patent Information
- Application Number
- CN202010896878.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-31
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2040-08-31
AI Technical Summary
The prior art has a large workload, low efficiency and insufficient information extraction when identifying medical bills.
By marking the layout information of the sample medical bills, the semantic segmentation model is trained, and the target matrix of the bills to be identified is calculated to determine the location information of each layout area.
The workflow of medical bill layout recognition is simplified, recognition efficiency is improved, and more accurate field layout division results are provided at the pixel level.
Smart Images

Figure CN112036304B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing, and in particular to a method, device and computer equipment for identifying the layout of medical bills. Background Art
[0002] In the claims industry, it is often necessary to extract information from medical bills. In recent years, with the rise of machine learning and deep learning, OCR (Optical Character Recognition) technology has gradually been applied to information extraction from medical bills. The main steps of medical bill OCR are: image preprocessing -> text detection -> text recognition -> field division -> field post-processing. In the field division stage, existing methods mainly use text detection text boxes and prior knowledge to roughly confirm the area of each field on the medical bill.
[0003] However, the processing logic of the above method is relatively complicated. Different search area logics are required for different formats of medical bills. It is impossible to use a unified logic to process medical bills across the country, which leads to a large processing workload and low work efficiency. In addition, since the layout recognition of medical bills mainly depends on the results of text detection, when the detection results are not good, the results of field division will also deteriorate, which will also lead to the inaccuracy of the extracted medical bill layout information. Summary of the invention
[0004] In view of this, the present application provides a method, device and computer equipment for medical bill layout recognition, the main purpose of which is to solve the current problem of large processing workload when identifying the medical bill layout, resulting in low work efficiency and inaccurate extracted medical bill layout information.
[0005] According to one aspect of the present application, a method for identifying the layout of a medical bill is provided, the method comprising:
[0006] Mark the layout information of the sample medical bill;
[0007] Training semantic segmentation model based on sample medical bills with labeled layout information;
[0008] Calculate the target matrix of the medical bills to be identified using a semantic segmentation model that meets the preset training criteria;
[0009] The position information of each layout area in the medical bill to be identified is determined according to the target matrix.
[0010] Preferably, the layout information includes a labeling matrix corresponding to each layout area, and the layout area includes a field area and a background area;
[0011] The layout information of the marked sample medical bill specifically includes:
[0012] Determining the position coordinates of each layout area in the sample medical bill;
[0013] configuring an independent matrix channel for each of the layout areas, and determining a labeling matrix corresponding to each of the matrix channels according to the position coordinates;
[0014] The sample medical bills are labeled based on the respective labeling matrices.
[0015] Preferably, the determining the position coordinates of each layout area in the sample medical bill specifically includes:
[0016] Determine a minimum detection frame corresponding to the field area and the background area;
[0017] The four vertex coordinates corresponding to the minimum detection frame are determined as the position coordinates corresponding to the field area and the background area.
[0018] Preferably, configuring an independent matrix channel for each of the layout areas, and determining the annotation matrix corresponding to each of the matrix channels according to the position coordinates, specifically includes:
[0019] configuring a first matrix channel for each of the field areas;
[0020] Determine a first labeling matrix for each field region based on a first preset rule of the first matrix channel, wherein the first preset rule corresponds to setting pixel values of pixels outside the field region to 0 and setting pixel values of pixels within the field region to 1;
[0021] configuring a second matrix channel for the background area;
[0022] Based on the second preset rule of the second matrix channel, a second labeling matrix of the background area is determined, wherein the pixel values of the pixels outside the background area are set to 1, and the pixel values of the pixels within the background area are set to 0.
[0023] Preferably, the labeling of the sample medical bills based on each of the labeling matrices specifically includes:
[0024] Each of the field regions is labeled with the corresponding first labeling matrix, and the background region is labeled with the second labeling matrix.
[0025] Preferably, the semantic segmentation model is trained based on sample medical bills with annotated layout information, specifically including:
[0026] Inputting sample medical bills with the labeling matrix corresponding to each layout area into the semantic segmentation model, so as to use the semantic segmentation model to identify the pixel information in each layout area and determine the binarization matrix corresponding to each layout area;
[0027] Calculating the error value between the binary matrix corresponding to each of the layout areas and the marked matrix;
[0028] Calculating a weighted average of the error values of each of the layout areas according to the preset weights of each of the layout areas;
[0029] Compare the weighted average of the error values with a preset threshold, and if it is determined that the weighted average of the error values is less than the preset threshold, determine that the semantic segmentation model passes the training;
[0030] If the weighted average of the error values is determined to be greater than or equal to the preset threshold, the semantic segmentation model is determined to have failed the training, and the semantic segmentation model is retrained using the sample medical bills, and / or the preset weights of each of the layout areas are updated so that the semantic segmentation model meets the preset training standards.
[0031] Preferably, the method of calculating the target matrix of the medical bills to be identified by using a semantic segmentation model that meets the preset training standard specifically includes:
[0032] Inputting the medical bill to be identified into the semantic segmentation model that meets the preset training standard, obtaining each target matrix channel and the target matrix corresponding to the target matrix channel;
[0033] Determining the position information of each layout area in the to-be-identified medical bill according to the target matrix specifically includes:
[0034] Determine the connected domains corresponding to each of the target layout areas based on the target matrix;
[0035] The position coordinates of each target layout area are determined according to the minimum circumscribed rectangle of the connected domain.
[0036] According to another aspect of the present application, a device for identifying the layout of a medical bill is provided, the device comprising:
[0037] A marking module, used to mark the layout information of the sample medical bill;
[0038] A training module, used to train a semantic segmentation model based on sample medical bills with annotated layout information;
[0039] A calculation module, used for calculating a target matrix of medical bills to be identified using a semantic segmentation model that meets a preset training standard;
[0040] A determination module is used to determine the position information of each layout area in the medical bill to be identified according to the target matrix.
[0041] Preferably, the layout information includes a marking matrix corresponding to each layout area, and when the layout area includes a field area and a background area, the marking module specifically includes: a first determining unit, a second determining unit, and a marking unit;
[0042] A first determining unit, used to determine the position coordinates of each layout area in the sample medical bill;
[0043] A second determining unit is used to configure an independent matrix channel for each of the layout areas, and determine a labeling matrix corresponding to each of the matrix channels according to the position coordinates;
[0044] A labeling unit is used to label the sample medical bills based on each of the labeling matrices.
[0045] Preferably, the first determining unit is specifically configured to:
[0046] Determine a minimum detection frame corresponding to the field area and the background area;
[0047] The four vertex coordinates corresponding to the minimum detection frame are determined as the position coordinates corresponding to the field area and the background area.
[0048] Preferably, the second determining unit is specifically configured to:
[0049] configuring a first matrix channel for each of the field areas;
[0050] Determine a first labeling matrix for each field region based on a first preset rule of the first matrix channel, wherein the first preset rule corresponds to setting pixel values of pixels outside the field region to 0 and setting pixel values of pixels within the field region to 1;
[0051] configuring a second matrix channel for the background area;
[0052] Based on a second preset rule of the second matrix channel, a second labeling matrix of the background area is determined, wherein the second preset rule sets the pixel values of pixels outside the background area to 1 and sets the pixel values of pixels inside the background area to 0.
[0053] Preferably, the marking unit is specifically used for:
[0054] Each of the field regions is labeled with the corresponding first labeling matrix, and the background region is labeled with the second labeling matrix.
[0055] Preferably, the training module specifically includes: an input unit, a calculation unit, a comparison unit, and a training update unit;
[0056] An input unit, used to input sample medical bills with annotation matrices corresponding to each layout area into the semantic segmentation model, so as to use the semantic segmentation model to identify pixel information in each layout area and determine the binarization matrix corresponding to each layout area;
[0057] A calculation unit, used for calculating the error value between the binary matrix corresponding to each of the layout areas and the marked matrix;
[0058] A calculation unit, used for calculating a weighted average value of the error values of each of the layout areas according to a preset weight of each of the layout areas;
[0059] A comparison unit, configured to compare the weighted average of the error values with a preset threshold, and if it is determined that the weighted average of the error values is less than the preset threshold, then it is determined that the semantic segmentation model passes the training;
[0060] A training update unit is used to determine that the semantic segmentation model has not passed the training if the weighted average of the error values is greater than or equal to the preset threshold, retrain the semantic segmentation model using the sample medical bills, and / or update the preset weights of each of the layout areas so that the semantic segmentation model meets the preset training standards.
[0061] Preferably, the calculation module is specifically used to input the medical bill to be identified into the semantic segmentation model that meets the preset training standard, and obtain each target matrix channel and the target matrix corresponding to the target matrix channel;
[0062] Preferably, the determination module is specifically used to determine the connected domain corresponding to each of the target layout areas based on the target matrix; and determine the position coordinates of each of the target layout areas according to the minimum circumscribed rectangle of the connected domain.
[0063] According to another aspect of the present application, a non-volatile readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned method for identifying the layout of medical bills is implemented.
[0064] According to another aspect of the present application, a computer device is provided, comprising a non-volatile readable storage medium, a processor, and a computer program stored on the non-volatile readable storage medium and executable on the processor, wherein the processor implements the above-mentioned method for medical bill layout recognition when executing the program.
[0065] By means of the above technical scheme, the present application provides a method, device and computer equipment for medical bill layout recognition. Compared with the current method of medical bill layout recognition, the present application can pre-mark the position coordinates of each layout area in the sample medical bill, and use the data matrix of the corresponding position coordinates of each layout area to train the semantic segmentation model. After the semantic segmentation model is successfully trained, the medical bill to be identified is input into the semantic segmentation model, and the target matrix corresponding to each layout area can be obtained, and the position information of each target area existing in the medical bill to be identified is determined by the target matrix. The medical bill layout analysis method based on semantic segmentation proposed in the present application can automatically extract the medical bill field area according to the characteristics of the input medical bill. For various types of medical bills, one model can be used for processing after learning, so the workflow of medical bill layout recognition can be simplified and the work efficiency of recognition can be improved. In addition, in the present application, based on the semantic analysis model, a more accurate field layout division result can be provided at the pixel level, and there will be no overlap of two layout areas, so the recognition accuracy of the medical bill layout information can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the local application. In the drawings:
[0067] Figure 1 A schematic diagram of a process for identifying a medical bill layout provided in an embodiment of the present application is shown;
[0068] Figure 2 A schematic diagram showing a flow chart of another method for identifying the layout of medical bills provided in an embodiment of the present application;
[0069] Figure 3 A schematic diagram of the structure of a device for identifying the layout of a medical bill provided in an embodiment of the present application is shown;
[0070] Figure 4 A schematic diagram of the structure of another device for medical bill layout recognition provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0071] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0072] In view of the problem that the initial workload is large when identifying the layout of medical bills, resulting in low work efficiency and the extracted medical bill layout information is not accurate enough, the embodiment of the present application provides a method for identifying the layout of medical bills, such as Figure 1 As shown, the method includes:
[0073] 101. Mark the layout information of the sample medical receipt.
[0074] The layout information includes a marking matrix corresponding to each layout area, and the layout area includes a field area and a background area.
[0075] In a specific application scenario, before marking the layout information corresponding to the sample medical bill, it specifically includes: selecting a predetermined number of medical bill images of different medical bill types as sample medical bills, and preprocessing the sample medical bills. The preprocessing process mainly processes the sample medical bills into a predetermined input format through operations such as proportional scaling and normalization. For example, the predetermined input format can be a 512*512*8 matrix, where 512 refers to the width and height of the image. Through the above preprocessing, a 512*512 standard image can be further obtained.
[0076] The executor of this embodiment may be a system for identifying the layout of medical bills. A semantic analysis model is built into the system. Before identifying the version of the medical bill, the semantic analysis model needs to be trained in advance using sample medical bills with marked layout information. After determining that the semantic analysis model meets the preset training standards, the semantic analysis model can be used to identify the medical bills to be identified, and a target matrix of the medical bills to be identified can be obtained. The target matrix can be further used to determine the position information of each layout area in the medical bills to be identified.
[0077] 102. Train a semantic segmentation model based on sample medical receipts with annotated layout information.
[0078] For this embodiment, in a specific application scenario, before using the semantic analysis model to identify the medical bills to be identified, it is necessary to repeatedly train the model using sample medical bills with standard layout information so that the semantic analysis model reaches the preset training standard.
[0079] 103. Calculate the target matrix of the medical bills to be identified using a semantic segmentation model that meets the preset training criteria.
[0080] For this embodiment, in a specific application scenario, after determining that the semantic analysis model reaches the preset training standard, the preprocessed medical bills to be identified can be input into the semantic analysis model, and the semantic analysis model will output the target matrix corresponding to the medical bills to be identified, wherein the target matrix is the binarized matrix corresponding to each matrix channel.
[0081] 104. Determine the position information of each layout area in the medical bill to be identified according to the target matrix.
[0082] In a specific application scenario, since the number of corresponding layout areas is unknown when the medical bill to be identified is input into the semantic analysis model, after obtaining the target matrix, the number of layout areas contained in the medical bill to be identified can be determined based on the number of matrix channels of the target matrix, and the position information of each layout area can be further determined based on the grayscale value of the pixel point corresponding to each matrix channel.
[0083] Through the method of medical bill layout recognition in this embodiment, the position coordinates of each layout area in the sample medical bill can be pre-marked, and the semantic segmentation model can be trained using the data matrix of the corresponding position coordinates of each layout area. After the semantic segmentation model is successfully trained, the medical bill to be identified is input into the semantic segmentation model, and the target matrix corresponding to each layout area can be obtained, and the position information of each target area in the medical bill to be identified is determined by the target matrix. The medical bill layout analysis method based on semantic segmentation proposed in this application can automatically extract the medical bill field area according to the characteristics of the input medical bill. For various types of medical bills, one model can be used for processing after learning, so the workflow of medical bill layout recognition can be simplified and the work efficiency of recognition can be improved. In addition, in this application, based on the semantic analysis model, a more accurate field layout division result can be provided at the pixel level, and there will be no overlap of two layout areas, so the recognition accuracy of the medical bill layout information can be guaranteed.
[0084] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another method for medical bill layout recognition is provided, such as Figure 2 As shown, the method includes:
[0085] 201. Determine the position coordinates of each layout area in the sample medical bill.
[0086] The layout area includes multiple field areas and a background area.
[0087] For this embodiment, in a specific application scenario, step 201 of the embodiment may specifically include: determining the minimum detection frame corresponding to the field area and the background area; determining the four vertex coordinates corresponding to the minimum detection frame as the position coordinates corresponding to the field area and the background area.
[0088] In specific application scenarios, the corresponding minimum detection frame can be determined according to the pixel distribution corresponding to each layout area, and then the position coordinates of the upper left, lower left, upper right and lower right points of the minimum detection frame can be marked using existing annotation tools, and the four vertex coordinates can be further determined as the position coordinates corresponding to the layout area. For example, the annotation tool iPhotoDraw can be used to annotate and obtain the position coordinates of the minimum detection frame.
[0089] 202. Configure an independent matrix channel for each layout area, and determine the labeling matrix corresponding to each matrix channel according to the position coordinates.
[0090] For this embodiment, in a specific application scenario, step 202 of the embodiment may specifically include: configuring a first matrix channel for each field area; determining a first labeling matrix for each field area based on a first preset rule of the first matrix channel, wherein the first preset rule corresponds to setting the pixel value of pixels outside the field area to 0, and setting the pixel value of pixels within the field area to 1; configuring a second matrix channel for the background area; determining a second labeling matrix for the background area based on a second preset rule of the second matrix channel, wherein the second preset rule corresponds to setting the pixel value of pixels outside the background area to 1, and setting the pixel value of pixels within the background area to 0.
[0091] In a specific application scenario, it is necessary to process each sample medical bill into a w*h*n annotation matrix based on the position coordinates of the layout area corresponding to the sample medical bill, where w and h are the width and height of the image respectively, and the value of n corresponds to the sum of the number of field areas and background areas contained in the sample medical bill, indicating that an independent channel is configured for each layout area, and the n channels are all 0, 1 binary matrices. In order to distinguish the field area from the background area, it is necessary to set two different matrix annotation rules for the field area and the background area. For the background area, it is necessary to construct a w*h image with all pixel values 1, and then set the pixel value in the background area to 0 according to the position coordinates corresponding to the background area; for the n-1 field areas that are not the background, it is necessary to pre-construct a w*h image with all pixel values 0, and then set the pixel value in the corresponding field area to 1 according to the position coordinates of each field area; then combine these n matrix channels together to form a w*h*n annotation matrix.
[0092] Here, the medical bill for medical outpatient charges is taken as a sample medical bill to illustrate this embodiment. The medical bill for medical outpatient charges includes seven field areas, namely: hospital name, medical bill number, amount, date, total in capital letters, major drug items, and minor drug items. Then, the minimum detection frames corresponding to the above seven field areas and a background area can be further determined, and the position coordinates of the four points of the upper left, lower left, upper right, and lower right of the minimum detection frame are marked. Independent matrix channels are configured for the 8 layout areas respectively, and the marking matrix w*h*8 corresponding to the 8 channels can be obtained after processing. For the above 7 non-background field areas, the first marking matrix needs to be determined based on the first preset rule. For example, taking the hospital name as an example, it is necessary to first construct a w*h picture with all pixel values of 0, and then set the pixel point value in the hospital name marking box to 1 according to the marking data. For the background area, it is necessary to determine the second marking matrix based on the second preset rule, that is, first construct a w*h picture with all pixel values of 1, and then set the pixel point value in the background area to 0 according to the position coordinates. Finally, the annotation matrices corresponding to these 8 matrix channels are integrated together to form a w*h*8 matrix, among which the pixels with the first matrix as 1 can represent the background; the pixels with the second matrix as 1 can represent the hospital name; the pixels with the third matrix as 1 can represent the medical bill number; the pixels with the fourth matrix as 1 can represent the amount; the pixels with the fifth matrix as 1 can represent the date; the pixels with the sixth matrix as 1 can represent the total in capital letters; the pixels with the seventh matrix as 1 can represent the major drug item; and the pixels with the eighth matrix as 1 can represent the minor drug item.
[0093] 203. Label sample medical bills based on each labeling matrix.
[0094] For this embodiment, in a specific application scenario, step 203 of the embodiment may specifically include: marking each field area with a corresponding first marking matrix, and marking the background area with a second marking matrix.
[0095] For this embodiment, in a specific application scenario, after obtaining the annotation matrix corresponding to each field area and the background area, the sample medical bill can be annotated to serve as a training benchmark for the semantic recognition model, and to train and correct the semantic recognition model's binary matrix output value for the sample medical bill.
[0096] 204. Train a semantic segmentation model based on sample medical receipts with annotated layout information.
[0097] For this embodiment, in a specific application scenario, step 204 of the embodiment may specifically include: inputting sample medical bills with annotation matrices corresponding to each layout area into a semantic segmentation model, so as to use the semantic segmentation model to identify pixel information in each layout area and determine the binarization matrix corresponding to each layout area; calculating the error value between the binarization matrix corresponding to each layout area and the annotation matrix; calculating the weighted average of the error values for each layout area according to the preset weights of each layout area; comparing the weighted average of the error values with the preset threshold, and if it is determined that the weighted average of the error values is less than the preset threshold, then it is determined that the semantic segmentation model has passed the training; if it is determined that the weighted average of the error values is greater than or equal to the preset threshold, then it is determined that the semantic segmentation model has not passed the training, and the sample medical bills are used to retrain the semantic segmentation model, and / or the preset weights of each layout area are updated so that the semantic segmentation model meets the preset training standards.
[0098] Specifically, after the labeled and processed sample medical bills are input into the semantic segmentation model, after training through a series of basic operations such as convolution, pooling, activation and upsampling, the binarization matrix corresponding to each layout area can be obtained. Then, the binarization matrix corresponding to each layout area is compared with the result of the corresponding data annotation through the similarity measurement loss function, and the error value between the network output result and the pre-annotated data is calculated, so as to determine the degree of training based on the error value. When the calculated error value is larger, the recognition accuracy of the semantic analysis model is lower, and vice versa, the recognition accuracy of the semantic analysis model is determined to be higher. In a specific application scenario, a preset threshold for comparison with the error value can be pre-set, wherein the preset threshold is the maximum error value when determining that the semantic analysis model meets the preset training standard. When the calculated error value is less than or equal to the preset threshold, the semantic segmentation model is determined to have passed the training, otherwise, the semantic segmentation model is determined to have failed the training, and the semantic segmentation model needs to be retrained using the sample medical bills, and / or the preset weights of each layout area are updated so that the semantic segmentation model meets the preset training standard.
[0099] 205. Calculate the target matrix of the medical bills to be identified using a semantic segmentation model that meets the preset training criteria.
[0100] For this embodiment, in a specific application scenario, step 205 of the embodiment may specifically include: inputting the medical bill to be identified into a semantic segmentation model that meets the preset training standard, obtaining each target matrix channel, and the target matrix corresponding to the target matrix channel.
[0101] In a specific application scenario, after the medical bill to be identified is input into the semantic segmentation model, the target matrix corresponding to w*h*n can be obtained, and it can be further determined that the number of field areas corresponding to the medical bill to be identified is n-1, as well as the binarization matrix corresponding to each field area and background area.
[0102] 206. Determine the position information of each layout area in the medical bill to be identified according to the target matrix.
[0103] For this embodiment, in a specific application scenario, step 206 of the embodiment may specifically include: determining the connected domain corresponding to each target layout area based on the target matrix; and determining the position coordinates of each target layout area according to the minimum circumscribed rectangle of the connected domain.
[0104] Specifically, after obtaining the binarization matrix corresponding to each field area and background area, the connected domain of the medical bill to be identified after binarization is extracted to obtain each field area and background area. The connected domain can be obtained through the function cv2.findContours of opencv (open source computer vision library). After extracting the connected domain, the four-point position coordinates of each field area can be determined by solving the minimum circumscribed rectangle of the connected domain.
[0105] By means of the above-mentioned method for identifying the layout of medical bills, the position coordinates of each layout area in the sample medical bills can be pre-marked, and the semantic segmentation model can be trained using the data matrix of the corresponding position coordinates of each layout area. After the semantic segmentation model is successfully trained, the medical bill to be identified is input into the semantic segmentation model, and the target matrix corresponding to each layout area can be obtained, and the position information of each target area in the medical bill to be identified is determined by the target matrix. The medical bill layout analysis method based on semantic segmentation proposed in this application can automatically extract the medical bill field area according to the characteristics of the input medical bill. For various types of medical bills, one model can be used for processing after learning, so the workflow of medical bill layout recognition can be simplified and the work efficiency of recognition can be improved. In addition, in this application, based on the semantic analysis model, a more accurate field layout division result can be provided at the pixel level, and there will be no overlap of two layout areas, so the recognition accuracy of the medical bill layout information can be guaranteed.
[0106] Further, as Figure 1 and Figure 2 The specific implementation of the method shown in the embodiment of the present application provides a device for identifying the layout of medical bills, such as Figure 3 As shown, the device includes: a marking module 31, a training module 32, a calculation module 33, and a determination module 34;
[0107] A marking module 31, which can be used to mark the layout information of the sample medical bill;
[0108] A training module 32, which can be used to train a semantic segmentation model based on sample medical bills with annotated layout information;
[0109] A calculation module 33, which can be used to calculate a target matrix of medical bills to be identified using a semantic segmentation model that meets a preset training standard;
[0110] The determination module 34 can be used to determine the position information of each layout area in the medical bill to be identified according to the target matrix.
[0111] In a specific application scenario, when the layout information includes a label matrix corresponding to each layout area, and the layout area includes a field area and a background area, such as Figure 4 As shown, the marking module 31 may specifically include: a first determining unit 311, a second determining unit 312, and a labeling unit 313;
[0112] The first determination unit 311 can be used to determine the position coordinates of each layout area in the sample medical bill;
[0113] The second determining unit 312 may be used to configure an independent matrix channel for each layout area, and determine a labeling matrix corresponding to each matrix channel according to the position coordinates;
[0114] The labeling unit 313 may be used to label sample medical bills based on each labeling matrix.
[0115] Accordingly, the first determining unit 311 may be specifically configured to: determine a minimum detection frame corresponding to the field area and the background area; and determine four vertex coordinates corresponding to the minimum detection frame as position coordinates corresponding to the field area and the background area.
[0116] In a specific application scenario, the second determination unit 312 can be specifically used to: configure a first matrix channel for each field area; determine a first labeling matrix for each field area based on a first preset rule of the first matrix channel, wherein the first preset rule sets the pixel value of pixels outside the field area to 0, and the pixel value of pixels within the field area to 1; configure a second matrix channel for the background area; determine a second labeling matrix for the background area based on a second preset rule of the second matrix channel, wherein the second preset rule sets the pixel value of pixels outside the background area to 1, and the pixel value of pixels within the background area to 0.
[0117] Correspondingly, the labeling unit 313 may be specifically configured to label each field region with a corresponding first labeling matrix, and label the background region with a second labeling matrix.
[0118] In specific application scenarios, such as Figure 4As shown, the training module 32 may specifically include: an input unit 321, a calculation unit 322, a comparison unit 323, and a training update unit 324;
[0119] The input unit 321 can be used to input the sample medical bills with the annotation matrix corresponding to each layout area into the semantic segmentation model, so as to use the semantic segmentation model to identify the pixel information in each layout area and determine the binarization matrix corresponding to each layout area;
[0120] The calculation unit 322 may be used to calculate the error value between the binary matrix corresponding to each layout area and the marking matrix;
[0121] The calculation unit 322 may be further configured to calculate a weighted average value of the error value of each layout area according to a preset weight of each layout area;
[0122] The comparison unit 323 may be specifically configured to compare the weighted average of the error values with a preset threshold value, and if the weighted average of the error values is determined to be less than the preset threshold value, the semantic segmentation model is determined to have passed the training;
[0123] The training update unit 324 can be specifically used to determine that the semantic segmentation model has not passed the training if the weighted average of the error values is greater than or equal to a preset threshold, retrain the semantic segmentation model using sample medical bills, and / or update the preset weights of each layout area so that the semantic segmentation model meets the preset training standards.
[0124] In a specific application scenario, the calculation module 33 can be specifically used to input the medical bill to be identified into a semantic segmentation model that meets the preset training standard, and obtain each target matrix channel and the target matrix corresponding to the target matrix channel.
[0125] Correspondingly, the determination module 34 can be specifically used to determine the connected domain corresponding to each target layout area based on the target matrix; and determine the position coordinates of each target layout area according to the minimum circumscribed rectangle of the connected domain.
[0126] It should be noted that for other corresponding descriptions of the functional units involved in the device for identifying the layout of medical bills provided in this embodiment, reference can be made to Figure 1 to Figure 2 The corresponding description will not be repeated here.
[0127] Based on the above Figure 1 to Figure 2 The method shown in the embodiment also provides a non-volatile storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by the processor, the above-mentioned Figure 1 to Figure 2 The method for identifying the medical bill layout is shown.
[0128] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0129] Based on the above Figure 1 to Figure 2 The method shown and Figure 3 , Figure 4 In order to achieve the above-mentioned purpose, the present embodiment further provides a computer device, which includes a storage medium and a processor; a non-volatile storage medium for storing a computer program; and a processor for executing the computer program to achieve the above-mentioned Figure 1 to Figure 2 The method for identifying the medical bill layout is shown.
[0130] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0131] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0132] The non-volatile storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the non-volatile storage medium, and communication with other hardware and software in the information processing entity device.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware.
[0134] By applying the technical solution of the present application, compared with the current existing technology, the present application can pre-mark the position coordinates of each layout area in the sample medical bill, and use the data matrix of the corresponding position coordinates of each layout area to train the semantic segmentation model. After the semantic segmentation model is successfully trained, the medical bill to be identified is input into the semantic segmentation model, and the target matrix corresponding to each layout area can be obtained. The position information of each target area in the medical bill to be identified is determined by the target matrix. The medical bill layout analysis method based on semantic segmentation proposed in the present application can automatically extract the medical bill field area according to the characteristics of the input medical bill. For various types of medical bills, one model can be used for processing after learning, so the workflow of medical bill layout recognition can be simplified and the work efficiency of recognition can be improved. In addition, in the present application, based on the semantic analysis model, a more accurate field layout division result can be provided at the pixel level, and there will be no overlap of two layout areas, so the recognition accuracy of the medical bill layout information can be guaranteed.
[0135] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0136] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for identifying the layout of medical bills, characterized in that: include: Mark the layout information of the sample medical bill; Training semantic segmentation model based on sample medical bills with labeled layout information; Calculate the target matrix of the medical bills to be identified using a semantic segmentation model that meets the preset training criteria; Determine the position information of each layout area in the to-be-identified medical bill according to the target matrix; The layout information includes a labeling matrix corresponding to each layout area, and the layout area includes a field area and a background area; The layout information of the marked sample medical bill specifically includes: Determining the position coordinates of each layout area in the sample medical bill; configuring an independent matrix channel for each of the layout areas, and determining a labeling matrix corresponding to each of the matrix channels according to the position coordinates; annotating the sample medical bills based on each of the annotation matrices; The configuring of independent matrix channels for each of the layout areas, and determining the labeling matrix corresponding to each of the matrix channels according to the position coordinates, specifically includes: configuring a first matrix channel for each of the field areas; Determine a first labeling matrix for each field region based on a first preset rule of the first matrix channel, wherein the first preset rule corresponds to setting pixel values of pixels outside the field region to 0 and setting pixel values of pixels within the field region to 1; configuring a second matrix channel for the background area; Based on a second preset rule of the second matrix channel, a second labeling matrix of the background area is determined, wherein the second preset rule sets the pixel values of pixels outside the background area to 1 and sets the pixel values of pixels inside the background area to 0.
2. The method according to claim 1, characterized in that Determining the position coordinates of each layout area in the sample medical bill specifically includes: Determine a minimum detection frame corresponding to the field area and the background area; The four vertex coordinates corresponding to the minimum detection frame are determined as the position coordinates corresponding to the field area and the background area.
3. The method according to claim 1, characterized in that The step of labeling the sample medical bills based on each labeling matrix specifically includes: Each of the field regions is labeled with the corresponding first labeling matrix, and the background region is labeled with the second labeling matrix.
4. The method according to claim 3, characterized in that The semantic segmentation model is trained based on sample medical bills with annotated layout information, specifically including: Inputting sample medical bills with the labeling matrix corresponding to each layout area into the semantic segmentation model, so as to use the semantic segmentation model to identify the pixel information in each layout area and determine the binarization matrix corresponding to each layout area; Calculating the error value between the binary matrix corresponding to each of the layout areas and the marked matrix; Calculating a weighted average of the error values of each of the layout areas according to the preset weights of each of the layout areas; Compare the weighted average of the error values with a preset threshold, and if it is determined that the weighted average of the error values is less than the preset threshold, determine that the semantic segmentation model passes the training; If the weighted average of the error values is determined to be greater than or equal to the preset threshold, the semantic segmentation model is determined to have failed the training, and the semantic segmentation model is retrained using the sample medical bills, and / or the preset weights of each of the layout areas are updated so that the semantic segmentation model meets the preset training standards.
5. The method according to claim 4, characterized in that The method of calculating the target matrix of the medical bills to be identified by using the semantic segmentation model that meets the preset training standard specifically includes: Inputting the medical bill to be identified into the semantic segmentation model that meets the preset training standard, obtaining each target matrix channel and the target matrix corresponding to the target matrix channel; Determining the position information of each layout area in the to-be-identified medical bill according to the target matrix specifically includes: Determine the connected domains corresponding to each of the layout areas based on the target matrix; The position coordinates of each of the layout areas are determined according to the minimum circumscribed rectangle of the connected domain.
6. A device for identifying the layout of medical bills, characterized in that: include: A marking module, used to mark the layout information of the sample medical bill; A training module, used to train a semantic segmentation model based on sample medical bills with annotated layout information; A calculation module, used for calculating a target matrix of medical bills to be identified using a semantic segmentation model that meets a preset training standard; A determination module, used to determine the position information of each layout area in the medical bill to be identified according to the target matrix; The layout information includes a marking matrix corresponding to each layout area, the layout area includes a field area and a background area, and the marking module specifically includes: a first determination unit, a second determination unit, and a marking unit; The first determining unit is used to determine the position coordinates of each layout area in the sample medical bill; The second determining unit is used to configure an independent matrix channel for each of the layout areas, and determine the labeling matrix corresponding to each of the matrix channels according to the position coordinates; The labeling unit is used to label the sample medical bills based on each of the labeling matrices; The second determining unit is specifically configured to: configuring a first matrix channel for each of the field areas; Determine a first labeling matrix for each field region based on a first preset rule of the first matrix channel, wherein the first preset rule corresponds to setting pixel values of pixels outside the field region to 0 and setting pixel values of pixels within the field region to 1; configuring a second matrix channel for the background area; Based on a second preset rule of the second matrix channel, a second labeling matrix of the background area is determined, wherein the second preset rule sets the pixel values of pixels outside the background area to 1 and sets the pixel values of pixels inside the background area to 0.
7. A non-volatile readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for medical bill layout recognition described in any one of claims 1 to 5 is implemented.
8. A computer device comprising a non-volatile readable storage medium, a processor, and a computer program stored in the non-volatile readable storage medium and executable on the processor, characterized in that: When the processor executes the program, the method for medical bill layout recognition described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Form parsing method based on character location and recognition, and medium and computer device
WO2020164281A1