CN112287932A - Method, device and equipment for determining image quality and storage medium - Google Patents
Method, device and equipment for determining image quality and storage medium Download PDFInfo
- Publication number
- CN112287932A CN112287932A CN201910668079.8A CN201910668079A CN112287932A CN 112287932 A CN112287932 A CN 112287932A CN 201910668079 A CN201910668079 A CN 201910668079A CN 112287932 A CN112287932 A CN 112287932A
- Authority
- CN
- China
- Prior art keywords
- image
- character
- determining
- recognized
- character content
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 230000002194 synthesizing effect Effects 0.000 claims abstract description 19
- 238000012549 training Methods 0.000 claims description 8
- 230000015572 biosynthetic process Effects 0.000 claims description 6
- 238000003786 synthesis reaction Methods 0.000 claims description 6
- 230000015654 memory Effects 0.000 claims description 5
- 238000012545 processing Methods 0.000 abstract description 2
- 230000008569 process Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 3
- 238000003384 imaging method Methods 0.000 description 3
- 238000011176 pooling Methods 0.000 description 3
- 239000013598 vector Substances 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/148—Segmentation of character regions
- G06V30/153—Segmentation of character regions using recognition of characters or words
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration using two or more images, e.g. averaging or subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Biophysics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Biomedical Technology (AREA)
- Multimedia (AREA)
- Computational Linguistics (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
The application discloses a method, a device, equipment and a storage medium for determining image quality, and belongs to the technical field of image processing. The method comprises the following steps: acquiring a first image, wherein the first image comprises characters to be recognized; inputting the first image into a target network model, and determining the characteristics and the character content of the character to be recognized, wherein the target network model is used for determining the characteristics and the character content of the character in any image based on any image; synthesizing the character content and a background image template to obtain a second image; inputting the second image into the target network model, and determining the characteristics of the character content; and determining the image quality of the first image based on the characteristics of the character to be recognized and the characteristics of the character content. Therefore, the problem that the image quality score value cannot accurately reflect the image quality due to semantic interference can be avoided, and the accuracy of the subsequent character recognition result is improved.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for determining image quality.
Background
In some scenarios, there may be a need to recognize characters in an image. For example, in case of a case, the license plate information of a vehicle including a suspect may be recognized by monitoring the captured image of the vehicle. Generally, the recognition result is affected by the image quality, and for this reason, the image quality may be determined to filter out poor quality images and perform character recognition based on the good quality images.
At present, in the process of determining image quality, for an image, a region including characters in the image is detected, the region is segmented from the image and input into a pre-trained recognition model, the confidence level and content of each character are determined through the recognition model, an average confidence level can be calculated according to the confidence levels of all the characters, the average confidence level is determined as an image quality score value, and the image quality score value can reflect the image quality.
The above method is susceptible to interference from semantic associations between adjacent characters in the front and back when determining the confidence level of each character. If the imaging of a certain character is not clear, the corresponding confidence coefficient of the character as a certain content is possibly determined to be higher according to the semantics of the adjacent character, so that a higher image quality score value is obtained, and the image quality of the image is possibly determined to be better according to the image quality score value. Thus, the determined image quality score value cannot accurately reflect the quality of the image, thereby affecting the subsequent character recognition result.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a storage medium for determining image quality, which can solve the problem that the image quality score value determined in the related technology cannot accurately reflect the image quality and influences the character recognition result. The technical scheme is as follows:
in one aspect, a method of determining image quality is provided, the method comprising:
acquiring a first image, wherein the first image comprises characters to be recognized;
inputting the first image into a target network model, and determining the characteristics and the character content of the character to be recognized, wherein the target network model is used for determining the characteristics and the character content of the character in any image based on any image;
synthesizing the character content and a background image template to obtain a second image;
inputting the second image into the target network model, and determining the characteristics of the character content;
and determining the image quality of the first image based on the characteristics of the character to be recognized and the characteristics of the character content.
In a possible implementation manner of the present application, the synthesizing the character content and the background image template to obtain the second image includes:
selecting a background image template from at least one background image template;
setting the font of the character content as a reference font, and setting the color of the character content as a target color, wherein the target color is different from the background color of the selected background image template;
and synthesizing the set character content with the selected background image template to obtain the second image.
In a possible implementation manner of the present application, the determining the image quality of the first image based on the features of the character to be recognized and the features of the character content includes:
determining similarity between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the similarity between the characteristics of the character to be recognized and the characteristics of the character content, wherein the similarity is negatively related to the image quality.
In a possible implementation manner of the present application, the determining the image quality of the first image based on the features of the character to be recognized and the features of the character content includes:
determining Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, wherein the Euclidean distance is inversely related to the image quality.
In one possible implementation manner of the present application, before the inputting the first image into the target network model, the method further includes:
acquiring a plurality of image samples and the character content of at least one character in each image sample;
and inputting the image samples and the character content of at least one character in each image sample into a network model to be trained for training to obtain the target network model.
In another aspect, an apparatus for determining image quality is provided, the apparatus comprising:
the device comprises an acquisition module, a recognition module and a recognition module, wherein the acquisition module is used for acquiring a first image, and the first image comprises characters to be recognized;
the first determining module is used for inputting the first image into a target network model and determining the characteristics and the character content of the character to be recognized, and the target network model is used for determining the characteristics and the character content of the character in any image based on any image;
the synthesis module is used for synthesizing the character content and the background image template to obtain a second image;
the second determining module is used for inputting the second image into the target network model and determining the characteristics of the character content;
and the third determining module is used for determining the image quality of the first image based on the characteristics of the character to be recognized and the characteristics of the character content.
In one possible implementation manner of the present application, the synthesis module is configured to:
selecting a background image template from at least one background image template;
setting the font of the character content as a reference font, and setting the color of the character content as a target color, wherein the target color is different from the background color of the selected background image template;
and synthesizing the set character content with the selected background image template to obtain the second image.
In one possible implementation manner of the present application, the third determining module is configured to:
determining similarity between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the similarity between the characteristics of the character to be recognized and the characteristics of the character content, wherein the similarity is negatively related to the image quality.
In one possible implementation manner of the present application, the third determining module is configured to:
determining Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, wherein the Euclidean distance is inversely related to the image quality.
In one possible implementation manner of the present application, the first determining module is further configured to:
acquiring a plurality of image samples and the character content of at least one character in each image sample;
and inputting the image samples and the character content of at least one character in each image sample into a network model to be trained for training to obtain the target network model.
In another aspect, an apparatus is provided, the apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the steps of any one of the methods of the above aspects.
In another aspect, a computer-readable storage medium is provided, having instructions stored thereon, which when executed by a processor, implement the steps of any of the methods of the above aspects.
In another aspect, a computer program product is provided comprising instructions which, when run on a computer, cause the computer to perform the steps of any of the methods of the above aspects.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
in the process of determining the image quality, acquiring an image including a character to be recognized as a first image, inputting the first image into a target network model, wherein the target network model can determine the characteristic and the character content of the character to be recognized, synthesizing the character content with a background image template to obtain a second image, and inputting the second image into the target network model to determine the characteristic of the character content. Therefore, the image quality of the first image can be determined by determining the characteristics of the character to be recognized and the characteristics of the character content. Therefore, the problem that the image quality score value cannot accurately reflect the image quality due to semantic interference can be avoided, and the accuracy of the subsequent character recognition result is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow diagram illustrating a method of determining image quality in accordance with one illustrative embodiment;
FIG. 2 is a schematic illustration of acquiring a first image, according to an exemplary embodiment;
FIG. 3 is a schematic illustration of a first image shown in accordance with an exemplary embodiment;
FIG. 4 is a schematic illustration of a second image shown in accordance with an exemplary embodiment;
FIG. 5 is a flow chart illustrating a method of determining image quality in accordance with another exemplary embodiment;
FIG. 6 is a schematic diagram illustrating an arrangement of an apparatus for determining image quality according to an exemplary embodiment;
FIG. 7 is a schematic diagram illustrating the structure of an apparatus according to an exemplary embodiment.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Before describing a method for determining image quality provided by the embodiments of the present application in detail, an application scenario and an implementation environment related to the embodiments of the present application will be described.
First, a brief description is given of an application scenario related to an embodiment of the present application.
In some scenes where characters in an image need to be recognized, when the characters are recognized, the recognition result may be affected by the image quality, and therefore, determining the image quality is very helpful for recognizing the characters in the image. Currently, for an image, a region including characters in the image is generally detected, the region is divided from the image, the number of characters included in the region is detected, and the number of characters can be determined as an image quality score of the region image. However, when the image is blurred, the image quality score of the image may still be high due to the large number of characters in the image, and a conclusion that the image quality of the image is good may be obtained. Therefore, the determined image quality score value may not accurately reflect the quality of the image, and the subsequent character recognition result may be affected. For this reason, the embodiments of the present application provide a method for determining image quality, which can solve the above problems, and please refer to the following embodiments.
Next, a brief description will be given of an implementation environment related to the embodiments of the present application.
The method for determining the image quality provided by the embodiment of the application can be executed by equipment. The equipment can be provided with a camera, and a plurality of images can be obtained through shooting by the camera, or a gallery can be stored in the equipment so as to obtain a plurality of images from the gallery, or a video library can be stored in the equipment so as to obtain a plurality of images from a video. Further, the device may further include an image composition module that may be configured to combine the character content with the background image template. As an example, the device may be a terminal or a server, which is not limited in this embodiment of the present application.
Fig. 1 is a flowchart illustrating a method for determining image quality according to an exemplary embodiment, which is described by way of example as applied to the above implementation environment, and may include the following implementation steps:
step 101: a first image is acquired, and the first image comprises characters to be recognized.
Wherein, the character to be recognized can include but is not limited to one or more of Chinese characters, letters and numbers.
When determining the image quality, an image including characters to be recognized needs to be acquired, so that the image quality can be determined according to the characters to be recognized in the image. For ease of understanding and description, the acquired image including the character to be recognized may be referred to as a first image.
As an example, for any image, it may be determined through a detection algorithm whether an area containing characters exists in the image, and if so, the image of the area is cut out from the image, and the image of the area is determined to be the first image. The image may be an image obtained from a gallery, or an image captured by a camera, or a single frame image in a video.
That is to say, for any image, determining whether at least one region containing characters exists in the image through a detection algorithm, if so, intercepting the image of the at least one region from the image, and determining that the image of any region in the image of the at least one region is a first image; if not, another image is acquired, and the operation is continued.
Illustratively, an image shot by a camera is obtained, and if an area containing characters is detected to exist in the image, the image of the area can be intercepted from the image, and the image of the area is determined as a first image; assuming that a plurality of regions containing characters are detected in the image, images of the plurality of regions may be cut out from the image, and any one of the images of the plurality of regions may be determined as the first image. For example, as shown in fig. 2, two regions containing characters exist in an image, and the images of the two regions can be cut from the image, where the character contained in the first region image is "PIG calendar note", the character contained in the second region image is "PIG", and any one of the two region images can be determined as the first image.
Step 102: inputting the first image into a target network model, and determining the characteristics and the character content of the character to be recognized, wherein the target network model is used for determining the characteristics and the character content of the character in any image based on the any image.
Wherein, the target network model is obtained through deep learning training. That is to say, before inputting the first image into the target network model and determining the features and character contents of the characters to be recognized, the network model to be trained needs to be trained to obtain the target network model. For example, the network model to be trained may be a convolutional neural network, and further, the network model to be trained may be a VGG Net (VGG neural network), a ResNet (residual neural network), or the like, which is not limited in this embodiment of the present application.
In some embodiments, the network model to be trained is trained, a plurality of image samples and the character content of at least one character in each image sample may be obtained, and the character content of at least one character in the plurality of image samples and each image sample is input into the network model to be trained for training, so as to obtain the target network model.
As an example, a plurality of image samples and the character content of at least one character in each image sample are obtained, a plurality of images may be obtained, each image in the plurality of images contains characters, the area images containing characters are respectively cut out from each image, the plurality of area images containing characters are determined as a plurality of image samples, the character content of at least one character in each image sample in the plurality of image samples can be obtained through manual recognition, and the character content of at least one character in each image sample is obtained.
As an example, after obtaining a plurality of image samples and character content of at least one character in each image sample, each image sample may be respectively paired with the character content of the at least one character corresponding to the image sample, and the paired image samples and the character content of the at least one character are correspondingly input into a network model to be trained, so that training of the model to be trained may be implemented, and a target network model may be obtained.
It should be noted that the image samples are generally image samples with better image quality, so that the character content of the characters in the image samples can be identified manually.
In some embodiments, the target network model may include an input layer, a convolutional layer, a pooling layer, and an output layer, and after the device inputs the first image into the target network model, the target network model processes the first image sequentially through the input layer, the convolutional layer, the pooling layer, and the output layer, and outputs the features and character content of the character to be recognized.
In some embodiments, when the number of the characters to be recognized is one, after the first image is input into the target network model, the target network model may determine the features of the characters to be recognized, may determine the character content of the characters to be recognized based on the features of the characters to be recognized, and may output the features of the characters to be recognized and the character content of the characters to be recognized.
Exemplarily, assume a first imageThe character recognition method includes the steps that a character to be recognized is contained in the image, the first image is very clear, and after the first image is input into a target network model, the target network model can determine the characteristic f of the character to be recognizedp1And according to the feature fp1The character content of the character to be recognized may be determined to be "a".
In other embodiments, when the number of the characters to be recognized is multiple, after the first image is input into the target network model, the target network model may determine the features of each of the characters to be recognized, sort the features of the characters to be recognized according to the order in which the features of each of the characters to be recognized are determined, and splice the sorted features together to output as the features of the characters to be recognized. The character content of each character to be recognized can be determined based on the characteristics of the characters to be recognized, the character content of the characters to be recognized is sequenced according to the sequence of determining the characteristics of the characters to be recognized, and the sequenced character content is output as the character content of the characters to be recognized.
For example, referring to fig. 3, it is assumed that the first image is an image of a license plate, and the number of characters to be recognized is 7. After the first image is input into the target network model, the target network model can sequentially extract the features of each character to be recognized from left to right to obtain the features of 7 characters to be recognized, and the feature of the 7 characters to be recognized after the ordering is assumed to be fp1、fp2、fp3、fp4、fp5、fp6、fp7Splicing the characteristics of the 7 characters to be recognized together to obtain Fp=(fp1,fp2,fp3,fp4,fp5,fp6,fp7) And outputting the character as the characteristic of the character to be recognized. Based on fp1The character content of the first character to be recognized can be determined to be "new" based on fp27, determining the character content of the second character to be recognized as "N", and so on, determining the content of each character to be recognized in the 7 characters to be recognized, and arranging the character contents of the 7 characters to be recognized in sequence to obtain "new N7a 795" as the character to be recognizedOutputting the character content of the other characters.
Notably, the feature f of the character to be recognizedpUsually, the vector has a dimension of N, where N may be set by a user according to actual needs, or may be set by default of a device, and this is not limited in the embodiment of the present application.
It should be noted that, the above description is only given by taking the target network model as an example, where the target network model includes an input layer, a convolutional layer, a pooling layer, and an output layer, in other embodiments, the target network model may further include other network layers, for example, may further include an implicit layer, and the like, which is not limited in this embodiment.
Step 103: and synthesizing the character content and the background image template to obtain a second image.
The second image is an image with high image quality, and can be used for forming contrast with the first image and determining the image quality of the first image.
In some embodiments, synthesizing the character content with the background image template to obtain the second image may include the following two implementation manners:
the first implementation mode comprises the following steps: selecting a background image template from at least one background image template, setting the font of the character content as a reference font, setting the color of the character content as a target color, wherein the target color is different from the background color of the selected background image template, and synthesizing the set character content and the selected background image template to obtain a second image.
When one background image template is selected from at least one background image template, the background image template may be arbitrarily selected by a user according to actual needs, or may be selected by default by a device, which is not limited in the embodiment of the present application.
The reference font may be set by a user according to actual needs, or may be set by default by the device, which is not limited in the embodiment of the present application.
Wherein, the target color can be set by the user according to the background color of the selected background image template, and the target color is different from the background color of the selected background image template, further, the target color can be determined to have great contrast with the background color of the selected background image template, so as to identify the character content more easily.
For example, assuming that a plurality of background image templates exist in the gallery, and one background image template with a blue background color is arbitrarily selected, the font of the character content may be set as a regular script, the color of the character content may be set as white, and a second image of the white text with a blue background may be obtained in an image synthesis module of the input device that inputs the character content of the white regular script and the blue background image template.
The second implementation mode comprises the following steps: setting a blank image as a background image template, setting the font of the character content as a reference font, setting the color of the character content as a target color, wherein the target color is different from the background color of the selected background image template, and synthesizing the set character content and the selected background image template to obtain a second image.
That is, a blank image may be obtained, the color of the image may be set arbitrarily, the set image may be used as a background image template, the font and the color of the character content may be set arbitrarily, and the set character content and the set background image template may be synthesized to obtain the second image as long as the color of the character content is different from the background color of the background image template.
It should be noted that, when the font of the character to be recognized in the first image is a relatively complex font, the reference font should be set as a font close to the complex font as possible.
Step 104: and inputting the second image into the target network model, and determining the characteristics of the character content.
Inputting the second image into the target network model, the target network model can determine the character content characteristics and output the character content characteristics.
In some embodiments, when the number of the character contents is one, after the second image is input to the target network model, the target network model may determine the characteristics of the character contents and output the characteristics of the character contents.
Exemplarily, assuming that the second image contains a character content and is very clear, after the second image is input into the target network model, the target network model can determine the feature f of the character contentt1And the character content feature ftAnd (6) outputting.
In other embodiments, when the number of the character contents is multiple, after the second image is input to the target network model, the target network model may determine a feature of each of the multiple character contents, sort the features of the multiple character contents according to the order in which the features of each character content are determined, and splice the sorted features together to output as the features of the character contents.
For example, referring to fig. 4, it is assumed that the second image is an image of a license plate, and the number of character contents is 7. After the second image is input into the target network model, the target network model can sequentially extract the features of each character content from left to right to obtain the features of 7 character contents, and assume that the features of the 7 character contents after being sorted are ft1、ft2、ft3、ft4、ft5、ft6、ft7Splicing the features of the 7 character content together to obtain Ft=(ft1,ft2,ft3,ft4,ft5,ft6,ft7) And outputting the character content as the character content characteristic.
Step 105: the image quality of the first image is determined based on the features of the character to be recognized and the features of the character content.
Since the character content is obtained according to the character to be recognized and the character to be recognized exists in the first image, the image quality of the first image can be determined according to the characteristics of the character to be recognized and the characteristics of the character content. For example, referring to fig. 5, the features of the character to be recognized may be compared with the features of the character content to obtain the image quality of the first image.
As an example, determining the image quality of the first image based on the features of the character to be recognized and the features of the character content may include the following two implementations:
the first implementation mode comprises the following steps: determining the similarity between the characteristics of the character to be recognized and the characteristics of the character content, and determining the image quality of the first image according to the similarity between the characteristics of the character to be recognized and the characteristics of the character content, wherein the similarity is in negative correlation with the image quality.
In some embodiments, the similarity between the feature of the character to be recognized and the feature of the character content is determined, the cosine similarity between the feature of the character to be recognized and the feature of the character content may be determined, and the image quality of the first image is determined according to the cosine similarity between the feature of the character to be recognized and the feature of the character content.
As an example, the cosine similarity between the feature of the character to be recognized and the feature of the character content may be determined by the following formula (1).
Wherein, in the above formula (1), simcosIs cosine similarity, FpFeatures representing characters to be recognized, FtFeatures representing the content of the character,. represents the dot product of the vectors,. represents the multiplication of the scalars, | | | represents the modulus of the calculated vector.
It should be noted that the cosine similarity obtained in the above manner is inversely related to the image quality of the first image. That is, the larger the value of the cosine similarity is, the worse the image quality of the first image is; conversely, the smaller the cosine similarity value is, the better the image quality of the first image is.
The second implementation mode comprises the following steps: determining Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, and determining the image quality of the first image according to the Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, wherein the Euclidean distance is negatively related to the image quality.
As an example, the euclidean distance between the feature of the character to be recognized and the feature of the character content may be determined by the following formula (2).
Wherein, in the above formula (2), d is Euclidean distance, FpFeatures representing characters to be recognized, FtFeatures that represent the content of the character.
In other embodiments, a manhattan distance or a mahalanobis distance between the feature of the character to be recognized and the feature of the character content may also be determined, and the image quality of the first image may be determined according to the manhattan distance or the mahalanobis distance between the feature of the character to be recognized and the feature of the character content.
Note that the euclidean distance obtained in the above manner is inversely related to the image quality of the first image. That is, the larger the value of the euclidean distance, the worse the image quality of the first image is; conversely, a smaller value of the euclidean distance indicates a better image quality of the first image.
It is noted that, in the embodiment of the present application, the determining of the feature of the character to be recognized and the determining of the feature of the character content are determined based on the actual imaging condition of the character to be recognized in the first image and the actual imaging condition of the character content in the second image, and are related to the interference factor. Therefore, the scheme of the application can be suitable for determining the image quality of the image under different interferences.
In the embodiment of the application, in the process of determining the image quality, an image including a character to be recognized is obtained as a first image, the first image is input into a target network model, the target network model can determine the feature and the character content of the character to be recognized, the character content is synthesized with a background image template to obtain a second image, and the second image is input into the target network model to determine the feature of the character content. Therefore, the image quality of the first image can be determined by determining the characteristics of the character to be recognized and the characteristics of the character content. Therefore, the problem that the image quality score value cannot accurately reflect the image quality due to semantic interference can be avoided, and the accuracy of the subsequent character recognition result is improved.
Fig. 6 is a schematic structural diagram illustrating an apparatus for determining image quality according to an exemplary embodiment, which may be implemented by software, hardware, or a combination of both. Referring to fig. 6, the apparatus may include: an obtaining module 601, a first determining module 602, a synthesizing module 603, a second determining module 604 and a third determining module 605.
An obtaining module 601, configured to obtain a first image, where the first image includes a character to be recognized;
a first determining module 602, configured to input the first image into a target network model, and determine features and character contents of characters to be recognized, where the target network model is configured to determine features and character contents of characters in any image based on the any image;
a synthesizing module 603, configured to synthesize the character content and the background image template to obtain a second image;
a second determining module 604, configured to input the second image into the target network model, and determine a feature of the character content;
a third determining module 605, configured to determine the image quality of the first image based on the features of the character to be recognized and the features of the character content.
In one possible implementation manner of the present application, the synthesis module 603 is configured to:
selecting a background image template from at least one background image template;
setting a font of the character contents as a reference font, and setting a color of the character contents as a target color, the target color being different from a background color of the selected background image template;
and synthesizing the set character content with the selected background image template to obtain a second image.
In a possible implementation manner of the present application, the third determining module 605 is configured to:
determining the similarity between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the similarity between the characteristics of the character to be recognized and the characteristics of the character content, wherein the similarity is negatively related to the image quality.
In a possible implementation manner of the present application, the third determining module 605 is configured to:
determining Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, wherein the Euclidean distance is negatively related to the image quality.
In a possible implementation manner of the present application, the first determining module 602 is further configured to:
acquiring a plurality of image samples and the character content of at least one character in each image sample;
and inputting the plurality of image samples and the character content of at least one character in each image sample into a network model to be trained for training to obtain a target network model.
In the embodiment of the application, in the process of determining the image quality, an image including a character to be recognized is obtained as a first image, the first image is input into a target network model, the target network model can determine the feature and the character content of the character to be recognized, the character content is synthesized with a background image template to obtain a second image, and the second image is input into the target network model to determine the feature of the character content. Therefore, the image quality of the first image can be determined by determining the characteristics of the character to be recognized and the characteristics of the character content. Therefore, the problem that the image quality score value cannot accurately reflect the image quality due to semantic interference can be avoided, and the accuracy of the subsequent character recognition result is improved.
It should be noted that: the apparatus for determining image quality provided in the above embodiments is only illustrated by dividing the above functional modules when determining image quality, and in practical applications, the above function allocation may be performed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to perform all or part of the above described functions. In addition, the apparatus for determining image quality and the method for determining image quality provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 7 is a schematic structural diagram of an apparatus 700 according to an embodiment of the present application, where the apparatus 700 may be a terminal or a server. The apparatus 700 may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 701 and one or more memories 702, where the memory 702 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 701 to implement the method for determining image quality provided by the above-mentioned method embodiments.
Of course, the device 700 may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the device 700 may also include other components for implementing device functions, which are not described herein again.
Embodiments of the present application also provide a non-transitory computer-readable storage medium, where instructions in the storage medium, when executed by a processor of a mobile terminal, enable the mobile terminal to perform the method for determining image quality provided in the embodiment shown in fig. 1.
Embodiments of the present application further provide a computer program product containing instructions, which when run on a computer, cause the computer to perform the method for determining image quality provided by the above embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims (12)
1. A method of determining image quality, the method comprising:
acquiring a first image, wherein the first image comprises characters to be recognized;
inputting the first image into a target network model, and determining the characteristics and the character content of the character to be recognized, wherein the target network model is used for determining the characteristics and the character content of the character in any image based on any image;
synthesizing the character content and a background image template to obtain a second image;
inputting the second image into the target network model, and determining the characteristics of the character content;
and determining the image quality of the first image based on the characteristics of the character to be recognized and the characteristics of the character content.
2. The method of claim 1, wherein the synthesizing of the character content with a background image template to obtain a second image comprises:
selecting a background image template from at least one background image template;
setting the font of the character content as a reference font, and setting the color of the character content as a target color, wherein the target color is different from the background color of the selected background image template;
and synthesizing the set character content with the selected background image template to obtain the second image.
3. The method of claim 1, wherein determining the image quality of the first image based on the features of the character to be recognized and the features of the character content comprises:
determining similarity between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the similarity between the characteristics of the character to be recognized and the characteristics of the character content, wherein the similarity is negatively related to the image quality.
4. The method of claim 1, wherein determining the image quality of the first image based on the features of the character to be recognized and the features of the character content comprises:
determining Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, wherein the Euclidean distance is inversely related to the image quality.
5. The method of claim 1, wherein prior to inputting the first image into the target network model, further comprising:
acquiring a plurality of image samples and the character content of at least one character in each image sample;
and inputting the image samples and the character content of at least one character in each image sample into a network model to be trained for training to obtain the target network model.
6. An apparatus for determining image quality, the apparatus comprising:
the device comprises an acquisition module, a recognition module and a recognition module, wherein the acquisition module is used for acquiring a first image, and the first image comprises characters to be recognized;
the first determining module is used for inputting the first image into a target network model and determining the characteristics and the character content of the character to be recognized, and the target network model is used for determining the characteristics and the character content of the character in any image based on any image;
the synthesis module is used for synthesizing the character content and the background image template to obtain a second image;
the second determining module is used for inputting the second image into the target network model and determining the characteristics of the character content;
and the third determining module is used for determining the image quality of the first image based on the characteristics of the character to be recognized and the characteristics of the character content.
7. The apparatus of claim 6, wherein the synthesis module is to:
selecting a background image template from at least one background image template;
setting the font of the character content as a reference font, and setting the color of the character content as a target color, wherein the target color is different from the background color of the selected background image template;
and synthesizing the set character content with the selected background image template to obtain the second image.
8. The apparatus of claim 6, wherein the third determination module is to:
determining similarity between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the similarity between the characteristics of the character to be recognized and the characteristics of the character content, wherein the similarity is negatively related to the image quality.
9. The apparatus of claim 6, wherein the third determination module is to:
determining Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content;
and determining the image quality of the first image according to the Euclidean distance between the characteristics of the character to be recognized and the characteristics of the character content, wherein the Euclidean distance is inversely related to the image quality.
10. The apparatus of claim 6, wherein the first determination module is further to:
acquiring a plurality of image samples and the character content of at least one character in each image sample;
and inputting the image samples and the character content of at least one character in each image sample into a network model to be trained for training to obtain the target network model.
11. An apparatus, characterized in that the apparatus comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the steps of any of the methods of claims 1-5.
12. A computer-readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the steps of any of the methods of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910668079.8A CN112287932B (en) | 2019-07-23 | 2019-07-23 | Method, device, equipment and storage medium for determining image quality |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910668079.8A CN112287932B (en) | 2019-07-23 | 2019-07-23 | Method, device, equipment and storage medium for determining image quality |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112287932A true CN112287932A (en) | 2021-01-29 |
CN112287932B CN112287932B (en) | 2024-05-10 |
Family
ID=74419563
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910668079.8A Active CN112287932B (en) | 2019-07-23 | 2019-07-23 | Method, device, equipment and storage medium for determining image quality |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112287932B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113537192A (en) * | 2021-06-30 | 2021-10-22 | 北京百度网讯科技有限公司 | Image detection method, image detection device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018099194A1 (en) * | 2016-11-30 | 2018-06-07 | 杭州海康威视数字技术股份有限公司 | Character identification method and device |
CN108875722A (en) * | 2017-12-27 | 2018-11-23 | 北京旷视科技有限公司 | Character recognition and identification model training method, device and system and storage medium |
CN109685100A (en) * | 2018-11-12 | 2019-04-26 | 平安科技(深圳)有限公司 | Character identifying method, server and computer readable storage medium |
CN110009027A (en) * | 2019-03-28 | 2019-07-12 | 腾讯科技(深圳)有限公司 | Comparison method, device, storage medium and the electronic device of image |
-
2019
- 2019-07-23 CN CN201910668079.8A patent/CN112287932B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018099194A1 (en) * | 2016-11-30 | 2018-06-07 | 杭州海康威视数字技术股份有限公司 | Character identification method and device |
CN108875722A (en) * | 2017-12-27 | 2018-11-23 | 北京旷视科技有限公司 | Character recognition and identification model training method, device and system and storage medium |
CN109685100A (en) * | 2018-11-12 | 2019-04-26 | 平安科技(深圳)有限公司 | Character identifying method, server and computer readable storage medium |
CN110009027A (en) * | 2019-03-28 | 2019-07-12 | 腾讯科技(深圳)有限公司 | Comparison method, device, storage medium and the electronic device of image |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113537192A (en) * | 2021-06-30 | 2021-10-22 | 北京百度网讯科技有限公司 | Image detection method, image detection device, electronic equipment and storage medium |
CN113537192B (en) * | 2021-06-30 | 2024-03-26 | 北京百度网讯科技有限公司 | Image detection method, device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112287932B (en) | 2024-05-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111080628B (en) | Image tampering detection method, apparatus, computer device and storage medium | |
US10936911B2 (en) | Logo detection | |
KR101896357B1 (en) | Method, device and program for detecting an object | |
US8861884B1 (en) | Training classifiers for deblurring images | |
US11244157B2 (en) | Image detection method, apparatus, device and storage medium | |
CN111862035B (en) | Training method of light spot detection model, light spot detection method, device and medium | |
CN111767828B (en) | Certificate image reproduction identification method and device, electronic equipment and storage medium | |
CN112036395A (en) | Text classification identification method and device based on target detection | |
US9025889B2 (en) | Method, apparatus and computer program product for providing pattern detection with unknown noise levels | |
CN115443490A (en) | Image auditing method and device, equipment and storage medium | |
CN112101359B (en) | Text formula positioning method, model training method and related device | |
CN112597940B (en) | Certificate image recognition method and device and storage medium | |
He et al. | Aggregating local context for accurate scene text detection | |
CN116543261A (en) | Model training method for image recognition, image recognition method device and medium | |
CN109615620B (en) | Image compression degree identification method, device, equipment and computer readable storage medium | |
CN113592807A (en) | Training method, image quality determination method and device, and electronic equipment | |
CN112287932B (en) | Method, device, equipment and storage medium for determining image quality | |
CN110659631A (en) | License plate recognition method and terminal equipment | |
CN110533020A (en) | A kind of recognition methods of text information, device and storage medium | |
CN117197292A (en) | Method, apparatus, device and storage medium for generating image | |
CN110781345B (en) | Video description generation model obtaining method, video description generation method and device | |
CN115004245A (en) | Target detection method, target detection device, electronic equipment and computer storage medium | |
CN113905188A (en) | Video stitching dynamic adjustment method and system, electronic device and storage medium | |
CN108229521B (en) | Object recognition network training method, device and system and application thereof | |
CN113610064B (en) | Handwriting recognition method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |