Text detection method, device, storage medium and computer equipment

Through the text detection method, the text area to be identified in the image to be detected is determined, and text recognition and entity comparison are performed, which solves the problems of low manual verification efficiency and low accuracy, and achieves efficient and accurate text detection.

CN114155535BActive Publication Date: 2025-03-11创优数字科技(广东)有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111485964.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-07
Publication Date
2025-03-11
Estimated Expiration
2041-12-07

AI Technical Summary

Technical Problem

In the prior art, the product launches fast, while the manual verification speed is slow, resulting in low inspection efficiency, and possible missed inspection or missed inspection, with low accuracy.

Method used

Provide a text detection method, including obtaining an image to be detected containing text, determining the text area to be recognized, identifying the text in the text area, extracting the target entity and comparing it with the standard entity, and determining whether the text is written correctly.

Benefits of technology

By narrowing the scope of text detection, we can improve the efficiency and accuracy of text recognition, reduce missed and missed inspections, and improve the accuracy of inspections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114155535B_ABST
    Figure CN114155535B_ABST
Patent Text Reader

Abstract

The text detection method, device, storage medium and computer equipment provided by the present application, when performing text detection on an image to be detected containing text, narrows the text detection range from the entire image to be detected to a single text area, which is beneficial to the efficiency and accuracy of subsequent text recognition and avoids the influence of other non-text areas; then the present application can recognize the text in the text area to be recognized and obtain the corresponding text recognition result, which contains all the text information in the image to be detected. On this basis, the present application can check the keywords in the text information, such as after extracting the target entity in the text recognition result, determine whether the text in the image to be detected is written correctly based on the comparison result between the target entity and the standard entity. This can not only ensure the correctness of the keywords in the image to be detected, but also reduce the computational complexity of text detection, thereby further improving the efficiency of text detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text recognition, and in particular to a text detection method, apparatus, storage medium and computer equipment. Background Art

[0002] At present, most products are sold with corresponding physical labels, and physical labels are mainly used to indicate the name, weight, volume, purpose and other information of the item, such as product description labels, price labels, main ingredient labels, specification labels, material labels, address labels, date labels, etc.

[0003] Generally, before a product is put on the shelf, it is necessary to check the content of the physical label of the product, such as whether the price in the physical label is wrong, whether the address is correct, whether there are text errors in the product description, etc. The existing inspection method mainly adopts manual verification. During the verification, the physical label is compared word by word with the real label stored in the PLM (Product Lifecycle Management) system. If an error is found, it is returned to the designer for re-modification. After the modification, it is manually re-checked until the design is correct.

[0004] However, due to the rapid speed of product updates and the slow speed of manual verification, a large amount of inspection work cannot be completed in a short period of time, resulting in low inspection efficiency. In addition, due to the large amount of inspection, missed inspections and wrong inspections may occur, resulting in low accuracy of manual inspections. Summary of the invention

[0005] The purpose of the present application is to solve at least one of the above-mentioned technical defects, especially the fact that the speed of product updates in the prior art is fast, while the speed of manual verification is slow, and a large amount of inspection work cannot be completed in a short time, resulting in low inspection efficiency. In addition, due to the large amount of inspection, missed inspections and wrong inspections may occur, resulting in the technical defect of low accuracy of manual inspection.

[0006] The present application provides a text detection method, the method comprising:

[0007] Get the image to be detected containing text;

[0008] Determining a text area to be recognized in the image to be detected;

[0009] Recognize the text in the text area to be recognized to obtain a text recognition result;

[0010] A target entity is extracted from the text recognition result, and the target entity is compared with a standard entity, and whether the text in the image to be detected is written correctly is determined according to the comparison result.

[0011] Optionally, determining a text area to be recognized in the image to be detected includes:

[0012] Get the target text area detection model;

[0013] The image to be detected is input into the target text region detection model to obtain the text region to be identified in the image to be detected output by the target text region detection model.

[0014] Optionally, obtaining the target text area detection model includes:

[0015] Get a first sample image containing text;

[0016] According to a preset division strategy, the first sample image is divided into a plurality of sub-sample images;

[0017] Marking the real image center point and real image size of each sub-sample image, and the real image coordinates of each sub-sample image in the first sample image;

[0018] Inputting each sub-sample image into a preset initial text region detection model in sequence, obtaining a predicted image center point and a predicted image size of each sub-sample image output by the initial text region detection model, and a predicted image coordinate of each sub-sample image in the first sample image;

[0019] Training the initial text region detection model with the goal of making the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image approach the real image center point, real image size, and real image coordinates of each sub-sample image in the first sample image;

[0020] When the initial text region detection model meets a preset first training condition, the trained initial text region detection model is used as a target text region detection model.

[0021] Optionally, recognizing the text in the text area to be recognized to obtain a text recognition result includes:

[0022] Locating text lines in the text area to be recognized to obtain at least one text line;

[0023] Obtain the target text recognition model;

[0024] Each text line is input into the target text recognition model in turn to obtain a text recognition result output by the target text recognition model.

[0025] Optionally, obtaining the target text recognition model includes:

[0026] Acquire a second sample image containing text, and obtain a plurality of training images after intercepting text lines in the second sample image;

[0027] After labeling the texts in each training image, a second sample label is obtained, where the second sample label is an index obtained by mapping the characters corresponding to the texts in each training image in the dictionary;

[0028] Inputting each training image into a preset initial text recognition model, respectively, to obtain a prediction label corresponding to each training image output by the initial text recognition model;

[0029] Training the initial text recognition model with the goal of making the predicted label close to the second sample label;

[0030] When the initial text recognition model meets the preset second training condition, the trained initial text recognition model is used as the target text recognition model.

[0031] Optionally, before inputting each training image into a preset initial text recognition model, the method further includes:

[0032] According to the preset enhancement strategy, data enhancement is performed on each training image.

[0033] Optionally, extracting the target entity in the text recognition result includes:

[0034] Determine the target NLP model;

[0035] The text recognition result is input into the target NLP model to obtain the target entity in the text recognition result output by the target NLP model.

[0036] Optionally, determining the target NLP model includes:

[0037] Get a third sample image containing text;

[0038] Segmenting the text in the third sample image, and marking the parts of speech of the segmented words, and determining the real entity category corresponding to each word after the part of speech is marked;

[0039] Inputting the third sample image into a preset initial NLP model to obtain a predicted entity category corresponding to each word predicted in the third sample image output by the initial NLP model;

[0040] Training the initial NLP model with the goal of making the predicted entity category corresponding to each predicted word close to the real entity category corresponding to the word;

[0041] When the initial NLP model meets the preset third training condition, the trained initial NLP model is used as the target NLP model.

[0042] Optionally, comparing the target entity with a standard entity in a database, and determining whether the text in the image to be detected is written correctly according to the comparison result, includes:

[0043] According to the product category corresponding to the target entity, extracting the standard entity corresponding to the product category from the database;

[0044] Calculate the cosine value between the word vector corresponding to the target entity and the word vector corresponding to the standard entity;

[0045] Comparing the cosine value with a preset cosine threshold;

[0046] If the cosine value is less than the preset cosine threshold, it is determined that the text in the image to be detected is incorrectly written;

[0047] If the cosine value is not less than the preset cosine threshold, it is determined that the text in the image to be detected is written correctly.

[0048] The present application also provides a text detection device, comprising:

[0049] An image acquisition module is used to acquire an image to be detected containing text;

[0050] A text region detection module, used to determine a text region to be identified in the image to be detected;

[0051] A text recognition module, used to recognize the text in the text area to be recognized and obtain a text recognition result;

[0052] The text detection module is used to extract the target entity in the text recognition result, and compare the target entity with the standard entity, and determine whether the text in the image to be detected is written correctly according to the comparison result.

[0053] The present application also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the text detection method as described in any one of the above embodiments.

[0054] The present application also provides a computer device, comprising: one or more processors, and a memory;

[0055] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the text detection method described in any one of the above embodiments is executed.

[0056] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0057] The text detection method, device, storage medium and computer equipment provided by the present application can first determine the text area to be identified in the image to be detected when performing text detection on an image to be detected containing text, thereby narrowing the text detection range from the entire image to be detected to a single text area, which is beneficial to the efficiency and accuracy of subsequent text recognition and avoids the influence of other non-text areas; then the present application can recognize the text in the text area to be identified and obtain the corresponding text recognition result, which contains all the text information in the image to be detected. On this basis, the present application can check the keywords in the text information, such as after extracting the target entity in the text recognition result, determine whether the text in the image to be detected is written correctly based on the comparison result between the target entity and the standard entity. This can not only ensure the correctness of the keywords in the image to be detected, but also reduce the computational complexity of text detection, thereby further improving the efficiency of text detection. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0059] Figure 1 A flowchart of a text detection method provided in an embodiment of the present application;

[0060] Figure 2 A schematic diagram of the structure of a physical label provided in an embodiment of the present application;

[0061] Figure 3 A schematic diagram of the result of named entity extraction provided in an embodiment of the present application;

[0062] Figure 4 A schematic diagram of a structure for intercepting a text line in a second sample image provided by an embodiment of the present application;

[0063] Figure 5 A structural schematic diagram of a text detection device provided in an embodiment of the present application;

[0064] Figure 6A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0066] Generally, before a product is put on the shelf, it is necessary to check the content of the physical label of the product, such as whether the price in the physical label is wrong, whether the address is correct, whether there are text errors in the product description, etc. The existing inspection method mainly adopts manual verification. During the verification, the physical label is compared word by word with the real label stored in the PLM (Product Lifecycle Management) system. If an error is found, it is returned to the designer for re-modification. After the modification, it is manually re-checked until the design is correct.

[0067] However, due to the rapid speed of product updates and the slow speed of manual verification, a large amount of inspection work cannot be completed in a short period of time, resulting in low inspection efficiency. In addition, due to the large amount of inspection, missed inspections and wrong inspections may occur, resulting in low accuracy of manual inspections.

[0068] Based on this, this application proposes the following technical solutions, see below for details:

[0069] In one embodiment, Figure 1 As shown, Figure 1 A flowchart of a text detection method provided in an embodiment of the present application; the present application provides a text detection method, which may include:

[0070] S110: Acquire an image to be detected containing text.

[0071] In this step, before performing text detection, an image to be detected containing text can be obtained, and the text in the image to be detected is obtained by extracting the text according to the relevant product data preset and stored in the database. For example, the image to be detected contains product name and address information, and the product name corresponds to the name of the product that has been produced, sold, or to be sold stored in the database, and the address information is the production address or agent address extracted from the database and related to the product name in the image to be detected.

[0072] Therefore, when detecting text in an image to be detected, the present application may refer to the standard information related thereto stored in the database to determine whether the text in the image to be detected is incorrect.

[0073] Furthermore, the image to be detected here can be a physical label image, a design poster image, or a product advertisement image. The physical label image here can contain text information such as product name, specifications, product features, precautions, storage method, production date, address information, price, etc. Schematically, Figure 2 As shown, Figure 2 A schematic diagram of the structure of a physical label provided in an embodiment of the present application.

[0074] Figure 2 The physical label includes the product name, such as invisible and traceless sanitary napkins; specifications, such as 8 pieces; storage methods, such as store in a cool, ventilated and dry place; precautions, such as do not discard in the toilet, and do not use if allergic; agents and addresses, product standards, hygiene standards, production date, product features, prices, etc. Of course, the content of different physical labels can be different or the same, depending on the actual situation, and there is no restriction here.

[0075] The text in this application can be text, such as Chinese characters, English, Russian, etc.; it can also be Arabic numerals, such as a specific price, etc.; it can also be a combination of text and Arabic numerals, such as 8 pieces per package; in addition, the text in this application can also contain mathematical characters, such as &, *, etc., which are not limited here.

[0076] S120: Determine a text area to be recognized in the image to be detected.

[0077] In this step, after the image to be detected containing text is acquired through S110, the text area to be recognized can be determined according to the image to be detected.

[0078] It is understandable that, due to the differences in the image size of different images to be detected, the layout of the text in the images to be detected, etc., if the text in the images to be detected is directly recognized, it will not only increase the difficulty of text recognition, but also reduce the accuracy of text recognition. Therefore, before recognizing the text in the images to be detected, the present application can first determine the text area to be recognized in the images to be detected, and then recognize the text in the text area to be recognized, which can reduce the difficulty of text recognition and ensure the accuracy of text recognition.

[0079] When determining the text area to be identified in the image to be detected, the present application can use the connected domain method, assuming that the color of the text in the image to be detected is consistent, and use color clustering to determine the text area to be identified; it can also be based on the edge detection method, using the relatively high contrast between the text and the background, first detecting the edge, then using morphological operators to connect the edges into text areas, and finally using heuristic rules for screening; it can also be based on the texture method, identifying the special texture of the text area in the image to be detected, and using the different texture features of the text area and the background area to detect, extract and identify the text; in addition, the present application can also use the text area contained in the image to be detected as a detection target, and use the target detection algorithm to detect the detection target in the image to be detected, so as to determine the text area to be identified in the image to be detected.

[0080] In a specific implementation, the present application can perform target detection on the image to be detected based on the CenterNet model. Since the resolution of the physical label is usually relatively large, such as hundreds of millions of pixels, it is difficult to detect small targets at large resolutions using general target detection algorithms; while using the CenterNet model to detect the target image, the anchor points assigned in the CenterNet model are only placed at the corresponding positions, there is no size box, and there is no manually set threshold for foreground and background classification, so the setting of hyperparameters is subtracted, reducing the difficulty of parameter adjustment; each target in the CenterNet model has only one positive anchor point, so NMS (non-maximum suppression) post-processing is not required; compared with traditional target detection models, the CenterNet model uses a larger resolution output feature map, so there is no need to use multiple feature map anchors; in addition, the CenterNet model does not need to perform classification processes and post-processing operations compared to other key point-based target detection methods (such as CornerNet and ExtremeNet), thereby effectively improving the target detection speed.

[0081] Furthermore, before determining the text area to be identified in the image to be detected, the present application can also perform a preprocessing operation on the image to be detected, so as to make the recognition accuracy of the text area higher and the recognition speed faster. The preprocessing operation includes but is not limited to dividing the image area of ​​the image to be detected, such as dividing the image to be detected into multiple sub-images according to the image size of the image to be detected, and then sending each sub-image to the neural network in turn for target detection. At this time, the resolution of the input image of the neural network can also be adjusted accordingly, and the detection results of each sub-image output by the neural network can be merged to obtain the final text area to be identified.

[0082] S130: Recognize the text in the text area to be recognized to obtain a text recognition result.

[0083] In this step, after the text region to be recognized in the image to be detected is determined in S120, the text in the text region to be recognized can be recognized and a corresponding text recognition result can be obtained.

[0084] It is understandable that after obtaining the text area to be identified in the image to be detected, in order to obtain the text information in the text area, the present application can identify the text polarity in the text area to be identified, thereby obtaining the text recognition result, and detect whether the text in the current image to be detected is written correctly based on the text recognition result. The text recognition method can basically be divided into three categories: statistics, logical judgment and syntax. The commonly used text recognition methods mainly include template matching method and geometric feature extraction method.

[0085] Among them, the template matching method mainly matches the input text with the given standard text (template) of each category, calculates the similarity between the input text and each template, and takes the category with the greatest similarity as the recognition result. This method is suitable for recognizing printed text with fixed fonts, and has strong adaptability to text defects, edge noise, etc.

[0086] The geometric feature extraction method mainly extracts some geometric features of the text, such as the endpoints, bifurcation points, concave and convex parts of the text, and line segments in horizontal, vertical, inclined and other directions, closed loops, etc., and obtains the recognition result by logical combination judgment based on the position and relationship of these features. Since this recognition method uses structural information for text recognition, it is suitable for text recognition with large variations, such as reading, translation, literature retrieval, letter and parcel sorting, manuscript editing and proofreading, summary and analysis of a large number of statistical reports and cards, bank check processing, statistical summary of commodity invoices, identification of commodity codes, management of commodity warehouses, and automatic processing of a large number of credit cards in the collection of water, electricity, gas, rent, personal insurance and other fees, and partial automation of office typists.

[0087] When the image to be detected in the present application is an image corresponding to a physical label, since physical labels generally use printed text in a fixed font, for this type of image to be detected, the present application can use a template matching method for text recognition.

[0088] In a specific implementation, when the template matching method is used for text recognition, the present application can convert text recognition into a sequence learning problem based on end-to-end text recognition based on deep learning. For example, the CRNN network has a network structure that includes three parts, from bottom to top: convolutional network layer: this layer uses CNN, and its function is to extract feature sequences from the input image; recurrent network layer: this layer uses RNN, and its function is to predict the label (true value) distribution of the feature sequence obtained from the convolutional network layer; sequence recognition layer: this layer uses the CTC algorithm, and its function is to convert the label distribution obtained from the recurrent network layer into the final recognition result through operations such as de-duplication and integration.

[0089] Since the CRNN network can process sequences of indefinite length, the recognition accuracy can be further improved for text lines of varying lengths in the text area after using the CRNN network for text recognition. In addition, the CRNN network not only extracts robust features, but also avoids the extremely difficult single-character segmentation and single-character recognition in traditional algorithms through serialization recognition. At the same time, serialization recognition is also embedded with time sequence dependencies. For example, when training the CRNN network, serialization recognition is performed according to the time sequence of the corpus used in training, thereby making text recognition more efficient.

[0090] Furthermore, when recognizing text in a text area to be recognized, the present application can first locate the text lines in the text area to be recognized, and then recognize the text in each text line. This can not only improve the recognition efficiency, but also improve the recognition accuracy, and is also beneficial to the selection of network models in subsequent text recognition.

[0091] S140: extracting a target entity from the text recognition result, and comparing the target entity with a standard entity in a database, and determining whether the text in the image to be detected is written correctly based on the comparison result.

[0092] In this step, the text in the text area to be recognized is recognized through S130. After the text recognition result is obtained, the target entity in the text recognition result can be extracted, and the target entity can be compared with the standard entity in the database. Then, based on the comparison result, it is determined whether the text in the image to be detected is written correctly.

[0093] It is understandable that text entity extraction is one of the main tasks of natural language processing (NLP). When identifying and extracting named entities in NLP, specific entities with shorter character lengths can be extracted, such as product names and specifications, and then the extraction results can be stored; regular expressions can also be used to match information with longer character lengths, such as regular expressions to precautions in physical object labels, and then the character content in the text paragraph specified by the precautions can be extracted, and the current operation ends when a period is encountered.

[0094] Named entities refer to names of people, organizations, places, and all other entities identified by names. More general entities also include numbers, dates, currencies, addresses, etc. Recognizing named entities means identifying names of people, places, organizations, dates, and times from text.

[0095] Named entity recognition can be roughly divided into three types: string matching, statistical language model, and sequence labeling. The first two methods require pre-construction of dictionaries and exhaustive enumeration of all entities. Their disadvantage is that they cannot discover new words, variants, etc., while the sequence labeling method does not require the construction of dictionaries and exhaustive enumeration of all entities. Therefore, sequence labeling is mostly used in named entity recognition.

[0096] After the target entity in the text recognition result is identified and extracted, in order to further ensure the accuracy of the extracted target entity, the present application can compare the target entity with the standard entity in the database. If the target entity is the same or basically the same as the standard entity, it is determined that the text in the image to be detected is written correctly. If there is a large difference between the target entity and the standard entity, it is determined that the text in the image to be detected is written incorrectly. At this time, the incorrectly written text can be marked and returned for rewriting.

[0097] It can be understood that since the text in the image to be detected is extracted based on the relevant product data pre-set and stored in the database, and the database also pre-stores the entity information corresponding to each category of products, in order to distinguish the entity information extracted from the text recognition result from the entity information corresponding to the product pre-stored in the database, the entity information extracted from the text recognition result is collectively referred to as the target entity, and the entity information corresponding to the product pre-stored in the database is collectively referred to as the standard entity, and the standard entity is compared with the target entity to detect whether the text is written incorrectly.

[0098] Furthermore, when performing a comparison, the present application can extract standard entities corresponding to the product category in the database based on the product category corresponding to the target entity. For example, based on the product category corresponding to the extracted address information, the address information corresponding to the product category can be extracted from the database, thereby detecting the extracted address information based on the address information of the product category extracted from the database.

[0099] In a specific implementation, Figure 3 As shown, Figure 3 A schematic diagram of the result of named entity extraction provided in the embodiment of the present application; combined with Figure 2 It is known that when this application is Figure 2 After extracting the named entities in , we can get Figure 3The extraction results shown in the figure, where the extracted entities and entity identifiers include product name, specification, material, brand and price, and the extraction results corresponding to the extracted entities and entity identifiers are Invisible and Traceless Series Sanitary Napkins, 8 pieces, non-woven fabric, polymer absorbent paper, PE film, Co., Ltd., RMB: 10. It can be seen that after the text recognition results are extracted in the present application, the keywords in the image to be detected can be obtained more intuitively. When these keywords are subsequently detected in text, the detection efficiency can be improved and missed detection and wrong detection can be avoided.

[0100] In the above embodiment, when performing text detection on an image to be detected that contains text, the text area to be identified in the image to be detected can be determined first, thereby narrowing the text detection range from the entire image to be detected to a single text area, which is beneficial to the efficiency and accuracy of subsequent text recognition and avoids the influence of other non-text areas; then the present application can recognize the text in the text area to be identified and obtain the corresponding text recognition result, which contains all the text information in the image to be detected. On this basis, the present application can check the keywords in the text information, such as after extracting the target entity in the text recognition result, determine whether the text in the image to be detected is written correctly based on the comparison result between the target entity and the standard entity. This can not only ensure the correctness of the keywords in the image to be detected, but also reduce the computational complexity of text detection, thereby further improving the efficiency of text detection.

[0101] In one embodiment, determining the text area to be recognized in the image to be detected in S120 may include:

[0102] S121: Obtain a target text area detection model.

[0103] S122: Input the image to be detected into the target text region detection model to obtain the text region to be identified in the image to be detected output by the target text region detection model.

[0104] In this embodiment, when determining the text area to be identified in the image to be detected, the present application can first obtain a target text area detection model, and then perform target detection on the image to be detected through the target text area detection model, thereby obtaining the text area to be identified in the image to be detected.

[0105] Among them, since the resolution of the image to be detected in this embodiment, such as the resolution of the physical label, is usually relatively large, it is difficult to detect small targets at large resolution using general target detection algorithms. Therefore, the target text area detection model obtained in this embodiment can be a CenterNet model. By using the CenterNet model to perform target detection on the image to be detected, not only the speed of target detection can be improved, but also the accuracy of target detection can be improved.

[0106] In one embodiment, obtaining the target text area detection model in S121 may include:

[0107] S1211: Acquire a first sample image containing text.

[0108] S1212: Divide the first sample image into a plurality of sub-sample images according to a preset division strategy.

[0109] In this step, after obtaining the first sample image containing text, in order to better detect the target in the first sample image, the present application can divide the first sample image into multiple sub-sample images according to a preset division strategy.

[0110] Among them, the above-mentioned preset division strategy can be to set a specific number of divisions based on the size of the first sample image, so that the larger the size of the first sample image, the more sub-sample images it is divided into, and the smaller the size of the first sample image, the fewer sub-sample images it is divided into, thereby ensuring that the size of the divided sub-sample images is neither too small nor too large.

[0111] Furthermore, the present application may also divide the first sample image according to a preset size range of sub-sample images to ensure that the sizes of the divided sub-sample images are within the preset size range of the sub-sample images.

[0112] S1213: Label the real image center point and real image size of each sub-sample image, and the real image coordinates of each sub-sample image in the first sample image.

[0113] In this step, before training the target text area detection model, the obtained multiple sub-sample images can be labeled so that the model can continuously correct the prediction results according to the labeled sample labels and obtain the final target text area detection model.

[0114] Furthermore, when the present application uses the CenterNet model as the preferred target text area detection model, before training the CenterNet model, the real image center point, real image size, and real image coordinates of each sub-sample image in the first sample image can be pre-labeled.

[0115] Among them, the real image center point of each sub-sample image represents the real key point of the sub-sample image, which can be obtained by calculation. The CenterNet model in this application can learn the real key point during the training process; and the real image size of each sub-sample image represents the real width and height of the sub-sample image. This application can lock the text area in each sub-sample image through the real image center point and real image size of each sub-sample image.

[0116] In addition, each sub-sample image of the present application is also marked with the real image coordinates of the sub-sample image in the first sample image. Since the first sample image is divided into multiple sub-sample images in the present application, after the real image coordinates of each sub-sample image in the first sample image are marked, the multiple sub-sample images can be better synthesized to obtain the text area to be identified in the final image to be detected.

[0117] S1214: Input each sub-sample image into a preset initial text area detection model in sequence to obtain the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image output by the initial text area detection model.

[0118] S1215: Train the initial text region detection model with the goal of making the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image approach the real image center point, real image size, and real image coordinates of each sub-sample image in the first sample image, respectively.

[0119] In this step, after each sub-sample image is input into the preset initial text area detection model in turn, the initial text area detection model can detect the text area in each sub-sample image and output the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image. Next, the present application can take the predicted image center point of each sub-sample image approaching the real image center point of the sub-sample image as the goal, calculate the center point loss value between the predicted image center point of each sub-sample image and the real image center point of the sub-sample image, and update the various parameters in the model according to the center point loss value; take the predicted image size of each sub-sample image approaching the real image size of the sub-sample image as the goal, calculate the size loss value between the predicted image size of each sub-sample image and the real image size of the sub-sample image, and update the various parameters in the model according to the size loss value; take the predicted image coordinates of each sub-sample image in the first sample image approaching the real image coordinates of the sub-sample image in the first sample image as the goal, calculate the coordinate loss value between the predicted image coordinates of each sub-sample image in the first sample image and the real image coordinates of the sub-sample image in the first sample image, and update the various parameters in the model according to the coordinate loss value, so as to train the initial text area detection model.

[0120] S1216: When the initial text region detection model meets a preset first training condition, the trained initial text region detection model is used as a target text region detection model.

[0121] In this step, after iteratively training the initial text area detection model in S130, it can be determined whether the initial text area detection model after each iterative training meets the preset first training condition. If so, the trained initial text area detection model is used as the target text area detection model.

[0122] Among them, the first training condition here can be the number of iterations set before the training of the initial text area detection model. When the number of iterations is reached, it means that the initial text area detection model has been trained; the first training condition can also be the parameter threshold corresponding to each parameter in the initial text area detection model. If the parameter value corresponding to each parameter meets the parameter threshold, it means that the initial text area detection model has been trained. The first training condition in this application can also be other conditions, which can be set according to actual conditions and are not limited here.

[0123] In one embodiment, recognizing the text in the text area to be recognized in S130 to obtain a text recognition result may include:

[0124] S131: Locate text lines in the text area to be recognized to obtain at least one text line.

[0125] S132: Obtain a target text recognition model.

[0126] S133: Input each text line into the target text recognition model in sequence to obtain a text recognition result output by the target text recognition model.

[0127] In this embodiment, when recognizing text in a text area to be recognized, the present application can first locate the text lines in the text area to be recognized, thereby obtaining at least one text line, and then obtain a target text recognition model, and use the target text recognition model to recognize the text in each text line, thereby obtaining a corresponding text recognition result.

[0128] It is understandable that in natural scenes, the text types include horizontal text, inclined text and curved text. The segmentation-based method can make predictions at the pixel level and can better describe texts of different shapes in natural scenes. When locating the text lines in the text area to be identified, the present application can use the DBNet algorithm. The DBNet algorithm can insert the binarization operation into the segmentation network for joint optimization, so that the network can adaptively predict the threshold of each pixel in the image, thereby achieving complete distinction between foreground and background pixels. In addition, the binarization threshold in the DBNet algorithm is obtained by network learning, and the binarization step is added to the network for training together, so that the final output graph will have very strong robustness to the threshold, which simplifies the post-processing while improving the effect of text detection.

[0129] When obtaining the target text recognition model, the present application can select the CRNN network as the target text recognition model. The CRNN network can process indefinite length sequences. Therefore, for text lines of different lengths in the text area, the recognition accuracy can be further improved after using the CRNN network for text recognition. In addition, the CRNN network not only extracts robust features, but also avoids the extremely difficult single-character segmentation and single-character recognition in traditional algorithms through serialization recognition. At the same time, serialization recognition is also embedded with time sequence dependency. For example, when training the CRNN network, serialization recognition is performed according to the time sequence of the corpus used in training, thereby making text recognition more efficient.

[0130] In one embodiment, obtaining the target text recognition model in S132 may include:

[0131] S1321: Acquire a second sample image containing text, and extract text lines in the second sample image to obtain a plurality of training images.

[0132] In this step, if Figure 4 As shown, Figure 4 A schematic diagram of a structure for intercepting a text line in a second sample image provided by an embodiment of the present application; Figure 4 In the example, when the text line of the second sample image is intercepted, the DBNet algorithm can be used, so that the training image corresponding to each text line in the second sample image can be obtained quickly and accurately.

[0133] S1322: After labeling the text in each training image, obtain a second sample label, where the second sample label is an index obtained by mapping the character corresponding to the text in each training image in the dictionary.

[0134] In this step, combine Figure 4 It is known that when Figure 4 After intercepting the text lines in and obtaining multiple training images, the text in each training image can be annotated respectively. During the annotation, the text in each training image can be mapped to a digital ID in the dictionary, that is, an index, so as to obtain a second sample label corresponding to each training image.

[0135] It is understandable that the dictionary here is also called a hash table, which is the only mapping type in Python, used to store associative containers of key-value pairs, and the contents of the dictionary can be modified, added, and deleted. In this application, after determining the characters corresponding to the text in each training image, the characters can be input into the dictionary as the key value in the key-value pair, so as to find the value corresponding to the key value in the dictionary, that is, the index corresponding to the character.

[0136] S1323: Input each training image into a preset initial text recognition model respectively, and obtain a prediction label corresponding to each training image output by the initial text recognition model.

[0137] S1324: Training the initial text recognition model with the goal of making the predicted label close to the second sample label.

[0138] In this step, after each training image is input into the preset initial text recognition model respectively, the prediction label corresponding to each training image output by the initial text recognition model can be obtained. Then, the present application can train the initial text recognition with the goal of making the prediction label approach the second sample label, so as to obtain the target text recognition model.

[0139] S1325: When the initial text recognition model meets the preset second training condition, the trained initial text recognition model is used as the target text recognition model.

[0140] In this step, after iteratively training the initial text recognition model in S1324, it can be determined whether the initial text recognition model after each iterative training meets the preset second training condition. If so, the trained initial text recognition model is used as the target text recognition model.

[0141] Among them, the second training condition here can be the number of iterations set before the initial text recognition model is trained. When the number of iterations is reached, it means that the initial text recognition model has been trained. The first training condition can also be the parameter thresholds corresponding to the parameters in the initial text recognition model. If the parameter values ​​corresponding to the parameters meet the parameter thresholds, it means that the initial text recognition model has been trained. The second training condition in this application can also be other conditions, which can be set according to actual conditions and are not limited here.

[0142] In one embodiment, before inputting each training image into a preset initial text recognition model in S1323, the process may further include: performing data enhancement on each training image according to a preset enhancement strategy.

[0143] In this embodiment, when training is started, data enhancement can be performed on each training image according to a preset enhancement strategy. The enhancement strategy may include blurring, jittering, gasuss noise, random cropping, perspective, color reversal, TIA data augmentation and other disturbance methods on the training image. In addition, each disturbance method may be selected with a probability of 20% during the training process.

[0144] Furthermore, the training of the network structure of the data-enhanced CRNN in this application can be divided into three stages, and the setting of the learning rate in each stage is different until the loss and accuracy remain unchanged. The following methods can be used to train the neural network architecture of each level of the data-enhanced CRNN:

[0145] A. Use the connection time series classifier CTC as the loss function;

[0146] B. Use the Adam algorithm as the optimization algorithm for overall model adjustment;

[0147] C. In the initial stage, the parameters of the multi-level neural network architecture can be adjusted using a learning rate of 0.00005, and the number of training iterations can be set to 3000.

[0148] It is understandable that the CRNN network in this application can be fine-tuned using different corpora according to different application scenarios. Usually, the model trained on a large public data set has false positives and false negatives for specific application scenarios. At this time, we can collect corresponding predictions according to the actual application scenario and fine-tune it, so that the recognition accuracy of the model for specific application scenarios will be much higher. In addition, this application can also use CTC loss function and Adam optimization algorithm during model training, so that the prediction accuracy of the model can be further improved through training.

[0149] In one embodiment, extracting the target entity in the text recognition result in S140 may include:

[0150] S141: Determine the target NLP model.

[0151] S142: Input the text recognition result into the target NLP model to obtain the target entity in the text recognition result output by the target NLP model.

[0152] In this embodiment, when extracting the target entity, the target NLP model can be determined first, and then the text recognition result can be input into the target NLP model so that the target NLP model can identify and extract the entity in the text recognition result, thereby obtaining the target entity in the text recognition result output by the target NLP model.

[0153] Among them, the target NLP model can use the RNN+CRF model, and the specific model can be ERNIE-Gram+CRF. The natural language processing model in this application can be selected according to the actual situation and is not limited here.

[0154] In one embodiment, determining the target NLP model in S141 may include:

[0155] S1411: Acquire a third sample image containing text.

[0156] S1412: Segment the text in the third sample image, and mark the parts of speech of the segmented words, and determine the real entity category corresponding to each word after the marked part of speech.

[0157] In this step, before training the initial NLP model, the text in the third sample image containing the text can be segmented, and the parts of speech of the segmented words can be marked. The purpose of marking the parts of speech is to assign a category to each word, which is called a part-of-speech tag, such as noun, verb, adjective, etc.

[0158] After the part of speech of each word after word segmentation in the third sample image is labeled, the real entity category of each word after the part of speech is labeled can be determined. For example, the entity categories in the sentence "On June 20, 2016, the Cavaliers defeated the Warriors in Oakland to win the NBA championship" are place name (Oakland), time (June 20, 2016), team (Cavaliers, Warriors) and organization (NBA). Named entity recognition systems usually include two parts: entity boundary recognition and entity classification, where entity boundary recognition is mainly to determine whether a string is an entity, and entity classification divides the recognized entities into different pre-given categories.

[0159] S1413: Input the third sample image into a preset initial NLP model to obtain a predicted entity category corresponding to each word predicted in the third sample image output by the initial NLP model.

[0160] S1414: The initial NLP model is trained with the goal of making the predicted entity category corresponding to each predicted word close to the real entity category corresponding to the word.

[0161] In this step, after the third sample image is input into the preset initial NLP model, the text in the third sample image is segmented by the initial NLP model, and the parts of speech corresponding to the segmented words and the predicted entity category corresponding to each word are determined. Then, with the goal of making the predicted entity category corresponding to each word close to the real entity category corresponding to the word, the initial NLP model is trained until the training is completed, thereby obtaining the final target NLP model.

[0162] S1415: When the initial NLP model meets the preset third training condition, the trained initial NLP model is used as the target NLP model.

[0163] In this step, after iterative training of the initial NLP model in S1414, it can be determined whether the initial NLP model after each iterative training meets the preset third training condition. If so, the trained initial NLP model is used as the target NLP model.

[0164] Among them, the third training condition here can be the number of iterations set before the initial NLP model is trained. When the number of iterations is reached, it means that the initial NLP model has been trained. The third training condition can also be the parameter threshold corresponding to each parameter in the initial NLP model. If the parameter value corresponding to each parameter meets the parameter threshold, it means that the initial NLP model has been trained. The third training condition in this application can also be other conditions, which can be set according to actual conditions and are not limited here.

[0165] In one embodiment, comparing the target entity with a standard entity in a database in S140, and determining whether the text in the image to be detected is written correctly according to the comparison result, may include:

[0166] S151: According to the product category corresponding to the target entity, extract the standard entity corresponding to the product category from the database.

[0167] In this step, the text in the image to be detected is obtained by extracting the relevant product data pre-set and stored in the database. For example, if the image to be detected contains product name and address information, the product name corresponds to the name of the product that has been produced, sold, or to be sold stored in the database, and the address information is the production address or agent address extracted from the database and related to the product name in the image to be detected.

[0168] Therefore, the present application can extract standard entities corresponding to the product category in the database according to the product category corresponding to the target entity. For example, according to the product category corresponding to the extracted address information, the address information corresponding to the product category can be extracted from the database, thereby detecting the extracted address information based on the address information of the product category extracted from the database.

[0169] Furthermore, the database here may be a PLM (Product Lifecycle Management) system, which can manage the entire process of a product from design to final production. Therefore, the system stores multiple product categories and standard entities corresponding to each product category.

[0170] S152: Calculate the cosine value between the word vector corresponding to the target entity and the word vector corresponding to the standard entity.

[0171] S153: Compare the cosine value with a preset cosine threshold.

[0172] S154: If the cosine value is less than the preset cosine threshold, it is determined that the text in the image to be detected is incorrectly written.

[0173] S155: If the cosine value is not less than the preset cosine threshold, it is determined that the text in the image to be detected is written correctly.

[0174] In this step, when determining the word vector of the target entity and the word vector of the standard entity, the corresponding word vector can be obtained through the feature extraction network, such as extracting the word vector information through Word2vec, and then calculating the cosine value of the angle between the two word vectors. If the cosine value is 1, they are exactly the same. If it is less than a preset cosine threshold, such as 0.8, it is judged that the extracted information is inconsistent with the information in the PLM database, and an abnormal alarm can be issued at this time.

[0175] In the above embodiment, when comparing the target entity with the standard entity, the corresponding word vector is obtained through the feature extraction network. Without the need to manually construct features, the feature vector corresponding to each entity can be automatically extracted from the text, thereby realizing the automated evolution of feature engineering. Compared with related technologies, automated feature engineering can greatly reduce the workload.

[0176] The text detection device provided in an embodiment of the present application is described below. The text detection device described below and the text detection method described above can be referenced to each other.

[0177] In one embodiment, Figure 5 As shown, Figure 5 A structural diagram of a text detection device provided in an embodiment of the present application; the present application also provides a text detection device, which may include an image acquisition module 210, a text area detection module 220, a text recognition module 230, and a text detection module 240, specifically including the following:

[0178] The image acquisition module 210 is used to acquire an image to be detected that contains text.

[0179] The text region detection module 220 is used to determine the text region to be identified in the image to be detected.

[0180] The text recognition module 230 is used to recognize the text in the text area to be recognized and obtain a text recognition result.

[0181] The text detection module 240 is used to extract the target entity in the text recognition result, and compare the target entity with the standard entity, and determine whether the text in the image to be detected is written correctly according to the comparison result.

[0182] In the above embodiment, when performing text detection on an image to be detected that contains text, the text area to be identified in the image to be detected can be determined first, thereby narrowing the text detection range from the entire image to be detected to a single text area, which is beneficial to the efficiency and accuracy of subsequent text recognition and avoids the influence of other non-text areas; then the present application can recognize the text in the text area to be identified and obtain the corresponding text recognition result, which contains all the text information in the image to be detected. On this basis, the present application can check the keywords in the text information, such as after extracting the target entity in the text recognition result, determine whether the text in the image to be detected is written correctly based on the comparison result between the target entity and the standard entity. This can not only ensure the correctness of the keywords in the image to be detected, but also reduce the computational complexity of text detection, thereby further improving the efficiency of text detection.

[0183] In one embodiment, the text region detection module 220 may include:

[0184] The first acquisition module is used to acquire a target text area detection model.

[0185] The target recognition module is used to input the image to be detected into the target text area detection model to obtain the text area to be recognized in the image to be detected output by the target text area detection model.

[0186] In one embodiment, the first acquisition module may include:

[0187] The first acquisition submodule is used to acquire a first sample image containing text.

[0188] The image division module is used to divide the first sample image into a plurality of sub-sample images according to a preset division strategy.

[0189] The first marking module is used to mark the real image center point and the real image size of each sub-sample image, and the real image coordinates of each sub-sample image in the first sample image.

[0190] The first prediction module is used to input each sub-sample image into a preset initial text area detection model in sequence to obtain the predicted image center point and predicted image size of each sub-sample image output by the initial text area detection model, as well as the predicted image coordinates of each sub-sample image in the first sample image.

[0191] The first training module is used to train the initial text area detection model with the goal of making the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image approach the real image center point, real image size, and real image coordinates of each sub-sample image in the first sample image.

[0192] The first judgment module is used to use the trained initial text region detection model as the target text region detection model when the initial text region detection model meets a preset first training condition.

[0193] In one embodiment, the text recognition module 230 includes:

[0194] The text line positioning module is used to locate the text line in the text area to be recognized to obtain at least one text line.

[0195] The second acquisition module is used to acquire the target text recognition model.

[0196] The text recognition submodule is used to input each text line into the target text recognition model in sequence to obtain the text recognition result output by the target text recognition model.

[0197] In one embodiment, the second acquisition module may include:

[0198] A second acquisition submodule is used to acquire a second sample image containing text, and obtain a plurality of training images after intercepting text lines in the second sample image;

[0199] The second labeling module is used to label the text in each training image to obtain a second sample label, where the second sample label is an index mapped in a dictionary to the character corresponding to the text in each training image.

[0200] The second prediction module is used to input each training image into a preset initial text recognition model to obtain a prediction label corresponding to each training image output by the initial text recognition model.

[0201] The second training module is used to train the initial text recognition model with the goal of making the predicted label close to the second sample label.

[0202] The second judgment module is used to use the trained initial text recognition model as the target text recognition model when the initial text recognition model meets the preset second training condition.

[0203] In one embodiment, the device may further include:

[0204] The data enhancement module is used to perform data enhancement on each training image according to a preset enhancement strategy.

[0205] In one embodiment, the text detection module 240 may include:

[0206] A model determination module is used to determine the target NLP model;

[0207] The text detection submodule is used to input the text recognition result into the target NLP model to obtain the target entity in the text recognition result output by the target NLP model.

[0208] In one embodiment, the model determination module may include:

[0209] The third acquisition module is used to acquire a third sample image containing text.

[0210] The third labeling module is used to segment the text in the third sample image, label the parts of speech of the segmented words, and determine the real entity category corresponding to each word after the part of speech is labeled.

[0211] The third prediction module is used to input the third sample image into a preset initial NLP model to obtain a predicted entity category corresponding to each word predicted in the third sample image output by the initial NLP model.

[0212] The third training module is used to train the initial NLP model with the goal of making the predicted entity category corresponding to each predicted word close to the real entity category corresponding to the word.

[0213] The third judgment module is used to use the trained initial NLP model as the target NLP model when the initial NLP model meets the preset third training condition.

[0214] In one embodiment, the text detection module 240 may include:

[0215] The extraction module is used to extract the standard entity corresponding to the product category in the database according to the product category corresponding to the target entity.

[0216] The cosine calculation module is used to calculate the cosine value between the word vector corresponding to the target entity and the word vector corresponding to the standard entity.

[0217] The comparison module is used to compare the cosine value with a preset cosine threshold.

[0218] The first detection module is used to determine that the text in the image to be detected is incorrectly written if the cosine value is less than the preset cosine threshold.

[0219] The second detection module is used to determine that the text in the image to be detected is written correctly if the cosine value is not less than the preset cosine threshold.

[0220] In one embodiment, the present application further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the text detection method as described in any one of the above embodiments.

[0221] In one embodiment, the present application also provides a computer device, including: one or more processors, and a memory.

[0222] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the text detection method described in any one of the above embodiments is executed.

[0223] Indicatively, Figure 6 As shown, Figure 6This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 may be provided as a server. Figure 6 The computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301 for storing instructions executable by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute the instructions to perform the text detection method of any of the above embodiments.

[0224] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.

[0225] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0226] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0227] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.

[0228] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A text detection method, characterized in that: The method comprises: Get the image to be detected containing text; Determining a text area to be recognized in the image to be detected; Recognize the text in the text area to be recognized to obtain a text recognition result; Extracting a target entity from the text recognition result, and comparing the target entity with a standard entity in a database, and determining whether the text in the image to be detected is written correctly according to the comparison result; The step of determining a text area to be recognized in the image to be detected includes: Get a first sample image containing text; According to a preset division strategy, the first sample image is divided into a plurality of sub-sample images; Marking the real image center point and real image size of each sub-sample image, and the real image coordinates of each sub-sample image in the first sample image; Inputting each sub-sample image into a preset initial text region detection model in sequence, obtaining a predicted image center point and a predicted image size of each sub-sample image output by the initial text region detection model, and a predicted image coordinate of each sub-sample image in the first sample image; Training the initial text region detection model with the goal of making the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image approach the real image center point, real image size, and real image coordinates of each sub-sample image in the first sample image; When the initial text region detection model meets a preset first training condition, the trained initial text region detection model is used as a target text region detection model; The image to be detected is input into the target text region detection model to obtain the text region to be identified in the image to be detected output by the target text region detection model.

2. The text detection method according to claim 1, characterized in that: Recognizing the text in the text area to be recognized to obtain a text recognition result, including: Locating text lines in the text area to be recognized to obtain at least one text line; Obtain the target text recognition model; Each text line is input into the target text recognition model in turn to obtain a text recognition result output by the target text recognition model.

3. The text detection method according to claim 2, characterized in that: The step of obtaining a target text recognition model includes: Acquire a second sample image containing text, and obtain a plurality of training images after intercepting text lines in the second sample image; After labeling the texts in each training image, a second sample label is obtained, where the second sample label is an index obtained by mapping the characters corresponding to the texts in each training image in the dictionary; Inputting each training image into a preset initial text recognition model, respectively, to obtain a prediction label corresponding to each training image output by the initial text recognition model; Training the initial text recognition model with the goal of making the predicted label close to the second sample label; When the initial text recognition model meets the preset second training condition, the trained initial text recognition model is used as the target text recognition model.

4. The text detection method according to claim 3, characterized in that: Before inputting each training image into the preset initial text recognition model, the method further includes: According to the preset enhancement strategy, data enhancement is performed on each training image.

5. The text detection method according to claim 1, 2, 3 or 4, characterized in that: The extracting the target entity in the text recognition result includes: Determine the target NLP model; The text recognition result is input into the target NLP model to obtain the target entity in the text recognition result output by the target NLP model.

6. The text detection method according to claim 5, characterized in that: Determining the target NLP model includes: Get a third sample image containing text; Segmenting the text in the third sample image, and marking the parts of speech of the segmented words, and determining the real entity category corresponding to each word after the part of speech is marked; Inputting the third sample image into a preset initial NLP model to obtain a predicted entity category corresponding to each word predicted in the third sample image output by the initial NLP model; Training the initial NLP model with the goal of making the predicted entity category corresponding to each predicted word close to the real entity category corresponding to the word; When the initial NLP model meets the preset third training condition, the trained initial NLP model is used as the target NLP model.

7. The text detection method according to claim 1 or 2 or 3 or 4 or 6, characterized in that: The step of comparing the target entity with a standard entity in a database and determining whether the text in the image to be detected is written correctly according to the comparison result includes: According to the product category corresponding to the target entity, extracting the standard entity corresponding to the product category from the database; Calculate the cosine value between the word vector corresponding to the target entity and the word vector corresponding to the standard entity; Comparing the cosine value with a preset cosine threshold; If the cosine value is less than the preset cosine threshold, it is determined that the text in the image to be detected is incorrectly written; If the cosine value is not less than the preset cosine threshold, it is determined that the text in the image to be detected is written correctly.

8. A text detection device, characterized in that: include: An image acquisition module is used to acquire an image to be detected containing text; A text region detection module, used to determine a text region to be identified in the image to be detected; A text recognition module, used to recognize the text in the text area to be recognized and obtain a text recognition result; A text detection module is used to extract a target entity from the text recognition result, and compare the target entity with a standard entity, and determine whether the text in the image to be detected is written correctly according to the comparison result; The text area detection module comprises: Get a first sample image containing text; According to a preset division strategy, the first sample image is divided into a plurality of sub-sample images; Marking the real image center point and real image size of each sub-sample image, and the real image coordinates of each sub-sample image in the first sample image; Inputting each sub-sample image into a preset initial text region detection model in sequence, obtaining a predicted image center point and a predicted image size of each sub-sample image output by the initial text region detection model, and a predicted image coordinate of each sub-sample image in the first sample image; Training the initial text region detection model with the goal of making the predicted image center point, predicted image size, and predicted image coordinates of each sub-sample image in the first sample image approach the real image center point, real image size, and real image coordinates of each sub-sample image in the first sample image; When the initial text region detection model meets a preset first training condition, the trained initial text region detection model is used as a target text region detection model; The image to be detected is input into the target text region detection model to obtain the text region to be identified in the image to be detected output by the target text region detection model.

9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the text detection method according to any one of claims 1 to 7.

10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the text detection method according to any one of claims 1 to 7 is performed.

Citation Information

Patent Citations

  • Washing label detection method and device and storage medium

    CN111476232A

  • Text recognition method and device

    CN113344014A

  • Tax payment number recognition method, device, storage medium and computer equipment

    CN113610098A