Text detection model training method, text detection method and device
By removing annotation noise from sample images during the text detection model training process, and by combining feature extraction and prediction sub-models to adjust model parameters, the problem of poor model training performance was solved, and more accurate text location detection was achieved.
Patent Information
- Application Number
- CN202310540078.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-12
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-05-12
AI Technical Summary
Existing technologies ignore noise in the annotations of sample images when training text detection models, resulting in poor model training performance and inability to accurately detect the text location in images.
Feature maps of sample images are extracted through a feature extraction sub-model, and noise removal and text location prediction are performed in the prediction sub-model. The model parameters are adjusted in combination with the target loss value to remove the first preset noise in the annotation.
It improved the model training effect and the accuracy of prediction results, reduced false negatives and false positives, and increased the convergence speed of the model.
Smart Images

Figure CN116580407B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a text detection model training method, a text detection method and device, an electronic device and a computer readable storage medium. BACKGROUND
[0002] At present, when training a text detection model for detecting text positions in images, an initial text detection model is usually trained based on sample images labeled with text positions, and a text detection model trained to convergence is used to process an image to be detected.
[0003] The model training method in the related art may have poor model training effect and may not accurately detect text positions in images. SUMMARY
[0004] The present disclosure provides a text detection model training method, a text detection method and device, an electronic device and a computer readable storage medium.
[0005] In a first aspect, the present disclosure provides a text detection model training method, which comprises:
[0006] obtaining a sample image, a label of the sample image and an initial text detection model to be trained, wherein the label is used to represent label position information of text in the sample image, and the initial text detection model comprises a feature extraction sub-model and a prediction sub-model;
[0007] extracting a feature map corresponding to the sample image based on the feature extraction sub-model;
[0008] inputting the feature map into the prediction sub-model to perform noise removal processing and text position prediction processing, and obtaining prediction position information of the text in the sample image, wherein the noise removal processing is used to remove first preset noise in the label;
[0009] obtaining a target loss value according to the prediction position information and the label position information, and adjusting parameters of the initial text detection model based on the target loss value to obtain a target text detection model, wherein the target loss value is used to represent an error between a first position represented by the prediction position information and a second position represented by the label position information.
[0010] In a second aspect, the present disclosure provides a text detection method, which comprises:
[0011] obtaining a target image to be detected;
[0012] input the target image into a target text detection model for text detection processing to obtain target position information, wherein the target position information is used to represent position information of text in the target image, and the target text detection model is obtained according to the training method of the text detection model of the first aspect.
[0013] In a third aspect, the present disclosure provides a training device of a text detection model, which comprises:
[0014] a second obtaining unit configured to obtain a sample image, a label of the sample image, and an initial text detection model to be trained, wherein the label is used to represent labeled position information of text in the sample image, and the initial text detection model comprises a feature extraction sub-model and a prediction sub-model;
[0015] a feature extraction unit configured to extract a feature map corresponding to the sample image based on the feature extraction sub-model;
[0016] a prediction unit configured to input the feature map into the prediction sub-model for noise removal processing and text position prediction processing to obtain predicted position information of the text in the sample image, wherein the noise removal processing is used to remove first preset noise in the label;
[0017] a parameter adjustment unit configured to obtain a target loss value according to the predicted position information and the labeled position information, and adjust parameters of the initial text detection model based on the target loss value to obtain a target text detection model, wherein the target loss value is used to represent an error between a first position represented by the predicted position information and a second position represented by the labeled position information.
[0018] In a fourth aspect, the present disclosure provides a text detection device, which comprises:
[0019] a first obtaining unit configured to obtain a target image to be detected;
[0020] a detection unit configured to input the target image into a target text detection model for text detection processing to obtain target position information, wherein the target position information is used to represent position information of text in the target image, and the target text detection model is obtained according to the training method of the text detection model of the first aspect.
[0021] In a fifth aspect, the present disclosure provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the training method of the text detection model of the first aspect or the text detection method of the second aspect.
[0022] In a sixth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the training method of the text detection model of the first aspect or the text detection method of the second aspect.
[0023] In the embodiments of the present disclosure, it is considered that, in the training process of the text detection model, if the annotation of the sample image has noise, the model training effect may be poor and the model obtained by training may not accurately predict the text position. Therefore, in the embodiments of the present disclosure, after the electronic device obtains the sample image and its annotation and the initial text detection model to be trained in the training process of the text detection model, the feature extraction sub-model in the initial text detection model is used to first extract the feature map corresponding to the sample image, then the feature map is input into the prediction sub-model of the initial text detection model to simultaneously perform noise removal processing and text position prediction processing, which can reduce the influence of the first preset noise existing in the annotation of the sample image on the training result; and then, the target loss value is obtained based on the predicted position information and the annotation, and the parameters of the initial text detection model are adjusted based on the target loss value, so that the target text detection model which can accurately predict the text position is efficiently trained.
[0024] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0025] The accompanying drawings are included to provide a further understanding of the present disclosure and constitute a part of the specification, which together with the embodiments of the present disclosure serve to explain the present disclosure, and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of the specific example embodiments, with reference to the accompanying drawings, in which:
[0026] Figure 1 A schematic diagram of an implementation environment of a text detection model training method provided by the embodiments of the present disclosure;
[0027] Figure 2A flowchart of a text detection model training method provided by an embodiment of the present disclosure is provided.
[0028] Figure 3 A flowchart for obtaining predicted position information provided by an embodiment of the present disclosure is provided.
[0029] Figure 4 A framework schematic diagram of a text detection model training process provided by an embodiment of the present disclosure is provided.
[0030] Figure 5 A flowchart for obtaining a plurality of probability distribution maps provided by an embodiment of the present disclosure is provided.
[0031] Figure 6 A flowchart of obtaining a first probability distribution map provided by an embodiment of the present disclosure is provided.
[0032] Figure 7 A flowchart for obtaining a target loss value provided by an embodiment of the present disclosure is provided.
[0033] Figure 8 A flowchart of a text detection method provided by an embodiment of the present disclosure is provided.
[0034] Figure 9 A block diagram of a text detection model training device provided by an embodiment of the present disclosure is provided.
[0035] Figure 10 A block diagram of a text detection device provided by an embodiment of the present disclosure is provided.
[0036] Figure 11 A block diagram of an electronic device provided by an embodiment of the present disclosure is provided. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of the present disclosure to help understanding, which should be considered as merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.
[0038] In the case of no conflict, each embodiment of the present disclosure and each feature in the embodiments can be combined with each other.
[0039] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0040] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. "Coupled" or "connected" or similar terms are not restricted to physical or mechanical connections or associations, but can also include electrical connections, whether direct or indirect.
[0041] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted in an overly literal or overly formal sense unless expressly so defined herein.
[0042] In the related art, when training a text detection model for detecting the position of text in an image, an initial text detection model is generally trained based on sample images labeled with text positions, and the trained text detection model is used to process images to be detected until the model converges; in this model training method and text detection method, the text detection model is generally composed of an encoding sub-model and a decoding sub-model, wherein the encoding sub-model is used to extract feature data of a sample image, and the decoding sub-model is used to predict the position of text in an image based on the feature data extracted by the encoding sub-model.
[0043] In the process of implementing the present disclosure, the inventors found that the training method of such a text detection model in the related art may have the following problems: in the model training process, it is often assumed that the labeling of sample images is completely correct and there is no noise, for example, there is noise of missing labeling or mislabeling, or there is noise of incorrect labeling, that is, although the text position in the sample image is labeled, it is not accurately labeled, for example, the labeled text box is too large or too small; since the scheme in the related art often assumes that the labeling of sample images is completely correct and ignores the possible noise, this causes, on the one hand, the model convergence speed to be slow and the efficiency to be low during the training process; on the other hand, it may also cause the trained model to have problems such as missing detection, false detection, and inaccurate detection, thereby also affecting the downstream task, for example, a task of performing text recognition processing based on the trained text detection model.
[0044] Please refer to Figure 1which is a schematic diagram of an implementation environment of a method for training a text detection model according to an embodiment of the present disclosure. As shown in Figure 1 The implementation environment can include a server 101, a terminal device 102, and a network 103.
[0045] The server 101 can be a physical server, for example, a blade server, a rack server, etc. The server 101 can also be a virtual server, for example, a server cluster deployed in the cloud, which is not limited herein.
[0046] The terminal device 102 can be a smartphone, a laptop, a desktop computer, a tablet computer, etc. In the embodiments of the present disclosure, the terminal device 102 can be configured to provide training data and an initial text detection model to be trained to the server 101, where the training data can be sample images and annotations of the sample images.
[0047] The network 103 can be a wireless network or a wired network, and can be a local area network or a wide area network. The server 101 and the terminal device 102 can communicate with each other through the network 103.
[0048] In the embodiments of the present disclosure, the server 101 can be configured to participate in implementing a method for training a text detection model according to any embodiment of the present disclosure. For example, the server 101 can be configured to: obtain sample images, annotations of the sample images, and an initial text detection model to be trained sent by the terminal device 102, where the annotations are used to represent annotation position information of text in the sample images, and the initial text detection model includes a feature extraction sub-model and a prediction sub-model; extract a feature map corresponding to the sample images based on the feature extraction sub-model; input the feature map into the prediction sub-model to perform noise removal processing and text position prediction processing, to obtain prediction position information of the text in the sample images, where the noise removal processing is used to remove first preset noise in the annotations; obtain a target loss value based on the prediction position information and the annotation position information, and adjust parameters of the initial text detection model based on the target loss value, to obtain a target text detection model, where the target loss value is used to represent an error between a first position represented by the prediction position information and a second position represented by the annotation position information.
[0049] For another example, after the target text detection model is trained, the server 101 can also be configured to perform text detection processing, for example, the server 101 can also be configured to: obtain a target image to be detected sent by the terminal device 102; input the target image into the trained target text detection model to perform text detection processing, to obtain target position information used to identify position information of text in the target image.
[0050] It can be understood that, Figure 1The illustrated implementation environment is merely illustrative and is in no way intended to limit the present disclosure, its application, or uses. For example, although Figure 1 Only one server 101 and one terminal device 102 are shown, but this does not mean to limit the respective number, and multiple servers 101 and multiple terminal devices 102 can be included in the implementation environment; for another example, only the server 101 can be included in the implementation environment, which obtains the sample image and the label and the initial text detection model to be trained based on the network 103, and performs the training processing to obtain the target text detection model.
[0051] To solve the problem that the training method of the text detection model in the related art may have poor model training effect and the model obtained by training may not accurately detect the text position in the image, the present embodiment provides a training method of a text detection model, please refer to Figure 2 , which is a flowchart of the training method of the text detection model provided by the present embodiment. The method can be applied in an electronic device, which can be, for example, Figure 1 The server 101 shown.
[0052] As shown in Figure 2 , the training method of the text detection model provided by the present embodiment can include the following steps S201-S204, which will be described in detail below.
[0053] Step S201, obtaining a sample image, a label of the sample image, and an initial text detection model to be trained, wherein the label is used to represent the labeled position information of the text in the sample image, and the initial text detection model includes a feature extraction sub-model and a prediction sub-model.
[0054] In the present embodiment, the sample image can be any image containing text; the label of the sample image is used to represent the labeled position information of the text, i.e., the human-labeled text position, and the labeled position information can be in the form of a position box, which can be a polygon box, for example, the labeled position information can be a rectangular box composed of at least four position coordinates for representing the text position, and the four position coordinates can be the position coordinates of the four vertices of the rectangular box in the sample image.
[0055] Step S202, extracting a feature map corresponding to the sample image based on the feature extraction sub-model.
[0056] The feature map corresponding to the sample image is a feature map containing multi-size fusion features of the sample image.
[0057] Specifically, in the embodiments of the present disclosure, the feature extraction sub-model in the initial text detection model can be a model for extracting multi-size fusion features of an image. For example, the feature extraction sub-model can include a plurality of different convolutional layers that respectively extract image features of different sizes of the image, and then the plurality of image features of different sizes are up-sampled to the same size and merged to obtain the multi-size fusion features of the image, so as to express the features of different pixels in the image from different granularities.
[0058] In some embodiments, the method of extracting the feature map corresponding to the sample image based on the feature extraction sub-model includes: randomly obtaining an image of a preset size from the sample image and inputting the image into the feature extraction sub-model for multi-size feature extraction processing to obtain a plurality of image features of different sizes; and merging the plurality of image features of different sizes to obtain the feature map.
[0059] That is, in the case where the number of sample images is insufficient, in order to improve the model training effect and the model generalization ability, a cropped image of a preset size can be randomly cropped from the sample image, and the cropped image is input into the feature extraction sub-model for multi-size feature extraction processing to obtain a plurality of image features of different sizes, where the preset size can be, for example, 1024 pixels * 1024 pixels.
[0060] The merging of the plurality of image features of different sizes to obtain the feature map can include: up-sampling the plurality of image features of different sizes to the same size, and then merging the plurality of image features of the same size to obtain the feature map that fuses the image features of different sizes.
[0061] It should be noted that, in some embodiments, in order to further improve the model training effect and the model generalization ability, after obtaining the sample image, the method can further include: performing data augmentation processing on the sample image to obtain an augmented image corresponding to the sample image, randomly obtaining an image of a preset size from the augmented image and inputting the image into the feature extraction sub-model for multi-size feature extraction processing, and taking the obtained feature map as the feature map corresponding to the sample image.
[0062] As can be seen, in the embodiments of the present disclosure, by extracting the feature map corresponding to the sample image and fusing the image features of different sizes based on the feature extraction sub-model, the text location can be determined based on the multi-granularity image features when predicting the text location, so as to improve the accuracy of the prediction result.
[0063] In step S203, the feature map is input into the prediction sub-model to perform noise removal processing and text position prediction processing, to obtain predicted position information of the text in the sample image. The noise removal processing is used to remove the first preset noise in the annotation.
[0064] The first preset noise refers to that the position box represented by the annotation position information in the annotation does not accurately annotate the text position, that is, the annotated position box does not fit the text. For example, the position box of the text in the sample image is actually 100 pixels*100 pixels, but the annotated position box is 200 pixels*200 pixels or 50 pixels*200 pixels, and the like, which does not correctly fit the actual position of the text.
[0065] In the case that the annotation of the sample image has the first preset noise, since the annotation does not accurately represent the text position, training the model based on such sample images may cause the model to learn incorrect features, and thus slow down the convergence speed or even fail to accurately predict the text position.
[0066] Therefore, in the embodiments of the present disclosure, the default annotation is not completely correct, and the first preset noise that may exist in the annotation is removed based on the feature map when the text position is predicted based on the feature map, so as to avoid the model learning incorrect features and improve the accuracy of the obtained predicted position information.
[0067] In step S204, a target loss value is obtained according to the predicted position information and the annotation position information, and the parameters of the initial text detection model are adjusted based on the target loss value to obtain a target text detection model. The target loss value is used to represent the error between the first position represented by the predicted position information and the second position represented by the annotation position information.
[0068] After obtaining the predicted position information, the error between the predicted position information and the annotation position information can be calculated as a target loss value, and the model parameters are optimized based on the target loss value to obtain a target text detection model that satisfies a preset convergence condition.
[0069] It should be noted that in the embodiments of the present disclosure, the preset convergence condition can be that the calculated target loss value is lower than a preset threshold, that is, the error between the predicted position information predicted by the model and the annotation position information in the annotation is lower than the preset threshold; or the training iteration number of the model reaches a preset iteration value, which is not specially limited here.
[0070] In addition, in the embodiments of the present disclosure, the loss function used to calculate the target loss value can be any one of a mean squared error (MSE) loss function, a cross entropy (CE) loss function, or the like, or can be set to other loss functions as needed, which is not specially limited here.
[0071] According to the above description, compared with the problem that the model training effect is poor and the image text position cannot be accurately predicted in the related art when the existence of the label noise is ignored during model training, based on the method provided in the embodiments of the present disclosure, after the feature map corresponding to the sample image is extracted by the feature extraction sub-model based on the initial text detection model, the feature map is input into the prediction sub-model to simultaneously perform noise removal processing and text position prediction processing, which can avoid the influence of the first preset noise possibly existing in the label of the sample image on the model training, improve the model training effect and the accuracy of the prediction result.
[0072] Please refer to Figure 3 and Figure 4 which are respectively a flowchart for obtaining prediction position information and a framework schematic diagram of the training processing of the text detection model provided in the embodiments of the present disclosure; the following Figure 3 and Figure 4 explain how to obtain the prediction position information.
[0073] In the embodiments of the present disclosure, the label of the sample image can be a position box used to represent the position of the text of the sample image; as Figure 4 shown, the prediction sub-model can include a plurality of sequentially connected convolution groups, each convolution group can be used to predict the probability distribution of the pixels in the position box being text type pixels, and the probability distributions predicted by each convolution group are different; in this implementation manner, as Figure 3 shown, the step of inputting the feature map into the prediction sub-model to perform noise removal processing and text position prediction processing in the step S203 to obtain the prediction position information of the text in the sample image can include the following steps S301-S302.
[0074] In step S301, the feature map and the fusion feature data are sequentially input into each convolution group to perform text position prediction processing, and a plurality of probability distribution maps are obtained, wherein each probability distribution map corresponds to a convolution group, the fusion feature data includes the outputs of all the convolution groups before the current convolution group, and in the case that the current convolution group is the first convolution group in the plurality of convolution groups, the fusion feature data is a preset value.
[0075] In the embodiments of the present disclosure, the probability distribution diagram is used to represent the probability distribution of each pixel in the position box represented by the position information, and the probability distribution diagram can be a binary diagram composed of 0 and 1, wherein 1 can represent that the pixel at the corresponding position is a text type pixel, and 0 represents that the pixel at the corresponding position is not a text type pixel. Of course, this is only an example, and in actual processing, the probability distribution diagram can also be in other forms, which are not specially limited here.
[0076] That is, due to the noise in the annotation, the pixels in the annotated position box can not only contain text type pixels, but also contain background type pixels, wherein the text type pixel refers to the pixel in the position box of the sample image for constituting the text, and the background type pixel can be a pixel other than the text type pixel.
[0077] In practice, considering that in the annotated position box, the closer the distance to the position box boundary, the higher the probability of being a background type pixel, and the greater the distance to the position box boundary, the higher the probability of being a text type pixel, in the embodiments of the present disclosure, the probability of each pixel in the position box being a text type pixel can be predicted based on the feature map corresponding to the sample image, so as to accurately segment the text position. In order to improve the confidence coefficient of the prediction result, the idea of multi-model fusion and residual network can be used to predict different probability distributions based on multiple convolution groups, and the probability distribution predicted by the previous convolution group is used as input in the process of predicting the current probability distribution by the multiple convolution groups, so as to alleviate the influence of the first preset noise in the annotation by fusing the previous features, and improve the accuracy of the predicted position information.
[0078] In step S302, the prediction position information is obtained according to the plurality of probability distribution diagrams.
[0079] That is, after obtaining the plurality of probability distribution diagrams based on the plurality of convolution groups, the obtaining of the prediction position information based on the plurality of probability distribution diagrams can be that the mean of the plurality of probability distribution diagrams is taken as a merged diagram, and the prediction position information is obtained according to the plurality of merged diagrams.
[0080] In actual processing, the obtaining of the prediction position information according to the plurality of merged diagrams can be segmentation processing of the merged diagram based on a region growing algorithm or the like, so as to segment out the prediction position box for representing the text position as the prediction position information.
[0081] It can be seen that in the embodiment of the present disclosure, by respectively obtaining the probability distribution maps through the plurality of convolution groups, and taking the feature map and the probability distribution maps predicted by all the convolution groups located at the previous positions as inputs in the process of extracting the probability distribution map of the current convolution group, the features of the previous convolution groups can be fused, and meanwhile, by averaging the plurality of predicted probability distribution maps, the influence of the first preset noise in the annotation can be further alleviated, and the accuracy of the predicted position information can be improved.
[0082] Please continue to see Figure 4 In some embodiments, the number of the plurality of convolution groups of the prediction sub-model can be n, n is an integer greater than 1, and preferably n can be 6, that is, the prediction sub-model in the embodiment of the present disclosure can include 6 convolution groups; in this embodiment, as shown in Figure 5 The step of sequentially inputting the feature map and the fusion feature data into each convolution group in the step S301 to perform text position prediction processing to obtain the plurality of probability distribution maps can include the following steps S501-S503.
[0083] In the step S501, the feature map and the fusion feature data are input into the i-th convolution group to perform text position prediction processing to obtain a first probability distribution map, where the initial value of i is 1; in the step S502, when i is less than n, the fusion feature data is updated according to the first probability distribution map, i is updated according to the preset step value, and the step of inputting the feature map and the fusion feature data into the i-th convolution group to perform text position prediction processing to obtain the first probability distribution map is executed again; and in the step S503, when i is equal to n, the plurality of obtained first probability distribution maps are taken as the plurality of probability distribution maps.
[0084] In the embodiment of the present disclosure, the preset step value can be 1 unless otherwise specified.
[0085] That is, when n is 6, that is, the plurality of convolution groups are 6 convolution groups, when i is 1, for the convolution group 1, the input can only be the feature map extracted in the step S202, and the output can be the probability distribution Figure 1 ; then, since i is less than 6, the fusion feature data can be obtained based on the probability distribution Figure 1 , and i is updated to 2; then, the feature map and the current fusion feature data, that is, the probability distribution Figure 1 , can be input into the convolution group 2 to obtain the probability distribution Figure 1 , and the fusion feature data is updated to {probability distribution Figure 2 , probability distribution Figure 1}, and i is updated to 3; then, the convolution group 3 is input to obtain the probability distribution Figure 2 Figure 3 ; after the above steps are iteratively performed, the feature map and the probability distribution Figure 1 , the probability distribution Figure 2 , the probability distribution Figure 3 , the probability distribution Figure 4 , and the probability distribution Figure 5 In the input convolution group 6, the probability distribution Figure 6 is obtained, and the execution is stopped, and the probability distribution Figures 1 to 6 is taken as the plurality of probability distribution maps.
[0086] Please continue to refer to Figure 4 In some embodiments, each convolution group in the plurality of convolution groups can include m layers of convolution layers and 1 weight processing layer, where m is an integer greater than 1, and preferably m is 3, that is, each convolution group can include 3 convolution layers, and the input channel of the convolution layer at the first position in the convolution group can be 16+i-1.
[0087] In the embodiment of the present disclosure, when the number of convolution groups is 6, the input channel of the convolution layer 11 in the convolution group 1 is 16, the output channel of the convolution layer 11 is 16, the input channel of the convolution layer 12 is 16, and the output channel is 16, the input channel of the convolution layer 13 is 16, and the output channel is 1; the input channel of the convolution layer 21 in the convolution group 2 is 17, and the output channel is 17, the input channel and the output channel of the convolution layer 22 are both 17, the input channel of the convolution layer 23 is 17, and the output channel is 1, …, the input channel of the convolution layer 61 in the convolution group 6 is 21, and the output channel is both 21, the input and output channels of the convolution layer 62 are both 21, and the input channel of the convolution layer 63 is 21, and the output channel is 1; in addition, when m is 3, the convolution kernel of the first convolution layer in each convolution group can be 1*5, the padding is 1, and the convolution step is 1, the convolution kernel of the second convolution layer is 5*1, the padding is 1, and the convolution step is 1, the convolution kernel of the third convolution layer is 1*1, the padding is 0, and the convolution step is 1.
[0088] In this embodiment, as shown in Figure 6 the input of the feature map and the fusion feature data in the step S501 into the i-th convolution group for text position prediction processing to obtain the first probability distribution map can include the following steps S601-S602.
[0089] In step S601, the feature map and the fused feature data are subjected to convolution processing based on the m convolution layers in the i-th convolution group, to obtain an initial probability distribution map; and in step S602, the initial probability distribution map is input into a weight processing layer for weighted processing, to obtain a first probability distribution map, wherein the weight processing layer is configured to determine a weight value of each pixel in the position box according to a distance of each pixel in the position box to a boundary of the position box, a maximum boundary distance, and a number of pixels, wherein the maximum boundary distance is a maximum value of distances of all pixels in the position box to the boundary of the position box, and the number of pixels is a number of all pixels in the position box.
[0090] In the embodiments of the present disclosure, the weight value of each pixel can be calculated by the weight processing layer in the corresponding convolution group based on the following formula:
[0091]
[0092]
[0093] wherein D x represents the distance of the current pixel x to the boundary of the position box, i.e., the distance to the edge, D max represents the maximum boundary distance, x represents a pixel in the position box for which the weight value needs to be calculated, and n is the position of the current convolution group in all convolution groups.
[0094] According to the above description, in the embodiments of the present disclosure, different probability distributions indicating that the pixels in the labeled position box are text type pixels are obtained based on the multiple convolution groups in the predictor model, the multiple different probability distributions are fused based on the idea of feature fusion and residual network, and the predicted position information is obtained based on the fused probability distribution, which can avoid the first preset noise in the labeling, i.e., the influence of the labeled position box not fitting the text, and improve the accuracy of the prediction result.
[0095] Please refer to Figure 7 which is a flowchart provided by the embodiments of the present disclosure for obtaining a target loss value. As shown in Figure 7 , in some embodiments, the step S204 of obtaining the target loss value based on the predicted position information and the labeled position information includes the following steps S701-S703.
[0096] In step S701, the sample type of the sample image is determined based on the predicted position information and the labeled position information, wherein the sample type includes: a positive sample type for indicating that the predicted position information and the labeled position information match, and a negative sample type for indicating that the predicted position information and the labeled position information do not match.
[0097] Specifically, considering that in practice, there may also be a second preset noise in the labeling of the sample image, i.e., the text position is labeled by mistake or missed, which may also affect the model training, therefore, in the embodiments of the present disclosure, after obtaining the predicted position information, in the process of calculating the target loss value, whether the predicted position information and the labeled position information match can be judged, for example, whether the error of the two is within a certain threshold range to determine the sample type of the sample image, i.e., whether it is a positive sample type or a negative sample type. Considering that in the case of a positive sample type, the loss value between the predicted position information and the labeled position information can accurately reflect the model prediction effect, therefore, the loss value of the two can not be adjusted. In the case of a negative sample type, considering that the loss value between the predicted position information and the labeled position information cannot accurately reflect the model prediction effect at the beginning of model training, which may affect the model training, therefore, the loss value of the sample image of the negative sample type can be adjusted by setting the range of the weight to reduce the influence of the second preset noise on the model training.
[0098] In some embodiments, according to the predicted position information and the labeled position information, the sample type of the sample image is determined, including: respectively obtaining the intersection and the union between the first position and the second position; in the case that the ratio of the intersection to the union is greater than or equal to a preset threshold value, determining that the sample type is a positive sample type, and in the case that the ratio of the intersection to the union is less than the preset threshold value, determining that the sample type is a negative sample type.
[0099] That is, in the embodiments of the present disclosure, whether the predicted position information represented first position and the labeled position information represented second position match can be determined by the ratio of the intersection and the union between the two, if the ratio is greater than or equal to a preset threshold value, it can be determined that the sample type of the sample image is a positive sample type, otherwise, it can be determined that the sample type of the sample image is a negative sample type, wherein the preset threshold value may be 0.5, for example.
[0100] Step S702, according to the sample type and the current training iteration number, a weight value for removing the second preset noise in the labeling is determined.
[0101] As shown above, in some embodiments, according to the sample type and the current training iteration number, the weight value for removing the second preset noise in the labeling is determined, including: in the case of a positive sample type, setting the weight value to a first preset weight value; in the case of a negative sample type, determining the weight value according to the current training iteration number.
[0102] The first preset weight value may be 1 for example. In addition, in the embodiments of the present disclosure, in the case that the sample type is a negative sample type, the weight value of the loss value corresponding to the sample image of the negative sample type may be determined based on the following formula:
[0103]
[0104]
[0105] wherein e represents the current training iteration number, E max represents the preset maximum training iteration number. Specifically, considering that even until the end of training, the prediction result of the model cannot be completely correct, in the embodiments of the present disclosure, in order to reduce the influence of the second preset noise on the training result while improving the model training result as much as possible, the weight value may be determined based on the current iteration number and the preset maximum training iteration number in the initial training stage during the training process. In the later stage of model training, the weight value may be set to the second preset threshold value, for example, set to 0.5 in the above formula. It should be noted that in practice, the second preset threshold value may also be set to other numerical values, which are not specially limited here.
[0106] In step S703, the error value between the predicted position information and the labeled position information is calculated as an initial loss value, and the target loss value is obtained according to the initial loss value and the weight value.
[0107] After determining the weight value corresponding to the loss value, the target loss value that can reduce the influence of the second preset noise can be calculated based on the initial loss value and the weight value in the case that the initial loss value is calculated. The model parameters are optimized based on the target loss value, which can accelerate the model convergence speed and improve the accuracy of the prediction result.
[0108] It can be seen that in the embodiments of the present disclosure, when training the text detection model, not only can the prediction sub-model be used to remove the first preset noise that may exist in the label, i.e., the inaccurate text box noise of the label, but also by judging whether the predicted position information and the labeled position information match to distinguish the sample type of the sample image in the process of adjusting the model parameters based on the loss value, and the weight of the loss value is adaptively adjusted based on the sample type, the influence of the second preset noise that may exist in the negative sample on the model training can be reduced, and the model training efficiency and the accuracy of the prediction result can be further improved.
[0109] Please refer to Figure 8 which is a flowchart of a text detection method provided by the embodiments of the present disclosure. The method can be applied in an electronic device, which may, for example, be a mobile phone Figure 1The server 101 shown, or also can be a terminal device, for example, can be a mobile phone, tablet computer and personal computer and other devices, here is not special limited.
[0110] As Figure 8 The text detection method provided by the embodiment of the present disclosure can include the following steps S801-S802.
[0111] Step S801, obtaining a target image to be detected.
[0112] Step S802, inputting the target image into a target text detection model for text detection processing to obtain target position information, wherein the target position information is used to represent the position information of the text in the target image, and the target text detection model is obtained according to the training method of the text detection model in the above embodiment.
[0113] Since the target text detection model is obtained by removing the influence of the possible label noise in the sample image, such as the first preset noise and / or the second preset noise, during the training process, the text detection based on the target text detection model can enable the electronic device to accurately predict the target position information of the text in the target image.
[0114] It should be noted that the target text detection model in the embodiment of the present disclosure can not only be directly used for the text detection task, but also be used for other downstream tasks, for example, it can be used in the text recognition task, which will not be described here.
[0115] In addition, it can be understood that in the process of training the target text detection model, if the training process also includes the processing of removing the second preset noise, i.e. the missing label and mislabeling noise, the target text detection model can not include the processing of judging the sample type based on the predicted position information in the process of applying the target text detection model, so as to reduce the model structure.
[0116] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form combined embodiments without violating the principle logic. Limited to the length of the present disclosure, the present disclosure will not be described here. Those skilled in the art can understand that in the above method of the specific embodiment, the specific execution order of each step should be determined by its function and possible internal logic.
[0117] In addition, the present disclosure also provides a text detection model training device, a text detection device, an electronic device and a computer readable storage medium, all of which can be used to implement any one of the text detection model training method or the text detection method provided by the present disclosure. The corresponding technical solutions and descriptions are described in the method part and are not described here.
[0118] Figure 9A block diagram of a text detection model training apparatus provided by embodiments of the present disclosure.
[0119] With reference to Figure 9 Embodiments of the present disclosure provide a text detection model training apparatus, which comprises a second acquisition unit 901, a feature extraction unit 902, a prediction unit 903 and a parameter adjustment unit 904.
[0120] The second acquisition unit 901 is configured to acquire a sample image, a label of the sample image and an initial text detection model to be trained, wherein the label is used to represent label position information of text in the sample image, and the initial text detection model comprises a feature extraction sub-model and a prediction sub-model.
[0121] The feature extraction unit 902 is configured to extract a feature map corresponding to the sample image based on the feature extraction sub-model.
[0122] The prediction unit 903 is configured to input the feature map into the prediction sub-model to perform noise removal processing and text position prediction processing, and obtain prediction position information of the text in the sample image, wherein the noise removal processing is used to remove a first preset noise in the label.
[0123] The parameter adjustment unit 904 is configured to obtain a target loss value according to the prediction position information and the label position information, and adjust parameters of the initial text detection model based on the target loss value to obtain a target text detection model, wherein the target loss value is used to represent an error between a first position represented by the prediction position information and a second position represented by the label position information.
[0124] In some embodiments, when the parameter adjustment unit 904 obtains the target loss value according to the prediction position information and the label position information, the parameter adjustment unit 904 can be configured to: determine a sample type of the sample image according to the prediction position information and the label position information, wherein the sample type comprises a positive sample type used to represent that the prediction position information and the label position information match, and a negative sample type used to represent that the prediction position information and the label position information do not match; determine a weight value used to remove a second preset noise in the label according to the sample type and a current training iteration number; calculate an error value between the prediction position information and the label as an initial loss value, and obtain the target loss value according to the initial loss value and the weight value.
[0125] In some embodiments, when the parameter adjustment unit 904 determines the sample type of the sample image according to the prediction position information and the label position information, the parameter adjustment unit 904 can be configured to: respectively acquire an intersection and a union between the first position and the second position; in a case where a ratio of the intersection to the union is greater than or equal to a preset threshold, determine that the sample type is the positive sample type, and in a case where the ratio of the intersection to the union is less than the preset threshold, determine that the sample type is the negative sample type.
[0126] In some embodiments, the parameter adjusting unit 904, when determining the weight value for removing the second preset noise in the label according to the sample type and the current number of training iterations, can be configured to: set the weight value as a first preset weight value in a case where the sample type is a positive sample type; and determine the weight value according to the current number of training iterations in a case where the sample type is a negative sample type.
[0127] In some embodiments, the label is a position box used to represent the position of the text in the sample image; the prediction sub-model includes a plurality of sequentially connected convolution groups, each convolution group being configured to predict a probability distribution of a pixel in the position box being a text type pixel, and the probability distributions predicted by the convolution groups being different; and the prediction unit 903, when inputting the feature map into the prediction sub-model to perform noise removal processing and text position prediction processing to obtain the prediction position information of the text in the sample image, can be configured to: input the feature map and the fusion feature data into each convolution group in sequence to perform text position prediction processing to obtain a plurality of probability distribution maps, wherein each probability distribution map corresponds to a convolution group, the fusion feature data includes the outputs of all convolution groups before the current convolution group, and in a case where the current convolution group is a first convolution group in the plurality of convolution groups, the fusion feature data is a preset value; and obtain the prediction position information according to the plurality of probability distribution maps.
[0128] In some embodiments, the number of the plurality of convolution groups is n, and n is an integer greater than 1; and the prediction unit 903, when inputting the feature map and the fusion feature data into each convolution group in sequence to perform text position prediction processing to obtain the plurality of probability distribution maps, can be configured to: input the feature map and the fusion feature data into an i-th convolution group to perform text position prediction processing to obtain a first probability distribution map, wherein the initial value of i is 1; in a case where i is less than n, update the fusion feature data according to the first probability distribution map, and update i by a preset step value, and then perform the step of inputting the feature map and the fusion feature data into the i-th convolution group to perform text position prediction processing to obtain the first probability distribution map again; and in a case where i is equal to n, obtain the plurality of first probability distribution maps as the plurality of probability distribution maps.
[0129] In some embodiments, each of the plurality of convolution groups comprises m layers of convolution layers and 1 weight processing layer, where m is an integer greater than 1; when the prediction unit 903 inputs the feature map and the fusion feature data into the i th convolution group to perform text position prediction processing to obtain the first probability distribution map, the prediction unit 903 can be configured to: perform convolution processing on the feature map and the fusion feature data based on the m layers of convolution layers in the i th convolution group to obtain an initial probability distribution map; and input the initial probability distribution map into the weight processing layer to perform weighting processing to obtain the first probability distribution map, wherein the weight processing layer is configured to determine a weight value of each pixel according to a distance of each pixel in the position box to a boundary of the position box, a maximum boundary distance, and a number of pixels, where the maximum boundary distance is a maximum value of distances of all pixels in the position box to the boundary of the position box, and the number of pixels is a number of all pixels in the position box.
[0130] In some embodiments, when the feature extraction unit 902 extracts the feature map corresponding to the sample image based on the feature extraction sub-model, the feature extraction unit 902 can be configured to: input an image of a predetermined size randomly obtained from the sample image into the feature extraction sub-model to perform multi-size feature extraction processing to obtain a plurality of image features of different sizes; and perform merging processing on the plurality of image features of different sizes to obtain the feature map.
[0131] Figure 10 A block diagram of a text detection device provided by an embodiment of the present disclosure.
[0132] With reference to Figure 10 An embodiment of the present disclosure provides a text detection device, which comprises a first acquisition unit 1001 and a prediction unit 1002.
[0133] The first acquisition unit 1001 is configured to acquire a target image to be detected.
[0134] The prediction unit 1002 is configured to input the target image into a target text detection model to perform text detection processing to obtain target position information, where the target position information is used to represent position information of text in the target image, and the target text detection model is obtained by the training method of any one of the text detection models.
[0135] Figure 11 A block diagram of an electronic device provided by an embodiment of the present disclosure.
[0136] With reference to Figure 11The electronic device 1100 includes at least one processor 1101, at least one memory 1102, and one or more I / O interfaces 1103 connected between the processor 1101 and the memory 1102. The memory 1102 stores one or more computer programs executable by the at least one processor 1101. The one or more computer programs are executed by the at least one processor 1101 to enable the at least one processor 1101 to perform the training method of the text detection model or the text detection method described above.
[0137] The present disclosure also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the training method of the text detection model or the text detection method described above. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0138] The present disclosure also provides a computer program product comprising computer readable code, or a non-volatile computer-readable storage medium carrying computer readable code, which, when run in a processor of an electronic device, causes the processor in the electronic device to perform the training method of the text detection model or the text detection method described above.
[0139] Those of ordinary skill in the art can understand that all or some of the steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component can have multiple functions, or one function or step can be performed by several physical components in cooperation. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable storage medium, which can include computer storage media (or non-transitory media) and communication media (or transitory media).
[0140] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store preset (desired) information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0141] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0142] Computer readable program instructions for carrying out operations of the present disclosure can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state setting data, or any combination of one or more of the above in any combination of one or more programming languages including an object oriented programming language such as Smalltalk, C++ or the like and conventional procedural programming languages such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.
[0143] The computer program product described herein can be embodied in a specific manner by hardware, software, or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium. In another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), and the like.
[0144] The various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer readable program instructions.
[0145] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can be a computer- readable storage medium having no data storage cycles that change state. The instructions can be executed by one or more processors of a computer, other programmable data processing apparatus, or other devices to produce a computer-implemented process such that the instructions which execute via the one or more processors of the computer or other programmable data processing devices create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0146] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0147] The flow and block diagrams in the drawings show architectural, functional, and operational aspects of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow and block diagrams can represent a module, a segment, or a portion of instructions which comprise one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may
[0148] Example embodiments have been disclosed and, although a specific terminology is employed, it is merely for the convenience of the reader and is not intended to be limiting. In some instances, specific details have been included for the purpose of providing a thorough understanding of the embodiments presented, but it will be apparent to those skilled in the art that embodiments of the application can be practiced without these specific details. In some instances, features, characteristics and / or elements described in connection with a particular embodiment can be used in conjunction with, or switched to, features, characteristics and / or elements described in connection with other embodiments, unless otherwise explicitly stated. Accordingly, it will be understood that various changes in form and details can be made without departing from the scope of the disclosure as set forth in the appended claims.
Claims
1. A method for training a text detection model, the method comprising: The method comprises: obtaining a sample image, a label of the sample image and an initial text detection model to be trained, wherein the label is used to represent annotation position information of text in the sample image, and the initial text detection model comprises a feature extraction sub-model and a prediction sub-model; extracting a feature map corresponding to the sample image based on the feature extraction sub-model; inputting the feature map into the prediction sub-model for noise removal processing and text position prediction processing to obtain prediction position information of the text in the sample image, wherein the noise removal processing is used to remove first preset noise in the label; obtaining a target loss value according to the prediction position information and the annotation position information, and adjusting parameters of the initial text detection model based on the target loss value to obtain a target text detection model, wherein the target loss value is used to represent an error between a first position represented by the prediction position information and a second position represented by the annotation position information; wherein the label is a position box used to represent a position of text in the sample image; the prediction sub-model comprises a plurality of sequentially connected convolution groups, and each convolution group is used to predict a probability distribution of pixels in the position box being text type pixels, and the probability distributions predicted by the convolution groups are different; the inputting of the feature map into the prediction sub-model for noise removal processing and text position prediction processing to obtain the prediction position information of the text in the sample image comprises: inputting the feature map and fusion feature data into each convolution group in sequence for text position prediction processing to obtain a plurality of probability distribution maps, wherein each probability distribution map corresponds to a convolution group, the fusion feature data comprises outputs of all convolution groups before a current convolution group, and in a case where the current convolution group is a first convolution group in the plurality of convolution groups, the fusion feature data is a preset value; the prediction position information is obtained according to the plurality of probability distribution maps.
2. The method of claim 1, wherein, the obtaining of the target loss value according to the prediction position information and the annotation position information comprises: determining a sample type of the sample image according to the prediction position information and the annotation position information, wherein the sample type comprises a positive sample type used to represent that the prediction position information and the annotation position information match, and a negative sample type used to represent that the prediction position information and the annotation position information do not match; determining a weight value used to remove second preset noise in the label according to the sample type and a current training iteration number; calculating an error value between the prediction position information and the annotation position information as an initial loss value, and obtaining the target loss value according to the initial loss value and the weight value.
3. The method of claim 2, wherein, the determining of the sample type of the sample image according to the prediction position information and the annotation position information comprises: respectively obtaining an intersection and a union between the first position and the second position; In a case where a ratio of the intersection and the union is greater than or equal to a preset threshold, determining that the sample type is the positive sample type, and in a case where the ratio of the intersection and the union is less than the preset threshold, determining that the sample type is the negative sample type.
4. The method of claim 2, wherein, The weight value for removing the second preset noise in the label is determined according to the sample type and a current number of training iterations, including: In a case where the sample type is the positive sample type, setting the weight value as a first preset weight value; In a case where the sample type is the negative sample type, determining the weight value according to the current number of training iterations.
5. The method of claim 1, wherein, The number of the plurality of convolution groups is n, and n is an integer greater than 1; The feature map and the fusion feature data are sequentially input into each convolution group for text position prediction processing to obtain a plurality of probability distribution maps, including: The feature map and the fusion feature data are input into an i th convolution group for text position prediction processing to obtain a first probability distribution map, where the initial value of i is 1; In a case where i is less than n, the fusion feature data is updated according to the first probability distribution map, i is updated by a preset step value, and the step of inputting the feature map and the fusion feature data into the i th convolution group for text position prediction processing to obtain a first probability distribution map is executed again; In a case where i is equal to n, the obtained plurality of first probability distribution maps are taken as the plurality of probability distribution maps.
6. The method of claim 5, wherein, Each convolution group in the plurality of convolution groups includes m convolution layers and one weight processing layer, where m is an integer greater than 1; The feature map and the fusion feature data are input into an i th convolution group for text position prediction processing to obtain a first probability distribution map, including: The feature map and the fusion feature data are convoluted based on the m convolution layers in the i th convolution group to obtain an initial probability distribution map; The initial probability distribution map is input into the weight processing layer for weighted processing to obtain the first probability distribution map, where the weight processing layer is used to determine a weight value of each pixel according to a distance of each pixel in the position frame to a boundary of the position frame, a maximum boundary distance, and a pixel number, the maximum boundary distance is a maximum value of distances of all pixels in the position frame to the boundary of the position frame, and the pixel number is a number of all pixels in the position frame.
7. The method of claim 1, wherein, The feature map corresponding to the sample image is extracted based on the feature extraction sub-model, including: An image of a preset size is randomly obtained from the sample image and input into the feature extraction sub-model for multi-size feature extraction processing to obtain a plurality of image features of different sizes; The plurality of image features of different sizes are merged to obtain the feature map.
8. A text detection method characterized by, Including: An image of a target to be detected is obtained; The target image is input into a target text detection model for text detection processing to obtain target position information, wherein the target position information is used to represent position information of text in the target image, and the target text detection model is obtained according to the training method of the text detection model in any one of claims 1-7.
9. A text detection apparatus characterized by comprising: Comprising: a first acquisition unit configured to acquire a target image to be detected; a detection unit configured to input the target image into a target text detection model for text detection processing to obtain target position information, wherein the target position information is used to represent position information of text in the target image, and the target text detection model is obtained according to the training method of the text detection model in any one of claims 1-7.
10. An electronic device, comprising: Comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
11. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by a processor, implements the method of any one of claims 1-8.
Citation Information
Patent Citations
Text detection model training method and device and text detection method and device
CN112818975A
Target detection model training method and device and target detection method
CN115131655A