Image quality evaluation method and device, electronic equipment and readable storage medium
By using classification and semantic segmentation models to detect the blur, grayness, and brightness of document images, this technology addresses the problem of insufficient quality assessment of text regions in existing technologies, enabling real-time quality feedback and efficient acquisition of document images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SF TECH CO LTD
- Filing Date
- 2021-11-22
- Publication Date
- 2026-06-19
Smart Images

Figure CN116167958B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically, to an image quality assessment method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] Currently, to facilitate the storage, transmission, and organization of important paper documents such as manuscripts and forms, most documents are captured using image acquisition devices to obtain document images, which are then stored and transmitted. However, to ensure that the content of the paper documents in the captured images is clearly visible, a quality assessment of the captured document images is necessary.
[0003] For document images, the most important aspect of quality assessment is the recognizability of text regions. However, there are currently very few methods for assessing the quality of document images, and most of them only focus on the overall quality of the document image, lacking quality assessment of text regions. This results in inconsistent quality of the final document images, making it impossible to recognize the text in the images. Summary of the Invention
[0004] Based on this, embodiments of the present invention provide an image quality assessment method, apparatus, electronic device, and readable storage medium, which enables effective detection of document regions in an image and ensures image quality.
[0005] Embodiments of the present invention can be implemented in the following ways:
[0006] In a first aspect, embodiments of the present invention provide an image quality assessment method, the method comprising:
[0007] Acquire the target image to be evaluated;
[0008] Based on a preset classification model, the category to which the target image belongs is detected;
[0009] If the target image belongs to the first category including document images, then the blur, grayness, and brightness of the pixels in the document image are detected according to the preset semantic segmentation model;
[0010] The quality assessment result of the target image is obtained based on the blur, grayness, and brightness of the pixels in the document image.
[0011] In an optional implementation, the step of detecting the blur, darkness, and brightness of pixels in the document image according to a preset semantic segmentation model includes:
[0012] The document image in the target image is cropped, and the cropped document image is input into the semantic segmentation model;
[0013] The semantic segmentation model is used to extract features from the document image to obtain the feature map of the document image;
[0014] The feature map is predicted using the semantic segmentation model to obtain the blur, grayscale, and brightness of pixels in the document image.
[0015] In an optional implementation, the step of obtaining the quality assessment result of the target image based on the blur, darkness, and brightness of the pixels in the document image includes:
[0016] Based on the blurriness, darkness, and brightness of the pixels in the document image, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels in the document image to all pixels in the document image.
[0017] Based on the calculated proportions, the quality assessment results of the target image are obtained.
[0018] In an optional implementation, the step of obtaining the quality assessment result of the target image based on the calculated proportion includes:
[0019] If the proportion of blurred pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a blurry text prompt is given.
[0020] If the proportion of overly dark pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text prompt indicating that the image is too dark is issued.
[0021] If the proportion of overly bright pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text over-brightness warning is issued.
[0022] In an optional implementation, the classification model includes classification branches, and the step of detecting the category to which the target image belongs according to the preset classification model includes:
[0023] Based on the classification branch of the classification model, detect whether there is a document image in the target image;
[0024] If the target image contains a document image, then the target image is determined to belong to the first category, which includes document images.
[0025] In an optional implementation, if the target image is detected to belong to a first category including document images, the method further includes:
[0026] Detect whether the document image is distorted, and detect whether the document image is obscured or damaged;
[0027] If the document image is distorted, the target image is determined to belong to the second category, the image quality of the target image is unqualified, and a document distortion warning is issued;
[0028] If the document image is obscured or damaged, the target image is determined to belong to the third category, the image quality of the target image is not up to standard, and a document image obscuration warning is issued.
[0029] In an optional implementation, the classification model includes a detection branch. If the target image is detected to belong to a first category including document images, the method further includes:
[0030] Based on the detection branch of the classification model, the location information of the document image is detected;
[0031] Based on the location information of the document image, the area occupied by the document image in the target image is obtained;
[0032] Detect whether the area of the region is less than a second preset threshold;
[0033] If the image quality is less than the second preset threshold, the target image is determined to belong to the fourth category, the image quality of the target image is not qualified, and a document image ratio prompt is given.
[0034] In an optional implementation, after detecting whether the area of the region is less than a second preset threshold, the method further includes:
[0035] If the value is not less than the second preset threshold, detect the position information of the text region within the document image;
[0036] The step of obtaining the quality assessment result of the target image based on the blur, grayness, and brightness of pixels in the document image includes:
[0037] Based on the position information of the text region, the blur, grayscale, and brightness of the pixels within the text region are obtained;
[0038] Based on the blurriness, darkness, and brightness of the pixels within the text area, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels within the text area to all pixels within the text area.
[0039] Based on the calculated proportions, the quality assessment results of the target image are obtained.
[0040] In an optional implementation, if the target image is detected to belong to a first category including document images, the method further includes:
[0041] The document image is filtered using the Laplacian operator to obtain a filtered document image. The variance of the filtered document image is calculated, and the blurriness of the document image is obtained based on the variance.
[0042] Calculate the grayscale histogram of the document image, and obtain the brightness of the document image based on the grayscale histogram;
[0043] The quality assessment result of the target image is obtained based on the blur and brightness of the document image.
[0044] Secondly, embodiments of the present invention provide an image quality assessment device, the image quality assessment device comprising:
[0045] The image acquisition module is used to acquire the target image to be evaluated;
[0046] The document detection module is used to detect the category to which the target image belongs based on a preset classification model;
[0047] The document analysis module is used to detect the blur, grayscale, and brightness of pixels in the document images of the target image according to a preset semantic segmentation model when the target image belongs to the first category including document images.
[0048] The image quality assessment module is used to obtain the quality assessment result of the target image based on the blur, grayness, and brightness of the pixels in the document image.
[0049] Thirdly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the image quality assessment method described in any of the foregoing embodiments.
[0050] Fourthly, embodiments of the present invention provide a readable storage medium, the readable storage medium including a computer program, wherein the computer program, when running, controls the electronic device where the readable storage medium is located to execute the image quality assessment method described in any of the foregoing embodiments.
[0051] The image quality assessment method, apparatus, electronic device, and readable storage medium provided in this invention, after acquiring the target image to be assessed, detect the category to which the target image belongs according to a preset classification model. If the target image belongs to the first category including document images, the blurriness, grayness, and brightness of the pixels in the document image in the target image are detected according to a preset semantic segmentation model. Then, based on the blurriness, grayness, and brightness of the pixels in the document image, the quality assessment result of the target image is obtained. In this way, the document region in the target image is effectively detected, ensuring the quality of the target image. Attached Figure Description
[0052] The technical solution and other beneficial effects of the present invention will become apparent from the following detailed description of specific embodiments of the invention, in conjunction with the accompanying drawings.
[0053] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0054] Figure 2 This is a schematic flowchart of an image quality assessment method provided in an embodiment of the present invention.
[0055] Figure 3 This is another schematic diagram of the image quality assessment method provided in an embodiment of the present invention.
[0056] Figure 4 This is a block diagram of an image quality assessment device provided in an embodiment of the present invention.
[0057] Icons: 100 - Electronic device; 10 - Image quality assessment device; 11 - Image acquisition module; 12 - Document detection module; 13 - Document analysis module; 14 - Image quality assessment module; 20 - Memory; 30 - Processor; 40 - Communication unit. Detailed Implementation
[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0059] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," and "counterclockwise," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0060] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection, an electrical connection, or a connection that allows for communication; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0061] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0062] The following disclosure provides many different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed. In addition, examples of various specific processes and materials are provided in this invention, but those skilled in the art will recognize the application of other processes and / or the use of other materials.
[0063] Currently, to facilitate the storage, transmission, and organization of important paper documents such as manuscripts and forms, most documents are captured using image acquisition devices to obtain document images, which are then stored and transmitted. However, to ensure the clarity of the paper document content within the captured images, a quality assessment is necessary. This assessment must ensure that the image contains the paper document, and that the area containing the paper document does not occupy too small a portion of the image. Furthermore, it must ensure that the content of the paper document within the image is free from quality issues such as blurriness, excessive brightness, or excessive darkness.
[0064] For acquisition devices with displays, the acquired document images can be manually reviewed. Document images that fail the review, i.e. those that cannot be clearly identified, can be resampled. However, this method is time-consuming, and each staff member has different standards for image quality, resulting in inconsistent quality of the final acquired document images. Acquisition devices without displays cannot immediately determine the quality of the acquired document images, thus making it impossible to determine whether re-acquisition is necessary.
[0065] Currently, there are few methods for assessing the quality of document images, and most only focus on the overall quality of the document image, lacking assessment of the quality of text areas. Furthermore, many factors affect the clarity and legibility of text, but existing methods can only solve single problems under ideal conditions and cannot analyze multiple scenarios. In addition, existing methods do not integrate document image acquisition with document image quality assessment, meaning they cannot provide immediate feedback on image quality during acquisition, thus failing to automatically or forcibly re-acquire the image.
[0066] Based on the above research, embodiments of the present invention provide an image quality assessment method, apparatus, electronic device, and readable storage medium. After acquiring the target image to be assessed, the category to which the target image belongs is detected according to a preset classification model. If the target image belongs to the first category including document images, the blurriness, grayness, and brightness of the pixels in the document image in the target image are detected according to a preset semantic segmentation model. Then, based on the blurriness, grayness, and brightness of the pixels in the document image, the quality assessment result of the target image is obtained. In this way, effective detection of document regions in the target image is achieved from multiple perspectives, satisfying the analysis of target images in multiple scenarios and ensuring the quality of the target image.
[0067] Please see Figure 1 , Figure 1 This is a structural block diagram of an electronic device 100 provided in this embodiment. The electronic device 100 includes an image quality assessment device 10, a memory 20, a processor 30, and a communication unit 40. The memory 20 stores machine-readable instructions that can be executed by the processor 30. When the electronic device 100 is running, the processor 30 communicates with the memory 20 through a bus, and the processor 30 executes the machine-readable instructions and performs an image quality assessment method.
[0068] The memory 20, processor 30, and communication unit 40 are electrically connected directly or indirectly to each other to achieve signal transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The image quality assessment device 10 includes at least one software function module that can be stored in the memory 20 in the form of software or firmware. The processor 30 is used to execute the executable module (e.g., the software function module or computer program included in the image quality assessment device 10) stored in the memory 20.
[0069] The memory 20 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0070] In some embodiments, processor 30 is used to perform one or more functions described in this embodiment. In some embodiments, processor 30 may include one or more processing cores (e.g., a single-core processor (S) or a multi-core processor (S)). By way of example only, processor 30 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), an application-specific instruction-set processor (ASIP), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a field-programmable gate array (FPGA), a programmable logic device (PLD), a controller, a microcontroller unit, a reduced instruction set computing (RISC) computer, or a microprocessor, or any combination thereof.
[0071] In this embodiment, the memory 20 is used to store the program, and the processor 30 is used to execute the program after receiving the execution instruction. The process definition method disclosed in any implementation of this embodiment can be applied to the processor 30, or implemented by the processor 30.
[0072] The communication unit 40 is used to establish a communication connection between the electronic device 100 and other devices via a network, and to send and receive data via the network.
[0073] In some implementations, the network can be any type of wired or wireless network, or a combination thereof. By way of example only, the network may include wired networks, wireless networks, fiber optic networks, telecommunications networks, intranets, the Internet, local area networks (LANs), wide area networks (WANs), wireless local area networks (WLANs), metropolitan area networks (MANs), public switched telephone networks (PSTNs), Bluetooth networks, ZigBee networks, or near field communication (NFC) networks, or any combination thereof.
[0074] It should be noted that, in this embodiment, the electronic device 100 is an image acquisition device, that is, a device that integrates a camera.
[0075] Understandably, Figure 1 The structure shown is for illustrative purposes only. The electronic device 100 may also have... Figure 1 Showing more or fewer components, or having with Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0076] based on Figure 1 The implementation architecture of this embodiment provides an image quality assessment method, which is based on... Figure 1 The electronic device shown performs the following detailed explanation of the steps of the image quality assessment method provided in this embodiment. Please refer to [reference needed]. Figure 2 The image quality assessment method provided in this embodiment includes steps S101 to S104.
[0077] Step S101: Obtain the target image to be evaluated.
[0078] The target image is a photograph of a document (i.e., a paper document). When document acquisition is needed, the document can be photographed to obtain the target image.
[0079] Step S102: Detect the category to which the target image belongs based on the preset classification model.
[0080] The classification model can be trained using a deep convolutional neural network. In this embodiment, the classification model can be trained using supervised training, that is, by training an optimal model using sample data with known true values. This model is then used to map all inputs to corresponding outputs, and the outputs are judged to achieve the purpose of prediction and classification. The trained model then has the ability to predict and classify unknown data. Therefore, in this embodiment, when training the classification model, multiple sample images can be acquired, and then the sample images can be labeled with categories. The labeled sample images are then input into the deep convolutional neural network for training to obtain the classification model.
[0081] Once the classification model is obtained, the category to which the target image belongs can be detected based on the classification model.
[0082] In this embodiment, the category to which the target image belongs can be, but is not limited to, categories that include document images and categories that do not include document images. Here, a document image refers to the image content corresponding to a paper document.
[0083] In practical applications, due to equipment limitations or document placement issues, the captured target image may not contain the document image; that is, no document image was captured during the shooting process. Therefore, based on a pre-defined classification model, when detecting the category to which the target image belongs, if the target image is detected as belonging to a category that does not include a document image, it indicates that no document image was captured, and thus, the image quality of the target image can be determined to be substandard.
[0084] In this embodiment, when it is determined that the target image does not include a document image, a prompt indicating that no document image exists needs to be given to prompt the collector to re-collect the image, thereby avoiding the collection of images that do not include document images and preventing the omission of image collection.
[0085] In this embodiment, when the target image is detected to belong to a category that includes document images, it indicates that a document image was captured during image acquisition. To ensure the quality of the captured image, after detecting that the target image includes a document image, step S103 is executed to detect whether the content of the document image is clearly visible.
[0086] Step S103: If the target image belongs to the first category including document images, then the blur, grayness, and brightness of the pixels in the document image are detected according to the preset semantic segmentation model.
[0087] The semantic segmentation model can be obtained by training a convolutional neural network, such as a fully convolutional network for semantic segmentation (FCN) or an efficient neural network (ENet).
[0088] Accordingly, in this embodiment, the semantic segmentation model can be trained using a supervised training method. That is, when training the semantic segmentation model, multiple sample images can be acquired, and the pixels in the sample images can be labeled with ambiguity, grayness, and brightness. Then, the labeled sample images are input into a convolutional neural network for training to obtain the semantic segmentation model. The resulting semantic segmentation model then has the ability to detect pixel ambiguity, grayness, and brightness.
[0089] Therefore, once the semantic segmentation model is obtained, the blurriness, grayness, and brightness of pixels in a document image can be detected using the semantic segmentation model.
[0090] Step S104: Obtain the quality assessment result of the target image based on the blur, grayness, and brightness of the pixels in the document image.
[0091] In this embodiment, pixel blurriness is used to characterize the degree of blurriness of the pixel, while pixel darkness and brightness are used to characterize whether the pixel is too dark or too bright. Therefore, after obtaining the blurriness, darkness, and brightness of the pixels in the document image, it is possible to analyze whether the content in the document image is clearly visible based on these parameters, and obtain the quality assessment result of the target image based on whether the content in the document image is clearly visible.
[0092] If the content in the document image is not clearly visible, the quality assessment result of the target image is unqualified; if the content in the document image is clearly visible, the quality assessment result of the target image is qualified.
[0093] In this embodiment, by detecting the blurriness, darkness, and brightness of pixels in the document image, the clarity of the document image content can be evaluated from multiple angles based on the blurriness, darkness, and brightness of the pixels in the document image. This can effectively detect the document region in the target image and ensure the quality of the target image.
[0094] The image quality assessment method provided in this embodiment, after acquiring the target image to be assessed, detects the category to which the target image belongs based on a preset classification model. If the target image belongs to the first category, including document images, it detects the blurriness, darkness, and brightness of pixels in the document image within the target image based on a preset semantic segmentation model. Then, based on the blurriness, darkness, and brightness of the pixels in the document image, it obtains the quality assessment result of the target image. In this way, image quality review is precise to the semantic level, effectively detecting whether there are abnormalities such as blurriness, excessive brightness, or excessive darkness in the text within the document area, thus ensuring the quality of the target image.
[0095] Meanwhile, the image quality assessment method provided in this embodiment provides a prompt that no document image exists when the target image does not include the document image, prompting the collector to re-acquire the image. In this way, image acquisition and image quality assessment are integrated, and it is possible to determine whether the acquired image meets the standard at the moment of acquisition, standardize the collector's operation, and unify the acquisition quality.
[0096] To accurately assess the quality of target images, in this embodiment, the classification model includes a classification branch, which is used to detect the category to which the target image belongs. Based on this, the step of detecting the category to which the target image belongs, according to the preset classification model, may include:
[0097] Based on the classification branch of the classification model, detect whether there is a document image in the target image.
[0098] If the target image contains a document image, then the target image is determined to belong to the first category, which includes document images.
[0099] The process involves inputting the target image into the classification model, which then detects the target image through a classification branch and outputs the category to which the target image belongs. If no document image is detected in the target image, the output indicates that the target image belongs to the category "Does not include document images." Conversely, if a document image is detected in the target image, the output indicates that the target image belongs to the first category, "Includes document images."
[0100] In practical applications, during image capture, due to equipment limitations or document placement, the captured document image may be distorted, obscured, or damaged, resulting in substandard image quality. To conduct quality assessment of the target image from multiple perspectives, refining the granularity to the level of whether the text in the image is clear and legible, in this embodiment, if the target image is detected to belong to the first category including document images, the image quality assessment method provided in this embodiment further includes:
[0101] It can detect whether document images are distorted, and whether document images are obscured or damaged.
[0102] If the document image is distorted, the target image is determined to belong to the second category, the image quality of the target image is not up to standard, and a document distortion warning is issued.
[0103] If the document image is obscured or damaged, the target image is determined to belong to the third category, the image quality of the target image is not up to standard, and a document image obscuration warning will be issued.
[0104] After inputting the target image into the classification model, and after detecting the presence of a document image in the target image, it is necessary to further detect whether the document image is distorted and whether it is occluded or damaged.
[0105] When a document image is distorted, the target image is determined to belong to the second category of document image distortion, and the image quality of the target image is not up to standard. Then, a document distortion prompt is given to remind the collector to re-collect the image.
[0106] If a document image is obscured or damaged, the target image is determined to belong to the third category of document images that are damaged or obscured. The image quality of the target image is not up to standard, and a prompt indicating that the document image is obscured is given to prompt the collector to re-collect the image.
[0107] In practical applications, if the area of the document image in the target image is too small, the content of the document image in the target image may not be clearly visible. Therefore, in this embodiment, the classification model also includes a detection branch. If the target image is detected to belong to the first category including document images, the image quality assessment method may further include:
[0108] Based on the detection branch of the classification model, the location information of the document images is detected.
[0109] Based on the location information of the document image, the area occupied by the document image in the target image is obtained.
[0110] Check if the area of the detection region is less than the second preset threshold.
[0111] If the image quality is less than the second preset threshold, the target image is determined to belong to the fourth category, the image quality of the target image is not qualified, and a document image ratio prompt is given.
[0112] The detection branch is used to perform the task of detecting the location of the document image. After the target image is input into the classification model, the detection branch detects the location of the document image in the target image and then outputs the location information of the document image.
[0113] It should be noted that, in this embodiment, the position information of the document image in the target image can be represented by the vertex coordinates of the document image. For example, when the document image is rectangular, its position information in the target image can be represented by the coordinates of four points: the upper left, upper right, lower right, and lower left of the document image.
[0114] After obtaining the location information of the document image, the area occupied by the document image in the target image can be calculated based on this location information. Then, after obtaining the area occupied by the document image in the target image, it is checked whether the occupied area is less than a second preset threshold.
[0115] When the area occupied is not less than the second preset threshold, it indicates that the area of the document image in the target image meets the visibility requirements, and the area of the document image has little impact on the visibility of the content in the document image. However, when the area occupied is less than the second preset threshold, it indicates that the area of the document image in the target image is too small, which may cause the content of the document image in the target image to be unclear. Therefore, the target image is judged to belong to the fourth category of "too small proportion", the image quality of the target image is not qualified, and a prompt is given that the document image proportion is too small, so as to prompt the collector to re-collect the image.
[0116] The second preset threshold can be set according to actual needs, and this embodiment does not impose specific limitations. Optionally, in this embodiment, the second preset threshold can be 80%.
[0117] In a specific implementation scenario, after acquiring the target image, the target image is input into the classification model. The classification branch of the classification model classifies the target image into one of the following categories: {a first category including document images, a second category with distorted document images, a third category with damaged or occluded document images, and a fifth category not including document images}. At the same time, the detection branch of the classification model detects the location information of the document images in the target image.
[0118] When the classification model's classification branch outputs that the target image belongs to the second, third, or fifth category, a corresponding prompt will be given, prompting the collector to re-collect the image. When the detection branch outputs the location information of the document image, based on the location information of the document image, if the area occupied by the document image in the target image is calculated to be less than a second preset threshold, then the target image will be classified into the fourth category due to its small proportion, and a prompt indicating that the proportion is too small will be given, prompting the collector to re-collect the image.
[0119] Optionally, in this embodiment, the detection branch and the classification branch can simultaneously detect the target image. While the classification branch detects the category to which the target image belongs, the detection branch can detect the location of the document image. In this embodiment, when the classification branch detects that there is no document image in the target image, or when the detection branch does not output the location of the document image, it indicates that the target image belongs to a category that does not include document images. When the classification branch detects that there is a document image in the target image, or when the detection branch outputs the location of the document image, it indicates that the target image belongs to a first category that includes document images.
[0120] Optionally, to ensure image quality, in this embodiment, the subsequent review process will only be performed on the target image when the target image output by the classification branch belongs to the first category, and the area occupied by the document image in the target image is calculated to be no less than the second preset threshold based on the position information output by the detection branch.
[0121] In an optional implementation, in order to quickly obtain the quality assessment result of the target image, in this embodiment, after obtaining that the target image includes a document image, that is, after obtaining that the target image belongs to the first category including document images, the document image can also be quality reviewed in the following way:
[0122] (1) The document image is filtered using the Laplacian operator to obtain the filtered document image. The variance of the filtered document image is calculated, and the blur of the document image is obtained based on the variance.
[0123] (2) Calculate the grayscale histogram of the document image and obtain the brightness of the document image based on the grayscale histogram.
[0124] (3) Based on the blur and brightness of the document image, the quality assessment result of the target image is obtained.
[0125] Since the target image includes background areas such as borders in addition to the document image area, in order to avoid interference from the background area in the detection of the document image, in this embodiment, the document image can be cropped according to the position information of the document image output by the detection branch to obtain the document image.
[0126] In this embodiment, for detecting the blurriness of a document image, the Laplacian operator can be used to filter the document image to obtain a filtered document image. Then, the variance of the filtered document image is calculated, and the blurriness of the document image is obtained based on the variance. Specifically, if the variance is lower than a predefined threshold, the document image is determined to have high blurriness and is considered blurry; otherwise, the document image is determined to have low blurriness and is not blurry.
[0127] In this embodiment, the detection of brightness in a document image, specifically whether it is too bright or too dark, can be achieved by analyzing the grayscale histogram of the document image. The grayscale histogram describes the distribution of gray levels in an image, visually showing the proportion of gray areas. Therefore, after obtaining the grayscale histogram of the document image, this embodiment can calculate the percentage of pixels within a set brightness range to detect whether the document image is too dark or too bright.
[0128] Optionally, if the pixel percentage is greater than a first threshold, the document image is determined to be too bright; if the pixel percentage is less than a second threshold, the document image is determined to be too dark. The first threshold is greater than the second threshold. The first and second thresholds can be set according to actual needs, and this embodiment does not impose specific limitations.
[0129] After obtaining the blur and brightness of the document image, the quality assessment result of the target image can be obtained based on the blur and brightness of the document image.
[0130] If a document image is detected to be blurry, too dark, or too bright, its quality assessment result is deemed unqualified, and a message indicating that the document image is blurry, too dark, or too bright is given to prompt the collector to re-collect the image. If the document image is detected to be neither blurry nor too dark or too bright, its quality assessment result is deemed qualified, and the target image is stored.
[0131] The image quality assessment method provided in this embodiment detects whether a document image is blurry and detects the brightness of the document image using the Laplacian operator and histogram. It has low computational load and fast processing speed, which can effectively improve efficiency.
[0132] While using the Laplacian operator and histograms to assess the quality of document images is computationally efficient and fast, this method can only detect the overall condition of the document image and cannot accurately determine at the semantic level whether certain text is blurry, too dark, or too bright. Furthermore, the recognizability of a document image only needs to consider whether the areas containing text are clear and legible. Therefore, to accurately determine at the semantic level which text is blurry, too dark, or too bright, this embodiment also uses a semantic segmentation model to detect the blurriness, darkness, and brightness of pixels in the document image.
[0133] In this embodiment, please refer to the following: Figure 3 The steps of detecting the blur, grayness, and brightness of pixels in a document image based on a preset semantic segmentation model may include steps S201 to S203.
[0134] Step S201: Crop the document image in the target image and input the cropped document image into the semantic segmentation model.
[0135] Since the target image includes background areas such as borders in addition to the document image area, the document image can be cropped in this embodiment to avoid interference from the background area in the detection of the document image.
[0136] Optionally, in this embodiment, the document image can be cropped based on the position information of the document image output by the detection branch.
[0137] After cropping the document image, the cropped document image can be input into the semantic segmentation model.
[0138] Step S202: Extract features from the document image using a semantic segmentation model to obtain the feature map of the document image.
[0139] Step S203: The feature map is predicted using a semantic segmentation model to obtain the blur, grayscale, and brightness of pixels in the document image.
[0140] In this semantic segmentation model, after the document image is input, the model extracts features from the image through convolutional operations, resulting in a feature map. The feature map is then used for prediction to obtain the blurriness, darkness, and brightness of each pixel in the document image. Since any pixel in a document image may simultaneously be both blurry and dark, or both blurry and overly bright, this embodiment sets the number of kernels in the last convolutional layer to 6. This ensures that any document image of length H and width W input to the semantic segmentation model will output a feature map of size H*W*6. This H*W*6 feature map can be understood as each pixel having six values, representing the scores for six conditions: blurry, not blurry, overly bright, not overly bright, overly dark, and not overly dark.
[0141] After obtaining the H*W*6 feature map, based on the mutual exclusion relationship, it can be divided into three groups: blurry and non-blurry, too bright and not bright, and too dark and not dark. Then, the softmax function is applied to the feature map three times to normalize the two scores of each pixel in each group, so as to obtain the probability of each pixel being "blurry", "non-blurry", "too bright", "not bright", "too dark" and "not dark".
[0142] The probability of each pixel being "blurred", "unblurred", "too bright", "not too bright", "too dark", or "not too dark" can be expressed as {P} 模糊 P非模糊}, {P 过亮 P 不过亮}, {P 过暗 P 不过暗}. Here, fuzzy and non-fuzzy are mutually exclusive, therefore P 模糊 With P 非模糊 The sum of is 1; overly bright and underly bright are mutually exclusive, therefore P 过亮 With P 不过亮 The sum of is 1; excessive darkness and moderate darkness are mutually exclusive, therefore P 过暗 With P 不过暗 The sum of is 1.
[0143] After obtaining the probability values of each pixel in the document image as blurred or not blurred, too dark or not dark, and too bright or not bright, the blur, grayscale, and brightness of the pixels in the document image are obtained based on these probability values.
[0144] For each pixel in each document image, if the probability of the pixel being blurred is greater than the probability of it not being blurred, the pixel is considered blurred with a high degree of blur. If the probability of the pixel being blurred is not greater than the probability of it not being blurred, the pixel is considered not blurred with a low degree of blur. If the probability of the pixel being too bright is greater than the probability of it not being bright, the pixel is considered too bright with a high degree of brightness. If the probability of the pixel being too bright is not greater than the probability of it not being bright, the pixel is considered not bright with a low degree of brightness. If the probability of the pixel being too dark is greater than the probability of it not being dark, the pixel is considered too dark with a high degree of darkness. If the probability of the pixel being too dark is not greater than the probability of it not being dark, the pixel is considered not dark with a low degree of darkness.
[0145] In one alternative implementation, the semantic segmentation model can be configured to have 3 kernels in the last convolutional layer. This ensures that any document image of length H and width W input to the semantic segmentation model will output a feature map of size H*W*3. The H*W*3 feature map can be understood as each pixel having three values representing the scores for three conditions: blurry, overly bright, and overly dark. After obtaining the H*W*3 feature map, the softmax function is used to normalize the score of each pixel, yielding the probability values for "blurry," "overly bright," and "overly dark" for each pixel. Then, based on these probability values, the blur level, grayscale level, and brightness of each pixel are determined.
[0146] For example, for each pixel, if the probability value of the pixel being blurred is greater than a first preset threshold, the pixel is determined to be blurred with a high degree of blur. If the probability value of the pixel being blurred is not greater than the first preset threshold, the pixel is determined to be unblurred with a low degree of blur. If the probability value of the pixel being too bright is greater than a second preset threshold, the pixel is determined to be too bright with a high degree of brightness. If the probability value of the pixel being too bright is not greater than the second preset threshold, the pixel is determined to be too dim with a low degree of brightness. If the probability value of the pixel being too dark is greater than a third preset threshold, the pixel is determined to be too dark with a high degree of darkness. If the probability value of the pixel being too dark is not greater than the third preset threshold, the pixel is determined to be not too dark with a low degree of darkness. The first, second, and third preset thresholds can be set according to actual needs, and this embodiment does not impose specific limitations.
[0147] After obtaining the blur, darkness, and brightness of each pixel in the document image, that is, after obtaining the judgment result of whether each pixel in the document image is blurry, too dark, or too bright, the quality assessment result of the target image can be obtained based on the blur, darkness, and brightness of each pixel in the document image.
[0148] In this embodiment, the step of obtaining the quality assessment result of the target image based on the blur, grayness, and brightness of pixels in the document image may include:
[0149] Based on the blurriness, darkness, and brightness of the pixels in the document image, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels in the document image relative to all pixels in the document image.
[0150] Based on the calculated proportions, the quality assessment results of the target image are obtained.
[0151] The process involves obtaining the blur, darkness, and brightness of each pixel in the document image. This allows us to determine whether each pixel is blurry, too dark, or too bright. Then, we count the number of blurry, dark, and bright pixels in the document image. Finally, based on these counts, we calculate the percentage of each type of pixel in the document image relative to all pixels, yielding the percentage results.
[0152] After obtaining the proportion results, the quality assessment results of the target image can be obtained based on the calculated proportion results.
[0153] In this embodiment, the step of obtaining the quality assessment result of the target image based on the calculated proportion result may include:
[0154] If the proportion of blurred pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a blurry text prompt is given.
[0155] If the proportion of overly dark pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text prompt indicating that the image is too dark is issued.
[0156] If the proportion of overly bright pixels in the proportion results is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text prompt indicating that the image is too bright is issued.
[0157] Specifically, if the proportion of blurred pixels in the calculated percentage result exceeds a first preset threshold, the document image is determined to be blurry, the image quality of the target image is deemed unacceptable, and a blurry text warning is issued. If the proportion of excessively dark pixels in the calculated percentage result exceeds a first preset threshold, the document image is determined to be excessively dark, the image quality of the target image is deemed unacceptable, and a dark text warning is issued. If the proportion of excessively bright pixels in the calculated percentage result exceeds a first preset threshold, the document image is determined to be excessively bright, the image quality of the target image is deemed unacceptable, and a bright text warning is issued.
[0158] The first preset threshold can be set according to actual needs, and this embodiment does not limit it. Optionally, in this embodiment, the first preset threshold can be 50%.
[0159] It should be noted that, in this embodiment, when the proportion of blurred pixels in the proportion result is greater than the first preset threshold, and the proportion of excessively dark pixels is also greater than the first preset threshold, it indicates that the document image is both blurred and excessively dark, and the image quality of the target image is unqualified. When the proportion of blurred pixels in the proportion result is greater than the first preset threshold, and the proportion of excessively bright pixels is also greater than the first preset threshold, it indicates that the document image is both blurred and excessively bright.
[0160] In practical applications, document images may include not only text areas but also background areas. However, for document image recognizability, only the clarity and legibility of the text-containing areas need to be considered. Therefore, to reduce computational load and avoid the background area affecting the accuracy of text area detection, this embodiment uses the blurriness, grayscale, and brightness of pixels within the text area to obtain the quality assessment result.
[0161] Therefore, in this embodiment, after determining whether the area of the detection region is less than the second preset threshold, the image quality assessment method further includes:
[0162] If the value is not less than the second preset threshold, the position information of the text area within the document image is detected.
[0163] Accordingly, the steps for obtaining the quality assessment result of the target image based on the blur, darkness, and brightness of the pixels in the document image may include:
[0164] Based on the location information of the text area, the blur, darkness, and brightness of the pixels within the text area are obtained.
[0165] Based on the blurriness, darkness, and brightness of the pixels within the text area, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels within the text area relative to all pixels in the text area.
[0166] Based on the calculated proportions, the quality assessment results of the target image are obtained.
[0167] In this embodiment, when detecting the location information of a document image using the detection branch of the classification model, the location information of text regions within the document image can also be detected based on the detection branch. Therefore, in this embodiment, the detection branch can output both the location information of the document image and the location information of text regions within the document image.
[0168] Based on this, after obtaining the blur, grayscale, and brightness of each pixel within the document image, the blur, grayscale, and brightness of each pixel within the text area can be matched according to the position information of the text area within the document image.
[0169] After obtaining the blur, darkness, and brightness of each pixel within the text area, it is possible to determine whether each pixel within the text area is blurry, too dark, or too bright. Then, the number of blurry, dark, and bright pixels within the text area is counted to obtain the number of blurry, dark, and bright pixels within the text area. Based on the number of blurry, dark, and bright pixels within the text area, the proportion of blurry, dark, and bright pixels to all pixels within the text area is calculated to obtain the proportion results.
[0170] After obtaining the proportion results, if the proportion of blurred pixels in the proportion results is greater than a first preset threshold, it is determined that the text area in the target image is blurred, the image quality of the target image is unqualified, and a blurry text warning is issued. If the proportion of excessively dark pixels in the proportion results is greater than the first preset threshold, it is determined that the text area in the target image is excessively dark, the image quality of the target image is unqualified, and a dark text warning is issued. If the proportion of excessively bright pixels in the proportion results is greater than the first preset threshold, it is determined that the text area in the target image is excessively bright, the image quality of the target image is unqualified, and a bright text warning is issued.
[0171] The image quality assessment method provided in this embodiment detects the blurriness, grayness, and brightness of each pixel in the text region. Therefore, it can pinpoint the problematic pixel at the semantic level. When a pixel in the text region is blurry, too dark, or too bright, it can indicate the location of the problematic pixel in the image, thus specifying the location of the problematic text and prompting the collector to pay attention to the location of the problem.
[0172] The image quality assessment method provided in this embodiment adopts a cascaded approach. First, it detects the category to which the target image belongs, and then assesses the quality of the target image from multiple perspectives, such as whether there is a document image, whether the document image occupies too small a proportion, whether the document image is distorted, and whether the document image is occluded or damaged. Then, it detects the pixels in the text area of the document image from multiple perspectives, such as blur, grayscale, and brightness. This satisfies the image quality review requirements of multiple scenarios. At the same time, it refines the quality review of document images to the semantic level, and achieves effective detection of the recognizability of document images.
[0173] The image quality assessment method provided in this embodiment integrates image acquisition and image quality assessment. When an image is detected, it can determine whether the image quality is up to standard and provide a corresponding prompt if it is not up to standard. In this way, the operation of the acquirer is standardized and the acquisition quality is consistent.
[0174] Based on the same inventive concept, please refer to the following: Figure 4 This embodiment also provides an image quality assessment device 10, which is applied to... Figure 1 The electronic device shown in this embodiment includes an image acquisition module 11, a document detection module 12, a document analysis module 13, and an image quality assessment module 14.
[0175] Image acquisition module 11 is used to acquire the target image to be evaluated.
[0176] The document detection module 12 is used to detect the category to which the target image belongs based on a preset classification model.
[0177] The document analysis module 13 is used to detect the blur, grayscale, and brightness of pixels in the document image according to a preset semantic segmentation model when the target image belongs to the first category including document images.
[0178] The image quality assessment module 14 is used to obtain the quality assessment result of the target image based on the blur, grayness, and brightness of the pixels in the document image.
[0179] In an optional implementation, the document analysis module 13 is used for:
[0180] The document image in the target image is cropped, and the cropped document image is input into the semantic segmentation model.
[0181] Feature maps of document images are obtained by extracting features from document images using a semantic segmentation model.
[0182] By using a semantic segmentation model to predict the feature map, the blur, grayness, and brightness of pixels in the document image can be obtained.
[0183] In an optional implementation, the image quality assessment module 14 is used for:
[0184] Based on the blurriness, darkness, and brightness of the pixels in the document image, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels in the document image relative to all pixels in the document image.
[0185] Based on the calculated proportions, the quality assessment results of the target image are obtained.
[0186] In an optional implementation, the image quality assessment module 14 is used for:
[0187] If the proportion of blurred pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a blurry text prompt is given.
[0188] If the proportion of overly dark pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text prompt indicating that the image is too dark is issued.
[0189] If the proportion of overly bright pixels in the proportion results is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text prompt indicating that the image is too bright is issued.
[0190] In an optional implementation, the classification model includes classification branches, and the document detection module 12 is used for:
[0191] Based on the classification branch of the classification model, detect whether there is a document image in the target image.
[0192] If the target image contains a document image, then the target image is determined to belong to the first category, which includes document images.
[0193] In an optional implementation, if the target image is detected to belong to a first category including document images, the document detection module 12 is used to:
[0194] It can detect whether document images are distorted, and whether document images are obscured or damaged.
[0195] If the document image is distorted, the target image is determined to belong to the second category, the image quality of the target image is not up to standard, and a document distortion warning is issued.
[0196] If the document image is obscured or damaged, the target image is determined to belong to the third category, the image quality of the target image is not up to standard, and a document image obscuration warning will be issued.
[0197] In an optional implementation, the classification model includes a detection branch. If the target image is detected to belong to a first category including document images, the document detection module 12 is used to:
[0198] Based on the detection branch of the classification model, the location information of the document images is detected.
[0199] Based on the location information of the document image, the area occupied by the document image in the target image is obtained.
[0200] Check if the area of the detection region is less than the second preset threshold.
[0201] If the image quality is less than the second preset threshold, the target image is determined to belong to the fourth category, the image quality of the target image is not qualified, and a document image ratio prompt is given.
[0202] In an optional implementation, after detecting whether the area of the detection region is less than a second preset threshold, the document detection module 12 is further configured to:
[0203] If the value is not less than the second preset threshold, the position information of the text area within the document image is detected.
[0204] In an optional implementation, the image quality assessment module 14 is used for:
[0205] Based on the location information of the text area, the blur, darkness, and brightness of the pixels within the text area are obtained.
[0206] Based on the blurriness, darkness, and brightness of the pixels within the text area, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels within the text area relative to all pixels in the text area.
[0207] Based on the calculated proportions, the quality assessment results of the target image are obtained.
[0208] In an optional implementation, if the target image is detected to belong to a first category including document images, the document analysis module 13 is used to:
[0209] The Laplacian operator is used to filter the document image, resulting in a filtered document image. The variance of the filtered document image is then calculated, and the blur level of the document image is obtained based on the variance.
[0210] Analyze the grayscale histogram of the document images and determine their brightness based on the histogram.
[0211] The quality assessment result of the target image is obtained based on the blurriness and brightness of the document image.
[0212] The image quality assessment device provided in this embodiment, after acquiring the target image to be assessed, detects the category to which the target image belongs according to a preset classification model. If the target image belongs to the first category including document images, it detects the blur, grayness, and brightness of the pixels in the document image in the target image according to a preset semantic segmentation model. Then, based on the blur, grayness, and brightness of the pixels in the document image, it obtains the quality assessment result of the target image. In this way, it achieves effective detection of the document region in the target image and ensures the quality of the target image.
[0213] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the image quality assessment device 10 described above can be referred to the corresponding process in the aforementioned method, and will not be elaborated further here.
[0214] Based on the above, this embodiment also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the image quality assessment method described in any of the foregoing embodiments.
[0215] The readable storage medium can be, but is not limited to, USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, and other media capable of storing program code.
[0216] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the readable storage medium described above can be referred to the corresponding process in the aforementioned method, and will not be elaborated further here.
[0217] In summary, the image quality assessment method, apparatus, electronic device, and readable storage medium provided in this embodiment of the invention, after acquiring the target image to be assessed, detect the category to which the target image belongs according to a preset classification model. If the target image belongs to the first category including document images, the blurriness, grayness, and brightness of the pixels in the document image in the target image are detected according to a preset semantic segmentation model. Then, based on the blurriness, grayness, and brightness of the pixels in the document image, the quality assessment result of the target image is obtained. In this way, the document region in the target image is effectively detected, ensuring the quality of the target image.
[0218] In the several embodiments provided in this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus and method embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0219] In addition, the functional modules in the embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0220] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0221] The above descriptions are merely various embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An image quality assessment method, characterized in that, The method includes: Acquire the target image to be evaluated; The category to which the target image belongs is detected according to a preset classification model; the classification model includes a classification branch and a detection branch. If the classification branch detects that the target image belongs to a first category including document images, the location information of the document image is detected according to the detection branch of the classification model; the area occupied by the document image in the target image is obtained according to the location information of the document image; and it is detected whether the area of the area is less than a second preset threshold. If the area of the region is less than the second preset threshold, the target image is determined to belong to the fourth category, the image quality of the target image is not qualified, and a document image ratio prompt is given. If the area of the region is not less than the second preset threshold, then the blurriness, grayness, and brightness of the pixels in the document image are detected according to the preset semantic segmentation model; based on the blurriness, grayness, and brightness of the pixels in the document image, the quality assessment result of the target image is obtained.
2. The image quality assessment method of claim 1, wherein, The step of detecting the blur, darkness, and brightness of pixels in the document image based on a preset semantic segmentation model includes: The document image in the target image is cropped, and the cropped document image is input into the semantic segmentation model; The semantic segmentation model is used to extract features from the document image to obtain the feature map of the document image; The feature map is predicted using the semantic segmentation model to obtain the blur, grayscale, and brightness of pixels in the document image.
3. The image quality assessment method of claim 1, wherein, The step of obtaining the quality assessment result of the target image based on the blur, darkness, and brightness of the pixels in the document image includes: Based on the blurriness, darkness, and brightness of the pixels in the document image, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels in the document image to all pixels in the document image. Based on the calculated proportions, the quality assessment results of the target image are obtained.
4. The image quality assessment method of claim 3, wherein, The step of obtaining the quality assessment result of the target image based on the calculated proportion includes: If the proportion of blurred pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a blurry text prompt is given. If the proportion of overly dark pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text prompt indicating that the image is too dark is issued. If the proportion of overly bright pixels in the proportion result is greater than the first preset threshold, the image quality of the target image is determined to be unqualified, and a text over-brightness warning is issued.
5. The image quality assessment method of claim 1, wherein, The step of detecting the category to which the target image belongs based on a preset classification model includes: Based on the classification branch of the classification model, detect whether there is a document image in the target image; If the target image contains a document image, then the target image is determined to belong to the first category, which includes document images.
6. The image quality assessment method according to any of claims 1-5, characterized in that, If the classification branch detection determines that the target image belongs to a first category including document images, the method further includes: Detect whether the document image is distorted, and detect whether the document image is obscured or damaged; If the document image is distorted, the target image is determined to belong to the second category, the image quality of the target image is unqualified, and a document distortion warning is issued; If the document image is obscured or damaged, the target image is determined to belong to the third category, the image quality of the target image is not up to standard, and a document image obscuration warning is issued.
7. The image quality assessment method of claim 1, wherein, After detecting whether the area of the region is less than a second preset threshold, the method further includes: If the value is not less than the second preset threshold, detect the position information of the text region within the document image; The step of obtaining the quality assessment result of the target image based on the blur, grayness, and brightness of pixels in the document image includes: Based on the position information of the text region, the blur, grayscale, and brightness of the pixels within the text region are obtained; Based on the blurriness, darkness, and brightness of the pixels within the text area, calculate the proportion of blurred pixels, overly dark pixels, and overly bright pixels within the text area to all pixels within the text area. Based on the calculated proportions, the quality assessment results of the target image are obtained.
8. The image quality assessment method of claim 1, wherein, If the classification branch detection determines that the target image belongs to a first category including document images, the method further includes: The document image is filtered using the Laplacian operator to obtain a filtered document image. The variance of the filtered document image is calculated, and the blurriness of the document image is obtained based on the variance. Calculate the grayscale histogram of the document image, and obtain the brightness of the document image based on the grayscale histogram; The quality assessment result of the target image is obtained based on the blur and brightness of the document image.
9. An image quality assessment apparatus characterized by comprising: The image quality assessment device includes: The image acquisition module is used to acquire the target image to be evaluated; The document detection module is used to detect the category to which the target image belongs based on a preset classification model; the classification model includes a classification branch and a detection branch. The document analysis module is used to detect the location information of the document image according to the detection branch of the classification model when the target image is detected to belong to the first category including document images; to obtain the area occupied by the document image in the target image according to the location information of the document image; to detect whether the area of the area is less than a second preset threshold; if the area of the area is less than the second preset threshold, the target image is determined to belong to the fourth category, the image quality of the target image is unqualified, and a document image proportion prompt is given; if the area of the area is not less than the second preset threshold, the blur, grayness, and brightness of the pixels in the document image in the target image are detected according to a preset semantic segmentation model. The image quality assessment module is used to obtain the quality assessment result of the target image based on the blur, grayness, and brightness of the pixels in the document image.
10. An electronic device, comprising: The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the image quality assessment method according to any one of claims 1 to 8.
11. A readable storage medium, characterized by, The readable storage medium includes a computer program, which, when executed, controls the electronic device containing the readable storage medium to perform the image quality assessment method according to any one of claims 1 to 8.