Image ambiguity detection method and system based on global text recognition
Through global text recognition technology, the blurriness of bill images is detected, which solves the problem of poor blur detection results in existing technologies caused by inconspicuous edge information, achieves a more accurate and efficient assessment of bill image clarity, and supports the medical insurance claims process. progressed smoothly.
Patent Information
- Application Number
- CN202410819045.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-01
AI Technical Summary
When the existing technology detects the blurriness of bill images, the edge information is not significant, resulting in poor detection results, which especially affects the claims efficiency during the medical insurance claims process.
The image blur detection method based on global text recognition is adopted. Through the target detection model and OCR text detection model, the bill area is extracted and text recognition is performed. The confidence and variance of the text line are calculated to determine the blur of the bill image.
It improves the accuracy and efficiency of blur detection of bill images, can more accurately identify the blur of text characters, and ensures the accuracy and efficiency of the claims process.
Smart Images

Figure CN118736602A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image blur detection, and in particular relates to an image blur detection method and system based on global text recognition. Background Art
[0002] During the medical insurance claims process, users take pictures of receipts with their mobile phones and upload them to the claims system. The backend server performs text recognition and extracts receipt information. If the pictures taken by users are blurry, a lot of information will be missing during the backend recognition, affecting the claims efficiency. In this case, it is particularly important to detect the blurriness of the pictures taken by users before uploading them.
[0003] The characteristics of bill images: a lot of text information and long text; the existing image blur detection algorithms are mainly fast Fourier transform (FFT) and Laplacian transform. These methods are all aimed at detecting edge information in the image. The more edge information, the clearer the image; however, bill images are mainly text characters, and the edge information is not significant. After batch image testing, the blur degree detection effect of using the existing blur detection algorithm is poor. Summary of the invention
[0004] The object of the present invention is to provide an image blur detection method and system based on global text recognition, so as to solve the problem of effectively detecting the blur of bill images when the edge information is not obvious.
[0005] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides an image blur detection method based on global text recognition, the method comprising:
[0006] Collecting bill images, detecting bill areas of the bill images and capturing sub-images;
[0007] Performing text detection on the sub-image to obtain a text line set of the sub-image;
[0008] Performing text recognition on the text line set, obtaining the confidence of each text character, taking the average of the confidences of the text characters in each text line as the fuzziness of each text line, and obtaining a text line fuzziness set;
[0009] The mean and variance of the text line fuzziness set are calculated, and the mean and variance are compared with preset values to determine the fuzziness of the bill image.
[0010] As a further improvement of an embodiment of the present invention, the method further includes that the detecting of the bill area of the bill image includes:
[0011] The pre-trained object detection model is used to detect the bill area of the bill image, and a sub-image is captured after the bill area is detected.
[0012] As a further improvement of an embodiment of the present invention, the method further includes: the intercepted sub-image includes:
[0013] The minimum bounding rectangle position information of the bill area in the bill image is obtained, and the minimum bounding rectangle area is intercepted as a sub-image.
[0014] As a further improvement of an embodiment of the present invention, the method further includes that performing text detection on the sub-image to obtain the text line set of the sub-image includes:
[0015] The OCR text detection model is used to perform text detection on the sub-image, detect all text lines in the sub-image, obtain the position information of the minimum circumscribed rectangles of all text lines to form a sub-image text line set L = {l1, l2...l i ...l n}, l i =[(x i1 ,y i1 ), (x i2 ,y i2 ), (x i3 ,y i3 ), (x i4 ,y i4 )], where l i Represents the position information of the minimum bounding rectangle of the i-th text line, (x i1 ,y i1 ), (x i2 ,y i2 ), (x i3 ,y i3 ), (x i4 ,y i4 ) represent the coordinates of the upper left corner, upper right corner, lower right corner, and lower left corner of the minimum bounding rectangle of the i-th text line.
[0016] As a further improvement of an embodiment of the present invention, the method further includes that performing text detection on the sub-image to obtain the text line set of the sub-image further includes:
[0017] The sub-image is subjected to color space conversion, noise reduction, binarization, and image quality optimization processing.
[0018] As a further improvement of an embodiment of the present invention, the method further includes: performing text recognition on a set of text lines includes:
[0019] The OCR text recognition model is used to traverse the text line set for text recognition, identify each text character in each text line, and obtain the confidence of each text character.
[0020] As a further improvement of an embodiment of the present invention, the method further includes: determining the blurriness of the bill image includes:
[0021] When the mean of the text line fuzziness set is less than the preset mean, and the variance of the text line fuzziness set is greater than the preset variance, the bill image is determined to be fuzzy;
[0022] When the mean of the text line fuzziness set is less than a preset value, and the variance of the text line fuzziness set is less than a preset variance, the bill image is determined to be fuzzy;
[0023] When the mean of the text line fuzziness set is greater than the preset mean, and the variance of the text line fuzziness set is greater than the preset variance, the bill image is determined to be fuzzy;
[0024] When the mean of the text line fuzziness set is greater than the preset mean and the variance of the text line fuzziness set is less than the preset variance, it is determined that the bill image is not blurred.
[0025] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention further provides an image blur detection system based on global text recognition, the system comprising:
[0026] Bill image upload module: used to collect bill images;
[0027] Algorithm model reasoning module: used to detect the bill area of the bill image and intercept the sub-image; perform text detection on the sub-image to obtain the text line set of the sub-image; use the target detection model to obtain the bill area of the bill image and intercept the sub-image; use the text detection model to obtain the text line set of the sub-image; perform text recognition on the text line set to obtain the confidence of each text character, use the average of the confidence of the text characters of each text line as the fuzziness of each text line, and obtain the text line fuzziness set;
[0028] Blur determination module: used to calculate the mean and variance of the text line blur set, compare the mean and variance with the preset value, and determine the blur of the bill image.
[0029] In order to achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention also provides an electronic device, including a memory and a processor, characterized in that the memory stores a computer program that can be run on the processor, and when the program is executed on the processor, the steps in the image blur detection method based on global text recognition as described in any one of the above items are implemented.
[0030] In order to achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention further provides a storage medium, wherein the storage medium stores a computer program, and is characterized in that when the computer program is executed by a processor, the steps in the image blur detection method based on global text recognition as described in any one of the above items are implemented.
[0031] Compared with the prior art, the image blur detection method based on global text recognition provided by the present invention specifically optimizes the text information in the bill image, rather than relying solely on the detection of edge information. Since the bill image is usually dominated by large-scale text characters, this optimization makes the detection more accurate and in line with the actual application scenario; through the neural network model, the area of interest in the bill image, that is, the area where the text characters are located, can be accurately extracted, effectively eliminating the information interference of the non-target area, and improving the efficiency and accuracy of subsequent processing; through the deep learning algorithm, all text characters can be accurately detected and recognized, which not only improves the recognition accuracy, but also makes the blur judgment of each character more accurate; the present invention not only performs blur judgment on the entire image, but also performs blur judgment on each text character; this refined processing method can more accurately determine the clarity of the bill image and identify which characters may be unavailable due to blur; the present invention uses deep learning to optimize the text information in the bill image, improves the accuracy and efficiency of blur detection, and provides more reliable technical support for practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is an overall flow chart of the image blur detection method based on global text recognition described in the present invention.
[0033] Figure 2 It is a schematic diagram of the system structure of the image blur detection system based on global text recognition described in the present invention. DETAILED DESCRIPTION
[0034] The present invention will be described in detail below in conjunction with the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on these embodiments are all within the scope of protection of the present invention.
[0035] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0036] In the first embodiment of the present invention, the present invention provides an image blur detection method based on global text recognition, such as Figure 1 As shown, the method includes,
[0037] S1: Collect bill images, detect the bill area of the bill image and capture the sub-image;
[0038] In a specific embodiment of the present invention, "detecting the bill area of the bill image and intercepting the sub-image" includes using the target detection model to perform target detection on the bill image, determine whether there is a bill in the image, and if there is a bill, obtain the minimum bounding rectangle position information of the bill area in the bill image, and intercept the minimum bounding rectangle area as a sub-image.
[0039] In a specific embodiment of the present invention, the "target detection model" includes selecting the PP-YOLOE model as a target detection pre-training model, preparing a bill image dataset to fine-tune the target detection pre-training model, and obtaining a target detection model.
[0040] In a specific embodiment of the present invention, "preparing a bill image dataset" includes:
[0041] S101: Collect the jpg-format bill images uploaded by the user, manually screen the data, and select the clear, unblurred, unobstructed images that contain complete bill information;
[0042] S102: Use the image annotation tool LabelImg to annotate the bill area in all images in the form of a rectangular box, and store the coordinates of the top left, top right, bottom right, and bottom left vertices of the rectangular box in json format [(x i1 ,y i1 ),(x i2 ,y i2 ),(x i3 ,y i3 ),(x i4 ,y i4 )] information and tag information, (x i1 ,y i1 ),(x i2 ,y i2 ),(x i3 ,y i3 ),(x i4 ,y i4 ) represent the coordinates of the upper left corner, upper right corner, lower right corner, and lower left corner of the rectangular box respectively.
[0043] S103: Use Python scripts to rotate, scale, crop, flip, and perform other operations on the original image to increase the diversity of the data set and improve the generalization ability of the model;
[0044] S104: Divide the data set processed in step S103 into three parts: a training set, a validation set and a test set according to a division ratio of 6:2:2.
[0045] In a specific embodiment of the present invention, “fine-tuning the target detection pre-trained model” includes:
[0046] S105: Load the prepared bill image dataset, including jpg format images and json format annotation data;
[0047] S106: configure fine-tuning training parameters, including learning rate, batch size, and training rounds. In this embodiment, the learning rate is set to 0.00125, the batch size is set to 4, and the training rounds are set to 300;
[0048] S107: Load the model file and weight parameters of the target detection pre-training model PP-YOLOE;
[0049] S108: Start fine-tuning training of the pre-trained model using the python training script in the GPU server environment;
[0050] S109: After the fine-tuning training is completed, the model is evaluated using the validation set to check the performance indicators of the model including the precision AP and the recall AR. In this embodiment, the average mAP and mAR of the intersection over union (IoU) ratio of the target detection real box and the predicted box in the range of 0.50:0.95 are used as the performance evaluation indicators;
[0051] S110: According to the evaluation results, the model is tuned, the learning rate is adjusted, the training rounds are increased, the sample data is increased, and the process of S106 to S109 is repeated for further optimization. In this embodiment, when mAP ≥ 0.85 and mAR ≥ 0.85, the target detection pre-training model is considered to have completed fine-tuning training and the target detection model is obtained.
[0052] It should be noted that fine-tuning training parameters is generally based on a comprehensive judgment of the dataset size and the GPU resources of the server.
[0053] In a specific embodiment of the present invention, the structure of the target detection model includes: sending the image to be detected as input into the target detection model, performing feature extraction through a convolutional neural network CNN, and extracting meaningful feature information in the image, including edges, textures, shapes, etc.; based on the feature extraction, generating a series of candidate regions, which may contain the target to be detected; for each candidate region, classification and regression are performed, the classification operation is used to determine whether the region contains the target, and the regression operation is used to determine the pixel position of the target in the image; after classification and regression, the model may output multiple overlapping bounding boxes. In order to eliminate these redundant bounding boxes, a non-maximum suppression algorithm is used to eliminate redundant bounding boxes, and finally the detected target and its corresponding bounding box information are output.
[0054] It should be noted that in the structure of the target detection pre-training model PP-YOLOE, the backbone network mainly uses the RepVGG module and the CSP model idea to improve ResNet; RepVGG is optimized on the basis of the VGG network, and the advantages of the ResNet network are applied to the VGG network by adding Identity and residual branches to the Block block of the VGG network; in addition, in the model reasoning stage, all network layers are converted into 3×3 convolutions through the Op fusion strategy, which facilitates the deployment and acceleration of the network; the neck uses a feature pyramid network to integrate feature maps of different scales, so that the model can detect targets at multiple scales and enhance the detection ability of small targets; the detection head adopts the Efficient Task-aligned head structure, which can more accurately identify and locate the bill area, and even in the face of bill images of different sizes, shapes, and complex backgrounds, it can also show excellent detection performance.
[0055] S2: Perform text detection on the sub-image to obtain a set of text lines in the sub-image;
[0056] In a specific embodiment of the present invention, “performing text detection on a sub-image to obtain a text line set of the sub-image” includes:
[0057] The OCR text detection model is used to perform text detection on the sub-image, detect all text lines in the sub-image, obtain the position information of the minimum circumscribed rectangles of all text lines to form a sub-image text line set L = {l1, l2...l i ...l n}, l i =[(x i1 ,y i1 ), (x i2 ,y i2 ), (x i3 ,y i3 ), (x i4 ,yi4 )], where l i Represents the position information of the minimum bounding rectangle of the i-th text line, (x i1 ,y i1 ), (x i2 ,y i2 ), (x i3 ,y i3 ), (x i4 ,y i4 ) represent the coordinates of the upper left corner, upper right corner, lower right corner, and lower left corner of the minimum bounding rectangle of the i-th text line.
[0058] In a specific embodiment of the present invention, the “OCR text detection model” includes selecting a PP-OCRv4 text detection model as a text detection pre-trained model, optimizing and fine-tuning the text detection pre-trained model using bill image data, and obtaining an OCR text detection model;
[0059] Specifically, the PP-OCRv4 text detection model is used to detect the bill image dataset, and the preliminary detection results are obtained. The undetected text lines are marked, and the areas where these text lines are located are marked with rectangular boxes. The marking parameter format is the coordinates of the four vertices [(x i1 ,y i1 ), (x i2 ,y i2 ), (x i3 ,y i3 ), (x i4 ,y i4 )], stored in json format, after annotation, fine-tune the text detection pre-training model, the steps are:
[0060] S201: Divide the labeled bill image dataset into a training set, a validation set, and a test set in a ratio of 8:1:1;
[0061] S202: configure fine-tuning training parameters, including learning rate, batch size, and training rounds. In this embodiment, the learning rate is set to 0.0000625, the batch size is set to 4, and the training rounds are set to 500;
[0062] S203: Load the text detection model file and weight parameters of the text detection pre-trained model PP-OCRv4;
[0063] S204: Start fine-tuning training of the text detection pre-trained model using a python training script in a GPU server environment;
[0064] S205: After the fine-tuning training is completed, the model is evaluated using the validation set to check the performance indicator Hmean of the text detection model;
[0065] S206: According to the evaluation results, the model is tuned, the learning rate is adjusted, the number of training rounds is increased, and the process of S202 to S205 is repeated to further improve the performance of the model until the training is completed. In this implementation, when Hmean ≥ 0.9, the text detection pre-training model is determined to have completed fine-tuning training and the OCR text detection model is obtained.
[0066] It should be noted that the performance indicator Hmean is an evaluation indicator that comprehensively considers the precision rate Precision and the recall rate Recall. It is used to measure the performance of the model in the text detection task. The calculation method of Hmean is:
[0067] In a specific embodiment of the present invention, the structure of the OCR text detection model includes preprocessing the bill area sub-image, including color space conversion, noise reduction, binarization, and optimizing image quality, wherein the color space conversion includes but is not limited to converting RGB images into grayscale images; performing feature extraction on the preprocessed image, and using a convolutional neural network to extract text-related features, including information such as the shape, size, edge, and direction of the text; based on the extracted features, using a segmentation-based DB text detection algorithm to locate the text area and obtain the bounding box of the text line; eliminating overlapping bounding boxes through non-maximum suppression (NMS), and finally outputting a set of text lines.
[0068] It should be noted that the OCR text detection model uses a lightweight convolutional neural network (CNN) as the backbone network. While ensuring performance, it reduces the number of parameters and calculations as much as possible to achieve faster reasoning speed. The OCR text detection model uses a feature pyramid network for multi-scale feature fusion. By fusing features from different layers, the model can better handle texts of different sizes, directions, and aspect ratios. After feature extraction and fusion, the OCR text detection model outputs one or more prediction layers for predicting the position and shape of the text area. These prediction layers include a classification branch for determining whether each pixel belongs to text and a regression branch for predicting the coordinates of the text bounding box. The original prediction results output by the OCR text detection model need to be post-processed to obtain the final text detection results. The post-processing mainly includes non-maximum suppression (NMS) to eliminate redundant bounding boxes, as well as bounding box correction and text line merging.
[0069] S3: Perform text recognition on the text line set, obtain the confidence of each text character, use the average of the confidence of the text characters in each text line as the fuzziness of each text line, and obtain a text line fuzziness set;
[0070] In a specific embodiment of the present invention, "performing text recognition on a set of text lines" includes performing text recognition on the set of text lines using an OCR text recognition model, recognizing each text character in the text line, and obtaining the confidence of each text character.
[0071] In a specific embodiment of the present invention, the “OCR text recognition model” includes selecting a PP-OCRv4 text recognition model as a text recognition pre-training model, optimizing and fine-tuning the text recognition pre-training model using bill image data, and obtaining an OCR text recognition model;
[0072] Specifically, after the bill image is detected by the OCR text detection model, a small image is captured for each text line output, and the PP-OCRv4 text recognition pre-training model is used to recognize all small images. The results after recognition are screened, and small images with incorrect recognition are selected. The text content is manually annotated and used as a fine-tuning training data set for fine-tuning training. The steps are as follows:
[0073] S301: Divide the fine-tuning training data set into a training set, a validation set, and a test set in a ratio of 8:1:1;
[0074] S302: configure fine-tuning training parameters, including learning rate, batch size, and training rounds. In this embodiment, the learning rate is set to 0.0000625, the batch size is set to 64, and the training rounds are set to 500;
[0075] S303: Load the model file and weight parameters of the pre-trained model PP-OCRv4;
[0076] S304: Use the Python training script in the GPU server environment to start fine-tuning training of the text recognition pre-training model;
[0077] S305: After the fine-tuning training is completed, the model is evaluated using the validation set to check the performance indicator ACC of the text recognition model, where ACC represents the text recognition accuracy;
[0078] S306: According to the evaluation results, the model is tuned, the learning rate is adjusted, the number of training rounds is increased, and the process of S302 to S305 is repeated for further optimization until the training is completed. In this embodiment, when ACC ≥ 0.9, it is determined that the text recognition pre-training model has completed fine-tuning training and the OCR text recognition model is obtained.
[0079] In a specific embodiment of the present invention, the OCR text recognition model structure includes: inputting a text line into a convolutional neural network CNN to extract text line thumbnail features, including information such as the outline, strokes and structure of the text; passing the extracted features to a sequence recognition module, using a recurrent neural network RNN to encode and decode the feature sequence, generate a corresponding text sequence, and realize sequence modeling; outputting the probability distribution of each character category; selecting the character category with the highest probability in the probability distribution as the prediction result of the model, converting the output sequence of the RNN into the final text information through a transcription layer, and outputting the text recognition result and the text character confidence.
[0080] It should be noted that the probability distribution reflects the model's prediction confidence for each character category.
[0081] In a specific embodiment of the present invention, "obtaining a text line fuzziness set" includes traversing the text line set using a text recognition model, ensuring that each text line in the text line set is subjected to text recognition using the text recognition model, obtaining the confidence of all text characters in each text line, and calculating the average of the confidences of all text characters in each text line. As the blurriness b of each text line i Finally, we get the text line ambiguity set B{b1, b2, b3...b n},in, Represents the mean confidence of the text characters in each text line, S i represents the confidence of the text character, m represents the number of text characters in each text line, B represents the fuzziness set of the text line, and b n Indicates the fuzziness of the nth text line in the text line fuzziness set.
[0082] S4: Calculate the mean and variance of the text line fuzziness set, compare the mean and variance with a preset value, and determine the fuzziness of the bill image.
[0083] In a specific embodiment of the present invention, “calculating the mean and variance of the text line fuzziness set” includes: the mean calculation formula of the text line fuzziness set is expressed as: The variance calculation formula of the text line fuzziness set is expressed as: in, represents the mean of the text line fuzziness set, b i represents the ambiguity of the jth text line in the text line ambiguity set, n represents the total number of text line ambiguities, B 2 Represents the variance of the text line ambiguity set.
[0084] In a specific embodiment of the present invention, "determining the blurriness of the bill image" includes:
[0085] When the mean of the text line fuzziness set is less than the preset mean, and the variance of the text line fuzziness set is greater than the preset variance, the bill image is judged to be fuzzy, and the user needs to upload the bill again;
[0086] When the mean of the text line fuzziness set is less than the preset value, and the variance of the text line fuzziness set is less than the preset variance, the bill image is judged to be fuzzy, and the user needs to upload the bill again;
[0087] When the mean of the text line fuzziness set is greater than the preset mean, and the variance of the text line fuzziness set is greater than the preset variance, the bill image is judged to be fuzzy, and the user needs to upload the bill again;
[0088] When the mean of the text line fuzziness set is greater than the preset mean and the variance of the text line fuzziness set is less than the preset variance, it is determined that the bill image is not blurred and the user does not need to re-upload the bill.
[0089] In a second embodiment of the present invention, the present invention provides an image blur detection system for global text recognition, such as Figure 2 As shown, the system comprises:
[0090] Algorithm model training module: used to fine-tune the target detection pre-training model, text detection pre-training model and text recognition pre-training model to obtain the target detection model, OCR text detection model and OCR text recognition model;
[0091] It should be noted that the structure of the target detection model includes: sending the image to be detected as input into the target detection model, performing feature extraction through the convolutional neural network CNN, and extracting meaningful feature information in the image, including edges, textures, shapes, etc.; based on the feature extraction, generating a series of candidate regions, which may contain the target to be detected; for each candidate region, performing two main operations: classification and regression. The classification operation is used to determine whether the region contains the target, and the regression operation is used to determine the pixel position of the target in the image; after classification and regression, the model may output multiple overlapping bounding boxes. In order to eliminate these redundant bounding boxes, the non-maximum suppression algorithm is used to eliminate redundant bounding boxes, and finally the detected target and its corresponding bounding box information are output.
[0092] It should also be noted that the structure of the OCR text detection model includes: preprocessing the bill area sub-image, including color space conversion, noise reduction, binarization, and optimizing image quality; feature extraction of the preprocessed image, using a convolutional neural network to extract text-related features, including text shape, size, edge, direction and other information; based on the extracted features, using the segmentation-based DB text detection algorithm to locate the text area and obtain the bounding box of the text line; using non-maximum suppression (NMS) to eliminate overlapping bounding boxes, and finally output a set of text lines.
[0093] It should also be noted that the structure of the OCR text recognition model includes: taking small images of text lines, performing feature extraction, and using convolutional neural networks to extract text-related features, including information such as the shape, strokes, and structure of the text; performing sequence modeling on the extracted features through the recurrent neural network RNN, outputting the probability distribution of each character category, selecting the character category with the highest probability in the probability distribution as the prediction result of the model, converting the output sequence of the RNN into the final text information through the transcription layer, and outputting the text recognition result and the text character confidence.
[0094] Bill image upload module: used to collect bill images;
[0095] Algorithm model reasoning module: used to detect the bill area of the bill image and intercept the sub-image; perform text detection on the sub-image to obtain the text line set of the sub-image; use the target detection model to obtain the bill area of the bill image and intercept the sub-image; use the text detection model to obtain the text line set of the sub-image; perform text recognition on the text line set to obtain the confidence of each text character, use the average of the confidence of the text characters of each text line as the fuzziness of each text line, and obtain the text line fuzziness set;
[0096] Blur determination module: used to calculate the mean and variance of the text line blur set, compare the mean and variance with the preset value, and determine the blur of the bill image.
[0097] In embodiment three of the present invention, the present invention provides an electronic device, comprising a memory and a processor, characterized in that the memory stores a computer program that can be run on the processor, and when the program is executed on the processor, the steps in the image blur detection method based on global text recognition as described in any one of the above items are implemented.
[0098] In a fourth embodiment of the present invention, the present invention provides a storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps in the image blur detection method based on global text recognition as described in any one of the above items.
[0099] In summary, the image blur detection method based on global text recognition provided by the present invention is specifically optimized for text information in bill images, rather than relying solely on edge information detection. Since bill images are usually dominated by large-scale text characters, this optimization makes the detection more accurate and in line with actual application scenarios; through the neural network model, the area of interest in the bill image, that is, the area where the text characters are located, can be accurately extracted, effectively eliminating information interference in non-target areas, and improving the efficiency and accuracy of subsequent processing; through the deep learning algorithm, all text characters can be accurately detected and recognized, which not only improves the recognition accuracy, but also makes the blur judgment of each character more accurate; the present invention not only performs blur judgment on the entire image, but also performs blur judgment on each text character; this refined processing method can more accurately determine the clarity of the bill image and identify which characters may be unavailable due to blur; the present invention uses deep learning to optimize the text information in the bill image, improves the accuracy and efficiency of blur detection, and provides more reliable technical support for practical applications.
[0100] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
[0101] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the modules described above can refer to the corresponding process in the aforementioned method implementation, and will not be repeated here.
[0102] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present implementation scheme.
[0103] In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0104] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for a computer system (which can be a personal computer, a server, or a network system, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0105] Finally, it should be noted that the above implementation modes are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned implementation modes, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned implementation modes, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various implementation modes of the present application.
Claims
1. A method for detecting image blur based on global text recognition, characterized in that: include, Collecting bill images, detecting bill areas of the bill images and capturing sub-images; Performing text detection on the sub-image to obtain a text line set of the sub-image; Performing text recognition on the text line set, obtaining the confidence of each text character, taking the average of the confidences of the text characters in each text line as the fuzziness of each text line, and obtaining a text line fuzziness set; The mean and variance of the text line fuzziness set are calculated, and the mean and variance are compared with preset values to determine the fuzziness of the bill image.
2. The image blur detection method based on global text recognition according to claim 1, characterized in that: The bill area for detecting the bill image includes: The pre-trained object detection model is used to detect the bill area of the bill image, and a sub-image is captured after the bill area is detected.
3. The image blur detection method based on global text recognition according to claim 1 or 2, characterized in that: The captured sub-image includes: The minimum bounding rectangle position information of the bill area in the bill image is obtained, and the area enclosed by the minimum bounding rectangle is intercepted as a sub-image.
4. The image blur detection method based on global text recognition according to claim 1, characterized in that: The step of performing text detection on a sub-image to obtain a text line set of the sub-image includes: The OCR text detection model is used to perform text detection on the sub-image, detect all text lines in the sub-image, obtain the position information of the minimum circumscribed rectangle of all text lines to form a sub-image text line set L = {l1,l2...l i ... n }, l i =[(x i1 ,y i1 ),(x i2 ,y i2 ),(x i3 ,y i3 ),(x i4 ,y i4 )], where l i Represents the position information of the minimum bounding rectangle of the i-th text line, (x i1 ,y i1 ),(x i2 ,y i2 ),(x i3 ,y i3 ),(x i4 ,y i4 ) represent the coordinates of the upper left corner, upper right corner, lower right corner, and lower left corner of the minimum bounding rectangle of the i-th text line.
5. The image blur detection method based on global text recognition according to claim 1 or 4, characterized in that: The step of performing text detection on the sub-image to obtain a text line set of the sub-image further includes: The sub-image is subjected to color space conversion, noise reduction, binarization, and image quality optimization processing.
6. The image blur detection method based on global text recognition according to claim 1, characterized in that: The performing text recognition on the text line set comprises: The OCR text recognition model is used to traverse the text line set for text recognition, identify each text character in each text line, and obtain the confidence of each text character.
7. The image blur detection method based on global text recognition according to claim 1, characterized in that: The determination of the fuzziness of the bill image includes: When the mean of the text line fuzziness set is less than the preset mean, and the variance of the text line fuzziness set is greater than the preset variance, the bill image is determined to be fuzzy; When the mean of the text line fuzziness set is less than a preset value, and the variance of the text line fuzziness set is less than a preset variance, the bill image is determined to be fuzzy; When the mean of the text line fuzziness set is greater than the preset mean, and the variance of the text line fuzziness set is greater than the preset variance, the bill image is determined to be fuzzy; When the mean of the text line fuzziness set is greater than the preset mean and the variance of the text line fuzziness set is less than the preset variance, it is determined that the bill image is not blurred.
8. An image blur detection system based on global text recognition, characterized in that: include, Bill image upload module: used to collect bill images; Algorithm model reasoning module: used to detect the bill area of the bill image and intercept the sub-image; perform text detection on the sub-image to obtain the text line set of the sub-image; use the target detection model to obtain the bill area of the bill image and intercept the sub-image; use the text detection model to obtain the text line set of the sub-image; perform text recognition on the text line set to obtain the confidence of each text character, use the average of the confidence of the text characters of each text line as the fuzziness of each text line, and obtain the text line fuzziness set; Blur determination module: used to calculate the mean and variance of the text line blur set, compare the mean and variance with the preset value, and determine the blur of the bill image.
9. An electronic device, comprising a memory and a processor, characterized in that: The memory stores a computer program that can be run on the processor, and when the program is executed on the processor, the steps in the image blur detection method based on global text recognition as claimed in any one of claims 1 to 7 are implemented.
10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image blur detection method based on global text recognition as claimed in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Image detection method and device, electronic equipment and storage medium
CN113537192A
Fuzzy judgment method, system and device for medical bill picture and medium
CN113963149A
Medical document picture quality evaluation method, device and equipment
CN118135595A
