Image definition detection method, electronic device, and computer-readable storage medium

By combining traditional algorithms with deep learning algorithms, and using the Sobel operator and neural network training model, the accuracy problem of image sharpness detection was solved, and more efficient detection results were achieved.

CN115661803BActive Publication Date: 2026-06-30ZHEJIANG DAHUA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG DAHUA TECH CO LTD
Filing Date
2022-08-31
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, image sharpness detection methods suffer from inaccurate detection, deep learning algorithms have poor generalization ability, and traditional algorithms may not yield optimal results.

Method used

A method combining traditional and deep learning algorithms is adopted. The model is trained using the Sobel operator and a neural network to obtain the sharpness of the target image. The final sharpness is determined by adding the weights of the first and second sharpness values.

Benefits of technology

It improves the accuracy of image sharpness detection, solves the problems of poor generalization of deep learning algorithms and non-optimal solutions of traditional algorithms, and achieves more efficient detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115661803B_ABST
    Figure CN115661803B_ABST
Patent Text Reader

Abstract

This application discloses an image sharpness detection method, an electronic device, and a computer-readable storage medium, comprising: acquiring a target image; inputting the target image into a first algorithm and a trained sharpness detection model respectively; wherein the first algorithm is obtained by training an image sharpness detection algorithm using a neural network, and the sharpness detection model is a trained deep learning model; performing sharpness detection on the target image using the first algorithm and outputting a first sharpness; and performing sharpness detection on the target image using the sharpness detection model and outputting a second sharpness; and determining the sharpness of the target image based on the first sharpness and the second sharpness. This application, by combining the computational advantages of traditional algorithms and deep learning algorithms, can solve both the problem of poor generalization caused by relying solely on deep learning algorithms and the problem of non-optimal solutions caused by relying solely on traditional algorithms, thereby improving the accuracy of image sharpness detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing, and in particular to image sharpness detection methods, electronic devices, and computer-readable storage media. Background Technology

[0002] With the continuous development of image recognition technology, it is crucial to select high-quality images from massive amounts of data. Image clarity, color, and brightness are all important factors affecting its quality.

[0003] Sharpness refers to the clarity of textures and boundaries in an image. Sharpness detection serves as auxiliary information in image detection, filtering, and recognition, and is particularly important for image quality assessment. Current technologies primarily rely on deep learning algorithms or traditional algorithms to detect image sharpness.

[0004] However, deep learning algorithms can never overcome the drawback of poor generalization; traditional algorithms have better generalization, but the results obtained are not necessarily the optimal solutions, and both have the problem of not being able to accurately detect sharpness. Summary of the Invention

[0005] The main technical problem addressed by this application is to provide an image sharpness detection method, electronic device, and computer-readable storage medium, which can solve the problem that the prior art cannot accurately detect sharpness.

[0006] To address the aforementioned technical problems, the first technical solution adopted in this application is to provide an image sharpness detection method, comprising: acquiring a target image; inputting the target image into a first algorithm and a trained sharpness detection model respectively; wherein, the first algorithm is obtained by training an algorithm for detecting image sharpness using a neural network, and the sharpness detection model is a trained deep learning model; performing sharpness detection on the target image using the first algorithm and outputting a first sharpness; and performing sharpness detection on the target image using the sharpness detection model and outputting a second sharpness; and determining the sharpness of the target image based on the first sharpness and the second sharpness.

[0007] The step of determining the sharpness of the target image based on the first sharpness and the second sharpness includes: multiplying the first sharpness and the second sharpness by their respective weight values ​​and then adding them together to obtain the sharpness of the target image.

[0008] The step of using the first algorithm to detect the sharpness of the target image and outputting the first sharpness includes: determining the corresponding Sobel operator based on the size of the target image; using the Sobel operator to determine the edge feature value of each pixel in the target image; using a low threshold and a high threshold to filter the obtained multiple edge feature values ​​to obtain edge feature values ​​with values ​​within a preset range; and calculating the multiple edge feature values ​​with values ​​within the preset range to obtain the first sharpness.

[0009] The Sobel operator includes a first Sobel operator and a second Sobel operator. The step of determining the edge feature value of each pixel in the target image using the Sobel operator includes: determining the absolute value of the horizontal gradient convolution of each pixel using the first Sobel operator, and determining the absolute value of the vertical gradient convolution of each pixel using the second Sobel operator. The step of filtering the acquired multiple edge feature values ​​using a low threshold and a high threshold to obtain edge feature values ​​with values ​​within a preset range includes: filtering the absolute values ​​of the horizontal gradient convolution and the absolute values ​​of the vertical gradient convolution corresponding to each pixel using the low threshold and the high threshold; retaining the absolute values ​​of the horizontal gradient convolution and the absolute values ​​of the vertical gradient convolution corresponding to the pixel if both are within the preset range; and calculating the multiple edge feature values ​​with values ​​within the preset range to obtain a first sharpness step, including: calculating the multiple absolute values ​​of the horizontal gradient convolution and the absolute values ​​of the vertical gradient convolution within the preset range to obtain the first sharpness.

[0010] The training method of the first algorithm includes: using a neural network to construct an operator for filtering by high and low thresholds in the algorithm for detecting image sharpness; inputting multiple labeled sample images into the algorithm for detecting image sharpness including the neural network; predicting the sharpness of the sample images through the neural network; and iteratively adjusting the preset low threshold parameters and high threshold parameters in the neural network based on the loss function corresponding to the prediction result and the labeling type of the sample images, so as to determine the adjusted algorithm including the neural network as the first algorithm.

[0011] The training method for the sharpness detection model is as follows: input multiple labeled sample images into a preset deep learning model; predict the sharpness of the sample images using the preset deep learning model; determine whether to retrain the preset deep learning model based on the loss function corresponding to the prediction result and the labeling type of the sample images, and determine the trained deep learning model as the sharpness detection model.

[0012] The steps prior to inputting the target image into the first algorithm and the trained sharpness detection model include: merging the first algorithm and the sharpness detection model into the same detection model; preprocessing the target image to obtain feature data of the target image; and inputting the target image into the first algorithm and the trained sharpness detection model, which includes: inputting the feature data into the detection model so that the detection model distributes the feature data to the first algorithm and the sharpness detection model.

[0013] The steps for obtaining the target image include: obtaining an image to be detected that includes a target license plate detection box; inputting the target image into a first algorithm and a trained sharpness detection model, respectively, including: inputting the image to be detected into the first algorithm and the trained sharpness detection model, respectively; performing sharpness detection on the target image using the first algorithm and outputting a first sharpness; and performing sharpness detection on the target image using the sharpness detection model and outputting a second sharpness, including: performing sharpness detection on the image to be detected using the first algorithm and outputting a first sharpness; and performing sharpness detection on the image to be detected using the sharpness detection model and outputting a second sharpness; and determining the sharpness of the target image based on the first sharpness and the second sharpness, including: determining the sharpness of the target license plate based on the first sharpness and the second sharpness.

[0014] To solve the above-mentioned technical problems, the second technical solution adopted in this application is to provide an electronic device, including: a memory for storing program data, wherein the program data, when executed, implements the steps in the image sharpness detection method described above; and a processor for executing the program data stored in the memory to implement the steps in the image sharpness detection method described above.

[0015] To solve the above-mentioned technical problems, the third technical solution adopted in this application is to provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the steps in the image sharpness detection method described above.

[0016] The beneficial effects of this application are as follows: Unlike existing technologies, this application provides an image sharpness detection method, electronic device, and computer-readable storage medium. By inputting the acquired target image into a first algorithm and a trained sharpness detection model for detection, it can obtain a first sharpness based on a traditional algorithm and a second sharpness based on a deep learning algorithm. Then, based on the first and second sharpness, the sharpness of the target image is determined. This combines the computational advantages of traditional and deep learning algorithms, solving both the problem of poor generalization caused by relying solely on deep learning algorithms and the problem of non-optimal solutions caused by relying solely on traditional algorithms. This improves the accuracy of image sharpness detection and thus enhances the detection effect. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the first embodiment of the image sharpness detection method of this application;

[0019] Figure 2 This is a flowchart illustrating the second embodiment of the image sharpness detection method of this application;

[0020] Figure 3 This is a flowchart illustrating the third embodiment of the image sharpness detection method of this application;

[0021] Figure 4 This is a flowchart illustrating the fourth embodiment of the image sharpness detection method of this application;

[0022] Figure 5 This is a flowchart illustrating the application scenario of the image sharpness detection method of this application;

[0023] Figure 6 This is a flowchart illustrating another application scenario of the image sharpness detection method of this application;

[0024] Figure 7 yes Figure 6 A flowchart illustrating one implementation method of training the detection model in China;

[0025] Figure 8 This is a schematic diagram of one embodiment of the image sharpness detection device of this application;

[0026] Figure 9 This is a schematic diagram of the structure of one embodiment of the electronic device of this application;

[0027] Figure 10 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention. Detailed Implementation

[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “said,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms, unless otherwise clearly indicated above. “Multiple” generally includes at least two, but does not exclude the inclusion of at least one.

[0030] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0031] It should be understood that the terms "comprising," "including," or any other variations used herein are intended to cover a 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. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0032] Please see Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the image sharpness detection method of this application. In this embodiment, the image sharpness detection method includes:

[0033] S11: The target image has been obtained.

[0034] In this embodiment, the target image is the image after preprocessing the image to be processed.

[0035] The images to be processed are either images captured by a surveillance camera and uploaded, or images uploaded by a user. The surveillance camera can be a dome camera or other types of cameras; this application does not limit the specific type.

[0036] Preprocessing refers to adding detection boxes to the image to be processed and then cutting out the detection boxes to obtain the target image included in the detection boxes.

[0037] In one specific implementation scenario, the target image can be a license plate image of a motor vehicle with a detection bounding box added. In another specific implementation scenario, the target image can be a license plate image of a non-motor vehicle with a detection bounding box added; this application does not limit the specific implementation.

[0038] S12: Input the target image into the first algorithm and the trained sharpness detection model respectively; wherein, the first algorithm is obtained by training an algorithm for detecting image sharpness using a neural network, and the sharpness detection model is a trained deep learning model.

[0039] In this embodiment, the first algorithm is an algorithm for detecting sharpness.

[0040] In a specific implementation scenario, the first algorithm can be a traditional algorithm. Here, a traditional algorithm refers to a well-defined specification in mathematics and computer science for solving a class of problems. Traditional algorithms can perform computation, data processing, automated reasoning, and other tasks. As an efficient method, a traditional algorithm can be represented in a well-defined formal language within a finite space and time to compute functions. Starting from an initial state and initial input (which may be empty), the instructions describe a computation that, when executed, proceeds through a finite number of well-defined successive states, ultimately producing an "output".

[0041] In another specific implementation scenario, the first algorithm can be obtained by training a traditional algorithm for detecting image sharpness using a neural network. This is a combined algorithm that integrates traditional algorithms with deep learning, and can also be considered a networked algorithm. The neural network can generate a high-dimensional representation, enabling the encoded first algorithm to run in a high-dimensional space. This avoids encountering algorithmic bottlenecks under low-data conditions, thus solving the task more efficiently.

[0042] In this embodiment, the sharpness detection model is obtained by training a deep learning model. Specifically, this sharpness detection model is obtained by training a deep learning model using labeled images as the initial model. The deep learning model can be a deep model such as Inception, VGG16, DenseNet, MobileNet, ShuffleNet, etc., and this application does not limit it to any particular model.

[0043] Unlike traditional algorithms, deep learning emphasizes the depth of the model structure, typically having 5, 6, or even 10+ hidden layers, and clearly defines the importance of feature learning. That is, through layer-by-layer feature transformation, the feature representation of samples in the original space is transformed to a new feature space, making classification or prediction easier. Compared to traditional algorithms that construct features using manually defined rules, deep learning models utilize large datasets to learn features, better capturing the rich inherent information of the data. By designing and establishing an appropriate number of neural computation nodes and a multi-layered computational hierarchy, selecting suitable input and output layers, and through network learning and optimization, a functional relationship from input to output can be established, approximating real-world relationships as closely as possible. Using successfully trained deep learning models, the automation requirements for complex task processing can be met.

[0044] In a specific implementation scenario, when the first algorithm is a traditional algorithm, features are extracted from the target object based on the input of the traditional algorithm, and the limited extracted feature data is input into the first algorithm. At the same time, a feature extractor of a neural network is used to extract features from the target object, and a large amount of extracted feature data is input into the network layer of the deep learning model.

[0045] In another specific implementation scenario, when the first algorithm is a networked algorithm obtained by training a traditional algorithm for detecting image sharpness using a neural network, after extracting a large amount of feature data of the target image using a feature extractor, the large amount of feature data can be input into the first algorithm and the deep learning model respectively.

[0046] S13: Detect the sharpness of the target image using the first algorithm and output the first sharpness; and detect the sharpness of the target image using the sharpness detection model and output the second sharpness.

[0047] In this embodiment, the first algorithm and the sharpness detection model respectively perform sharpness detection on the feature data of the input target object to obtain the first sharpness and the second sharpness.

[0048] S14: Determine the sharpness of the target image based on the first sharpness and the second sharpness.

[0049] In this embodiment, the first sharpness and the second sharpness can be multiplied by their respective weight values ​​and then added together to obtain the sharpness of the target image.

[0050] In other embodiments, a first resolution and a second resolution can be output separately, which can be selected by the user based on their needs. This application does not limit this.

[0051] Understandably, this embodiment, by inputting the acquired target image into the first algorithm and the trained sharpness detection model respectively for detection, can obtain a first sharpness based on the traditional algorithm and a second sharpness based on the deep learning algorithm. Then, the sharpness of the target image is determined based on the first sharpness and the second sharpness. It can combine the computational advantages of the traditional algorithm and the deep learning algorithm, which can solve the problem of poor generalization caused by relying solely on the deep learning algorithm and the problem of non-optimal solution caused by relying solely on the traditional algorithm, thereby improving the accuracy of image sharpness detection and thus improving the detection effect.

[0052] Please see Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the image sharpness detection method of this application. In this embodiment, the image sharpness detection method includes:

[0053] S21: The target image has been obtained.

[0054] Please refer to the description in S11 for the specific process, which will not be repeated here.

[0055] S22: Input the target image into the first algorithm and the trained sharpness detection model respectively; wherein, the first algorithm is obtained by training an algorithm for detecting image sharpness using a neural network, and the sharpness detection model is a trained deep learning model.

[0056] In this embodiment, the first algorithm is a traditional algorithm for detecting sharpness, and the sharpness detection model is obtained by training a deep learning model.

[0057] Specifically, features of the target object are extracted based on the input of a traditional algorithm, and the limited extracted feature data is input into the first algorithm. At the same time, a feature extractor of a neural network is used to extract features of the target object, and the large amount of extracted feature data is input into the network layer of the sharpness detection model.

[0058] S23: Determine the corresponding Sobel operator based on the size of the target image.

[0059] In this embodiment, the first algorithm is an algorithm that uses the Sobel operator to calculate image sharpness.

[0060] The Sobel operator is an important processing method in computer vision. It is primarily used to obtain the first-order gradient of digital images, and its common application and physical significance is edge detection. The Sobel operator calculates the weighted difference between the gray values ​​of each pixel's four neighborhoods (top, bottom, left, and right) and finds the extreme value at the edge to detect it. In edge detection, there are two Sobel operators: one for detecting horizontal edges and the other for detecting vertical edges.

[0061] In this embodiment, the Sobel operator includes a first Sobel operator and a second Sobel operator. The first Sobel operator is an operator for detecting horizontal edges, and the second Sobel operator is an operator for detecting vertical edges.

[0062] S24: Use the Sobel operator to determine the edge feature value of each pixel in the target image.

[0063] In this embodiment, the absolute value of the horizontal gradient convolution of each pixel is determined using the first Sobel operator, and the absolute value of the vertical gradient convolution of each pixel is determined using the second Sobel operator.

[0064] Specifically, the gradient calculation formula is as follows:

[0065]

[0066]

[0067]

[0068]

[0069] Among them, G x G represents the image after lateral edge detection. y Let A be the image after vertical edge detection, A represent the target image, * represent the convolution operation, [] represent the two-dimensional matrix, G represent the gradient magnitude, θ represent the angle, and tan represent the tangent function.

[0070] S25: Use low and high thresholds to filter the acquired edge feature values ​​to obtain edge feature values ​​within a preset range.

[0071] In this embodiment, low and high thresholds are used to filter the absolute values ​​of the horizontal and vertical gradient convolutions corresponding to each pixel. If both the absolute values ​​of the horizontal and vertical gradient convolutions corresponding to a pixel are within a preset range, then the absolute values ​​of the horizontal and vertical gradient convolutions corresponding to that pixel are retained.

[0072] Specifically, if either the absolute value of the horizontal gradient convolution or the absolute value of the vertical gradient convolution corresponding to a pixel is outside the preset range, the value within the corresponding pixel region will be cleared to zero.

[0073] In this embodiment, the low threshold and the high threshold are initial thresholds set by the user based on their needs.

[0074] In one specific implementation scenario, the low threshold can be set to 30% and the high threshold can be set to 90%. In another specific implementation scenario, the low threshold can be set to 20% and the high threshold can be set to 95%. In yet another specific implementation scenario, the low and high thresholds can also be set to other values, which are not limited in this application.

[0075] Understandably, by filtering the edge feature values ​​corresponding to multiple pixels using low and high thresholds, some extreme values ​​that affect the mean of feature data can be eliminated. The overall level of multiple pixels can be reflected based on the retained edge feature values, thereby improving the accuracy of subsequent calculations of first sharpness.

[0076] S26: Calculate the edge feature values ​​of multiple values ​​within a preset range to obtain the first sharpness.

[0077] In this embodiment, the absolute values ​​of the horizontal gradient convolution and the absolute values ​​of the vertical gradient convolution within a preset range are calculated to obtain the first sharpness.

[0078] The first resolution output is a value ranging from 0 to 100.

[0079] S27: Use a sharpness detection model to detect the sharpness of the target image and output a second sharpness.

[0080] In this embodiment, the target image is subjected to feature detection by a sharpness detection model, that is, at least one parameter feature among the gradient values ​​in the horizontal and vertical directions, gray-level variance, edge sharpness, and brightness is obtained, and the target image is calculated based on the corresponding parameter features to output a second sharpness.

[0081] The second resolution output is a value ranging from 0 to 100.

[0082] S28: Multiply the first sharpness and the second sharpness by their respective weight values ​​and then add them together to obtain the sharpness of the target image.

[0083] In this embodiment, the weight values ​​corresponding to the first clarity and the second clarity are set by the user based on their needs.

[0084] In one specific implementation scenario, the weight values ​​corresponding to the first resolution and the second resolution can both be 50%. In another specific implementation scenario, the weight value corresponding to the first resolution can be 40%, and the weight value corresponding to the second resolution can be 60%. In yet another specific implementation scenario, the weight value corresponding to the first resolution can be 55%, and the weight value corresponding to the second resolution can be 45%. This application does not impose any limitations on these aspects.

[0085] In other implementations, a first resolution and a second resolution can be output separately, allowing the user to select based on their needs.

[0086] Understandably, the first algorithm, based on the Sobel operator, detects the sharpness of the target image. It leverages the strong generalization ability of the first algorithm to obtain a relatively accurate first sharpness value. Furthermore, the trained sharpness detection model adaptively adjusts the model parameters in the deep learning model through a data annotation learning mechanism, improving the prediction effect on the target image. Then, the first and second sharpness values ​​are multiplied by their corresponding weight values ​​and summed to obtain the sharpness of the target image. This combines the computational advantages of traditional and deep learning algorithms, solving both the poor generalization problem caused by relying solely on deep learning algorithms and the non-optimal solution problem caused by relying solely on traditional algorithms. This improves the accuracy of image sharpness detection and thus enhances the detection effect.

[0087] Please see Figure 3 , Figure 3 This is a flowchart illustrating the third embodiment of the image sharpness detection method of this application.

[0088] In this embodiment, the method for training the algorithm for detecting image sharpness includes: constructing an operator in the algorithm for detecting image sharpness using a neural network to filter by high and low thresholds; inputting multiple labeled sample images into the algorithm for detecting image sharpness including the neural network; predicting the sharpness of the sample images using the neural network; and iteratively adjusting the preset low threshold parameter and high threshold parameter in the neural network based on the loss function corresponding to the prediction result and the labeling type of the sample images, so as to determine the adjusted algorithm including the neural network as the first algorithm.

[0089] Understandably, the above method only uses the neural network to iteratively adjust the preset low threshold parameter and high threshold parameter, and does not involve adjusting the operator used for edge detection using the Sobel operator.

[0090] In existing technologies, various parameters need to be manually adjusted based on the reasoning results of the algorithm. However, this code optimization method is highly dependent on manual intervention, which is not conducive to improving the optimization speed and computation speed. This implementation method uses a neural network to iterate on a certain operator in the algorithm, which can effectively avoid the inefficiency caused by manual adjustment.

[0091] Furthermore, by utilizing neural network encoding to realize the reasoning function of traditional algorithms, the first algorithm can achieve better reasoning results and stronger adaptability even when the image acquisition scenarios and image device acquisition parameters vary greatly and the image samples are sufficiently abundant.

[0092] In this embodiment, the training method of the sharpness detection model is as follows: input multiple labeled sample images into a preset deep learning model; predict the sharpness of the sample images through the preset deep learning model; determine whether to retrain the preset deep learning model based on the loss function corresponding to the prediction result and the labeling type of the sample images, and determine the trained deep learning model as the sharpness detection model.

[0093] Among them, the labeled sample images are those whose image sharpness has been annotated.

[0094] The deep learning model is optimized by optimizing the loss function corresponding to the prediction result and the image's annotation type. Specifically, the parameters of the loss function corresponding to the minimum loss value are determined as the current optimization parameters of the loss function, and the deep learning model is retrained. When the change in the current loss value is less than a preset range, the current loss function parameters are determined as the model parameters of the current deep learning model, and these model parameters are then used as the model parameters of the deep classification model to obtain a sharpness detection model.

[0095] In this embodiment, the image sharpness detection method includes:

[0096] S31: The target image has been acquired.

[0097] Please refer to the description in S11 for the specific process, which will not be repeated here.

[0098] S32: Merge the first algorithm and the sharpness detection model into the same detection model.

[0099] In this embodiment, the algorithm for detecting image sharpness encoded by a neural network is merged with a preset deep learning model into the same deep learning network as a whole, and the algorithm and the deep learning model are trained simultaneously to obtain a trained first algorithm and a sharpness detection model. The detection model is obtained based on the merging of the two.

[0100] The first algorithm and the sharpness detection model can run on the same hardware network acceleration unit.

[0101] S33: Preprocess the target image to obtain its feature data.

[0102] In this embodiment, a large amount of feature data of the target image is extracted using a feature extractor.

[0103] S34: Input the feature data into the detection model so that the detection model distributes the feature data to the first algorithm and the sharpness detection model.

[0104] In this embodiment, the first algorithm and the sharpness detection model use the same input for calculation.

[0105] Since the operators used to construct the neural network constitute only a small part of the first algorithm, the computational load required by the first algorithm is extremely small compared to the sharpness detection model, and it does not affect the operation of the hardware network acceleration unit.

[0106] In actual calculations, the inventors of this application found that the computational increase of the first algorithm is almost negligible compared to the sharpness detection model.

[0107] S35: Detect the sharpness of the target image using the first algorithm and output the first sharpness; and detect the sharpness of the target image using the sharpness detection model and output the second sharpness.

[0108] Please refer to the descriptions in S23 to S27 for the specific process, which will not be repeated here.

[0109] S36: Multiply the first sharpness and the second sharpness by their respective weight values ​​and then add them together to obtain the sharpness of the target image.

[0110] Please refer to the description in S28 for the specific process, which will not be repeated here.

[0111] Understandably, training traditional image sharpness detection algorithms using neural networks combines the advantages of traditional algorithms with those of deep learning. This ensures both the generalization ability of the algorithm and the ability to characterize more intrinsic information of the target image, thereby improving the accuracy of the first algorithm in detecting image sharpness. Furthermore, by using the trained sharpness detection model to detect the sharpness of the target object, the model parameters in the deep learning model can be adaptively adjusted through a data annotation learning mechanism, improving the prediction effect on the target image. Finally, multiplying the first sharpness and the second sharpness by their respective weight values ​​and then summing them yields the sharpness of the target image. This combines the computational advantages of the first algorithm and the deep learning algorithm, solving both the poor generalization problem caused by relying solely on deep learning algorithms and the non-optimal solution problem caused by relying solely on traditional algorithms, thus further improving the accuracy of image sharpness detection and ultimately enhancing the detection effect.

[0112] In one specific implementation, the image sharpness detection method of this application is illustrated by recognizing the license plate image of a motor vehicle. Figure 4 As shown, Figure 4 This is a flowchart illustrating the fourth embodiment of the image sharpness detection method of this application. In this embodiment, the target image is the image to be detected, including a target license plate detection frame, and the image sharpness detection method includes:

[0113] S41: Obtain the image to be detected, including the target license plate detection box.

[0114] In this embodiment, the image to be detected can be an image captured directly from the target license plate, or an image obtained by adding a detection box to the target license plate in the captured image and then cutting out the detection box.

[0115] S42: Input the image to be detected into the first algorithm and the trained sharpness detection model respectively; wherein, the first algorithm is obtained by training an algorithm for detecting image sharpness using a neural network, and the sharpness detection model is a trained deep learning model.

[0116] In this embodiment, the first algorithm is an algorithm for detecting the clarity of license plates. The first algorithm can be a traditional algorithm, or it can be a networked algorithm obtained by training a traditional algorithm for detecting image clarity using a neural network.

[0117] Wherein, when the first algorithm is an algorithm using neural network encoding, the training images are images labeled with the clarity of license plate images. Specifically, the algorithm for detecting image clarity uses a neural network to construct an operator that uses high and low thresholds for filtering; multiple labeled license plate images are input into the algorithm for detecting image clarity, which includes a neural network; the clarity of the license plate images is predicted by the neural network; based on the prediction result and the loss function corresponding to the labeling type of the license plate image, the preset low threshold parameters and high threshold parameters in the neural network are iteratively adjusted to determine the adjusted algorithm including the neural network as the first algorithm.

[0118] In a specific implementation scenario, when the first algorithm is a traditional algorithm, features are extracted from the target license plate based on the input of the traditional algorithm, and the limited extracted feature data is input into the first algorithm. At the same time, a feature extractor of a neural network is used to extract features from the target vehicle, and the large amount of extracted feature data is input into the network layer of a deep learning model.

[0119] In another specific implementation scenario, when the first algorithm is a networked algorithm obtained by training a traditional algorithm for detecting image sharpness using a neural network, the first algorithm and the sharpness detection model are merged into the same detection model. After extracting a large amount of feature data of the target license plate using the feature extractor of the detection model, the feature data is distributed to the first algorithm and the sharpness detection model.

[0120] S43: Use the first algorithm to perform sharpness detection on the image to be detected and output the first sharpness; and use the sharpness detection model to perform sharpness detection on the image to be detected and output the second sharpness.

[0121] Please refer to the descriptions in S23 to S27 for the specific process, which will not be repeated here.

[0122] S44: Determine the clarity of the target license plate based on the first and second clarity.

[0123] In this embodiment, the first clarity and the second clarity are multiplied by their respective weight values ​​and then added together to obtain the clarity of the target license plate.

[0124] Unlike existing technologies, this implementation utilizes a neural network to train a traditional algorithm for detecting image sharpness. This combines the advantages of traditional algorithms with those of deep learning, ensuring both the algorithm's generalization ability and the ability to characterize more intrinsic information about the target license plate, thereby improving the accuracy of the first algorithm in detecting the sharpness of the target license plate. Furthermore, by using the trained sharpness detection model to detect the sharpness of the target license plate, the model parameters in the deep learning model can be adaptively adjusted through a data annotation learning mechanism, improving the prediction effect on the license plate image. Finally, the first sharpness and the second sharpness are multiplied by their corresponding weight values ​​and then summed to obtain the sharpness of the target license plate. This combines the computational advantages of the first algorithm and the deep learning algorithm, solving both the poor generalization problem caused by relying solely on deep learning algorithms and the non-optimal solution problem caused by relying solely on traditional algorithms, thereby further improving the accuracy of detecting the sharpness of the target license plate and thus improving the detection effect.

[0125] Please see Figure 5 , Figure 5 This is a flowchart illustrating an application scenario of the image sharpness detection method of this application. In this embodiment, after acquiring the target image, the target image is input into both the first algorithm and the trained sharpness detection model. The first algorithm is used to detect the sharpness of the target image and outputs a first sharpness; the sharpness detection model is used to detect the sharpness of the target image and outputs a second sharpness. The first sharpness and the second sharpness are multiplied by their corresponding weight values ​​and then added together to obtain the sharpness of the target image.

[0126] Please see Figure 6 , Figure 6 This is a flowchart illustrating another application scenario of the image sharpness detection method described in this application. Figure 7 yes Figure 6 The flowchart illustrates one implementation method of the training method for the image sharpness detection model. In this implementation, the operator that calculates edge feature values ​​using the Sobel operator remains unchanged. Only the operator that uses high and low thresholds for filtering in the image sharpness detection algorithm is constructed using a neural network. The algorithm encoded by the neural network is merged with a preset deep learning model into the same deep learning network, forming a pre-designed neural network. The algorithm and the deep learning model are trained simultaneously using the input labeled image to obtain a trained first algorithm and a sharpness detection model. The detection model is then obtained based on the merged result. Subsequently, the target image is acquired and input into the detection model to detect the sharpness of the target image.

[0127] Correspondingly, this application provides an image sharpness detection device.

[0128] Please see Figure 8 , Figure 8 This is a schematic diagram of one embodiment of the image sharpness detection device of this application. Figure 8 As shown, the image sharpness detection device 80 includes an acquisition module 81, an input module 82, a detection module 83, and a determination module 84.

[0129] The acquisition module 81 is used to acquire the target image.

[0130] The input module 82 is used to input the target image into the first algorithm and the trained sharpness detection model, respectively.

[0131] The detection module 83 is used to perform sharpness detection on the target image using a first algorithm and output a first sharpness; and to perform sharpness detection on the target image using a sharpness detection model and output a second sharpness.

[0132] The determination module 84 is used to determine the sharpness of the target image based on the first sharpness and the second sharpness.

[0133] For details of the process, please refer to the relevant textual descriptions in S11~S14, S21~S28, S31~S36 and S41~S44, which will not be repeated here.

[0134] Unlike existing technologies, this implementation method uses the input module 82 to input the acquired target image into the first algorithm and the trained sharpness detection model for detection. It can obtain the first sharpness and the second sharpness using the detection module 83 based on traditional algorithms and deep learning algorithms, and then use the determination module 84 to determine the sharpness of the target image based on the first sharpness and the second sharpness. It can combine the computational advantages of traditional algorithms and deep learning algorithms, which can solve the problem of poor generalization caused by relying solely on deep learning algorithms and the problem of non-optimal solutions caused by relying solely on traditional algorithms, thereby improving the accuracy of image sharpness detection and thus improving the detection effect.

[0135] Correspondingly, this application provides an electronic device.

[0136] Please see Figure 9 , Figure 9 This is a schematic diagram of one embodiment of the electronic device of this application. For example... Figure 9 As shown, the electronic device 90 includes a memory 91 and a processor 92.

[0137] In this embodiment, the memory 91 is used to store program data, and when the program data is executed, it implements the steps in the image sharpness detection method described above; the processor 92 is used to execute the program instructions stored in the memory 91 to implement the steps in the image sharpness detection method described above.

[0138] Specifically, processor 92 controls itself and memory 91 to implement the steps in the image sharpness detection method described above. Processor 92 can also be referred to as a CPU (Central Processing Unit). Processor 92 may be an integrated circuit chip with signal processing capabilities. Processor 92 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 92 can be implemented using multiple integrated circuit chips.

[0139] Unlike existing technologies, this embodiment uses processor 92 to input the acquired target image into the first algorithm and the trained sharpness detection model for detection. It can obtain the first sharpness based on the traditional algorithm and the second sharpness based on the deep learning algorithm. Then, the sharpness of the target image is determined based on the first sharpness and the second sharpness. It can combine the computational advantages of traditional algorithms and deep learning algorithms, which can solve the problem of poor generalization caused by relying solely on deep learning algorithms and the problem of non-optimal solutions caused by relying solely on traditional algorithms. This improves the accuracy of image sharpness detection and thus improves the detection effect.

[0140] Correspondingly, this application provides a computer-readable storage medium.

[0141] Please see Figure 10 , Figure 10 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention.

[0142] The computer-readable storage medium 100 includes a computer program 1001 stored on it. When executed by the processor, the computer program 1001 implements the steps in the image sharpness detection method described above. Specifically, if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium 100. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a computer-readable storage medium 100 and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned computer-readable storage medium 100 includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0143] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

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

[0145] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0146] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or 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, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. 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.

[0147] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

[0148] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

Claims

1. A method of image sharpness detection, characterized in that, include: Obtain the target image; The target image is input into a first algorithm and a trained sharpness detection model, respectively. The first algorithm is obtained by training an image sharpness detection algorithm using a neural network, and the sharpness detection model is a trained deep learning model. The training method of the first algorithm includes: constructing an operator in the image sharpness detection algorithm using a neural network to filter images using high and low thresholds; inputting multiple labeled sample images into the image sharpness detection algorithm including the neural network; predicting the sharpness of the sample images using the neural network; and iteratively adjusting the preset low and high threshold parameters in the neural network based on the prediction result and the loss function corresponding to the labeling type of the sample images, so as to determine the adjusted algorithm including the neural network as the first algorithm. The first algorithm is used to detect the sharpness of the target image, and a first sharpness is output; and The sharpness detection model is used to detect the sharpness of the target image, and a second sharpness is output. The sharpness of the target image is determined based on the first sharpness and the second sharpness.

2. The image sharpness detection method according to claim 1, characterized in that, The step of determining the sharpness of the target image based on the first sharpness and the second sharpness includes: The first sharpness and the second sharpness are multiplied by their respective weight values ​​and then added together to obtain the sharpness of the target image.

3. The image sharpness detection method according to claim 1 or 2, characterized in that, The step of using the first algorithm to detect the sharpness of the target image and outputting a first sharpness includes: The corresponding Sobel operator is determined based on the size of the target image; The Sobel operator is used to determine the edge feature value of each pixel in the target image; Multiple edge feature values ​​are filtered using low and high thresholds to obtain edge feature values ​​within a preset range; The edge feature values ​​of multiple values ​​within a preset range are calculated to obtain the first sharpness.

4. The image sharpness detection method according to claim 3, characterized in that, The Sobel operator includes a first Sobel operator and a second Sobel operator; The step of determining the edge feature value of each pixel in the target image using the Sobel operator includes: The absolute value of the horizontal gradient convolution of each pixel is determined using the first Sobel operator, and the absolute value of the vertical gradient convolution of each pixel is determined using the second Sobel operator. The step of filtering multiple edge feature values ​​using low and high thresholds to obtain edge feature values ​​within a preset range includes: The absolute values ​​of the horizontal gradient convolution and the absolute values ​​of the vertical gradient convolution corresponding to each pixel are filtered using the low threshold and the high threshold. In response to the fact that the absolute values ​​of the horizontal gradient convolution and the vertical gradient convolution corresponding to the pixel are both within the preset range, the absolute values ​​of the horizontal gradient convolution and the vertical gradient convolution corresponding to the pixel are retained. The step of calculating the edge feature values ​​of the multiple values ​​within a preset interval to obtain the first sharpness includes: The absolute values ​​of the horizontal gradient convolution and the absolute values ​​of the vertical gradient convolution within the preset range of multiple values ​​are calculated to obtain the first sharpness.

5. The image sharpness detection method according to claim 3, characterized in that, The training method for the sharpness detection model is as follows: The labeled sample images are input into a preset deep learning model; The sharpness of the sample images is predicted using the preset deep learning model; Based on the loss function corresponding to the prediction result and the annotation type of the sample image, it is determined whether the preset deep learning model should be retrained, and the trained deep learning model is determined as the sharpness detection model.

6. The image sharpness detection method according to claim 5, characterized in that, Before the step of inputting the target image into the first algorithm and the trained sharpness detection model respectively, the following steps are included: The first algorithm and the sharpness detection model are merged into the same detection model; The target image is preprocessed to obtain its feature data; The step of inputting the target image into the first algorithm and the trained sharpness detection model respectively includes: The feature data is input into the detection model so that the detection model distributes the feature data to the first algorithm and the sharpness detection model.

7. The image sharpness detection method according to claim 1, characterized in that, The step of acquiring the target image includes: Obtain the image to be detected, including the target license plate detection box; The step of inputting the target image into the first algorithm and the trained sharpness detection model respectively includes: The image to be detected is input into the first algorithm and the trained sharpness detection model, respectively; The steps of performing sharpness detection on the target image using the first algorithm and outputting a first sharpness; and performing sharpness detection on the target image using the sharpness detection model and outputting a second sharpness include: The first algorithm is used to detect the sharpness of the image to be detected, and a first sharpness is output; and the sharpness detection model is used to detect the sharpness of the image to be detected, and a second sharpness is output. The step of determining the sharpness of the target image based on the first sharpness and the second sharpness includes: The clarity of the target license plate is determined based on the first clarity and the second clarity.

8. An electronic device, characterized in that, include: A memory for storing program data, which, when executed, implements the steps in the image sharpness detection method as described in any one of claims 1 to 7; A processor is configured to execute the program data stored in the memory to implement the steps in the image sharpness detection method as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the image sharpness detection method as described in any one of claims 1 to 7.