A method and system for automatic image quality assessment for text recognition

By automatically extracting the text area features in the image, calculating the quality prediction score, and judging whether to perform OCR recognition, it solves the problem of relying on manual review for image quality assessment in the existing technology, and improves the stability and efficiency of the OCR system.

CN118212637BActive Publication Date: 2024-09-03SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410612009.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-09-03
Estimated Expiration
2044-05-17

AI Technical Summary

Technical Problem

In the existing technology, automatic assessment of image quality relies on manual review, which is difficult to adapt to large data volumes and high timeliness applications, resulting in low-quality images entering the OCR process, increasing the risk of recognition errors and reducing business efficiency.

Method used

Using an automatic image quality assessment method for text recognition, by acquiring images, automatically locating and extracting text areas, extracting multi-level global semantic features and multi-scale local distortion features, calculating the quality prediction score, judging whether it is less than the preset threshold, and deciding whether to proceed OCR recognition.

Benefits of technology

It achieves accurate quality assessment of text areas in images, avoids low-quality images from affecting OCR recognition accuracy, and improves the stability and efficiency of the OCR system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118212637B
    Figure CN118212637B
Patent Text Reader

Abstract

The present invention belongs to the field of image analysis technology, and specifically relates to an automatic image quality assessment method and system for text recognition. The present invention predicts the quality of the text area and calculates the quality prediction score of the image, which helps to achieve accurate quality assessment of the text area in the image. And by comparing the calculated quality prediction score with a preset quality score threshold, and when the calculated quality prediction score is less than the preset threshold, the text in the image is prevented from being recognized, which helps to effectively avoid the influence of low-quality images on the OCR recognition accuracy and improve the stability and work efficiency of the entire OCR system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image analysis and processing, and in particular relates to an automatic image quality assessment method, system and storage medium for text recognition. Background Art

[0002] With the rapid development of artificial intelligence and computer vision technology, optical character recognition (OCR) technology plays an important role in many fields, such as document information entry, document digitization, license plate recognition, etc. However, the performance of OCR technology is often restricted by the quality of the input image, such as clarity, contrast, noise, distortion and lighting. In practical applications, image quality problems caused by various factors seriously affect the accuracy and efficiency of OCR technology.

[0003] Traditional automatic image quality assessment mostly relies on manual review, which is not only limited by the inconsistency of subjective judgment, but also difficult to adapt to large data volumes and time-sensitive application scenarios. When low-quality images are directly entered into the OCR process without screening, it not only increases the risk of recognition errors, but also consumes system resources and reduces overall business efficiency. Summary of the invention

[0004] In order to solve the technical problems existing in the above-mentioned background technology, the present invention provides an automatic image quality assessment method, system and storage medium for text recognition, aiming to achieve accurate quality assessment of the text area in the image, which helps to effectively avoid the impact of low-quality images on OCR recognition accuracy and improve the stability and work efficiency of the entire OCR system. The specific steps of the present invention are as follows: An automatic image quality assessment method for text recognition, comprising the following steps:

[0005] Step 1: Acquire the image;

[0006] Step 2: Automatically locate and extract the text area in the image;

[0007] Step 3: Extract semantic features of the text area, perform quality prediction on the text area based on the extracted semantic features, and calculate the quality prediction score of the image, wherein the semantic features include multi-level global semantic features and multi-scale local distortion features.

[0008] Step 4: determine whether the quality prediction score is less than a preset quality score threshold. If so, recognize the text in the image. If not, prevent text recognition and provide a prompt message.

[0009] Furthermore, the extraction of semantic features of the text area includes:

[0010] Extract multi-level global semantic features of text regions;

[0011] The text area is cut into pieces, and the multi-level local distortion features of each area are extracted. The multi-level local distortion features are aggregated to obtain multi-scale local distortion features.

[0012] Furthermore, the step of performing quality prediction on the text area according to the extracted semantic features and calculating the quality prediction score of the image includes:

[0013] Learning the mapping from multi-level global semantic features to rules on how to judge image quality to generate an adaptive parameter generation network mapping function, and calculating the specific weight of the image based on the generated adaptive parameter generation network mapping function;

[0014] Based on the semantic features and specific weights, the quality prediction score of the image is calculated.

[0015] Furthermore, the formula for calculating the specific weight of an image is as follows:

[0016]

[0017] Where x represents an image; Indicates a specific weight; Generates a network mapping function for adaptive parameters, S(x) represents the multi-level global semantic features of the text region extracted from image x, is the network parameter, and the weight dynamic deviation of image x is calculated at the same time, and the weight dynamic deviation is compensated to a specific weight.

[0018] The formula for calculating the quality prediction score of an image is as follows:

[0019]

[0020]

[0021] in, represents the quality prediction network model, Represents an image, Represents semantic features, Representing images The specific weight of Representing images The weight dynamic bias, is the adaptive weight.

[0022] On the other hand, the present invention provides an automatic image quality assessment system for text recognition, comprising:

[0023] An image acquisition module, used for acquiring images;

[0024] A text area detection module is used to automatically locate and extract the text area in the image;

[0025] The quality prediction module is used to predict the quality of the text area and calculate the quality prediction score of the image;

[0026] A judgment feedback module is used to judge whether the quality prediction score is less than a preset quality score threshold. If so, the image is pushed to the OCR recognition module for recognition. If not, the image is prevented from being pushed to the OCR recognition module and a prompt message is fed back;

[0027] OCR recognition module, used to recognize text in images;

[0028] The quality prediction module comprises:

[0029] A semantic extraction network model is used to extract semantic features of text areas, where the semantic features include multi-level global semantic features and multi-scale local distortion features;

[0030] An adaptive parameter generation network model is used to learn the mapping from multi-level global semantic features to rules on how to judge image quality, so as to generate an adaptive parameter generation network mapping function, and calculate the specific weight of the image based on the generated adaptive parameter generation network mapping function;

[0031] The quality prediction network model calculates the quality prediction score of the image based on semantic features and specific weights.

[0032] Furthermore, the semantic extraction network model includes: a densely connected network and a local distortion perception module;

[0033] The densely connected network consists of one convolution and pooling layer, three dense block layers, two transition layers, and one average pooling layer;

[0034] The transition layer includes a neural network BN layer, a ReLU function layer, a 1x1 convolution layer, and a 2x2 average pooling layer;

[0035] A bottleneck layer is set in the dense block layer, wherein the bottleneck layer adopts a three-layer design.

[0036] Furthermore, the adaptive parameter generation network model includes two 1×1 convolutional layers, multiple specific weight branches and multiple bias branches, wherein the specific weight branches include a 3×3 convolutional layer and a fully connected layer; the bias branches include an average pooling layer and a fully connected layer.

[0037] On the other hand, the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned automatic image quality assessment method for text recognition.

[0038] The beneficial effects of the present invention are:

[0039] The present invention predicts the quality of the text area and calculates the quality prediction score of the image, which helps to achieve accurate quality evaluation of the text area in the image. And by comparing the calculated quality prediction score with a preset quality score threshold, and when the calculated quality prediction score is less than the preset threshold, the text in the image is prevented from being recognized, which helps to effectively avoid the influence of low-quality images on the OCR recognition accuracy and improve the stability and work efficiency of the entire OCR system. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0041] Figure 1 The present invention is a flowchart of an embodiment of a method for automatic image quality assessment for text recognition.

[0042] Figure 2 It is a principle block diagram of the quality prediction module of the present invention. DETAILED DESCRIPTION

[0043] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0044] It should be noted that the following detailed descriptions are all illustrative and are intended to provide further explanation of the present invention. Unless otherwise specified, each technical and scientific term used in this embodiment has the same meaning as commonly understood by those skilled in the art to which the present invention belongs.

[0045] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0046] In the present invention, terms such as "upper", "lower", "left", "right", "front", "back", "vertical", "horizontal", "side", "bottom", etc. indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings. They are relational words determined only for the convenience of describing the structural relationships of the various parts or elements of the present invention, and do not specifically refer to any part or element in the present invention and should not be understood as limitations on the present invention.

[0047] In the present invention, terms such as "fixed connection", "connected", "connection", etc. should be understood in a broad sense, indicating that it can be fixedly connected, integrally connected or detachably connected; it can be directly connected or indirectly connected through an intermediate medium. Relevant scientific research or technical personnel in this field can determine the specific meanings of the above terms in the present invention according to specific circumstances, and they should not be understood as limiting the present invention.

[0048] Embodiment 1:

[0049] like Figure 1 As shown, this embodiment provides an agent-based image analysis and processing method, comprising the following steps:

[0050] S1: Acquire image.

[0051] S2: Automatically locate and extract the text area in the image.

[0052] Specifically, a pre-trained model is used to automatically locate and extract text areas in an image. The pre-trained model can be, for example, a paddleocr model selected as a basic model and a pre-trained model obtained by fine-tuning a low-quality text image dataset.

[0053] S3: Perform quality prediction on the text area and calculate the quality prediction score of the image.

[0054] Specifically, quality prediction of text regions includes the following three steps: semantic feature extraction, adaptive quality indicator extraction, and quality prediction.

[0055] S31: Semantic feature extraction. On the one hand, multi-level global semantic features are extracted for the entire text area. On the other hand, the text area is cut into blocks, multi-level local distortion features of each area are extracted, and the multi-level local distortion features are aggregated to obtain multi-scale local distortion features.

[0056] Specifically, a densely connected network (DenseNet) is used as the backbone network for semantic feature extraction. The densely connected network includes a convolution and pooling layer (Conv+Pooling), three dense block layers (Dense Block1, DenseBlock2 and Dense Block3), two transition layers (Transition1 and Transition2) and a global average pooling layer (Global Average Pooling, GAP). Each layer of the densely connected network can directly access and utilize the feature information in all earlier layers. When in use, the text area in the detected image is input into the densely connected network to output multi-level global semantic features.

[0057] The local distortion sensing module (LDSM) is connected to the densely connected network to integrate the semantic features from different levels of the densely connected network and aggregate the semantic features to obtain multi-scale local distortion features. Specifically, the input of the local distortion sensing module is the abstract features representing different levels from the outputs of Dense Block1, Dense Block2, and Dense Block3, covering semantic feature maps from low-level edges and textures to high-level semantic features.

[0058] The local distortion perception module includes: feature map blocking unit, multi-scale feature fusion unit, local attention mechanism unit, feature reconstruction and integration unit, etc.

[0059] The feature map block unit is used to divide the semantic feature map output by each Dense Block1, Dense Block2, and Dense Block3 into non-overlapping fixed-size blocks. This division allows the module to focus on the local area of ​​the image and independently analyze the distortion characteristics in each area.

[0060] Multi-scale feature fusion unit: extract the divided blocks from the corresponding positions of Dense Block1, Dense Block2, and Dense Block3 and splice them to form a feature block with cross-scale information. This step utilizes the complementarity of cross-layer features and provides a more comprehensive information basis for local distortion analysis.

[0061] Local attention unit: applies learnable weight distribution in channel and spatial dimensions on each feature patch.

[0062] Among them, the channel attention mechanism: First, for each feature block, perform global average pooling and global maximum pooling operations to collect information at all spatial positions, merge the two sets of pooling results and input them into a shared multi-layer perceptron (MLP) model, and generate a weighted vector through the learning process to map the relative importance of each channel. This weighted vector is then processed by a Sigmoid activation function and converted into a channel attention weight suitable for use, and the channel attention weight is applied to the original feature map, through element-by-element multiplication, which helps to adjust the feature strength according to the importance of the channel and enhance the model's ability to recognize local distorted features.

[0063] Spatial dimension attention mechanism: Average pooling and maximum pooling operations are applied to each channel to obtain the global spatial response of the channel. These responses are fed into a convolutional network containing two consecutive 3×3 convolutional layers to output a spatial attention map of the same size as the original feature. The spatial attention map is then multiplied with the channel attention weight to obtain the comprehensive attention weight of each pixel in each feature block, and the comprehensive attention weight is multiplied with each feature block to achieve fine-tuning of each pixel in the local area.

[0064] The feature reconstruction and integration unit is used to adjust the number of channels for each feature block adjusted by the local attention mechanism, restore its original size, and fuse it with the adjacent feature blocks to construct a complete multi-scale semantic feature map and extract multi-scale semantic features. At the same time, a global pooling operation is performed on all feature blocks to extract the global context information of the entire image, and the global context information is fused with the local multi-scale semantic features to identify the multi-scale local distortion features.

[0065] S32: Adaptive quality indicator extraction.

[0066] Learn the mapping from multi-level global semantic features to rules on how to judge image quality to generate an adaptive parameter generation network mapping function, and calculate specific weights for the acquired image based on the generated adaptive parameter generation network mapping function.

[0067] Specific weights are regarded as rules for perceiving image quality to quantize and calculate multiple quality indicators of the image to indicate the predicted image quality, the difference between the predicted image quality and the expected image quality is taken as a measure of dynamic deviation, and the measure is quantized to generate a weighted dynamic deviation.

[0068] The calculation formula of specific weight is as follows:

[0069]

[0070] Where x represents an image; Indicates a specific weight; Generate a network mapping function for adaptive parameters, S(x) represents the multi-level global semantic features of the text region extracted from the image x; is the network parameter.

[0071] At the same time, the weight dynamic deviation of image x is calculated and compensated to a specific weight.

[0072] Specifically, the quality indicator of image x is quantized according to the calculated specific weight to indicate the predicted image quality, the difference between the predicted image quality and the expected image quality is used as a measure of dynamic deviation, and the measure is quantized to generate a weighted dynamic deviation.

[0073] It should be noted that the calculated specific weight is not unique and invariant, and the specific weight is generated for the content of each image, that is, different specific weights are obtained for different image contents.

[0074] S33: Quality prediction.

[0075] According to the acquired specific weights and weight dynamic deviations, the adaptive weights are determined, and the determined adaptive weights are used to perform weighted combination of multi-scale local distortion features and multi-level global semantic features, and finally a quality prediction score s is obtained. The quality prediction score s is calculated. This score is a value between 0 and 1. The larger the value, the higher the image quality. Conversely, the smaller the value, the lower the image quality. The calculation formula of the quality prediction score s is as follows:

[0076]

[0077]

[0078] in, represents the quality prediction network model, Represents an image, Represents semantic features, Representing images The specific weight of Representing images The weight dynamic bias, is the adaptive weight.

[0079] S4: Determine whether the quality prediction score is less than a preset quality score threshold. If so, recognize the text in the image. If not, prevent text recognition and feedback prompt information.

[0080] Specifically, an image quality score threshold can be set according to the needs of the actual scenario. If the calculated image quality prediction analysis is lower than the threshold, the system will prevent these substandard images from continuing to enter the OCR recognition module to avoid recognition errors or failures caused by image quality problems, thereby improving the accuracy and operating efficiency of the entire image recognition, and at the same time feedback prompt information, which includes a detailed description of the image quality problem, such as but not limited to "image blur" and "excessive noise" and other problem descriptions.

[0081] If the calculated image quality prediction analysis is higher than the threshold, the image is automatically pushed to the OCR recognition module for text recognition.

[0082] Embodiment 2:

[0083] This embodiment provides an automatic image quality assessment system for text recognition, including:

[0084] (a) An image acquisition module, used to acquire images.

[0085] (ii) Text region detection module, used to automatically locate and extract text regions in images.

[0086] The text area detection module includes, for example, a pre-trained model obtained by fine-tuning a low-quality text image dataset using the paddleocr model as a base model. The pre-trained model automatically locates and extracts the text area in the image.

[0087] (iii) A quality prediction module, which is used to predict the quality of the text area and calculate the quality prediction score.

[0088] like Figure 2 As shown in the figure, the quality prediction module includes a semantic extraction network model, an adaptive parameter generation network model (Adaptive parameter generation network, ApgNet) and a quality prediction network model (Qualityprediction network, QpNet).

[0089] A) Semantic extraction network model, using DenseNet network as the backbone network for semantic feature extraction to extract multi-level global semantic features of text areas. Each layer can directly access and utilize all early feature level information.

[0090] Specifically, the DenseNet network consists of a convolution and pooling layer (Conv+Pooling), three dense block layers (DenseBlock), two transition layers (Transition) and an average pooling layer (AvgPooling).

[0091] Among them, the convolution layer slides and multiplies the input image through a set of learnable filters to generate a feature map, and obtains local low-level visual features such as edges, textures, and color distribution from the original image.

[0092] The pooling layer reduces the spatial resolution of the feature map by averaging the sub-regions (AvgPooling), which not only reduces the amount of computation and enhances translation invariance, but also retains important local features and reduces sensitivity to object position details, which is conducive to extracting high-level semantic features that are sensitive to the overall shape and layout of the object.

[0093] The dense block gradually builds a complex, multi-level feature representation through multiple cascaded convolutional layers and cross-layer connections, from local to global, from low-level to high-level, effectively capturing the semantic information of the image.

[0094] The transition layer is located between two dense blocks and includes a BN (Batch Normalization) layer, a ReLU function + 1x1 convolution layer (Conv), and a 2x2 average pooling layer (AvgPooling).

[0095] The BN layer normalizes the feature map of each batch of data (the mean is close to 0 and the variance is close to 1), improving the convergence speed and generalization performance of the neural network. ReLU, as a nonlinear activation function, introduces nonlinearity to capture the complex features of the image and improve computational efficiency; the 1x1 convolution layer performs inter-channel information integration and dimensionality reduction, and the two are combined to refine the output of the previous dense block. The 2x2 average pooling layer downsamples the feature map after BN, ReLU and 1x1 convolution processing, providing a lower resolution but more abstract feature representation for the next dense block.

[0096] In addition, adding bottleneck layers to each dense block helps to significantly reduce the amount of calculation and parameters without sacrificing too much feature expression ability. Among them, the first layer of the bottleneck layers: using 1x1 convolution kernel for channel compression, which helps to reduce the feature dimension; the second layer of the bottleneck layers: using 3x3 convolution layer to capture spatial features; the third layer of the bottleneck layers: restoring the feature dimension to an appropriate level through a 1x1 convolution layer.

[0097] It should be noted that, for ease of understanding and description, the three dense block layers are respectively recorded as the first dense block layer (DenseBlock1), the second dense block layer (DenseBlock2) and the third dense block layer (DenseBlock3). The two transition layers are respectively recorded as the first transition layer (Transition1) and the second transition layer (Transition2).

[0098] The DenseNet network extracts semantic features of text areas in the following order: first through a convolution and pooling layer, then through the first dense block layer, the first transition layer, the second dense block layer, the second transition layer, and the third dense block layer, and finally an average pooling layer outputs multi-level global semantic features.

[0099] The semantic extraction network model also includes a local distortion sensing module (LDSM), which is connected to the first dense block layer, the second dense block layer and the third dense block layer to obtain the semantic features in each dense block layer, and aggregate the obtained semantic features to obtain multi-scale local distortion features.

[0100] B) Adaptive parameter generation network model

[0101] The adaptive parameter generation network model obtains the multi-level global semantic features output by the semantic extraction network model, and learns the mapping from the multi-level global semantic features to the rules of how to judge the image quality, so as to generate an adaptive parameter generation network mapping function. Based on the generated adaptive parameter generation network mapping function, the specific weights of the acquired image are calculated, which helps to guide the quality prediction network model to adaptively extract the multi-level global semantic features for prediction. The specific weights are regarded as the rules for perceiving the image quality, so as to quantify and calculate the multiple quality indicators of the image to indicate the predicted image quality, and the difference between the predicted image quality and the expected image quality is taken as a measure of dynamic deviation, and the measure is quantified to generate the weighted dynamic deviation. For example, the weighted dynamic deviation of image x can be expressed as .

[0102] The calculation formula of specific weight is as follows:

[0103]

[0104] Where x represents an image; Indicates a specific weight; Generates a network mapping function for adaptive parameters, S(x) represents the multi-level global semantic features of the text region extracted from image x, is the network parameter.

[0105] Specifically, the adaptive parameter generation network model includes two 1×1 convolutional layers, multiple specific weight branches (Weight) and multiple bias branches (Bais).

[0106] Among them, the 1×1 convolutional layer realizes feature extraction and compression by performing linear transformation and cross-channel integration on the input data.

[0107] The specific weight branch includes a 3×3 convolution layer and a fully connected layer (FC). The 3×3 convolution layer further models the spatial correlation of the low-dimensional features output by the 1×1 convolution layer to capture the interaction between local features. The fully connected layer globally maps the convolutional features and generates an adaptive weight matrix that matches the weight structure of the corresponding layer in the model. In addition, the output channel of the fully connected layer of the specific weight branch is determined according to the dimension of the corresponding input channel in the quality prediction network to match the size.

[0108] The bias branch is used to compensate for the dynamic bias of the weights. Specifically, the bias branch calculates the corresponding dynamic bias of the weights based on the low-dimensional features output by the 1×1 convolutional layer. These biases are added to the preliminary results calculated by specific weights to correct the model's prediction tendency for different input samples. In particular, when there are problems such as data distribution offset and category imbalance, the dynamic bias of the weights can help the model better adapt to the data characteristics.

[0109] The bias branch includes an average pooling layer and a fully connected layer, and its bias is processed and output by the average pooling layer and the fully connected layer. The average pooling layer globally averages the features output by the 1×1 convolution layer and extracts statistical information that characterizes the global data distribution characteristics. The fully connected layer receives the statistical features after average pooling and generates a bias vector that matches the weights generated by the specific weight branch through nonlinear transformation. These bias vectors are added to the preliminary results calculated by the specific weights to provide the model with additional adaptive weight adjustment.

[0110] It should be noted that the specific weights depend on the image itself, rather than being fixed for all inputs. The adaptive parameter generation network can calculate specific weights for different quality indicators for different multi-level global semantic feature extraction quality indicators.

[0111] Among them, the adaptive parameter generation network model is a model that can establish a mapping from multi-level global semantic features to image quality judgment rules through pre-training. At the same time, the model is iteratively optimized so that it can learn to extract the optimal parameter set for the input features. These parameters essentially represent the weighted indicators of each level of features when evaluating image quality, guiding the system to understand the importance of different feature levels. The process of generating these weight parameters is embedded in a deep learning framework, in which the model continuously fine-tunes the parameters to maximize the accuracy of automatic image quality assessment. In short, the framework has learned through self-optimization how to dynamically generate weights that reflect key factors of image quality based on global semantic features, thereby achieving efficient evaluation of image quality.

[0112] C) Quality prediction network model, which is used to calculate the quality prediction score of the image based on the extracted semantic features and the specific weights of each quality indicator.

[0113] Specifically, the quality prediction network model includes a fully connected layer, a specific weight determination layer, and a score calculation layer.

[0114] There are four fully connected layers, three of which are used to receive the multi-scale local distortion features output by the local distortion perception module, and one is used to receive the multi-level global semantic features output by DenseNet.

[0115] The main task of the specific weight determination layer is to dynamically generate adaptive weights based on specific weights and weight dynamic deviation compensation to fuse the multi-scale local distortion features and multi-level global semantic features output by the above-mentioned fully connected layer.

[0116]

[0117] in, Representing images The weight dynamic bias, is the adaptive weight.

[0118] It should be noted that the specific weight determination layer is also used to "propagate" the generated adaptive weights to the subsequent feature fusion stage to guide how to combine multi-scale local distortion features and multi-level global semantic features. This is a nonlinear fusion operation that ensures that features from different sources and types are properly integrated according to their relative importance and contribution to the final quality prediction.

[0119] The score calculation layer is used to perform a weighted combination of multi-scale local distortion features and multi-level global semantic features according to these adaptive weights, and finally obtain a quality prediction score s. This score is a value between 0 and 1. The larger the value, the higher the image quality. Conversely, the smaller the value, the lower the image quality. The calculation formula of the quality prediction score s is as follows:

[0120]

[0121] in, represents the quality prediction network model, Represents an image, Represents semantic features, Representing images specific weight.

[0122] (iv) A judgment feedback module is used to judge whether the quality prediction score is less than a preset quality score threshold. If so, the image is pushed to the OCR recognition module. If not, text recognition is blocked and a prompt message is fed back.

[0123] Specifically, an image quality score threshold can be set according to actual scenario needs. If the calculated image quality prediction analysis is lower than the threshold, these substandard images are prevented from continuing to enter the OCR recognition process to avoid recognition errors or failures caused by image quality problems, thereby improving the accuracy and operating efficiency of the entire image recognition. At the same time, prompt information is fed back, which includes a detailed description of the image quality problem, such as but not limited to descriptions of problems such as "image blur" and "excessive noise".

[0124] If the calculated image quality prediction analysis is higher than the threshold, the extracted text area is automatically pushed to the OCR recognition module for text recognition.

[0125] (V) OCR recognition module, used to recognize the text in the image and output the recognition result.

[0126] When this embodiment is used, taking the smart card recognition system as an example, the user uploads an ID card, which first passes through the text area detection module to obtain the text area in the image, and then performs global and local semantic feature extraction. The adaptive parameter generation network generates a specific weight for this image, and this parameter and the global and local semantic features are input into the quality prediction network to obtain an evaluation score for this image. If it exceeds the preset threshold, card recognition is performed and the result is output; otherwise, card recognition is prevented and image quality problems are fed back.

[0127] Embodiment 3:

[0128] This embodiment provides a computer-readable storage medium, which includes a stored program. When the program is running, the device where the computer-readable storage medium is located is controlled to execute the automatic image quality assessment system for text recognition described in Example 1.

[0129] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0130] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0131] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0132] In addition, it should be noted that the flowchart in the accompanying drawings shows the method of the embodiment of the present disclosure. In the corresponding description in the flowchart or block diagram in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in an order different from that disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be performed substantially in parallel, and they can sometimes be performed in the opposite order, which can depend on the functions involved. Each block in the block diagram and / or flow chart, and the combination of blocks in the block diagram and / or flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0133] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An automatic image quality assessment method for text recognition. It is characterized in that The following steps are involved: Step 1: Acquire the image; Step 2: Automatically locate and extract the text area in the image; Step 3: extracting semantic features of the text area, predicting the quality of the text area based on the extracted semantic features, and calculating the quality prediction score of the image; wherein the semantic features include multi-level global semantic features and multi-scale local distortion features; Step 4: determine whether the quality prediction score is less than a preset quality score threshold. If so, recognize the text in the image. If not, prevent text recognition and provide a prompt message. The semantic features of the text area are extracted as follows: Extract multi-level global semantic features of text regions; The text area is cut into pieces, the multi-level local distortion features of each area are extracted, and the multi-level local distortion features are aggregated to obtain multi-scale local distortion features; The extracting semantic features of the text area also includes: A: A densely connected network is used as the backbone network for semantic feature extraction, wherein the densely connected network includes a convolution and pooling layer, three dense block layers, two transition layers, and a global average pooling layer. The three dense block layers are Dense Block1, Dense Block2, and Dense Block3; the two transition layers are Transition1 and Transition2; each layer of the densely connected network can directly access and utilize the feature information in all earlier layers, so that when in use, the text area in the detected image is input into the densely connected network, and multi-level global semantic features can be output; B: Integrate semantic features from different levels of the densely connected network and aggregate the semantic features to obtain multi-scale local distortion features. The outputs of Dense Block1, Dense Block2, and Dense Block3 represent abstract features at different levels, covering semantic feature maps from low-level edges and textures to high-level semantic features. Specifically, the following steps are included: B1: Divide the semantic feature maps output by each Dense Block1, Dense Block2, and Dense Block3 into non-overlapping fixed-size blocks. This division allows the module to focus on local areas of the image and independently analyze the distortion characteristics in each area; B2: Extract the divided blocks from the corresponding positions of Dense Block1, Dense Block2, and Dense Block3 and concatenate them to form a feature block with cross-scale information. This step utilizes the complementarity of cross-layer features and provides a more comprehensive information basis for local distortion analysis; B3: Apply learnable weight assignments in channel and spatial dimensions on each feature block; Among them, the channel attention mechanism: first, for each feature block, perform global average pooling and global maximum pooling operations to collect information at all spatial positions, merge the two sets of pooling results and input them into a shared multi-layer perceptron MLP model, and generate a weighted vector through the learning process to map the relative importance of each channel; this weighted vector is then processed by a Sigmoid activation function and converted into a channel attention weight suitable for use, and the channel attention weight is applied to the original feature map, through element-by-element multiplication, which helps to adjust the feature strength according to the importance of the channel and enhance the model's ability to recognize local distorted features; Spatial dimension attention mechanism: Average pooling and maximum pooling operations are applied to each channel to obtain the global spatial response of the channel; these responses are fed into a convolutional network containing two consecutive 3×3 convolutional layers to output a spatial attention map of the same size as the original feature, and then the spatial attention map is multiplied with the channel attention weight to obtain the comprehensive attention weight of each pixel in each feature block, and the comprehensive attention weight is multiplied with each feature block to achieve fine-tuning of each pixel in the local area; C: For each feature block adjusted by the local attention mechanism, a convolutional network with a 1x1 convolutional layer is used to adjust the number of channels, restore its original size, and fuse it with the adjacent feature blocks to construct a complete multi-scale semantic feature map and extract multi-scale semantic features. At the same time, a global pooling operation is performed on all feature blocks to extract the global context information of the entire image, and the global context information is fused with the local multi-scale semantic features to identify the multi-scale local distortion features.

2. The automatic image quality assessment method for text recognition according to claim 1, It is characterized in that The step of predicting the quality of the text area according to the extracted semantic features and calculating the quality prediction score of the image includes: Learning the mapping from multi-level global semantic features to rules on how to judge image quality to generate an adaptive parameter generation network mapping function, and calculating the specific weight of the image based on the generated adaptive parameter generation network mapping function; Based on the semantic features and specific weights, the quality prediction score of the image is calculated.

3. The automatic image quality assessment method for text recognition according to claim 2, It is characterized in that The formula for calculating the specific weight of an image is as follows: in, Represents an image; Indicates a specific weight; Generate network mapping function for adaptive parameters, S(x) represents the The multi-level global semantic features of the text region extracted from is the network parameter; The formula for calculating the quality prediction score of an image is as follows: in, represents the quality prediction network model, Represents an image, Represents semantic features, Representing images The specific weight of Representing images The weight dynamic bias, is the adaptive weight.

4. An automatic image quality assessment system for text recognition, It is characterized in that include: An image acquisition module, used for acquiring images; A text area detection module is used to automatically locate and extract the text area in the image; The quality prediction module is used to predict the quality of the text area and calculate the quality prediction score of the image; A judgment feedback module is used to judge whether the quality prediction score is less than a preset quality score threshold. If so, the image is pushed to the OCR recognition module for recognition. If not, the image is prevented from being pushed to the OCR recognition module and a prompt message is fed back; OCR recognition module, used to recognize text in images; The quality prediction module comprises: A semantic extraction network model is used to extract semantic features of text areas, where the semantic features include multi-level global semantic features and multi-scale local distortion features; An adaptive parameter generation network model is used to learn the mapping from multi-level global semantic features to rules on how to judge image quality, so as to generate an adaptive parameter generation network mapping function, and calculate the specific weight of the image based on the generated adaptive parameter generation network mapping function; The quality prediction network model calculates the quality prediction score of the image based on semantic features and specific weights; The semantic extraction network model includes: a dense connection network and a local distortion perception module; The dense connection network includes a convolution and pooling layer, three dense block layers, two transition layers, and a global average pooling layer. The three dense block layers are Dense Block1, Dense Block2, and Dense Block3; the two transition layers are Transition1 and Transition2; each layer of the dense connection network can directly access and utilize the feature information in all early layers, so that when in use, the text area in the detected image is input into the dense connection network, and multi-level global semantic features can be output; The local distortion perception module is connected to the dense connection network to integrate the semantic features from different levels of the dense connection network and aggregate the semantic features to obtain multi-scale local distortion features. The outputs of Dense Block1, DenseBlock2, and Dense Block3 represent abstract features at different levels, covering semantic feature maps from low-level edges and textures to high-level semantic features. The local distortion perception module includes: feature map segmentation unit, multi-scale feature fusion unit, local attention mechanism unit and feature reconstruction and integration unit; The feature map block unit is used to divide the semantic feature map output by each Dense Block1, Dense Block2, and Dense Block3 into non-overlapping fixed-size blocks. This division allows the module to focus on the local area of ​​the image and independently analyze the distortion characteristics in each area; Multi-scale feature fusion unit: extract the divided blocks from the corresponding positions of Dense Block1, Dense Block2, and Dense Block3 and splice them to form a feature block with cross-scale information; Local attention unit: applies learnable weight distribution in channel and spatial dimensions on each feature block; Among them, the channel attention mechanism: first, for each feature block, perform global average pooling and global maximum pooling operations to collect information at all spatial positions, merge the two sets of pooling results and input them into a shared multi-layer perceptron (MLP) model, and generate a weighted vector through the learning process to map the relative importance of each channel; this weighted vector is then processed by a Sigmoid activation function and converted into a channel attention weight suitable for use, and the channel attention weight is applied to the original feature map, through element-by-element multiplication, which helps to adjust the feature strength according to the importance of the channel and enhance the model's ability to recognize local distorted features; Spatial dimension attention mechanism: Average pooling and maximum pooling operations are applied to each channel to obtain the global spatial response of the channel; these responses are fed into a convolutional network containing two consecutive 3×3 convolutional layers to output a spatial attention map of the same size as the original feature, and then the spatial attention map is multiplied with the channel attention weight to obtain the comprehensive attention weight of each pixel in each feature block, and the comprehensive attention weight is multiplied with each feature block to achieve fine-tuning of each pixel in the local area; The feature reconstruction and integration unit is used to adjust the number of channels for each feature block adjusted by the local attention mechanism, restore its original size, and fuse it with the adjacent feature blocks to construct a complete multi-scale semantic feature map and extract multi-scale semantic features. At the same time, a global pooling operation is performed on all feature blocks to extract the global context information of the entire image, and the global context information is fused with the local multi-scale semantic features to identify the multi-scale local distortion features.

5. The automatic image quality assessment system for text recognition according to claim 4, It is characterized in that The adaptive parameter generation network model includes two 1×1 convolutional layers, multiple specific weight branches and multiple bias branches, wherein the specific weight branches include a 3×3 convolutional layer and a fully connected layer; the bias branches include an average pooling layer and a fully connected layer.

6. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute the automatic image quality assessment method for text recognition according to any one of claims 1 to 3.