Text detection model training method and device, text detection method and device and electronic equipment
Through the combination of wavelet decomposition and knowledge distillation model, the text detection results are separated to train the student model, which solves the problem of high resource consumption on mobile devices and achieves efficient text detection.
Patent Information
- Application Number
- CN202310341171.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-01
AI Technical Summary
Existing scene text detection technology has the problem of excessive resource consumption on mobile devices and is difficult to apply to mobile devices.
Wavelet decomposition processing is used to separate the text detection results into foreground images and background images, and the student model is trained based on the knowledge distillation model to reduce resource requirements.
The model training efficiency is improved, the processing resource consumption of text detection is reduced, and a student model with lower complexity is obtained, which is suitable for mobile devices.
Smart Images

Figure CN118736552A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text recognition technology, and in particular to a text detection model training, a text detection method, a device and an electronic device. Background Art
[0002] With the development of text recognition technology, scene text recognition technology has emerged. This technology recognizes text information in natural scenes. Compared with traditional technology for recognizing scanned documents, scene text recognition is more difficult because the text in natural scenes may exist in various patterns such as rotation and distortion, and may also be incomplete or blurred, and the text background is complex and diverse.
[0003] In the prior art, segmentation technology is usually used to extract text areas from scene images, and then text recognition is performed on the text areas. The segmentation technology usually segments pixels in the scene image, which requires more processing resources and has high hardware requirements. As mobile devices are gradually widely used, this method is difficult to apply on mobile devices due to limited resources of mobile devices.
[0004] Therefore, current scene text detection techniques suffer from the problem of consuming processing resources. Summary of the invention
[0005] Based on this, it is necessary to provide a text detection model training, a text detection method, an apparatus, an electronic device and a computer-readable storage medium to address the above technical problems.
[0006] In a first aspect, a text detection model training method is provided. The method comprises:
[0007] Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0008] Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0009] Determine a first foreground image and a first background image of the first frequency domain sub-image;
[0010] The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0011] In another embodiment, the training of the to-be-trained text detection model according to the first foreground image and the first background image to obtain a pre-trained text detection model includes:
[0012] Determining a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image;
[0013] Obtaining a model loss value of the text detection model to be trained according to the foreground loss value and the background loss value;
[0014] The text detection model to be trained is trained according to the model loss value to obtain the pre-trained text detection model.
[0015] In another embodiment, determining a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image includes:
[0016] Determine a second frequency domain sub-image corresponding to the sample image based on the teacher model in the knowledge distillation model;
[0017] Determine a second foreground image and a second background image of the second frequency domain sub-image;
[0018] Obtaining the foreground loss value according to a first loss value between the first foreground image and the second foreground image, and a second loss value between the first foreground image and an actual foreground image;
[0019] The background loss value is obtained according to a third loss value between the first background image and the second background image, and a fourth loss value between the first background image and the actual background image.
[0020] In another embodiment, determining the second frequency domain sub-image corresponding to the sample image based on the teacher model in the knowledge distillation model includes:
[0021] Inputting the sample image into the teacher model to obtain a second text detection result for the sample image;
[0022] Perform wavelet decomposition processing on the second text detection result to obtain the second frequency domain sub-image.
[0023] In another embodiment, determining a second foreground image and a second background image of the second frequency domain sub-image includes:
[0024] Performing dilation processing on the actual text detection result of the sample image to obtain a foreground mask of the sample image, and determining a background mask of the sample image according to the foreground mask;
[0025] The second foreground image is extracted from the second frequency domain sub-image according to the foreground mask, and the second background image is extracted from the second frequency domain sub-image according to the background mask.
[0026] In another embodiment, the determining of the second foreground image and the second background image of the second frequency domain sub-image further includes:
[0027] The foreground mask is subjected to wavelet decomposition processing to obtain the actual foreground image, and the background mask is subjected to wavelet decomposition processing to obtain the actual background image.
[0028] In a second aspect, a text detection method is provided. The method comprises:
[0029] Acquire the image to be detected;
[0030] The image to be detected is input into a pre-trained text detection model to obtain a text detection result of the pre-trained text detection model on the image to be detected; the pre-trained text detection model is obtained by the following steps:
[0031] Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0032] Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0033] Determine a first foreground image and a first background image of the first frequency domain sub-image;
[0034] The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0035] In a third aspect, a text detection model training device is provided. The device comprises:
[0036] An image detection module, used for inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0037] A wavelet decomposition module, configured to perform wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0038] An image separation module, used for determining a first foreground image and a first background image of the first frequency domain sub-image;
[0039] The model training module is used to train the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0040] In a fourth aspect, an electronic device is provided, characterized in that it includes: a memory, one or more processors;
[0041] The memory is used to store one or more programs;
[0042] When the one or more programs are executed by the one or more processors, the one or more processors implement the following operations:
[0043] Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0044] Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0045] Determine a first foreground image and a first background image of the first frequency domain sub-image;
[0046] The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0047] In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0048] Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0049] Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0050] Determine a first foreground image and a first background image of the first frequency domain sub-image;
[0051] The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0052] The above-mentioned text detection model training, text detection method, device, computer equipment and storage medium obtain a first text detection result for the sample image by inputting the acquired sample image into the text detection model to be trained, perform wavelet decomposition processing on the first text detection result, obtain a first frequency domain sub-image corresponding to the first text detection result, determine the first foreground image and the first background image of the first frequency domain sub-image, and train the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model; multiple sub-images of the sample image can be obtained by wavelet decomposition and separation of the foreground image and the background image, and the student model in the knowledge distillation can be supervised respectively by the multiple sub-images, and then the model training is performed, thereby improving the efficiency of model training and reducing the resources required for model training.
[0053] Moreover, by training a student model with lower complexity, using the student model for text detection can reduce the processing resources of text detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 is a flowchart of a text detection model training method provided in Example 1 of the present application;
[0055] Figure 2 is a flowchart of a text detection model training method provided in Example 2 of the present application;
[0056] Figure 3 is a schematic diagram of the structure of a knowledge distillation model in an embodiment of the present application;
[0057] Figure 4 is a schematic diagram of a text detection result and its frequency domain sub-image in an embodiment of the present application;
[0058] Figure 5 is a flowchart of a text detection method provided in Example 3 of the present application;
[0059] Figure 6 It is a structural schematic diagram of a text detection model training device provided in Example 4 of the present application;
[0060] Figure 7 is a structural schematic diagram of a text detection device provided in Embodiment 5 of the present application;
[0061] Figure 8 This is a structural diagram of an electronic device provided in Example 6 of the present application. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0063] Embodiment 1
[0064] Figure 1 is a flowchart of a text detection model training method provided in Example 1 of the present application. Figure 1 The text detection model training method of the first embodiment of the present application, taking application in a terminal as an example, specifically includes:
[0065] Step S110, inputting the acquired sample image into the text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in the knowledge distillation model.
[0066] The sample image may be an image containing text, and may be an image collected from a natural scene or artificially generated.
[0067] The first text detection result may be an image result outputted by the text detection model to be trained performing text detection on the sample image.
[0068] In a specific implementation, a knowledge distillation model can be constructed, which includes a teacher model and a student model. The teacher model is pre-trained so that the detection results of the trained teacher model for scene text meet certain reliability and / or accuracy requirements. After that, the student model, i.e., the text detection model to be trained, is trained. During the training process of the text detection model, a sample image can be obtained, and the sample image can be input into the text detection model to be trained. The text detection model to be trained performs text detection on the sample image and outputs a first text detection result.
[0069] Among them, the teacher model can use the DBNet (Real-time Scene Text Detection with Differentiable Binarization) network, and the backbone structure in the DBNet network can be ResNet50 (Residual Neural Network 50, 50-layer residual artificial neural network); the student model can also use the DBNet network, and the backbone structure in the DBNet network can be MobileNetV3 (lightweight neural network).
[0070] It can be seen that the student model is lighter than the teacher model. By transferring knowledge from the high-performance teacher model to the lightweight student model through knowledge distillation, and then using the student model for text detection, the resources consumed in the text detection process can be reduced.
[0071] In practical applications, the initial parameters of the student model in knowledge distillation can be set to obtain the student model to be trained. The text in natural scenes can also be photographed to obtain sample images, which are input into the student model to be trained. The student model to be trained performs text detection on the sample images to obtain image results of text detection on the sample images.
[0072] Step S120: performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result.
[0073] The first frequency domain sub-image may be a frequency domain image obtained by wavelet decomposition of the first text detection result.
[0074] In a specific implementation, two-dimensional wavelet decomposition may be performed on the first text detection result to obtain at least one first frequency domain sub-image corresponding to the first text detection result.
[0075] The wavelet decomposition method may be, but is not limited to, HAAR wavelet (Haar wavelet) decomposition.
[0076] In practical applications, the image results obtained by performing text detection on the sample image by the student model to be trained can be subjected to HAAR wavelet decomposition to obtain 4 frequency domain sub-images. The 4 frequency domain sub-images respectively show the details of the text detection image results in the horizontal reverse, vertical and diagonal directions, as well as the image sampled 2 times the text detection image results. These 4 frequency domain sub-images are used as the first frequency domain sub-images.
[0077] Step S130: determine a first foreground image and a first background image of a first frequency domain sub-image.
[0078] The first foreground image may be a foreground image in the first frequency domain sub-image.
[0079] The first background image may be an image of the background in the first frequency domain sub-image.
[0080] In a specific implementation, the actual text detection result of the sample image can be obtained, the text area and the non-text area can be determined from the actual text detection result, a foreground mask is generated according to the text area, a background mask is generated according to the non-text area, the first foreground image is extracted from the first frequency domain sub-image using the foreground mask, and the first background image is extracted from the first frequency domain sub-image using the background mask.
[0081] The actual text detection result may be a real image result of text detection on a sample image.
[0082] In practical applications, the real image results of sample image text detection can be obtained, and the text area can be determined from the real image results through morphological operations, and the text area is determined as the foreground mask, and the area outside the text area in the real image result is determined as the background mask. The foreground mask is multiplied with the four first frequency domain sub-images to obtain four first foreground images, which are represented as S1, S2, S3, and S4 respectively. The background mask can also be multiplied with the four first frequency domain sub-images to obtain four first background images, which are represented as S5, S6, S7, and S8 respectively.
[0083] Step S140: training the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0084] In a specific implementation, a foreground loss value can be determined based on the first foreground image, and a background loss value can be determined based on the first background image. The sum of the foreground loss value and the background loss value can be determined as the model loss value of the text detection model to be trained. When the model loss value does not meet the preset conditions, the parameters of the text detection model to be trained are adjusted, and the process returns to step S110, and the text detection model training method is re-executed. Based on the text detection model with adjusted parameters, the model loss value is calculated again until the obtained model loss value meets the preset conditions.
[0085] In practical applications, for the second text detection result obtained by the teacher model in knowledge distillation performing text detection on the sample image, wavelet decomposition can be performed first to obtain 4 second frequency domain sub-images, and then the foreground mask and background mask are used to separate each second frequency domain sub-image to obtain 4 second foreground images and 4 second background images, which are represented as T1, T2, T3, T4 and T5, T6, T7, T8 respectively; since the foreground mask and the background mask are obtained based on the real image results of the sample image text detection, the foreground mask and the background mask can be respectively decomposed by wavelet to obtain 4 actual foreground images and 4 actual background images, which are represented as G1, G2, G3, G4 and G5, G6, G7, G8 respectively. The foreground loss value LF is determined according to the difference between the first foreground image and the second foreground image, and the difference between the first foreground image and the actual foreground image. The background loss value LB is determined according to the difference between the first background image and the second background image, and the difference between the first background image and the actual background image, and the background loss value LB is obtained respectively.
[0086] LF=|Si-Ti| 2 +|Si-Gi| 2 , i=1,2,3,4,
[0087] LB=|Sj-Tj| 2 +|Sj-Gj| 2 , j=5,6,7,8.
[0088] Correspondingly, the model loss value can be L=LF+LB, and the model loss value is compared with a preset loss value threshold. If the model loss value is above the loss value threshold, the parameters of the current student model are adjusted and the process returns to step S110. Based on the text detection model with adjusted parameters, a new model loss value is recalculated. Otherwise, if the model loss value does not exceed the loss value threshold, the current student model is determined as a pre-trained student model, and the pre-trained student model is used for text detection.
[0089] The technical solution provided by the embodiment of the present application obtains a first text detection result for the sample image by inputting the acquired sample image into the text detection model to be trained, performs wavelet decomposition processing on the first text detection result, obtains a first frequency domain sub-image corresponding to the first text detection result, determines a first foreground image and a first background image of the first frequency domain sub-image, and trains the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model; multiple sub-images of the sample image can be obtained by wavelet decomposition and separation of the foreground image and the background image, and the student model in the knowledge distillation is supervised respectively by the multiple sub-images, and then the model is trained, thereby improving the efficiency of model training and reducing the resources required for model training.
[0090] Moreover, by training a student model with lower complexity, using the student model for text detection can reduce the processing resources of text detection.
[0091] Embodiment 2
[0092] Figure 2 is a flowchart of a text detection model training method provided in Example 2 of this application. Figure 2 The text detection model training method of the second embodiment of the present application specifically includes:
[0093] Step S210, inputting the acquired sample image into the text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in the knowledge distillation model.
[0094] In a specific implementation, a knowledge distillation model can be constructed, which includes a teacher model and a student model. The teacher model is pre-trained so that the detection results of the trained teacher model for scene text meet certain reliability and / or accuracy requirements. After that, the student model, i.e., the text detection model to be trained, is trained. During the training process of the text detection model, a sample image can be obtained, and the sample image is input into the text detection model to be trained. The text detection model to be trained performs text detection on the sample image and outputs a first text detection result.
[0095] In practical applications, the initial parameters of the student model in knowledge distillation can be set to obtain the student model to be trained. The text in natural scenes can also be photographed to obtain sample images, which are input into the student model to be trained. The student model to be trained performs text detection on the sample images to obtain image results of text detection on the sample images.
[0096] Step S220: performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result.
[0097] In a specific implementation, two-dimensional wavelet decomposition may be performed on the first text detection result to obtain at least one first frequency domain sub-image corresponding to the first text detection result.
[0098] In practical applications, the image results obtained by performing text detection on the sample image by the student model to be trained can be subjected to HAAR wavelet decomposition to obtain 4 frequency domain sub-images. The 4 frequency domain sub-images respectively show the details of the text detection image results in the horizontal reverse, vertical and diagonal directions, as well as the image sampled 2 times the text detection image results. These 4 frequency domain sub-images are used as the first frequency domain sub-images.
[0099] Step S230, dilating the actual text detection result of the sample image to obtain a foreground mask of the sample image, and determining a background mask of the sample image according to the foreground mask.
[0100] The foreground mask may be a mask of the foreground of the image, and can separate the foreground from the image.
[0101] The background mask may be a mask of the image background, and can separate the background from the image.
[0102] In a specific implementation, a morphological dilation operation may be performed on the actual text detection result of the sample image to obtain the text area in the actual text detection result, the text area is determined as the foreground mask, and the area outside the text area in the actual text detection result is determined as the background mask.
[0103] In practical applications, a morphological dilation operation can be performed on the real image result of sample image text detection to obtain the text area in the real image result, and the text area is determined as the foreground mask, and the area outside the text area in the real image result is determined as the background mask.
[0104] Step S240, extracting a first foreground image from the first frequency domain sub-image according to the foreground mask, and extracting a first background image from the first frequency domain sub-image according to the background mask;
[0105] In a specific implementation, the foreground mask may be multiplied with the first frequency domain sub-image to obtain the first foreground image, and the background mask may be multiplied with the first frequency domain sub-image to obtain the first background image.
[0106] In practical applications, the foreground mask can be multiplied with the four first frequency domain sub-images to obtain four first foreground images, which are represented as S1, S2, S3, and S4 respectively. The background mask can also be multiplied with the four first frequency domain sub-images to obtain four first background images, which are represented as S5, S6, S7, and S8 respectively.
[0107] Step S250, determining a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image.
[0108] The foreground loss value may be a loss value of the first foreground image relative to the second foreground image of the teacher model and the actual foreground image.
[0109] The background loss value may be a loss value of the first background image relative to the second background image of the teacher model and an actual background image.
[0110] In a specific implementation, the sample image can be input into a teacher model pre-trained in knowledge distillation, and a second frequency domain sub-image can be obtained by performing wavelet decomposition to determine the second foreground image and the second background image corresponding to the second frequency domain sub-image. The actual foreground image and the actual background image can also be obtained based on the actual text detection result of the sample image. The foreground loss value corresponding to the first foreground image is obtained according to the loss value between the first foreground image and the second foreground image, and the loss value between the first foreground image and the actual foreground image. The background loss value corresponding to the first background image is obtained according to the loss value between the first background image and the second background image, and the loss value between the first background image and the actual background image.
[0111] Optionally, the step S250 includes:
[0112] Based on the teacher model in the knowledge distillation model, a second frequency domain sub-image corresponding to the sample image is determined; a second foreground image and a second background image of the second frequency domain sub-image are determined; a foreground loss value is obtained according to a first loss value between the first foreground image and the second foreground image, and a second loss value between the first foreground image and the actual foreground image; a background loss value is obtained according to a third loss value between the first background image and the second background image, and a fourth loss value between the first background image and the actual background image.
[0113] The second frequency domain sub-image may be a frequency domain image obtained by wavelet decomposition of the second text detection result.
[0114] The second text detection result may be an image result outputted by a pre-trained teacher model performing text detection on a sample image.
[0115] The second foreground image may be a foreground image in the second frequency domain sub-image.
[0116] The second background image may be an image of the background in the second frequency domain sub-image.
[0117] In a specific implementation, the sample image can be input into the teacher model, the teacher model performs text detection on the sample image, outputs the second text detection result, performs wavelet decomposition on the second text detection result to obtain a second frequency domain sub-image, uses the foreground mask to extract the second foreground image from the second frequency domain sub-image, and uses the background mask to extract the second background image from the second frequency domain sub-image. The foreground mask of the sample image can also be subjected to wavelet decomposition to obtain the actual foreground image, and the background mask of the sample image can be subjected to wavelet decomposition to obtain the actual background image. The first loss value between the first foreground image and the second foreground image, the second loss value between the first foreground image and the actual foreground image, the third loss value between the first background image and the second background image, and the fourth loss value between the first background image and the actual background image are calculated, and the sum of the first loss value and the second loss value is used as the foreground loss value, and the sum of the third loss value and the fourth loss value is used as the background loss value.
[0118] In practical applications, the second text detection result output by the teacher model is subjected to wavelet decomposition to obtain four second frequency domain sub-images. The foreground mask is used to multiply each second frequency domain sub-image to obtain four second foreground images, which are represented as T1, T2, T3, and T4 respectively. The background mask is used to multiply each second frequency domain sub-image to obtain four second background images, which are represented as T5, T6, T7, and T8 respectively. Since the foreground mask and the background mask are obtained based on the real image results of the sample image text detection, the foreground mask and the background mask can be respectively subjected to wavelet decomposition to obtain four actual foreground images G1, G2, G3, and G4 and four actual background images G5, G6, G7, and G8. Then the first loss value between the first foreground image and the second foreground image is
[0119] L1=|S1-T1| 2 +|S2-T2| 2 +|S3-T3| 2 +|S4-T4| 2 ,
[0120] The second loss value between the first foreground image and the actual foreground image is
[0121] L2=|S1-G1| 2 +|S2-G2| 2 +|S3-G3| 2 +|S4-G4| 2 ,
[0122] The third loss value between the first background image and the second background image is
[0123] L3=|S5-T5| 2 +|S6-T6| 2 +|S7-T7| 2 +|S8-T8| 2 ,
[0124] The fourth loss value between the first background image and the actual background image is
[0125] L4=|S5-G5| 2 +|S6-G6| 2 +|S7-G7| 2 +|S8-G8| 2 ,
[0126] Therefore, the foreground loss value is LF=L1+L2, and the background loss value is LB=L3+L4.
[0127] According to the technical solution of the embodiment of the present application, the second frequency domain sub-image corresponding to the sample image is determined based on the teacher model in the knowledge distillation model; the second foreground image and the second background image of the second frequency domain sub-image are determined; the foreground loss value is obtained according to the first loss value between the first foreground image and the second foreground image, and the second loss value between the first foreground image and the actual foreground image; the background loss value is obtained according to the third loss value between the first background image and the second background image, and the fourth loss value between the first background image and the actual background image. The student model detection result can be compared with the teacher model detection result and the true result respectively to obtain the loss value of the student model detection result relative to the teacher model detection result, and the loss value of the student model detection result relative to the true result. The student model is trained by minimizing the total loss value, so that the trained student model has higher text detection reliability.
[0128] Optionally, the determining, based on the teacher model in the knowledge distillation model, a second frequency domain sub-image corresponding to the sample image includes:
[0129] The sample image is input into the teacher model to obtain a second text detection result for the sample image; the second text detection result is subjected to wavelet decomposition processing to obtain a second frequency domain sub-image.
[0130] In a specific implementation, the sample image can be input into a pre-trained teacher model, the teacher model performs text detection on the sample image, outputs a second text detection result, and performs wavelet decomposition on the second text detection result to obtain a second frequency domain sub-image.
[0131] In practical applications, the DBNet network can be pre-trained to obtain a teacher model. The backbone structure in the DBNet network can be ResNet50. The second text detection result output by the teacher model can also be decomposed by wavelet to obtain 4 second frequency domain sub-images.
[0132] According to the technical solution of the embodiment of the present application, a second text detection result for the sample image is obtained by inputting the sample image into the teacher model; the second text detection result is subjected to wavelet decomposition processing to obtain a second frequency domain sub-image. Since the teacher model has good performance, the second text detection result obtained by text detection has high reliability, thereby obtaining a second frequency domain sub-image with high reliability. The student model is trained based on the second frequency domain sub-image, which can improve the reliability of the student model.
[0133] Optionally, determining a second foreground image and a second background image of the second frequency domain sub-image includes:
[0134] The actual text detection result of the sample image is expanded to obtain a foreground mask of the sample image, and the background mask of the sample image is determined based on the foreground mask; a second foreground image is extracted from the second frequency domain sub-image based on the foreground mask, and a second background image is extracted from the second frequency domain sub-image based on the background mask.
[0135] In a specific implementation, the actual text detection result of the sample image can be obtained, and the actual text detection result can be subjected to morphological dilation processing to obtain the text area in the sample image, and the text area is used as the foreground mask of the sample image. The area outside the foreground mask in the actual text detection result is determined as the background mask, and the foreground mask is multiplied by the second frequency domain sub-image to obtain a second foreground image, and the background mask is multiplied by the second frequency domain sub-image to obtain a second background image.
[0136] In practical applications, the real image results of sample image text detection can be obtained, the real image results can be expanded to obtain the text area in the real image results, the text area is used as the foreground mask, the area outside the text area is used as the background mask, the foreground mask is multiplied with the four second frequency domain sub-images respectively to obtain four second foreground images, and the background mask is multiplied with the four second frequency domain sub-images respectively to obtain four second background images.
[0137] According to the technical solution of the embodiment of the present application, the actual text detection result of the sample image is expanded to obtain the foreground mask of the sample image, and the background mask of the sample image is determined based on the foreground mask; according to the foreground mask, the second foreground image is extracted from the second frequency domain sub-image, and, according to the background mask, the second background image is extracted from the second frequency domain sub-image. The foreground mask and the background mask can be used to determine the foreground and background from the frequency domain image obtained by the teacher model text detection, and then the loss values of the foreground and the background are respectively counted, so that during the student model training process, the model training can be supervised from the text area and the background area respectively, thereby improving the reliability of the trained student model.
[0138] Optionally, the determining a second foreground image and a second background image of the second frequency domain sub-image further includes:
[0139] The foreground mask is subjected to wavelet decomposition processing to obtain the actual foreground image, and the background mask is subjected to wavelet decomposition processing to obtain the actual background image.
[0140] In the specific implementation, since the foreground mask and the background mask are obtained based on the real image results of text detection of the sample image, the foreground mask and the background mask can be decomposed by wavelet respectively to obtain 4 actual foreground images G1, G2, G3, G4 and 4 actual background images G5, G6, G7, G8.
[0141] According to the technical solution of the embodiment of the present application, by performing wavelet decomposition processing on the foreground mask to obtain the actual foreground image, and performing wavelet decomposition processing on the background mask to obtain the actual background image, the foreground and background can be determined from the actual text detection result, and then the loss values of the foreground and background are respectively counted, so that during the training process of the student model, the model training can be supervised respectively from the text region and the background region, improving the reliability of the trained student model.
[0142] Step S260: Obtain the model loss value of the text detection model to be trained according to the foreground loss value and the background loss value.
[0143] In a specific implementation, the sum of the foreground loss value and the background loss value can be counted, and the sum of the foreground loss value and the background loss value is used as the model loss value of the text detection model to be trained.
[0144] In practical applications, after obtaining the foreground loss value LF = L1 + L2 and the background loss value LB = L3 + L4, the model loss value of the student model to be trained can be obtained as L = LF + LB = L1 + L2 + L3 + L4.
[0145] Step S270: Train the text detection model to be trained according to the model loss value to obtain a pre-trained text detection model.
[0146] In a specific implementation, the model loss value can be compared with a pre-set loss value threshold. If the model loss value is above the loss value threshold, after adjusting the parameters of the current text detection model, return to step S210, and recalculate the new model loss value based on the text detection model with adjusted parameters. Otherwise, if the model loss value does not exceed the loss value threshold, the current text detection model is determined as the pre-trained text detection model, and this pre-trained text detection model can be used for text detection.
[0147] In practical applications, set the loss value threshold T. If the model loss value L ≥ T, it means that the student model needs to be continuously trained. After adjusting the parameters of the current student model, return to step S210 for continuous training. Otherwise, if L < T, it means that the loss value of the current student model meets the requirements and there is no need for continuous training, and the current student model can be used for text detection.
[0148] The technical solution provided by the embodiment of the present application is as follows: by inputting the acquired sample image into the text detection model to be trained, a first text detection result for the sample image is obtained, the first text detection result is subjected to wavelet decomposition processing, a first frequency domain sub-image corresponding to the first text detection result is obtained, an actual text detection result of the sample image is expanded, a foreground mask of the sample image is obtained, and a background mask of the sample image is determined according to the foreground mask; a first foreground image is extracted from the first frequency domain sub-image according to the foreground mask; and, according to the background mask, a first background image is extracted from the first frequency domain sub-image, a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image are determined; a model loss value of the text detection model to be trained is obtained according to the foreground loss value and the background loss value; and the text detection model to be trained is trained according to the model loss value to obtain a pre-trained text detection model; multiple sub-images of the sample image can be obtained by wavelet decomposition and separation of the foreground image and the background image, and the student model in the knowledge distillation is supervised respectively by the multiple sub-images, and then the model training is performed, thereby improving the efficiency of the model training and reducing the resources required for the model training.
[0149] Moreover, by training a student model with lower complexity, using the student model for text detection can reduce the processing resources of text detection.
[0150] In order to facilitate those skilled in the art to have a deeper understanding of the embodiments of the present application, a specific example will be described below.
[0151] Figure 3 Schematic diagram of the structure of a knowledge distillation model in an embodiment of the present application. Figure 3 As shown, a knowledge distillation framework is constructed, which includes a pre-trained teacher model 301 with high complexity and good text detection performance, and a student model 302 to be trained. A sample image 303 containing text content is input into the teacher model 301 to obtain a teacher model output response graph 304. At the same time, the sample image 301 is input into the student model 302 to obtain a student model output response graph 305. The teacher model output response graph 304 and the student model output response graph 305 are respectively subjected to HAAR wavelet decomposition to obtain four second sub-images corresponding to the teacher model output response graph 304 and four first sub-images corresponding to the student model output response graph 305.
[0152] A ground truth (GT) 306 for text detection on a sample image is obtained, and morphological processing is performed on the ground truth 306 to obtain a foreground image 307 of the ground truth 306, for example, a dilation operation, the kernel of which may be 11×11, and the background image 308 may be calculated by subtracting the foreground image 307 from 1.
[0153] The foreground image 307 is multiplied by the four first sub-images to obtain four first foreground sub-images, and the student model is supervised in the text area. The background image 308 is multiplied by the four first sub-images to obtain four first background sub-images, and the student model is supervised in the background area. The student model is trained by calculating the total loss value between the first foreground sub-image and the first background sub-image output by the student model and the output result of the teacher model, and the first foreground sub-image and the first background sub-image output by the student model and the real image of the sample image for text detection, and the student model is obtained for text detection. The total loss value can be the sum of the loss value of the original DBNet network and the loss value after wavelet decomposition.
[0154] Figure 4 is a schematic diagram of a text detection result and its frequency domain sub-image in an embodiment of the present application. Figure 4 As shown, the response map (probability Map) can be the student model output response map 305. After performing wavelet decomposition on the student model output response map 305, four sub-images {LH, HL, HH, LL} can be obtained.
[0155] Table 1 provides the results of verification on ICDAR2015, MSRA-TD500, and Total-Text datasets, where ST is a traditional knowledge distillation method, FitNets is a thin deep network method, KDEM (Knowledge Distillation via Entropy Map) is a knowledge extraction method based on entropy mapping, and Ours is the text detection model training and text detection method provided by this application. It can be seen that the text detection model training and text detection method provided by this application have achieved the largest F score improvement on the three datasets, which fully proves the effectiveness of the text detection model training and text detection method proposed in this application.
[0156]
[0157] Table 1
[0158] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0159] Embodiment 3
[0160] Figure 5 is a flowchart of a text detection method provided in Example 3 of the present application. Figure 5 , the text detection method of the third embodiment of the present application specifically includes:
[0161] Step S510, obtaining an image to be detected.
[0162] Step S520, input the image to be detected into a pre-trained text detection model to obtain the text detection result of the pre-trained text detection model on the image to be detected; the pre-trained text detection model is obtained through the following steps: input the acquired sample image into the text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in the knowledge distillation model; the first text detection result is subjected to wavelet decomposition processing to obtain a first frequency domain sub-image corresponding to the first text detection result; the first foreground image and the first background image of the first frequency domain sub-image are determined; according to the first foreground image and the first background image, the text detection model to be trained is trained to obtain the pre-trained text detection model.
[0163] The image to be detected may be an image that needs to be subjected to text detection.
[0164] In a specific implementation, a sample image containing text content can be obtained, and the sample image can be input into a text detection model to be trained. The text detection model to be trained performs text detection on the sample image to obtain a first text detection result, and the first text detection result is subjected to wavelet decomposition to obtain a first frequency domain sub-image. A first foreground image and a first background image are extracted from the first frequency domain sub-image, and a loss value of the text detection model is calculated based on the first foreground image and the first background image. The text detection model is trained based on the loss value to obtain a pre-trained text detection model.
[0165] For an image to be detected, the image to be detected is input into a pre-trained text detection model, the pre-trained text detection model performs text detection on the image to be detected, and outputs the text detection result of the image to be detected.
[0166] Since the training process of the text detection model has been described in detail in the above embodiments, it will not be repeated here.
[0167] According to the technical solution of the embodiment of the present application, by acquiring an image to be detected and inputting the image to be detected into a pre-trained text detection model, a text detection result of the pre-trained text detection model on the image to be detected is obtained, and text detection can be performed on the image to be detected through a lightweight student model, thereby reducing resource consumption for text detection.
[0168] Embodiment 4
[0169] Based on the same inventive concept, the embodiment of the present application also provides a text detection model training device for implementing the text detection model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more model training device embodiments provided below can refer to the limitations of the text detection model training method above, and will not be repeated here.
[0170] Figure 6 Schematic diagram of a text detection model training device provided in Example 4 of the present application. Figure 6 The text detection model training device provided in this embodiment specifically includes: an image detection module 610, a wavelet decomposition module 620, an image separation module 630 and a model training module 640, wherein:
[0171] An image detection module 610 is used to input the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in the knowledge distillation model;
[0172] A wavelet decomposition module 620, configured to perform wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0173] An image separation module 630, configured to determine a first foreground image and a first background image of the first frequency domain sub-image;
[0174] The model training module 640 is used to train the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0175] In another embodiment, the model training module 640 includes:
[0176] a foreground loss value module, configured to determine a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image;
[0177] A model loss value module, used to obtain a model loss value of the text detection model to be trained according to the foreground loss value and the background loss value;
[0178] The loss value training module is used to train the text detection model to be trained according to the model loss value to obtain the pre-trained text detection model.
[0179] In another embodiment, the foreground loss value module includes:
[0180] A frequency domain image determination module, used to determine a second frequency domain sub-image corresponding to the sample image based on a teacher model in the knowledge distillation model;
[0181] A foreground image determination module, used to determine a second foreground image and a second background image of the second frequency domain sub-image;
[0182] a foreground loss value determining module, configured to obtain the foreground loss value according to a first loss value between the first foreground image and the second foreground image, and a second loss value between the first foreground image and an actual foreground image;
[0183] The background loss value determination module is used to obtain the background loss value according to a third loss value between the first background image and the second background image, and a fourth loss value between the first background image and the actual background image.
[0184] In another embodiment, the frequency domain image determination module is specifically used to:
[0185] Inputting the sample image into the teacher model to obtain a second text detection result for the sample image;
[0186] Perform wavelet decomposition processing on the second text detection result to obtain the second frequency domain sub-image.
[0187] In another embodiment, the foreground image determination module is specifically used to:
[0188] Performing dilation processing on the actual text detection result of the sample image to obtain a foreground mask of the sample image, and determining a background mask of the sample image according to the foreground mask;
[0189] The second foreground image is extracted from the second frequency domain sub-image according to the foreground mask, and the second background image is extracted from the second frequency domain sub-image according to the background mask.
[0190] In another embodiment, the foreground image determination module is further configured to:
[0191] The foreground mask is subjected to wavelet decomposition processing to obtain the actual foreground image, and the background mask is subjected to wavelet decomposition processing to obtain the actual background image.
[0192] Each module in the above-mentioned text detection model training device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0193] Embodiment 5
[0194] Based on the same inventive concept, the embodiment of the present application also provides a text detection device for implementing the above-mentioned text detection method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more text detection device embodiments provided below can refer to the limitations on the text detection method above, and will not be repeated here.
[0195] Figure 7 Schematic diagram of the structure of a text detection device provided in Example 5 of the present application. Figure 7 The text detection device provided in this embodiment specifically includes: an image acquisition module 710 and a text detection module 720, wherein:
[0196] An image acquisition module 710 is used to acquire an image to be detected;
[0197] The text detection module 720 inputs the image to be detected into a pre-trained text detection model to obtain a text detection result of the pre-trained text detection model on the image to be detected.
[0198] Each module in the above-mentioned text detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0199] Embodiment 6
[0200] Figure 8It is a structural schematic diagram of an electronic device provided in Example 6 of the present application. As shown in the figure, the electronic device includes: a processor 80, a memory 81, a display screen 82 with a touch function, an input device 83, an output device 84, and a communication device 85. The number of processors 80 in the electronic device can be one or more, and the figure takes one processor 80 as an example. The number of memories 81 in the electronic device can be one or more, and the figure takes one memory 81 as an example. The processor 80, memory 81, display screen 82, input device 83, output device 84, and communication device 85 of the electronic device can be connected via a bus or other means, and the figure takes the connection via a bus as an example. In the embodiment, the electronic device can be a computer, a mobile phone, a tablet, a projector, an interactive smart tablet, etc. In the embodiment, the electronic device is described as an interactive smart tablet as an example.
[0201] The memory 81, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the text detection model training and text detection method described in any embodiment of the present application. The memory 81 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 81 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 81 may further include a memory remotely arranged relative to the processor 80, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0202] The display screen 82 is a display screen 82 with a touch function, which can be a capacitive screen, an electromagnetic screen or an infrared screen. Generally speaking, the display screen 82 is used to display data according to the instructions of the processor 80, and is also used to receive touch operations acting on the display screen 82, and send corresponding signals to the processor 80 or other devices. Optionally, when the display screen 82 is an infrared screen, it also includes an infrared touch frame, which is arranged around the display screen 82, and can also be used to receive infrared signals and send the infrared signals to the processor 80 or other devices.
[0203] The communication device 85 is used to establish a communication connection with other devices, and can be a wired communication device and / or a wireless communication device.
[0204] The input device 83 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device. It can also be a camera for acquiring images and a sound pickup device for acquiring audio data. The output device 84 can include audio devices such as speakers. It should be noted that the specific composition of the input device 83 and the output device 84 can be set according to actual conditions.
[0205] The processor 80 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 81, that is, implements the above-mentioned text detection model training and text detection method.
[0206] Specifically, in the embodiment, when the processor 80 executes one or more programs stored in the memory 81, the following operations are specifically implemented:
[0207] Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0208] Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0209] Determine a first foreground image and a first background image of the first frequency domain sub-image;
[0210] The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0211] Based on the above embodiment, one or more processors 80 further implement the following operations:
[0212] Determining a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image;
[0213] Obtaining a model loss value of the text detection model to be trained according to the foreground loss value and the background loss value;
[0214] The text detection model to be trained is trained according to the model loss value to obtain the pre-trained student model.
[0215] Based on the above embodiment, one or more processors 80 further implement the following operations:
[0216] Determine a second frequency domain sub-image corresponding to the sample image based on the teacher model in the knowledge distillation model;
[0217] Determine a second foreground image and a second background image of the second frequency domain sub-image;
[0218] Obtaining the foreground loss value according to a first loss value between the first foreground image and the second foreground image, and a second loss value between the first foreground image and an actual foreground image;
[0219] The background loss value is obtained according to a third loss value between the first background image and the second background image, and a fourth loss value between the first background image and the actual background image.
[0220] Based on the above embodiment, one or more processors 80 further implement the following operations:
[0221] Inputting the sample image into the teacher model to obtain a second text detection result for the sample image;
[0222] Perform wavelet decomposition processing on the second text detection result to obtain the second frequency domain sub-image.
[0223] Based on the above embodiment, one or more processors 80 further implement the following operations:
[0224] Performing dilation processing on the actual text detection result of the sample image to obtain a foreground mask of the sample image, and determining a background mask of the sample image according to the foreground mask;
[0225] The second foreground image is extracted from the second frequency domain sub-image according to the foreground mask, and the second background image is extracted from the second frequency domain sub-image according to the background mask.
[0226] Based on the above embodiment, one or more processors 80 further implement the following operations:
[0227] The foreground mask is subjected to wavelet decomposition processing to obtain the actual foreground image, and the background mask is subjected to wavelet decomposition processing to obtain the actual background image.
[0228] Based on the above embodiment, one or more processors 80 further implement the following operations:
[0229] Acquire the image to be detected;
[0230] The image to be detected is input into a pre-trained text detection model to obtain a text detection result of the pre-trained text detection model on the image to be detected.
[0231] Embodiment 7
[0232] Embodiment 7 of the present application further provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a text detection model training method when executed by a computer processor, including:
[0233] Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model;
[0234] Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result;
[0235] Determine a first foreground image and a first background image of the first frequency domain sub-image;
[0236] The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
[0237] Of course, the storage medium containing computer-executable instructions provided in an embodiment of the present application, whose computer-executable instructions are not limited to the operations of the text detection model training method as described above, can also execute related operations in the text detection model training method provided in any embodiment of the present application, and have corresponding functions and beneficial effects.
[0238] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0239] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0240] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A text detection model training method, characterized in that: The method comprises: Inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model; Performing wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result; Determine a first foreground image and a first background image of the first frequency domain sub-image; The text detection model to be trained is trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
2. The method according to claim 1, characterized in that The step of training the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model includes: Determining a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image; Obtaining a model loss value of the text detection model to be trained according to the foreground loss value and the background loss value; The text detection model to be trained is trained according to the model loss value to obtain the pre-trained text detection model.
3. The method according to claim 2, characterized in that The determining of a foreground loss value corresponding to the first foreground image and a background loss value corresponding to the first background image includes: Determine a second frequency domain sub-image corresponding to the sample image based on the teacher model in the knowledge distillation model; Determine a second foreground image and a second background image of the second frequency domain sub-image; Obtaining the foreground loss value according to a first loss value between the first foreground image and the second foreground image, and a second loss value between the first foreground image and an actual foreground image; The background loss value is obtained according to a third loss value between the first background image and the second background image, and a fourth loss value between the first background image and the actual background image.
4. The method according to claim 3, characterized in that The determining, based on the teacher model in the knowledge distillation model, a second frequency domain sub-image corresponding to the sample image comprises: Inputting the sample image into the teacher model to obtain a second text detection result for the sample image; Perform wavelet decomposition processing on the second text detection result to obtain the second frequency domain sub-image.
5. The method according to claim 3, characterized in that: The determining of a second foreground image and a second background image of the second frequency domain sub-image comprises: Performing dilation processing on the actual text detection result of the sample image to obtain a foreground mask of the sample image, and determining a background mask of the sample image according to the foreground mask; The second foreground image is extracted from the second frequency domain sub-image according to the foreground mask, and the second background image is extracted from the second frequency domain sub-image according to the background mask.
6. The method according to claim 5, characterized in that The determining of a second foreground image and a second background image of the second frequency domain sub-image further includes: The foreground mask is subjected to wavelet decomposition processing to obtain the actual foreground image, and the background mask is subjected to wavelet decomposition processing to obtain the actual background image.
7. A text detection method, characterized in that: The method comprises: Acquire the image to be detected; The image to be detected is input into a pre-trained text detection model to obtain a text detection result of the pre-trained text detection model on the image to be detected; the pre-trained text detection model is obtained by the text detection model training method described in any one of claims 1-6.
8. A text detection model training device, characterized in that: The device comprises: An image detection module, used for inputting the acquired sample image into a text detection model to be trained to obtain a first text detection result for the sample image; the text detection model to be trained is a student model in a knowledge distillation model; A wavelet decomposition module, configured to perform wavelet decomposition processing on the first text detection result to obtain a first frequency domain sub-image corresponding to the first text detection result; An image separation module, used for determining a first foreground image and a first background image of the first frequency domain sub-image; The model training module is used to train the text detection model to be trained according to the first foreground image and the first background image to obtain a pre-trained text detection model.
9. An electronic device, characterized in that: include: memory, one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 7.
10. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions are used to perform the method according to any one of claims 1 to 7 when executed by a computer processor.
