Text recognition method, device, computer readable medium and electronic device
By using a pre-trained first model, the model solves the problem that private information cannot be effectively protected in the prior art through training data including negative sample areas, and achieves the effect of improving information privacy.
Patent Information
- Application Number
- CN201911260301.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-10
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2040-05-28
AI Technical Summary
Existing text recognition methods cannot effectively protect private information, resulting in leakage of sensitive information and affecting the privacy of information.
By using a pre-trained first model, the model is obtained by training data containing the negative sample area. The negative sample area includes a text area containing sensitive information and its corresponding setting output information, so that when sensitive information is included in the text area, the setting output information is directly output to avoid leakage of sensitive information.
It effectively improves the privacy of information and prevents sensitive information leakage caused by identifying the text and then screening it.
Smart Images

Figure CN111062389B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer and communication technology, and more specifically, to a text recognition method, device, computer-readable medium, and electronic device. Background Art
[0002] As the demand for and accuracy of text recognition continues to increase, text recognition models are typically built to identify text in images to achieve higher recognition accuracy. However, these recognition methods or models cannot meet the diverse needs of text recognition, especially when the recognition object includes private information or when users have high privacy requirements. This makes it difficult to guarantee the privacy of this information, resulting in lower text recognition performance. Summary of the Invention
[0003] The embodiments of the present application provide a text recognition method, device, computer-readable medium and electronic device, which can, at least to a certain extent, avoid the leakage of sensitive information caused by subsequent screening after text recognition at the model level, thereby improving the privacy of information.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a text recognition method is provided, including obtaining a to-be-processed image containing text information; detecting each text area contained in the to-be-processed image; identifying the text information contained in each text area through a pre-trained first model, wherein the first model is trained by training data containing a negative sample area, and the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; and outputting the text information identified by the first model.
[0006] According to one aspect of an embodiment of the present application, a text recognition device is provided, including: an acquisition unit for acquiring a to-be-processed image containing text information; a detection unit for detecting each text area contained in the to-be-processed image; an identification unit for identifying the text information contained in each text area through a pre-trained first model, wherein the first model is trained by training data containing a negative sample area, and the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; and an output unit for outputting the text information identified by the first model.
[0007] In some embodiments of the present application, based on the aforementioned scheme, the text recognition device includes: a first selection unit, used to select a negative sample area from the at least two text area samples based on the recognition results of the at least two text area samples by the first model; and a first training unit, used to train the first model using the negative sample area selected from the at least two text areas as a new text area sample.
[0008] In some embodiments of the present application, based on the aforementioned scheme, the first selection unit includes: a first calculation unit, used to calculate the loss value corresponding to each text area based on the recognition result of the at least two text area samples by the first model; a second calculation unit, used to determine the average loss corresponding to the at least two text area samples based on the loss values corresponding to the text areas; and a second selection unit, used to select a negative sample area from the at least two text area samples if the average loss is less than a loss threshold.
[0009] In some embodiments of the present application, based on the aforementioned scheme, the second selection unit is configured to: determine the average sliding loss based on the average loss and the sliding parameter; and select the text area corresponding to the loss value less than the average sliding loss as the negative sample area.
[0010] In some embodiments of the present application, based on the aforementioned scheme, the image to be processed includes an inspection report; the text recognition device also includes: a first recognition unit, used to identify the inspection information in the inspection report through the first model; a first adjustment unit, used to increase the loss value corresponding to the inspection report if the inspection information matches the preset information, to obtain an increased loss value; a second training unit, used to train the first model based on the increased loss value and the negative sample area.
[0011] In some embodiments of the present application, based on the aforementioned scheme, each text area contained in the image to be processed is detected by a pre-trained second model; the text recognition device also includes: a third selection unit, used to determine the model loss value based on the positive sample pixel points corresponding to the text area detected in the sample image and the negative sample pixel points selected from the non-text area; a third training unit, used to back-propagate the model loss value to obtain the second model.
[0012] In some embodiments of the present application, based on the aforementioned scheme, the text recognition device also includes: an area recognition unit, used to identify the text area containing text fragments and the non-text area not containing text fragments in the sample image; a fourth selection unit, used to select the negative sample pixel points from the non-text area.
[0013] In some embodiments of the present application, based on the aforementioned scheme, the fourth selection unit includes: a number recognition unit, used to identify the number of positive sample pixels corresponding to the text area; a third calculation unit, used to determine the number of negative sample pixels to be selected based on the product between the number of positive sample pixels and the positive-negative sample ratio; and a fifth selection unit, used to select the number of negative sample pixels from the non-text area.
[0014] In some embodiments of the present application, based on the aforementioned scheme, the fifth selection unit is configured to: determine the loss value corresponding to each pixel in the sample image based on the pixel label of each pixel in the text area and the sample image; and select pixel points with smaller loss values corresponding to each pixel from the non-text area as the negative sample pixels.
[0015] In some embodiments of the present application, based on the aforementioned scheme, the text information includes inspection information in the inspection report of the image to be processed; the text recognition device also includes: an abnormality recognition unit, used to identify inspection items in the inspection information, and identify abnormal items in the inspection information that exceed inspection indicators; an abnormality display unit, used to distinguish and display relevant information of the inspection items from relevant information of the abnormal items.
[0016] According to one aspect of an embodiment of the present application, a training method for a text recognition model is provided, characterized in that the text recognition model includes a first model for recognizing text, and the training method of the first model includes: inputting training data containing a negative sample area into a recognition network to obtain a recognition result; the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; determining a loss value of the first model based on the recognition result and the set output information; and obtaining the first model through training based on the loss value of the first model.
[0017] According to one aspect of an embodiment of the present application, a text recognition device is provided, including: a recognition unit, used to input training data containing a negative sample area into a recognition network to obtain a recognition result; the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; a loss unit, used to determine the loss value of the first model based on the recognition result and the set output information; and a training unit, used to train the first model based on the loss value of the first model.
[0018] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the text recognition method as described in the above embodiment is implemented.
[0019] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the text recognition method as described in the above embodiment.
[0020] In the technical solutions provided in some embodiments of the present application, since the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information, after the first model for text recognition is obtained through training of the negative sample area, the set output information can be directly output when the text area contains sensitive information, thereby avoiding the risk of sensitive information leakage caused by subsequent screening after the text is recognized at the model level, and improving the privacy of the information.
[0021] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are incorporated into and constitute a part of the specification, illustrating embodiments consistent with the present application and, together with the specification, explaining the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0023] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied;
[0024] Figure 2 A schematic diagram showing a technical solution to which the embodiments of the present application can be applied;
[0025] Figure 3 Schematically shows a flow chart of a text recognition method according to an embodiment of the present application;
[0026] Figure 4 A schematic diagram schematically shows a text area in a picture to be processed according to an embodiment of the present application;
[0027] Figure 5 Schematically shows a flow chart of a second model for training text detection according to an embodiment of the present application;
[0028] Figure 6 A schematic diagram schematically illustrates a second model of text detection according to an embodiment of the present application;
[0029] Figure 7 A schematic diagram of a detection model according to an embodiment of the present application is schematically shown;
[0030] Figure 8 A flowchart for selecting negative sample pixels according to an embodiment of the present application is schematically shown;
[0031] Figure 9 A schematic diagram of a text recognition network according to an embodiment of the present application is schematically shown;
[0032] Figure 10 A flowchart of selecting a negative sample area from at least two text area samples according to an embodiment of the present application is schematically shown;
[0033] Figure 11 A schematic diagram of a negative sample area-based training method provided in an embodiment of the present application;
[0034] Figure 12 A flowchart for detecting and identifying medical images provided in an embodiment of the present application;
[0035] Figure 13 A block diagram of a text recognition device according to an embodiment of the present application is shown;
[0036] Figure 14 A block diagram of a text recognition device according to an embodiment of the present application is shown;
[0037] Figure 15 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.
[0039] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps etc. can be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0040] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0041] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0042] Figure 1 A schematic diagram shows an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied.
[0043] like Figure 1 As shown, the system architecture may include terminal devices (such as Figure 1 101, tablet computer 102, and portable computer 103, which may also be a desktop computer, etc.), network 104, and server 105. Network 104 is a medium for providing a communication link between the terminal device and server 105. Network 104 can include various connection types, such as wired communication links, wireless communication links, etc.
[0044] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as needed. For example, the server 105 may be a server cluster consisting of multiple servers.
[0045] A user can use a terminal device to interact with server 105 via network 104 to receive or send messages, etc. Server 105 can be a server that provides various services. For example, if a user uploads an image to be processed to server 105 using terminal device 103 (or terminal device 101 or 102), server 105 can obtain the image to be processed that contains text information and detect the various text regions within the image to be processed. The server 105 then uses a pre-trained first model for text recognition to identify the text information contained in each text region. The first model is trained using training data containing negative sample regions, where the negative sample regions include: text regions containing sensitive information and set output information corresponding to the text regions containing sensitive information. The server then outputs the text information identified by the first model. By training the first model for text recognition based on text regions containing sensitive information and their set output information, the server directly outputs the set output information when sensitive information is contained in the text region. This avoids the risk of sensitive information leakage caused by subsequent text recognition at the model level, thereby improving the privacy of the information.
[0046] It should be noted that the text recognition method provided in the embodiments of the present application is generally executed by the server 105, and accordingly, the text recognition device is generally provided in the server 105. However, in other embodiments of the present application, the terminal device may also have similar functions to the server, thereby executing the text recognition solution provided in the embodiments of the present application.
[0047] Figure 2 A schematic diagram showing a technical solution to which an embodiment of the present application can be applied.
[0048] like Figure 2 As shown, the execution subject of the embodiment of the present application can be a terminal device, such as an artificial intelligence (AI) device, a user's mobile phone 210, etc., which is not limited here.
[0049] For example, a user uses a mobile phone to take a picture of a document containing text information to be processed. In this embodiment, the picture to be processed may be a hospital test report 220, which contains text information corresponding to each test item. The text regions contained in the picture to be processed are detected; the text information 230 contained in each text region is identified using a pre-trained first model for text recognition, wherein the first model is trained using training data containing negative sample regions, wherein the negative sample regions include: text regions containing sensitive information, and set output information corresponding to the text regions containing sensitive information; and the text information identified by the first model is output. The first model for text recognition is trained based on the text regions containing sensitive information and their set output information, so that the set output information is directly output when sensitive information is contained in the text region. This avoids the risk of sensitive information leakage caused by subsequent identification after text recognition at the model level, thereby improving the privacy of the information.
[0050] like Figure 2 As shown, in one embodiment of the present application, the terminal device outputs text information 230 identified by the first model on the user interface. The hospital test report 220 includes some personal information of the examinee, such as the examinee's name, gender, age, medical record number, etc. After detecting that this information is sensitive information through the first model, this embodiment directly outputs the set output information, such as directly displaying the text "Sensitive Information," while the rest of the information is displayed normally on the user interface. This embodiment uses this non-identification method to directly output the set output information when sensitive information is contained in the text area, thereby protecting the user's privacy and improving the confidentiality of the information.
[0051] The following is a detailed description of the implementation details of the technical solution of the embodiment of the present application:
[0052] Figure 3 A flowchart of a text recognition method according to an embodiment of the present application is shown. The text recognition method can be executed by a server, which can be Figure 1 Refer to the server shown in . Figure 3 As shown, the text recognition method includes at least steps S310 to S340, which are described in detail as follows:
[0053] In step S310, a picture to be processed containing text information is obtained.
[0054] In one embodiment of the present application, the method for obtaining the image to be processed can be to obtain it by real-time shooting with a device with a camera function, to retrieve the image to be processed stored locally, or to receive the image to be processed sent by other devices or storage devices, which is not limited here.
[0055] In one embodiment of the present application, the image to be processed is an image containing text information. For example, the image to be processed can be an inspection report, a transcript, a newspaper image, etc., which is not limited here.
[0056] For example, the terminal device can obtain a picture to be processed containing news information by photographing a newspaper; it can retrieve an image stored in the local storage space of the terminal device as a picture to be processed; it can also obtain a picture stored in the cloud or other storage location from other storage devices, servers, etc. as a picture to be processed.
[0057] In step S320, each text region contained in the image to be processed is detected.
[0058] In one embodiment of the present application, after obtaining the image to be processed, each text region contained in the image to be processed is detected from the image to be processed, wherein the text region refers to a region in the image to be processed that contains text information.
[0059] In this embodiment, during the process of detecting text areas, detection can be performed based on the order of text in a horizontal row. When a blank area is detected, the current detection is stopped, and the area containing text information in a row before the blank area is identified as a text area.
[0060] Figure 4 A schematic diagram of a text area in an image to be processed provided in an embodiment of the present application.
[0061] For example, based on Figure 2 By detecting the text information in the hospital test report, each text area 410 containing text information is obtained. The text area in the hospital test report is a text area in units of horizontal lines.
[0062] Figure 5 A flowchart of the second model for training text detection provided in an embodiment of the present application.
[0063] like Figure 5 As shown, the method for detecting each text area contained in the image to be processed in this embodiment can be obtained by detecting the second model through pre-training. In the process of training the second model, steps S510 to S520 can be included, which are described in detail as follows:
[0064] In step S510, a model loss value is determined based on positive sample pixels corresponding to the text area detected in the sample image and negative sample pixels selected from the non-text area.
[0065] In one embodiment of the present application, during the training of the second model, a detection network is first constructed based on a deep residual network (ResNet). The composition of the detection network of this embodiment is described in detail as follows:
[0066] Figure 6 Schematic diagram of the second model of text detection provided in the embodiment of the present application. Figure 6 As shown, the detection network is trained using a Progressive Scale Expansion Network (PSENet) model based on image segmentation. The PSENet model consists of two parts: the front end is a feature map F (630) that integrates multi-scale features through ResNet (610) and Feature Pyramid Network (FPN) (620); and the back end is a multi-branch prediction structure (640).
[0067] In one embodiment of the present application, when training a detection network based on sample images, the sample images are first normalized in their red, blue, and green (RBG) dimensions, and the sample images are processed to an unspecified size to improve the effectiveness and efficiency of model training. The normalized sample images are then input into the backbone network, i.e., ResNet (610), to extract visual features at different feature levels. Among them, the image corresponding to each feature level carries different features; the small-size feature map output from ResNet50 (610) is input into FPN (620) for multi-scale feature fusion. In FPN (620), the feature maps of different feature levels can be integrated to extract low-dimensional features in the feature map, namely P2~P5, and the features of different scales in the backbone network are effectively fused without any additional overhead to obtain a feature map that integrates multi-scale features; after obtaining the fused features of different levels, these feature maps with multi-scale features are fused to obtain F (630); F (630) is input into the multi-branch prediction structure 640 at the back end and projected into n branches to generate multiple segmentation results S1~S n-1 and S n Among them, each segmentation result is a segmentation mask of all text instances within a certain range, which is used to separate closely packed texts and obtain text regions.
[0068] Specifically, in the multi-branch prediction structure 640, the feature map obtained by the front-end FPN, which incorporates multi-scale features, is first mapped onto several branches. Each branch represents a prediction at a specific scale. The scale here corresponds to the kernel, i.e., each text instance in the prediction map. The kernel at the full scale corresponds to the actual size of the text instance to the size on the prediction map. The kernel at a small scale compresses each text instance on the prediction map to a certain size. Therefore, the prediction map corresponding to the kernel at the small scale can easily separate closely spaced text. Finally, starting with the prediction map corresponding to the smallest scale, all text instances in the entire image are obtained. The position of each text instance in the prediction map corresponds to the center position of each kernel. Each kernel is expanded in four directions, up, down, left, and right, using the corresponding kernel in the prediction map one scale larger as the target size, until it reaches the target size. Finally, after all prediction maps smaller than the full scale are expanded, the final image segmentation result is obtained. Each segmentation result is then wrapped with a bounding box to obtain the final detection result.
[0069] Furthermore, in this embodiment, when the application scenario is to use inspection reports as images to be processed, the image content in the inspection reports is relatively simple, and the backbone network does not need to have strong ability to extract image semantic features. Therefore, it is considered to simplify the backbone network to speed it up. Optionally, by replacing the RestNet network structure with a random network structure based on separable convolution and grouped convolution, the network model can run faster.
[0070] Figure 7 A schematic diagram of a detection model provided in an embodiment of the present application; wherein the left figure is a separable convolution structure, and the right figure is a grouped convolution structure.
[0071] like Figure 7 As shown in the left figure, in the separable convolution structure, the sample image (7101) is first input into the separable convolution structure, and through the separation channel (7102), a 1×1 convolution (7103) is first performed to output the first convolution result; the first convolution result is passed through the batch normalization linear rectification function (BatchNormalizationRectifiedLinearUnit, BNReLU), and a 3×3 depth filter convolution 3×3DWConv (7104) is performed to obtain the second convolution result; the second convolution result is passed through batch normalization (BatchNormalization, BN), and a 1×1 convolution is performed again (7105), and the output result is processed by BNReLU to output the third convolution result, and the third convolution result is connected and fused with the separation data output by the separation channel (7106), and the final output result (7108) is obtained through the random channel (7107).
[0072] like Figure 7As shown in the right figure, in the grouped convolution structure, the sample image (7201) is first grouped to obtain the first sample and the second sample, and the first sample is subjected to 3×3 depth filter convolution (7202) to obtain the fourth convolution result, where the convolution step size is 2; the fourth convolution result is subjected to BN processing and 1×1 convolution processing (7203) to obtain the fifth convolution result; at the same time, the second sample is subjected to 1×1 convolution processing (7204) to obtain the sixth convolution result; the sixth convolution result is subjected to BNReLU processing and 3×3 depth filter convolution (7205) to obtain the seventh convolution result; the seventh convolution result is subjected to 1×1 convolution processing (7206) to obtain the eighth convolution result; the BNReLU processing result of the fifth convolution result and the BN ReLU processing result of the eighth convolution result are connected and fused (7207), and the final output result (7209) is obtained through a random channel (7208).
[0073] In one embodiment of the present application, Figure 8 As shown, before determining the model loss value based on the positive sample pixels corresponding to the text area detected in the sample image and the negative sample pixels selected from the non-text area in step S510, steps S810 to S820 are also included, which are detailed as follows:
[0074] In step S810 , text regions containing text segments and non-text regions not containing text segments are identified in the sample image.
[0075] In one embodiment of the present application, during the training process, the model does not treat different text instances differently. We hope that the model will be more accurate in detecting indicator items and automatically filter out sensitive information when it is detected. By identifying the text area containing text information and the non-text area not containing text information in the sample image, wherein the pixels in the text area are positive sample pixels, in this embodiment, negative sample pixels are selected from the non-text area based on the positive sample pixels, so as to calculate the model loss value of the detection model based on the positive sample pixels and the negative sample pixels, and the detection network is trained based on the model loss value to obtain a second model.
[0076] In step S820 , negative sample pixels are selected from the non-text area.
[0077] In one embodiment of the present application, the above step of selecting negative sample pixels from the non-text area specifically includes:
[0078] Identify the number of positive sample pixels corresponding to the text area;
[0079] The number of negative sample pixels to be selected is determined based on the product of the number of positive sample pixels and the positive-negative sample ratio;
[0080] A number of negative sample pixels are selected from the non-text area.
[0081] In one embodiment of the present application, the pixels in the text area in this embodiment are positive sample pixels. When identifying the number of positive sample pixels, it can be determined based on the image resolution of the original sample image, or the image features of the text area and the non-text area can be uniformly processed to determine the number of positive sample pixels.
[0082] In one embodiment of the present application, a positive-to-negative sample ratio is pre-set, and the product of the positive-to-negative sample ratio and the number of positive sample pixels is calculated to obtain the number of negative sample pixels to be selected, so as to select negative sample pixels from the non-text area based on the number of negative sample pixels.
[0083] For example, let the positive-to-negative sample ratio be r, and the total area of positive samples containing text information in a sample image be S, that is, the number of positive sample pixels is S. The calculated number of negative sample pixels is r*S. For example, when r = 5, the calculated number of negative sample pixels required is 5S.
[0084] It should be noted that in many cases, the area of the text area in the sample image is different from the area of the non-text area, and the area of the non-text area may be smaller than the area of the text area. In this case, in order to ensure the number of selected negative sample pixels, repeated selections can be made from the non-text area to ensure that the ratio between the number of negative sample pixels and the number of positive sample pixels is constant, thereby ensuring the accuracy of the calculation of the model loss value.
[0085] In one embodiment of the present application, after determining the positive sample pixels and negative sample pixels that participate in calculating the model loss value, the model loss value is calculated based on the positive sample pixels and the negative sample pixels. The specific calculation method can be calculated based on the loss function method, which is not detailed here.
[0086] In one embodiment of the present application, the process of selecting negative sample pixels from the non-text area specifically includes:
[0087] Determine the loss value corresponding to each pixel in the sample image based on the pixel label of each pixel in the text area and the sample image;
[0088] Pixels with smaller loss values corresponding to each pixel in the non-text area are selected as negative sample pixels.
[0089] In one embodiment of the present application, after detecting text and non-text areas, the loss value corresponding to each pixel in the non-text area is calculated based on the pixel labels corresponding to each pixel in the sample image. Based on the loss values corresponding to each pixel, pixels with relatively small loss values are selected from the non-text area as negative sample pixels.
[0090] Furthermore, in order to better reflect the role of negative sample pixels in this application, the number of negative sample pixels can be determined in combination with the number of positive sample pixels, and then pixels with a smaller loss value than the number of negative sample pixels can be selected from the non-text area as negative sample pixels.
[0091] For example, the ratio of positive to negative samples is r, and the total area of positive samples containing text information in a sample image is S. That is, the number of positive sample pixels is S, and the calculated number of negative sample pixels is r*S. During the detection model training process, a loss value is calculated for each pixel in the image, and the loss values of each pixel are sorted. The r*S negative sample pixels with the smallest loss values are selected from the non-text area, and these are combined with the S positive sample pixels to calculate the overall model loss value of the detection network.
[0092] In step S520, the model loss value is back-propagated and trained to obtain a second model.
[0093] In one embodiment of the present application, after the model loss value is calculated, a neural network back propagation calculation is performed based on the model loss value to continuously update various parameters in the model, so that the model loss value is continuously reduced, thereby making the output data more ideal and obtaining a second model.
[0094] In this embodiment, by determining the number of positive sample pixels and the data of negative sample pixels, and based on the loss value of each pixel, a certain number of negative sample pixels with lower loss values are selected, that is, negative sample pixels with lower recognition effects that are several times higher than the number of positive sample pixels, to participate in the calculation of the model loss value, thereby improving the model loss value. After backpropagation training of the second model based on the model loss value, the accuracy of the second model training is guaranteed, and the text area is accurately detected by the second model.
[0095] In step S330, the text information contained in each text area is identified by a pre-trained first model, wherein the first model is trained by training data containing negative sample areas, and the negative sample areas include: text areas containing sensitive information, and set output information corresponding to the text areas containing sensitive information.
[0096] In one embodiment of the present application, a first model is pre-trained and used to recognize text information contained in a text region. The training samples of the first model include negative sample regions corresponding to text regions containing sensitive information, as well as set output information corresponding to such regions. The recognition network is trained based on the text regions containing sensitive information and their corresponding output information. When the text information in the text region is detected as sensitive information, the network does not perform text recognition and directly outputs the set output information, thereby achieving a desensitization effect for text recognition and protecting user privacy.
[0097] Furthermore, due to the individuality of the images being processed, they may contain various information other than sensitive information, such as noise. The processing methods for these situations are the same as those for sensitive information and are not detailed here. This approach can reduce the accuracy of noise processing in the images being processed, resulting in more accurate recognition results.
[0098] In one embodiment of the present application, the first model is trained by a recognition network based on Connectionist Temporal Classification (CTC), wherein the input is the text region output by the second model, and the output is specific text information or set output information.
[0099] Figure 9 A schematic diagram of a text recognition network provided in an embodiment of the present application.
[0100] like Figure 9 As shown, the processing flow of the recognition network is from bottom to top. First, the text area is preprocessed, such as normalizing the size to obtain a text area of uniform height (910); the text area (910) is sent to the visual geometry group (Visual Geometry Group, VGG) to extract visual features (920); then the extracted visual features (920) are reorganized to obtain recombined features (930); the recombined features (930) are sent to the forward and backward combined long short-term memory network (Bi-directional Long Short-Term Memory, Bi-LSTM) (940) to obtain semantic information in the image; finally, CTC (950) is used to enable it to find the probability transfer matrix between each word in the sentence and recognize the text information in the text area.
[0101] In one embodiment of the present application, the process of obtaining the parameters of the first model based on the above-mentioned recognition network training includes the following steps:
[0102] Selecting a negative sample region from the at least two text region samples based on recognition results of the at least two text region samples by the first model;
[0103] The first model is trained using negative sample regions selected from at least two text regions as new text region samples.
[0104] In one embodiment of the present application, during the training of a recognition network, at least two text region samples are input as a batch of text region samples into the recognition network to obtain recognition results. From these recognition results, text region samples with lower recognition effects are selected as negative sample regions, and targeted training is performed based on these negative sample regions to obtain more accurate parameters for the first model.
[0105] In one embodiment of the present application, Figure 10 As shown, the process of selecting a negative sample region from at least two text region samples based on the recognition results of the at least two text region samples by the first model includes steps S1010 to S1030:
[0106] In step S1010, based on the recognition results of the first model for at least two text region samples, the loss value corresponding to each text region is calculated.
[0107] In one embodiment of the present application, at least two text region samples are input into a recognition network to obtain recognition results corresponding to each text region. Based on the recognition results and the text labels assigned to the text regions, a loss value corresponding to each text region is calculated. The specific method for calculating the loss value can be based on a loss function, which is not detailed here.
[0108] In step S1020 , the average loss corresponding to at least two text region samples is determined according to the loss value corresponding to each text region.
[0109] In one embodiment of the present application, after calculating the loss value corresponding to each text area, the average loss corresponding to the batch of text area samples is determined based on the loss value corresponding to each text area, so as to measure the recognition effect of the batch of text area samples based on the average loss.
[0110] Alternatively, the average loss for a batch of text region samples can be calculated by directly averaging the loss values for each text region. Alternatively, a weighted average can be calculated based on the size of each text region and the weights and loss values. This is not a limitation here.
[0111] In step S1030 , if the average loss is less than the loss threshold, a negative sample region is selected from at least two text region samples.
[0112] In one embodiment of the present application, after calculating the average loss, if the average loss is less than a preset loss threshold, it means that the recognition effect of this batch of text areas is low, which may be because there are text areas that are more difficult to recognize. Therefore, negative sample areas are selected from this batch of text area samples.
[0113] For example, the loss threshold is set to 1.0. During the training process based on a batch of text region samples, when the calculated average loss is less than 1.0, negative sample areas are selected from the text area for targeted training to further improve the model training effect.
[0114] In one embodiment of the present application, if the average loss is greater than or equal to the loss threshold, the negative sample area is not selected and training continues based on the original training samples.
[0115] In one embodiment of the present application, the process of selecting a negative sample region from the text region in step S1030 specifically includes:
[0116] Then, the average sliding loss is determined based on the average loss and sliding parameters;
[0117] The text area corresponding to the loss value less than the average sliding loss is selected as the negative sample area.
[0118] In one embodiment of the present application, after calculating the average loss, if the average loss is less than the loss threshold, the average sliding loss is determined based on the average loss and the sliding parameter, so that the text area corresponding to the loss value less than the average sliding loss is selected as the negative sample area for targeted training.
[0119] Specifically, the formula for calculating the average sliding loss is: a·LOSS_Y+(1-a)·LOSS_A; where a represents the loss parameter, LOSS_Y represents the loss threshold, and LOSS_A represents the average loss.
[0120] For example, if the loss threshold is set to 1.0 and a is set to 0.8 during training based on a batch of text region samples, if the calculated average loss is 0.9, then the average sliding loss is 0.8×1.0+(1-0.8)×0.9=0.98. If the loss corresponding to a text region is less than 0.98, the text region is selected as a negative sample region.
[0121] Figure 11 A schematic diagram of a negative sample region-based training method provided in an embodiment of the present application.
[0122] like Figure 11As shown, a batch of text region training samples 1110 includes multiple text regions. After training based on each text region in text region training samples 1110, recognition results 1120 corresponding to each text region are obtained. Based on the set labels corresponding to each text region and the recognition results, the loss value of each text region is determined. Based on the loss value of each text region and the above method, some of the text regions are selected as negative sample regions, namely 1121, 1122, and 1123. These negative sample regions are then used in the next round of training, namely 1131.
[0123] Furthermore, in this embodiment, the number of text regions in a batch of text region training samples is certain. In order to ensure the uniformity of training, the remaining number of text regions is padded with the remaining text regions, that is, 1132, and finally the next batch of text region samples 1130 is obtained, and then the next batch of text region samples 1130 is put into the next training.
[0124] For example, the image to be processed in this embodiment may be an inspection report. In order to highlight the inspection information in the inspection report, the following steps may be included in the process of training the first model in this embodiment:
[0125] Inputting the inspection report into the first model to obtain inspection information in the inspection report;
[0126] If the inspection information matches the preset information, the loss value corresponding to the inspection report is increased to obtain an increased loss value;
[0127] Based on increasing the loss value and the negative sample area, the first model is trained to obtain parameters of the first model.
[0128] Specifically, a vocabulary is first constructed from the words and phrases of the inspection items. The inspection report is then fed into the first model. After obtaining the inspection information in the inspection report, if the recognized inspection information has a high degree of match in the vocabulary, the text instance is considered to correspond to the inspection item in the original image. To improve the model's recognition of these text instances, the corresponding loss is artificially increased to obtain an increased loss value. The parameters of the first model are then trained based on the increased loss value and the negative sample area.
[0129] In this embodiment, by adjusting the model loss value in the detection model and adjusting the model training samples and loss value in the recognition model, the obtained text recognition model performs better on the text information we want. At the same time, it also filters out sensitive information and image noise in the inspection report, reducing the pressure on the back-end engine processing and correspondingly increasing the accuracy of the entire system.
[0130] In step S340 , the text information recognized by the first model is output.
[0131] In one embodiment of the present application, the image to be processed is passed through the first model to obtain text information in the image to be processed, and the text information is output. The output method can be displayed on the user interface of the terminal device, or a text file can be generated based on the text information and directly output to the text file, which is not limited here.
[0132] Figure 12 A flowchart for detecting and identifying medical images provided in an embodiment of the present application.
[0133] like Figure 12 As shown, in one embodiment of the present application, a medical image is input in step S1210, and the image is pre-processed in step S1220 so that the image size is compressed to a fixed size and the pixels are converted into a single-channel image to facilitate uniform processing of the image; in step S1230, the pre-processed medical image is input into the detection model; in step S1240, the text box coordinates detected by the detection model are obtained; in step S1250, multiple small images are cropped according to the text box coordinates, and in step S1260, the multiple small images are sent to the recognition model; in step S1270, the text fragments corresponding to the small images are identified; in step S1280, the text box coordinates and the text fragments are assembled; in step S1290, the overall recognition result is returned, and the recognized text information is output.
[0134] In this embodiment, the medical image is first input into the detection model to obtain a small image corresponding to the text box coordinates, and then the small image is input into the recognition model to obtain the text information therein. The detection model and recognition model obtained based on the training can obtain the text information in the medical image more accurately and efficiently.
[0135] In one embodiment of the present application, after the process of outputting the text information recognized by the first model in step S340, the method further includes:
[0136] Identifying inspection items in the inspection information, and identifying abnormal items in the inspection information that exceed inspection indicators;
[0137] The relevant information of the inspection item and the relevant information of the abnormal item are displayed separately.
[0138] In one embodiment of the present application, the text information includes inspection information from an inspection report, specifically including information corresponding to each inspection item. After outputting the text information identified by the first model, the inspection items in the inspection information are identified to obtain information associated with each inspection item from pre-set inspection item information. The information is then displayed simultaneously with the identified inspection information to remind the user of the meaning of the relevant information.
[0139] In one embodiment of the present application, based on the preset normal threshold range corresponding to each inspection item, that is, the inspection index, abnormal items that exceed the inspection index are determined from each inspection item, and these abnormal items are displayed in a preset display method to alert relevant personnel to the abnormal inspection items.
[0140] For example, after obtaining the test information from a medical test report via a mobile phone, the electronic test information is displayed on the mobile phone. Abnormal items in the test information are identified and highlighted in red. In addition, medical interpretations of each indicator item are provided for the user's reference, improving the readability of the test report.
[0141] In one embodiment of the present application, the text recognition method can be applied in a medical environment, wherein the image to be processed includes the examiner's medical examination report, and the sensitive information includes the examiner's identity information in the medical examination report. For example, the identity information can be the examiner's name, gender, telephone number, and ID number, etc., which is not limited here.
[0142] In this embodiment, a medical test report is obtained, each report text area contained in the medical test report is detected, and the medical test information contained in each report text area is identified by a first model. Finally, the medical test information identified by the first model is output, and output information is set for the detected sensitive area, where the sensitive area is the area corresponding to the identity information. For example, the set output information can be "sensitive information". After determining that a certain report text area includes the identity information of the examiner, "sensitive information" is output corresponding to the report text area. In this embodiment, by not identifying the examiner's identity information and directly outputting the set output information, the privacy of the user information in the medical test report is protected, thereby improving the credibility of the text recognition method.
[0143] In one embodiment of the present application, a training method for a text recognition model is provided, wherein the text recognition model includes a first model for recognizing text, and the training method for the first model includes: inputting training data containing a negative sample area into a recognition network to obtain a recognition result; the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; determining a loss value of the first model based on the recognition result and the set output information; and obtaining the first model through training based on the loss value of the first model.
[0144] In one embodiment of the present application, the text recognition model includes a second model for detecting text areas in an image to be processed, and the training method of the second model includes: identifying text areas containing text information and non-text areas not containing text information in the sample image; selecting negative sample pixels from the non-text area based on the positive sample pixels corresponding to the text area; determining the model loss value of the second model based on the set labels corresponding to the positive sample pixels, negative sample pixels and each pixel in the text area; and back-propagating the model loss value to obtain the second model.
[0145] In one embodiment of the present application, the text recognition model includes a second model for detecting text regions and a first model for recognizing text. The text regions output by the second model serve as input to the first model, which then identifies text from the text regions. The training methods and data processing methods for the two models do not interfere with each other. The specific model training and data processing methods are described above and are not detailed here.
[0146] The following describes an embodiment of a text recognition device of the present application, which can be used to execute the text recognition method of the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the text recognition method of the above embodiment of the present application.
[0147] Figure 13 A block diagram of a text recognition device according to an embodiment of the present application is shown.
[0148] Reference Figure 13 As shown, a text recognition device 1300 according to an embodiment of the present application includes: an acquisition unit 1310, used to acquire a to-be-processed image containing text information; a detection unit 1320, used to detect each text area contained in the to-be-processed image; an identification unit 1330, used to identify the text information contained in each text area through a pre-trained first model, wherein the first model is trained by training data containing negative sample areas, and the negative sample areas include: text areas containing sensitive information, and set output information corresponding to the text areas containing sensitive information; an output unit 1340, used to output the text information identified by the first model.
[0149] In some embodiments of the present application, based on the aforementioned scheme, the text recognition device 1300 includes: a first selection unit, used to select a negative sample area from at least two text area samples based on the recognition results of the at least two text area samples by the first model; and a first training unit, used to train the first model using the negative sample area selected from the at least two text areas as a new text area sample.
[0150] In some embodiments of the present application, based on the aforementioned scheme, the first selection unit includes: a first calculation unit, used to calculate the loss value corresponding to each text area based on the recognition results of at least two text area samples by the first model; a second calculation unit, used to determine the average loss corresponding to at least two text area samples based on the loss value corresponding to each text area; and a second selection unit, used to select a negative sample area from at least two text area samples if the average loss is less than a loss threshold.
[0151] In some embodiments of the present application, based on the aforementioned scheme, the second selection unit is configured to: determine the average sliding loss based on the average loss and the sliding parameter; and select the text area corresponding to the loss value less than the average sliding loss as the negative sample area.
[0152] In some embodiments of the present application, based on the aforementioned scheme, the image to be processed includes an inspection report; the text recognition device 1300 also includes: a first recognition unit, used to identify the inspection information in the inspection report through a first model; a first adjustment unit, used to increase the loss value corresponding to the inspection report if the inspection information matches the preset information, to obtain an increased loss value; a second training unit, used to train the first model based on the increased loss value and the negative sample area.
[0153] In some embodiments of the present application, based on the aforementioned scheme, each text area contained in the image to be processed is detected by a pre-trained second model; the text recognition device 1300 also includes: a third selection unit, which is used to determine the model loss value based on the positive sample pixel points corresponding to the text area detected in the sample image and the negative sample pixel points selected from the non-text area; a third training unit, which is used to back-propagate the model loss value to obtain a second model.
[0154] In some embodiments of the present application, based on the aforementioned scheme, the text recognition device 1300 also includes: a region recognition unit, used to identify text regions containing text fragments and non-text regions that do not contain text fragments in the sample image; and a fourth selection unit, used to select negative sample pixels from the non-text regions.
[0155] In some embodiments of the present application, based on the aforementioned scheme, the fourth selection unit includes: a number recognition unit, used to identify the number of positive sample pixels corresponding to the text area; a third calculation unit, used to determine the number of negative sample pixels to be selected based on the product between the number of positive sample pixels and the positive-negative sample ratio; and a fifth selection unit, used to select the number of negative sample pixels from the non-text area.
[0156] In some embodiments of the present application, based on the aforementioned scheme, the fifth selection unit is configured to: determine the loss value corresponding to each pixel in the sample image according to the pixel label of each pixel in the text area and the sample image; and select pixel points with smaller loss values corresponding to each pixel from the non-text area as negative sample pixels.
[0157] In some embodiments of the present application, based on the aforementioned scheme, the text information includes inspection information in the inspection report as the image to be processed; the text recognition device 1300 also includes: an abnormality recognition unit, used to identify inspection items in the inspection information, and identify abnormal items in the inspection information that exceed the inspection indicators; an abnormality display unit, used to distinguish and display relevant information of the inspection items from relevant information of the abnormal items.
[0158] The following describes an embodiment of a text recognition model training device of the present application, which can be used to execute the text recognition model training method described in the above embodiments of the present application. For details not disclosed in the device embodiment of the present application, please refer to the embodiment of the text recognition model training method described in the above embodiments of the present application.
[0159] Figure 14 A block diagram of a text recognition device according to an embodiment of the present application is shown.
[0160] Reference Figure 14 As shown, a training device 1400 for a text recognition model according to an embodiment of the present application includes: a recognition unit 1410, used to input training data containing a negative sample area into a recognition network to obtain a recognition result; the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; a loss unit 1420, used to determine the loss value of the first model based on the recognition result and the set output information; a training unit 1430, used to train the first model based on the loss value of the first model.
[0161] In one embodiment of the present application, the text recognition model includes a second model for detecting text areas in the image to be processed, and the training device 1400 also includes: a detection unit for identifying the text area containing text information and the non-text area not containing text information in the sample image; a selection unit for selecting negative sample pixels from the non-text area based on the positive sample pixels corresponding to the text area; a determination unit for determining the model loss value of the second model based on the set labels corresponding to the positive sample pixels, the negative sample pixels and each pixel in the text area; and a reverse training unit for back-propagating the model loss value to obtain the second model.
[0162] Figure 15 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown.
[0163] It should be noted that Figure 15 The computer system 1500 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0164] like Figure 15 As shown, computer system 1500 includes a central processing unit (CPU) 1501, which can perform various appropriate actions and processes according to the program stored in read-only memory (ROM) 1502 or the program loaded from storage unit 1508 into random access memory (RAM) 1503, such as executing the method in the above embodiment. Various programs and data required for system operation are also stored in RAM 1503. CPU 1501, ROM 1502 and RAM 1503 are connected to each other via bus 1504. Input / output (I / O) interface 1505 is also connected to bus 1504.
[0165] The following components are connected to the I / O interface 1505: an input section 1506 including a keyboard, a mouse, and the like; an output section 1507 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1508 including a hard disk; and a communication section 1509 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 1509 performs communication processing via a network such as the Internet. A drive 1510 is also connected to the I / O interface 1505 as needed. Removable media 1511, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1510 as needed, so that computer programs read from the removable media can be installed in the storage section 1508 as needed.
[0166] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1509, and / or installed from a removable medium 1511. When the computer program is executed by the central processing unit (CPU) 1501, the various functions defined in the system of the present application are executed.
[0167] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0168] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0169] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0170] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiments, or may exist independently without being incorporated into the electronic device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device implements the method described in the above embodiments.
[0171] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0172] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments 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.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
[0173] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.
[0174] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for character recognition, characterized in that: include: Get the image to be processed containing text information; Detecting each text area contained in the image to be processed; the image to be processed includes an inspection report; The text information contained in each text area is identified by a pre-trained first model, wherein the first model is trained by training data containing a negative sample area, and the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; the recognition result of the first model for the detected sensitive area is the set output information, and the sensitive area is an area corresponding to the identity information; the training process of the pre-trained first model includes: identifying the inspection information in the inspection report by the first model; if the inspection information matches the preset information, increasing the loss value corresponding to the inspection report to obtain an increased loss value; based on the increased loss value and the negative sample area, training the first model; Output the text information recognized by the first model.
2. The method according to claim 1, characterized in that The method further comprises: Based on the recognition results of the first model on at least two text region samples, selecting a negative sample region from the at least two text region samples; The first model is trained using negative sample regions selected from the at least two text regions as new text region samples.
3. The method according to claim 2, characterized in that Based on the recognition results of the first model on at least two text region samples, selecting a negative sample region from the at least two text region samples includes: Calculate the loss value corresponding to each text region based on the recognition result of at least two text region samples by the first model; Determining an average loss corresponding to the at least two text region samples according to the loss values corresponding to the text regions; If the average loss is less than a loss threshold, a negative sample region is selected from the at least two text region samples.
4. The method according to claim 3, characterized in that Selecting a negative sample area from the at least two text area samples includes: Determining an average sliding loss based on the average loss and the sliding parameter; The text area corresponding to the loss value being less than the average sliding loss is selected as the negative sample area.
5. The method according to claim 1, characterized in that Detecting each text area contained in the image to be processed by using a pre-trained second model; the method further includes: Determine the model loss value based on the positive sample pixels corresponding to the text area detected in the sample image and the negative sample pixels selected from the non-text area; The model loss value is back-propagated and trained to obtain the second model.
6. The method according to claim 5, characterized in that Before determining the model loss value based on the positive sample pixels corresponding to the text area detected in the sample image and the negative sample pixels selected from the non-text area, the method further includes: Identifying a text region containing a text segment and a non-text region not containing a text segment in the sample image; The negative sample pixel points are selected from the non-text area.
7. The method according to claim 6, characterized in that Selecting the negative sample pixel point from the non-text area includes: Identify the number of positive sample pixels corresponding to the text area; Determining the number of negative sample pixels to be selected according to the product of the number of positive sample pixels and the positive-negative sample ratio; A number of the negative sample pixels is selected from the non-text area.
8. The method according to claim 6, characterized in that Selecting the negative sample pixel point from the non-text area includes: Determine a loss value corresponding to each pixel in the sample image according to the text area and the pixel label of each pixel in the sample image; Pixels with relatively small loss values corresponding to the pixels are selected from the non-text area as the negative sample pixels.
9. The method according to claim 1, characterized in that: The text information includes inspection information in the inspection report of the image to be processed; After outputting the text information recognized by the first model, the method further includes: Identifying inspection items in the inspection information, and identifying abnormal items in the inspection information that exceed inspection indicators; The relevant information of the inspection item and the relevant information of the abnormal item are displayed separately.
10. The method according to claim 1, characterized in that The text recognition method is applied in a medical environment, the image to be processed includes a medical examination report of a tester, and the sensitive information includes the identity information of the tester in the medical examination report; the method includes: obtaining the medical examination report; detecting each report text area contained in the medical examination report; identifying the medical examination information contained in each report text area by using the first model; The medical examination information identified by the first model is output, and the set output information is output for the detected sensitive area, where the sensitive area is the area corresponding to the identity information.
11. A text recognition device, characterized in that: The character recognition device comprises: An acquisition unit, used for acquiring a to-be-processed picture containing text information; A detection unit, used to detect each text area contained in the image to be processed; the image to be processed includes an inspection report; A recognition unit, configured to recognize text information contained in each text area through a pre-trained first model, wherein the first model is trained by training data containing a negative sample area, and the negative sample area includes: a text area containing sensitive information, and set output information corresponding to the text area containing sensitive information; the recognition result of the first model for the detected sensitive area is the set output information, and the sensitive area is an area corresponding to the identity information; the training process of the pre-trained first model includes: recognizing the inspection information in the inspection report through the first model; if the inspection information matches the preset information, increasing the loss value corresponding to the inspection report to obtain an increased loss value; and training the first model based on the increased loss value and the negative sample area; An output unit is used to output the text information recognized by the first model.
12. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the text recognition method according to any one of claims 1 to 10 is implemented.
13. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the text recognition method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Method and system for conducting desensitization processing on medical image data
CN107239666A
Medical inspection report electronization method, storage equipment and mobile terminal
CN108962346A
A method and device for generating classification model
CN109961032A
Text detection model training method, text area and content determination method and device
CN110110715A