CN113705461A - Face definition detection method, device, equipment and storage medium - Google Patents

Face definition detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN113705461A
CN113705461A CN202111003049.9A CN202111003049A CN113705461A CN 113705461 A CN113705461 A CN 113705461A CN 202111003049 A CN202111003049 A CN 202111003049A CN 113705461 A CN113705461 A CN 113705461A
Authority
CN
China
Prior art keywords
face
image
loss value
calculating
size
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
Application number
CN202111003049.9A
Other languages
Chinese (zh)
Other versions
CN113705461B (en
Inventor
洪叁亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111003049.9A priority Critical patent/CN113705461B/en
Publication of CN113705461A publication Critical patent/CN113705461A/en
Application granted granted Critical
Publication of CN113705461B publication Critical patent/CN113705461B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to artificial intelligence and digital medical technology, and discloses a face definition detection method, which comprises the following steps: training by utilizing a training image set, a real face confidence coefficient and a real face size to obtain a standard face positioning model; detecting an image to be detected by using a standard face positioning model to obtain the face size in the image to be detected and the confidence coefficient of each pixel point; collecting pixel points with confidence degrees larger than a preset threshold value, selecting central pixel points of the collected pixel points, and cutting according to the central pixel points and the face size to obtain a face frame diagram; and performing discrete cosine transformation and logarithm calculation on all pixel points of the face frame diagram to obtain a definition numerical value of the image to be detected. In addition, the invention also relates to a block chain technology, and the training image set can be stored in the node of the block chain. The invention also provides a face definition detection device, electronic equipment and a storage medium. The invention can solve the problem of lower image definition detection accuracy.

Description

Face definition detection method, device, equipment and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence and digital medical treatment, in particular to a face definition detection method and device, electronic equipment and a computer readable storage medium.
Background
In the human image acquisition process, the quality of the acquired human face images is uneven due to uncontrollable external factors, fuzzy human face images are not contained, and difficulty is brought to subsequent human face recognition. Therefore, it is important to detect the sharpness of the face image in advance.
Methods commonly used in the industry at present, such as image sharpness evaluation based on gradient calculation and image sharpness evaluation based on a deep learning method, both of which may cause low sharpness detection accuracy of an image due to complicated and various shooting environments and complicated backgrounds of the image interfering with sharpness evaluation and misjudging.
Disclosure of Invention
The invention provides a face definition detection method, a face definition detection device and a computer readable storage medium, and mainly aims to solve the problem of low image definition detection accuracy.
In order to achieve the above object, the present invention provides a face sharpness detection method, which includes:
acquiring a training image set and a real face confidence and a real face size corresponding to the training image set;
calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model;
calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
obtaining an image to be detected, and detecting the image to be detected by using the standard face positioning model to obtain the face size in the image to be detected and the confidence coefficient of each pixel point;
collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and calculating to obtain the definition numerical value of the image to be detected according to the pixel points in the human face block diagram.
Optionally, the calculating the predicted face confidence and the predicted face size of the training image set by using the pre-constructed face localization model includes:
performing data enhancement processing on each training image in the training image set to obtain a standard training image set;
selecting one of the images from the standard training image set one by one as a target image;
counting pixel values of all pixel points in the target image to obtain a pixel matrix of the target image;
performing convolution, pooling and activation processing on the pixel matrix by using the face positioning model to obtain a predicted face confidence of each pixel point in the target image;
and counting pixel points of the target image, of which the confidence coefficient of the predicted face is greater than a preset threshold value, as face pixel points, and calculating to obtain the size of the predicted face of the target image according to the face pixel points.
Optionally, the performing data enhancement processing on each training image in the training image set to obtain a standard training image set includes:
randomly clipping the training images of the training image set one by one;
and carrying out random image dithering on the cut training images to obtain a standard training image set.
Optionally, the optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model includes:
calculating a series loss value of the first loss value and the second loss value using a series loss function;
when the series loss value is larger than a preset loss threshold value, optimizing the face positioning model by using a preset optimization algorithm to obtain an optimized face positioning model;
calculating a predicted face confidence and a predicted face size of the training image set by using the optimized face positioning model, calculating a loss value of the predicted face confidence and the real face confidence to obtain a first loss value, calculating a loss value between the predicted face size and the real face size to obtain a second loss value, and returning to the step of calculating a series loss value of the first loss value and the second loss value by using a series loss function;
and when the series loss value is less than or equal to a preset loss threshold value, obtaining a standard face positioning model.
Optionally, the selecting a center pixel of the face pixels includes:
screening out extreme value pixel points of the abscissa and extreme value pixel points of the ordinate from the face pixel points to obtain a first pixel point with the largest abscissa, a second pixel point with the largest ordinate, a third pixel point with the smallest abscissa and a fourth pixel point with the smallest ordinate;
connecting the first pixel point with the third pixel point to obtain a first straight line, and connecting the second pixel point with the fourth pixel point to obtain a second straight line;
and determining a central pixel point of the face pixel point according to the intersection point of the first straight line and the second straight line.
Optionally, the clipping the image to be detected according to the central pixel point and the face size to obtain a face frame diagram, including:
constructing a rectangular frame by taking the central pixel point as a central point according to the width and the height of the face size to obtain a face frame;
and cutting the area of the face frame from the image to be detected to obtain a face frame diagram.
Optionally, the calculating the sharpness value of the image to be detected according to the pixel points in the face block diagram includes:
performing discrete cosine transform on the pixel value of each pixel point in the face frame diagram to obtain a discrete cosine transform coefficient;
carrying out logarithmic operation on the discrete cosine transform coefficient to obtain a logarithmic operation result of each pixel point;
and counting the number of pixel points which are greater than a preset threshold value in the logarithm operation result, and calculating according to the number to obtain a definition numerical value.
In order to solve the above problem, the present invention further provides a face sharpness detecting apparatus, including:
the face positioning model training module is used for acquiring a training image set and a real face confidence coefficient and a real face size corresponding to the training image set; calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model; calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
the human face block diagram acquisition module is used for acquiring an image to be detected, and detecting the image to be detected by using the standard human face positioning model to obtain the human face size in the image to be detected and the confidence coefficient of each pixel point; collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and the human face frame definition detection module is used for calculating to obtain a definition numerical value of the image to be detected according to the pixel points in the human face frame.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the above-described face sharpness detection method.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the above-mentioned face sharpness detection method.
According to the embodiment of the invention, the face confidence coefficient and the face size are generated by using the face positioning model obtained by training, so that the face in the image is positioned, the face frame is positioned more accurately, the error rate is low, and the robustness is good; in addition, the scheme cuts out the face frame from the image to be detected, and the definition value is calculated through the face frame, so that the operation is faster and more accurate. Therefore, the face definition detection method, the face definition detection device, the electronic equipment and the computer readable storage medium provided by the invention can solve the problem of low image definition detection accuracy.
Drawings
Fig. 1 is a schematic flow chart of a face sharpness detection method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a process of calculating a confidence of a predicted face and a size of the predicted face of the training image set according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of obtaining a standard face positioning model according to an embodiment of the present invention;
fig. 4 is a functional block diagram of a human face sharpness detection apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device for implementing the face sharpness detection method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a face definition detection method. The execution subject of the face sharpness detection method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal. In other words, the face sharpness detection method may be executed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Fig. 1 is a schematic flow chart of a face sharpness detection method according to an embodiment of the present invention. In this embodiment, the face sharpness detection method includes:
s1, acquiring a training image set and a real face confidence and a real face size corresponding to the training image set;
in the embodiment of the present invention, the training image includes an image of a human face, or a combination of an image including a human face and an image not including a human face. The real face confidence and the real face size corresponding to the training image can be obtained by manual labeling of business personnel in advance, wherein the real face confidence refers to the probability of the face contained in the image, and the real face size refers to the size, such as the width and the height, of the face in the image.
S2, calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model;
in the embodiment of the invention, the face positioning model comprises a MobileNet V2 neural network with an improved structure and a UNet neural network.
In detail, the structure-improved MobileNetV2 neural network is a lightweight convolutional neural network, the rear three-layer network structure of the complete MobileNetV2 neural network is removed from the network, a Linear Bottleneck Block (Linear bottle) and an Inverted Residual error Block (Inverted Residual) of the complete MobileNetV2 neural network are reserved, and the two modules can improve the feature expression capability of the network, so that the accuracy of a face positioning model is improved.
Optionally, the UNet neural network adopts a full convolution neural network, and the left convolution network is a feature extraction network: using convolution (conv) and pooling (pooling), the right convolutional network is a feature fusion network: the right convolution network uses the feature map generated by the up-sampling to carry out the layer jump connection (closure) operation with the feature map obtained by the convolution of the left convolution network, and the network is favorable for improving the image processing speed and better retaining the image features.
In the embodiment of the invention, the lightweight neural network is used for constructing the face positioning network, so that the complex data processing time after anchor point and non-maximum value suppression (NMS) is avoided, and the method is rapid and efficient, high in recall rate and low in false detection rate.
In the embodiment of the invention, the confidence coefficient of the predicted face is the confidence coefficient that each pixel point of the image of the training image set is the face; the face sizes include the width and height of the face region, which are the sizes of the image face frames of the training image set.
In detail, referring to fig. 2, the calculating the confidence of the predicted face and the size of the predicted face of the training image set by using the pre-constructed face localization model includes:
s21, performing data enhancement processing on each training image in the training image set to obtain a standard training image set;
s22, selecting one of the images from the standard training image set one by one as a target image;
s23, counting pixel values of all pixel points in the target image to obtain a pixel matrix of the target image;
s24, performing convolution, pooling and activation processing on the pixel matrix by using the face positioning model to obtain the predicted face confidence of each pixel point in the target image;
and S25, counting the pixel points of the target image, of which the confidence coefficient of the predicted face is greater than a preset threshold value, as face pixel points, and calculating to obtain the size of the predicted face of the target image according to the face pixel points.
Further, the performing data enhancement processing on each training image in the training image set to obtain a standard training image set includes:
randomly clipping the training images of the training image set one by one;
and carrying out random image dithering on the cut training images to obtain a standard training image set.
In the embodiment of the invention, the random cutting is to cut a plurality of images from one image at random, for example, cutting by a python technology; the random color dithering is a color cross effect which causes adjacent point-like difference by generating displacement on hues forming an image, and comprises random color dithering, random brightness dithering, random saturation dithering, random contrast dithering and the like; the random brightness dithering is an effect of causing brightness light and shade crossing on an image; the random saturation dithering is to generate a saturation difference-like cross effect on the image; the random contrast dithering is a cross effect that produces contrast differences in the contrast of the image.
In the embodiment of the invention, the number of pixel points which are larger than a preset threshold (for example, 0.9) in the confidence of the predicted face is counted, and the size of the predicted face is calculated according to the number of the pixel points. For example, the width and height of the image are 312 × 283 pixels, where the number of pixels with the confidence of the predicted face greater than the preset threshold is 50000, 250 pixels are calculated at the top and the bottom, and 200 pixels are calculated at the left and the right. The image width is calculated according to a ratio of 312:250, and the predicted face size is calculated according to the image width in a ratio of 5: 4.
In an optional embodiment of the invention, as the parameters of the neural network are numerous, if the training data is not rich enough, the neural network is often over-fitted, the model generalization capability is seriously influenced, the data of the image can be enhanced through random cutting and splicing and random color dithering, the diversity of the image is improved, the image detection by the neural network is more accurate, and the model generalization capability is improved.
S3, calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
in the embodiment of the invention, the first loss value is a deviation value between the confidence coefficient of the predicted face and the confidence coefficient of the real face; the second loss value is a deviation value between the height and width of the predicted face size and the height and width of the real face size.
In detail, a first Loss value according to the predicted face confidence and the real face confidence is calculated by using the following Focal local Loss function:
Figure BDA0003236222730000071
wherein alpha and beta are preset hyper-parameters,
Figure BDA0003236222730000072
representing true face confidence, Y representing prediction confidence, LcIs the first loss value.
Calculating a second loss value in the predicted face size and the real face size using a smooth-L1 loss function as follows, the second loss value comprising a width loss value and a height loss value:
Figure BDA0003236222730000081
Figure BDA0003236222730000082
Figure BDA0003236222730000083
wherein L iswIs the width loss value, LhIs a height loss value, wkIn order to be the width of the real human face,
Figure BDA0003236222730000084
to predict face width, hkThe height of the real human face is taken as the height,
Figure BDA0003236222730000085
for predicting the face height, N is the number of image sets to be detected, and a can be the difference value between the real face width and the predicted face width or the difference value between the real face height and the predicted face height.
Further, referring to fig. 3, the optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model includes:
s31, calculating a series loss value of the first loss value and the second loss value by using a series loss function;
s32, judging whether the series loss value is larger than a preset threshold value;
when the series loss value is greater than a preset loss threshold value, executing S33 to facilitate a preset optimization algorithm to optimize the face positioning model to obtain an optimized face positioning model;
s34, calculating the predicted face confidence coefficient and the predicted face size of the training image set by using the optimized face positioning model, calculating the loss value of the predicted face confidence coefficient and the real face confidence coefficient to obtain a first loss value, calculating the loss value between the predicted face size and the real face size to obtain a second loss value, and returning to the step S31;
and when the series loss value is less than or equal to a preset loss threshold value, executing S35 to obtain a standard face positioning model.
In an embodiment of the present invention, the calculating the confidence loss, the width loss, and the series loss of the height loss by using a preset series loss function includes:
calculating a series loss of the confidence loss, the width loss, and the height loss using the following series loss function:
L=LcλLwhLh
wherein λ isw,λhIs a predetermined weight, L is a series loss value, LcIs a first loss value, LwIs the width loss value, LhIs the height loss value.
In an optional embodiment of the present invention, a minimum loss allocation strategy may be used for model training, that is, for the face real frame of each image, for all output predicted face confidences and predicted face sizes, only one predicted face confidence and predicted face size with the minimum series loss is selected as a positive sample, and the others are negative samples, and the model is iteratively trained for 80 times by using the positive samples and the negative samples until the learning rate is reduced to a preset learning rate (for example, 5 e)-5) And continuously repeating the iteration for 80 times until the parameters of the face positioning network are converged to obtain the standard face positioning model.
In another optional embodiment of the present invention, when the series loss value is greater than the preset loss threshold, the Adam optimization algorithm is used to optimize the parameters of the standard face location model, and the Adam optimization algorithm can adaptively adapt to the learning rate in the program object detection model training process, so that the face location model is more accurate, and the performance of the face location model is improved, for example, when the learning rate is reduced to the preset learning rateRate 5e-5And then, finishing the training of the face positioning model to obtain a standard face positioning model.
S4, obtaining an image to be detected, and detecting the image to be detected by using the standard face positioning model to obtain the face size in the image to be detected and the confidence coefficient of each pixel point;
in the embodiment of the invention, the image to be detected comprises a shot image, for example, an image shot when a bank carries out face verification and an image when a user carries out face payment.
According to the embodiment of the invention, the image of the target object to be detected can be captured from the block chain for storing the image to be detected by using the python statement with the data capturing function, and after the image to be detected is obtained, the image to be detected is input to the standard face positioning model for detection, so that the detection result is obtained.
In the embodiment of the present invention, the process of detecting the image to be detected by using the standard face positioning model to obtain the face size and the confidence of each pixel point in the image to be detected is similar to the process of generating the predicted face confidence and the predicted face size of the training image by using the face positioning model in step S2, and is not repeated here.
S5, collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
in the embodiment of the invention, each pixel point of the image to be detected has a corresponding confidence, and when the confidence is greater than a preset threshold (for example, 0.9), the pixel point corresponding to the confidence can be determined to be a face pixel point. And the face central point is a central pixel point in the identified face pixel points. The human face block diagram is a rectangular frame selection diagram of a human face area on an image.
In an optional embodiment of the present invention, the selecting a center pixel of the face pixels includes:
screening out extreme value pixel points of the abscissa and extreme value pixel points of the ordinate from the face pixel points to obtain a first pixel point with the largest abscissa, a second pixel point with the largest ordinate, a third pixel point with the smallest abscissa and a fourth pixel point with the smallest ordinate;
connecting the first pixel point with the third pixel point to obtain a first straight line, and connecting the second pixel point with the fourth pixel point to obtain a second straight line;
and determining a central pixel point of the face pixel point according to the intersection point of the first straight line and the second straight line.
In the embodiment of the present invention, the cutting the target image according to the center pixel point and the face size to obtain a face frame diagram includes:
constructing a rectangular frame by taking the central pixel point as a central point according to the width and the height of the face size to obtain a face frame;
and cutting the area of the face frame from the image to be detected to obtain a face frame diagram.
In another embodiment of the present invention, a coordinate system is established with the point at the lower left corner of the image to be detected as the origin to obtain the coordinates (c, r) of the central pixel point, and the width W and the height H of the face are obtained from the face size, so that the coordinates of the point at the upper left corner of the face frame are calculated as:
x1=eR*c-W/2
y1=eR*r-H/2
the coordinates of the lower right corner point of the face frame are as follows:
x2=eR*c+W/2
y2=eR*r+H/2
where R is the step size, e.g., R ═ 4.
And obtaining a face frame through the coordinates of the upper left corner point and the coordinates of the lower right corner, reserving the face frame area, and cutting an image to be detected to obtain a face frame diagram.
And S6, calculating to obtain the definition value of the image to be detected according to the pixel points in the human face block diagram.
In the embodiment of the invention, discrete cosine transform is carried out on the human face block diagram, the DCT (discrete cosine transform) coefficient energy after the transform is mainly concentrated at the upper left corner, most of the rest coefficients are close to zero, the image can be transformed from a space domain to a frequency domain, the high-frequency information of the frequency domain corresponds to the edge and the details of the image, and the low-frequency information of the frequency domain corresponds to the outline of the image. From a frequency domain perspective, blurring is often manifested when the high frequency components of an image are insufficient.
In the embodiment of the present invention, the calculating the sharpness value of the image to be detected according to the pixel points in the face block diagram includes:
performing discrete cosine transform on the pixel value of each pixel point in the face frame diagram to obtain a discrete cosine transform coefficient;
carrying out logarithmic operation on the discrete cosine transform coefficient to obtain a logarithmic operation result of each pixel point;
and counting the number of pixel points which are greater than a preset threshold value in the logarithm operation result, and calculating according to the number to obtain a definition numerical value.
Specifically, discrete cosine transform is performed on the face block diagram, and a discrete cosine transform formula is as follows:
Figure BDA0003236222730000111
Figure BDA0003236222730000112
Figure BDA0003236222730000113
where I (x, y) is a pixel point of a face frame diagram W × N, W is a face frame diagram width, H is a face frame diagram height x, y is 0,1,2, …, C (u, v) is a discrete cosine transform coefficient, u is 0,1,2, …, W-1, v is 0,1,2, …, H-1, and for represents a loop operation.
Optionally, a logarithm operation is performed on the discrete cosine transform coefficient, and the logarithm operation is as follows:
log(|C(u,v)|)
counting the number of discrete cosine transform coefficients of all the pixels, which are greater than the preset threshold value, as T, for example, the preset threshold value may be-0.2. Calculating a sharpness value score based on said quantity, the formula being:
Figure BDA0003236222730000114
score=100*sharpness
wherein the sharpness value score is 0-100.
According to the embodiment of the invention, the face confidence coefficient and the face size are generated by using the face positioning model obtained by training, so that the face in the image is positioned, the face frame is positioned more accurately, the error rate is low, and the robustness is good; in addition, the scheme cuts out the face frame from the image to be detected, and the definition value is calculated through the face frame, so that the operation is faster and more accurate. Therefore, the face definition detection method provided by the invention can solve the problem of low image definition detection accuracy.
Fig. 4 is a functional block diagram of a face sharpness detecting apparatus according to an embodiment of the present invention.
The human face sharpness detection apparatus 100 of the present invention can be installed in an electronic device. According to the implemented functions, the human face sharpness detection apparatus 100 may include a human face positioning model training module 101, a human face block diagram obtaining module 102, and a human face block diagram sharpness detection module 103. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the face positioning model training module 101 is configured to obtain a training image set, and a true face confidence and a true face size corresponding to the training image set; calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model; calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
a face frame diagram obtaining module 102, configured to obtain an image to be detected, and detect the image to be detected by using the standard face positioning model to obtain a face size and a confidence of each pixel in the image to be detected; collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and the face frame definition detection module 103 is used for calculating to obtain a definition numerical value of the image to be detected according to the pixel points in the face frame.
In detail, when the modules in the face sharpness detection apparatus 100 according to the embodiment of the present invention are used, the same technical means as the face sharpness detection method described in fig. 1 to 3 are adopted, and the same technical effects can be produced, which is not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device for implementing a face sharpness detection method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a face sharpness detection program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., executing a face sharpness detection program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a face-sharpness detection program, but also to temporarily store data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The face sharpness detection program stored in the memory 11 of the electronic device 1 is a combination of computer programs, which when executed in the processor 10, enable:
acquiring a training image set and a real face confidence and a real face size corresponding to the training image set;
calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model;
calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
obtaining an image to be detected, and detecting the image to be detected by using the standard face positioning model to obtain the face size in the image to be detected and the confidence coefficient of each pixel point;
collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and calculating to obtain the definition numerical value of the image to be detected according to the pixel points in the human face block diagram.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, and is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a training image set and a real face confidence and a real face size corresponding to the training image set;
calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model;
calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
obtaining an image to be detected, and detecting the image to be detected by using the standard face positioning model to obtain the face size in the image to be detected and the confidence coefficient of each pixel point;
collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and calculating to obtain the definition numerical value of the image to be detected according to the pixel points in the human face block diagram.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A face sharpness detection method, characterized by comprising:
acquiring a training image set and a real face confidence and a real face size corresponding to the training image set;
calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model;
calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
obtaining an image to be detected, and detecting the image to be detected by using the standard face positioning model to obtain the face size in the image to be detected and the confidence coefficient of each pixel point;
collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and calculating to obtain the definition numerical value of the image to be detected according to the pixel points in the human face block diagram.
2. The method of detecting human face sharpness of claim 1, wherein the calculating of the predicted human face confidence and the predicted human face size of the training image set using a pre-constructed human face localization model comprises:
performing data enhancement processing on each training image in the training image set to obtain a standard training image set;
selecting one of the images from the standard training image set one by one as a target image;
counting pixel values of all pixel points in the target image to obtain a pixel matrix of the target image;
performing convolution, pooling and activation processing on the pixel matrix by using the face positioning model to obtain a predicted face confidence of each pixel point in the target image;
and counting pixel points of the target image, of which the confidence coefficient of the predicted face is greater than a preset threshold value, as face pixel points, and calculating to obtain the size of the predicted face of the target image according to the face pixel points.
3. The method according to claim 2, wherein the enhancing data of each training image in the training image set to obtain a standard training image set comprises:
randomly clipping the training images of the training image set one by one;
and carrying out random image dithering on the cut training images to obtain a standard training image set.
4. The method of claim 1, wherein the optimizing the face localization model using the first loss value and the second loss value to obtain a standard face localization model comprises:
calculating a series loss value of the first loss value and the second loss value using a series loss function;
when the series loss value is larger than a preset loss threshold value, optimizing the face positioning model by using a preset optimization algorithm to obtain an optimized face positioning model;
calculating a predicted face confidence and a predicted face size of the training image set by using the optimized face positioning model, calculating a loss value of the predicted face confidence and the real face confidence to obtain a first loss value, calculating a loss value between the predicted face size and the real face size to obtain a second loss value, and returning to the step of calculating a series loss value of the first loss value and the second loss value by using a series loss function;
and when the series loss value is less than or equal to a preset loss threshold value, obtaining a standard face positioning model.
5. The method for detecting human face sharpness of claim 1, wherein the selecting a center pixel of the human face pixels comprises:
screening out extreme value pixel points of the abscissa and extreme value pixel points of the ordinate from the face pixel points to obtain a first pixel point with the largest abscissa, a second pixel point with the largest ordinate, a third pixel point with the smallest abscissa and a fourth pixel point with the smallest ordinate;
connecting the first pixel point with the third pixel point to obtain a first straight line, and connecting the second pixel point with the fourth pixel point to obtain a second straight line;
and determining a central pixel point of the face pixel point according to the intersection point of the first straight line and the second straight line.
6. The method for detecting human face sharpness of claim 1, wherein the cropping the image to be detected according to the central pixel point and the human face size to obtain a human face frame diagram comprises:
constructing a rectangular frame by taking the central pixel point as a central point according to the width and the height of the face size to obtain a face frame;
and cutting the area of the face frame from the image to be detected to obtain a face frame diagram.
7. The method for detecting human face definition according to any one of claims 1 to 6, wherein the calculating the definition value of the image to be detected according to the pixel points in the human face frame includes:
performing discrete cosine transform on the pixel value of each pixel point in the face frame diagram to obtain a discrete cosine transform coefficient;
carrying out logarithmic operation on the discrete cosine transform coefficient to obtain a logarithmic operation result of each pixel point;
and counting the number of pixel points which are greater than a preset threshold value in the logarithm operation result, and calculating according to the number to obtain a definition numerical value.
8. A face sharpness detection apparatus, characterized in that the apparatus comprises:
the face positioning model training module is used for acquiring a training image set and a real face confidence coefficient and a real face size corresponding to the training image set; calculating the predicted face confidence and the predicted face size of the training image set by using a pre-constructed face positioning model; calculating a loss value between the confidence coefficient of the predicted face and the confidence coefficient of the real face to obtain a first loss value, calculating a loss value between the size of the predicted face and the size of the real face to obtain a second loss value, and optimizing the face positioning model by using the first loss value and the second loss value to obtain a standard face positioning model;
the human face block diagram acquisition module is used for acquiring an image to be detected, and detecting the image to be detected by using the standard human face positioning model to obtain the human face size in the image to be detected and the confidence coefficient of each pixel point; collecting the pixels with the confidence coefficient larger than a preset threshold value as face pixels, selecting the central pixels of the face pixels, and cutting the image to be detected according to the central pixels and the face size to obtain a face frame diagram;
and the human face frame definition detection module is used for calculating to obtain a definition numerical value of the image to be detected according to the pixel points in the human face frame.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of face sharpness detection according to any one of claims 1 to 7.
10. A computer-readable storage medium, storing a computer program, wherein the computer program, when executed by a processor, implements the face sharpness detection method according to any one of claims 1 to 7.
CN202111003049.9A 2021-08-30 2021-08-30 Face definition detection method, device, equipment and storage medium Active CN113705461B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111003049.9A CN113705461B (en) 2021-08-30 2021-08-30 Face definition detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111003049.9A CN113705461B (en) 2021-08-30 2021-08-30 Face definition detection method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113705461A true CN113705461A (en) 2021-11-26
CN113705461B CN113705461B (en) 2024-06-28

Family

ID=78656665

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111003049.9A Active CN113705461B (en) 2021-08-30 2021-08-30 Face definition detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113705461B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114120413A (en) * 2021-11-29 2022-03-01 北京百度网讯科技有限公司 Model training method, image synthesis method, device, equipment and program product
CN114240924A (en) * 2021-12-27 2022-03-25 南方电网物资有限公司 Power grid equipment quality evaluation method based on digitization technology
CN114332082A (en) * 2022-03-07 2022-04-12 飞狐信息技术(天津)有限公司 Definition evaluation method and device, electronic equipment and computer storage medium
CN114612971A (en) * 2022-03-04 2022-06-10 北京百度网讯科技有限公司 Face detection method, model training method, electronic device, and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295567A (en) * 2016-08-10 2017-01-04 腾讯科技(深圳)有限公司 The localization method of a kind of key point and terminal
CN109934092A (en) * 2019-01-18 2019-06-25 深圳壹账通智能科技有限公司 Identify color method, apparatus, computer equipment and storage medium
CN110378235A (en) * 2019-06-20 2019-10-25 平安科技(深圳)有限公司 A kind of fuzzy facial image recognition method, device and terminal device
CN112200056A (en) * 2020-09-30 2021-01-08 汉王科技股份有限公司 Face living body detection method and device, electronic equipment and storage medium
CN112580435A (en) * 2020-11-25 2021-03-30 厦门美图之家科技有限公司 Face positioning method, face model training and detecting method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295567A (en) * 2016-08-10 2017-01-04 腾讯科技(深圳)有限公司 The localization method of a kind of key point and terminal
CN109934092A (en) * 2019-01-18 2019-06-25 深圳壹账通智能科技有限公司 Identify color method, apparatus, computer equipment and storage medium
CN110378235A (en) * 2019-06-20 2019-10-25 平安科技(深圳)有限公司 A kind of fuzzy facial image recognition method, device and terminal device
WO2020252917A1 (en) * 2019-06-20 2020-12-24 平安科技(深圳)有限公司 Fuzzy face image recognition method and apparatus, terminal device, and medium
CN112200056A (en) * 2020-09-30 2021-01-08 汉王科技股份有限公司 Face living body detection method and device, electronic equipment and storage medium
CN112580435A (en) * 2020-11-25 2021-03-30 厦门美图之家科技有限公司 Face positioning method, face model training and detecting method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
黄法秀,等: "基于CNN的人脸图像亮度和清晰度质量评价", 《计算机工程与设计》, vol. 41, no. 7, 16 July 2020 (2020-07-16) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114120413A (en) * 2021-11-29 2022-03-01 北京百度网讯科技有限公司 Model training method, image synthesis method, device, equipment and program product
CN114240924A (en) * 2021-12-27 2022-03-25 南方电网物资有限公司 Power grid equipment quality evaluation method based on digitization technology
CN114612971A (en) * 2022-03-04 2022-06-10 北京百度网讯科技有限公司 Face detection method, model training method, electronic device, and program product
CN114332082A (en) * 2022-03-07 2022-04-12 飞狐信息技术(天津)有限公司 Definition evaluation method and device, electronic equipment and computer storage medium
CN114332082B (en) * 2022-03-07 2022-05-27 飞狐信息技术(天津)有限公司 Definition evaluation method and device, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN113705461B (en) 2024-06-28

Similar Documents

Publication Publication Date Title
CN113705461A (en) Face definition detection method, device, equipment and storage medium
CN112465071A (en) Image multi-label classification method and device, electronic equipment and medium
CN111695609B (en) Target damage degree judging method and device, electronic equipment and storage medium
CN113283446A (en) Method and device for identifying target object in image, electronic equipment and storage medium
CN112800955A (en) Remote sensing image rotating target detection method and system based on weighted bidirectional feature pyramid
CN111639704A (en) Target identification method, device and computer readable storage medium
CN113705460A (en) Method, device and equipment for detecting opening and closing of eyes of human face in image and storage medium
CN112749653A (en) Pedestrian detection method, device, electronic equipment and storage medium
CN112528908A (en) Living body detection method, living body detection device, electronic apparatus, and storage medium
CN113869219A (en) Face living body detection method, device, equipment and storage medium
CN115471775A (en) Information verification method, device and equipment based on screen recording video and storage medium
CN113723280A (en) Static face-based confrontation sample detection method, device, equipment and medium
CN115294426B (en) Method, device and equipment for tracking interventional medical equipment and storage medium
CN115131826B (en) Article detection and identification method, and network model training method and device
CN115049836B (en) Image segmentation method, device, equipment and storage medium
CN113888086B (en) Article signing method, device, equipment and storage medium based on image recognition
CN113705686B (en) Image classification method, device, electronic equipment and readable storage medium
CN116091784A (en) Target tracking method, device and storage medium
CN110942056A (en) Clothing key point positioning method and device, electronic equipment and medium
CN115439850A (en) Image-text character recognition method, device, equipment and storage medium based on examination sheet
CN115114992A (en) Method, device and equipment for training classification model and storage medium
CN114769072A (en) High-speed injection valve control method and device, electronic equipment and storage medium
CN113869385A (en) Poster comparison method, device and equipment based on target detection and storage medium
CN114240924A (en) Power grid equipment quality evaluation method based on digitization technology
CN114708230A (en) Vehicle frame quality detection method, device, equipment and medium based on image analysis

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